Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 84 lines 2.9 kB view raw
1{ lib, stdenv, fetchFromGitHub, popt, avahi, pkg-config, python3, gtk3, runCommand 2, gcc, autoconf, automake, which, procps, libiberty_static 3, runtimeShell 4, sysconfDir ? "" # set this parameter to override the default value $out/etc 5, static ? false 6}: 7 8let 9 pname = "distcc"; 10 version = "2021-03-11"; 11 distcc = stdenv.mkDerivation { 12 inherit pname version; 13 src = fetchFromGitHub { 14 owner = "distcc"; 15 repo = "distcc"; 16 rev = "de21b1a43737fbcf47967a706dab4c60521dbbb1"; 17 sha256 = "0zjba1090awxkmgifr9jnjkxf41zhzc4f6mrnbayn3v6s77ca9x4"; 18 }; 19 20 nativeBuildInputs = [ pkg-config autoconf automake ]; 21 buildInputs = [popt avahi python3 gtk3 which procps libiberty_static]; 22 preConfigure = 23 '' 24 export CPATH=$(ls -d ${gcc.cc}/lib/gcc/*/${gcc.cc.version}/plugin/include) 25 26 configureFlagsArray=( CFLAGS="-O2 -fno-strict-aliasing" 27 CXXFLAGS="-O2 -fno-strict-aliasing" 28 --mandir=$out/share/man 29 ${if sysconfDir == "" then "" else "--sysconfdir=${sysconfDir}"} 30 ${lib.optionalString static "LDFLAGS=-static"} 31 ${lib.withFeature (static == true || popt == null) "included-popt"} 32 ${lib.withFeature (avahi != null) "avahi"} 33 ${lib.withFeature (gtk3 != null) "gtk"} 34 --without-gnome 35 --enable-rfc2553 36 --disable-Werror # a must on gcc 4.6 37 ) 38 installFlags="sysconfdir=$out/etc"; 39 40 ./autogen.sh 41 ''; 42 43 # The test suite fails because it uses hard-coded paths, i.e. /usr/bin/gcc. 44 doCheck = false; 45 46 passthru = { 47 # A derivation that provides gcc and g++ commands, but that 48 # will end up calling distcc for the given cacheDir 49 # 50 # extraConfig is meant to be sh lines exporting environment 51 # variables like DISTCC_HOSTS, DISTCC_DIR, ... 52 links = extraConfig: (runCommand "distcc-links" { passthru.gcc = gcc.cc; } 53 '' 54 mkdir -p $out/bin 55 if [ -x "${gcc.cc}/bin/gcc" ]; then 56 cat > $out/bin/gcc << EOF 57 #!${runtimeShell} 58 ${extraConfig} 59 exec ${distcc}/bin/distcc gcc "\$@" 60 EOF 61 chmod +x $out/bin/gcc 62 fi 63 if [ -x "${gcc.cc}/bin/g++" ]; then 64 cat > $out/bin/g++ << EOF 65 #!${runtimeShell} 66 ${extraConfig} 67 exec ${distcc}/bin/distcc g++ "\$@" 68 EOF 69 chmod +x $out/bin/g++ 70 fi 71 ''); 72 }; 73 74 meta = { 75 description = "A fast, free distributed C/C++ compiler"; 76 homepage = "http://distcc.org"; 77 license = "GPL"; 78 79 platforms = lib.platforms.linux; 80 maintainers = with lib.maintainers; [ anderspapitto ]; 81 }; 82 }; 83in 84 distcc