<commit_before>{ stdenv, fetchFromGitHub, popt, avahi, pkgconfig, python, gtk, runCommand, gcc, autoconf, automake, which, procps
, sysconfDir ? ""   # set this parameter to override the default value $out/etc
, static ? false
}:

let
  name    = "distcc";
  version = "2016-02-24";
  distcc = stdenv.mkDerivation {
    name = "${name}-${version}";
    src = fetchFromGitHub {
      owner = "distcc";
      repo = "distcc";
      rev = "b2fa4e21b4029e13e2c33f7b03ca43346f2cecb8";
      sha256 = "1vj31wcdas8wy52hy6749mlrca9v6ynycdiigx5ay8pnya9z73c6";
    };

    buildInputs = [popt avahi pkgconfig python gtk autoconf automake pkgconfig which procps];
    preConfigure =
    ''
      export CPATH=$(ls -d ${gcc.cc}/lib/gcc/*/${gcc.cc.version}/plugin/include)

      configureFlagsArray=( CFLAGS="-O2 -fno-strict-aliasing"
                            CXXFLAGS="-O2 -fno-strict-aliasing"
          --mandir=$out/share/man
                            ${if sysconfDir == "" then "" else "--sysconfdir=${sysconfDir}"}
                            ${if static then "LDFLAGS=-static" else ""}
                            --with${if static == true || popt == null then "" else "out"}-included-popt
                            --with${if avahi != null then "" else "out"}-avahi
                            --with${if gtk != null then "" else "out"}-gtk
                            --without-gnome
                            --enable-rfc2553
                            --disable-Werror   # a must on gcc 4.6
                           )
      installFlags="sysconfdir=$out/etc";

      ./autogen.sh
    '';

    # The test suite fails because it uses hard-coded paths, i.e. /usr/bin/gcc.
    doCheck = false;

    passthru = {
      # A derivation that provides gcc and g++ commands, but that
      # will end up calling distcc for the given cacheDir
      #
      # extraConfig is meant to be sh lines exporting environment
      # variables like DISTCC_HOSTS, DISTCC_DIR, ...
      links = extraConfig: (runCommand "distcc-links" { passthru.gcc = gcc.cc; }
        ''
          mkdir -p $out/bin
          if [ -x "${gcc.cc}/bin/gcc" ]; then
            cat > $out/bin/gcc << EOF
            #!/bin/sh
            ${extraConfig}
            exec ${distcc}/bin/distcc gcc "\$@"
          EOF
            chmod +x $out/bin/gcc
          fi
          if [ -x "${gcc.cc}/bin/g++" ]; then
            cat > $out/bin/g++ << EOF
            #!/bin/sh
            ${extraConfig}
            exec ${distcc}/bin/distcc g++ "\$@"
          EOF
            chmod +x $out/bin/g++
          fi
        '');
    };

    meta = {
      description = "a fast, free distributed C/C++ compiler";
      homepage = "http://distcc.org";
      license = "GPL";

      platforms = stdenv.lib.platforms.linux;
      maintainers = with stdenv.lib.maintainers; [ <NAME> ];
    };
  };
in
  distcc
<commit_msg>distcc: add libiberty as a buildInput<commit_after>{ stdenv, fetchFromGitHub, popt, avahi, pkgconfig, python, gtk, runCommand
, gcc, autoconf, automake, which, procps, libiberty_static
, sysconfDir ? ""   # set this parameter to override the default value $out/etc
, static ? false
}:

let
  name    = "distcc";
  version = "2016-02-24";
  distcc = stdenv.mkDerivation {
    name = "${name}-${version}";
    src = fetchFromGitHub {
      owner = "distcc";
      repo = "distcc";
      rev = "b2fa4e21b4029e13e2c33f7b03ca43346f2cecb8";
      sha256 = "1vj31wcdas8wy52hy6749mlrca9v6ynycdiigx5ay8pnya9z73c6";
    };

    buildInputs = [popt avahi pkgconfig python gtk autoconf automake pkgconfig which procps libiberty_static];
    preConfigure =
    ''
      export CPATH=$(ls -d ${gcc.cc}/lib/gcc/*/${gcc.cc.version}/plugin/include)

      configureFlagsArray=( CFLAGS="-O2 -fno-strict-aliasing"
                            CXXFLAGS="-O2 -fno-strict-aliasing"
          --mandir=$out/share/man
                            ${if sysconfDir == "" then "" else "--sysconfdir=${sysconfDir}"}
                            ${if static then "LDFLAGS=-static" else ""}
                            --with${if static == true || popt == null then "" else "out"}-included-popt
                            --with${if avahi != null then "" else "out"}-avahi
                            --with${if gtk != null then "" else "out"}-gtk
                            --without-gnome
                            --enable-rfc2553
                            --disable-Werror   # a must on gcc 4.6
                           )
      installFlags="sysconfdir=$out/etc";

      ./autogen.sh
    '';

    # The test suite fails because it uses hard-coded paths, i.e. /usr/bin/gcc.
    doCheck = false;

    passthru = {
      # A derivation that provides gcc and g++ commands, but that
      # will end up calling distcc for the given cacheDir
      #
      # extraConfig is meant to be sh lines exporting environment
      # variables like DISTCC_HOSTS, DISTCC_DIR, ...
      links = extraConfig: (runCommand "distcc-links" { passthru.gcc = gcc.cc; }
        ''
          mkdir -p $out/bin
          if [ -x "${gcc.cc}/bin/gcc" ]; then
            cat > $out/bin/gcc << EOF
            #!/bin/sh
            ${extraConfig}
            exec ${distcc}/bin/distcc gcc "\$@"
          EOF
            chmod +x $out/bin/gcc
          fi
          if [ -x "${gcc.cc}/bin/g++" ]; then
            cat > $out/bin/g++ << EOF
            #!/bin/sh
            ${extraConfig}
            exec ${distcc}/bin/distcc g++ "\$@"
          EOF
            chmod +x $out/bin/g++
          fi
        '');
    };

    meta = {
      description = "a fast, free distributed C/C++ compiler";
      homepage = "http://distcc.org";
      license = "GPL";

      platforms = stdenv.lib.platforms.linux;
      maintainers = with stdenv.lib.maintainers; [ <NAME> ];
    };
  };
in
  distcc

{'fraction_non_alphanumeric': 0.1338609772883689, 'fraction_numerical': 0.02064693737095664, 'mean_word_length': 1.677567941040995, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5003702', 'n_tokens_mistral': 1961, 'n_tokens_neox': 1828, 'n_words': 439}