<commit_before>{ lib, stdenv, coreutils, pkgconfig                      # build/env
, cacert, ca-bundle, ivory                               # codegen
, curlUrbit, ent, gmp, h2o, libsigsegv, libuv, lmdb    # libs
, murmur3, openssl, softfloat3, urcrypt, zlib            #
, enableStatic           ? stdenv.hostPlatform.isStatic  # opts
, enableDebug            ? false
, doCheck                ? true
, enableParallelBuilding ? true
, dontStrip              ? true }:

let

  src = lib.cleanSource ../../../pkg/urbit;

  version = builtins.readFile "${src}/version";

in stdenv.mkDerivation {
  inherit src version;

  pname = "urbit" + lib.optionalString enableDebug "-debug"
    + lib.optionalString enableStatic "-static";

  nativeBuildInputs = [ pkgconfig ];

  buildInputs = [
    cacert
    ca-bundle
    curlUrbit
    ent
    gmp
    h2o
    ivory.header
    libsigsegv
    libuv
    lmdb
    murmur3
    openssl
    softfloat3
    urcrypt
    zlib
  ];

  # Ensure any `/usr/bin/env bash` shebang is patched.
  postPatch = ''
    patchShebangs ./configure
  '';

  checkTarget = "test";

  installPhase = ''
    mkdir -p $out/bin
    cp ./build/urbit $out/bin/urbit
    cp ./build/urbit-worker $out/bin/urbit-worker
  '';

  dontDisableStatic = enableStatic;

  configureFlags = if enableStatic
    then [ "--disable-shared" "--enable-static" ]
    else [];

  CFLAGS = [ (if enableDebug then "-O0" else "-O3") "-g" ]
    ++ lib.optionals (!enableDebug) [ "-Werror" ];

  MEMORY_DEBUG = enableDebug;
  CPU_DEBUG = enableDebug;
  EVENT_TIME_DEBUG = false;

  # See https://github.com/NixOS/nixpkgs/issues/18995
  hardeningDisable = lib.optionals enableDebug [ "all" ];

  inherit enableParallelBuilding doCheck dontStrip;

  meta = {
    debug = enableDebug;
    arguments = lib.optionals enableDebug [ "-g" ];
  };
}<commit_msg>build: do not include debug symbols in release<commit_after>{ lib, stdenv, coreutils, pkgconfig                      # build/env
, cacert, ca-bundle, ivory                               # codegen
, curlUrbit, ent, gmp, h2o, libsigsegv, libuv, lmdb    # libs
, murmur3, openssl, softfloat3, urcrypt, zlib            #
, enableStatic           ? stdenv.hostPlatform.isStatic  # opts
, enableDebug            ? false
, doCheck                ? true
, enableParallelBuilding ? true
, dontStrip              ? true }:

let

  src = lib.cleanSource ../../../pkg/urbit;

  version = builtins.readFile "${src}/version";

in stdenv.mkDerivation {
  inherit src version;

  pname = "urbit" + lib.optionalString enableDebug "-debug"
    + lib.optionalString enableStatic "-static";

  nativeBuildInputs = [ pkgconfig ];

  buildInputs = [
    cacert
    ca-bundle
    curlUrbit
    ent
    gmp
    h2o
    ivory.header
    libsigsegv
    libuv
    lmdb
    murmur3
    openssl
    softfloat3
    urcrypt
    zlib
  ];

  # Ensure any `/usr/bin/env bash` shebang is patched.
  postPatch = ''
    patchShebangs ./configure
  '';

  checkTarget = "test";

  installPhase = ''
    mkdir -p $out/bin
    cp ./build/urbit $out/bin/urbit
    cp ./build/urbit-worker $out/bin/urbit-worker
  '';

  dontDisableStatic = enableStatic;

  configureFlags = if enableStatic
    then [ "--disable-shared" "--enable-static" ]
    else [];

  CFLAGS = (if enableDebug then [ "-O0" "-g" ] else [ "-O3" ])
    ++ lib.optionals (!enableDebug) [ "-Werror" ];

  MEMORY_DEBUG = enableDebug;
  CPU_DEBUG = enableDebug;
  EVENT_TIME_DEBUG = false;

  # See https://github.com/NixOS/nixpkgs/issues/18995
  hardeningDisable = lib.optionals enableDebug [ "all" ];

  inherit enableParallelBuilding doCheck dontStrip;

  meta = {
    debug = enableDebug;
    arguments = lib.optionals enableDebug [ "-g" ];
  };
}
{'fraction_non_alphanumeric': 0.11721907841552143, 'fraction_numerical': 0.007006197790353005, 'mean_word_length': 2.3684210526315788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5739218', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1214, 'n_words': 281}