2021-05-06 09:16:54 +02:00
|
|
|
{ lib, stdenv, fetchFromGitHub, popt, avahi, pkg-config, python3, gtk3, runCommand
|
2016-03-28 08:01:08 +02:00
|
|
|
, gcc, autoconf, automake, which, procps, libiberty_static
|
2019-02-26 12:45:54 +01:00
|
|
|
, runtimeShell
|
2010-10-26 13:14:40 +02:00
|
|
|
, sysconfDir ? "" # set this parameter to override the default value $out/etc
|
|
|
|
, static ? false
|
|
|
|
}:
|
2009-10-20 13:54:49 +02:00
|
|
|
|
2012-12-22 19:35:15 +01:00
|
|
|
let
|
2012-12-26 23:32:23 +01:00
|
|
|
name = "distcc";
|
2021-05-06 09:16:54 +02:00
|
|
|
version = "2021-03-11";
|
2012-12-26 23:32:23 +01:00
|
|
|
distcc = stdenv.mkDerivation {
|
|
|
|
name = "${name}-${version}";
|
2016-03-15 06:40:26 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "distcc";
|
|
|
|
repo = "distcc";
|
2021-05-06 09:16:54 +02:00
|
|
|
rev = "de21b1a43737fbcf47967a706dab4c60521dbbb1";
|
|
|
|
sha256 = "0zjba1090awxkmgifr9jnjkxf41zhzc4f6mrnbayn3v6s77ca9x4";
|
2012-12-26 23:32:23 +01:00
|
|
|
};
|
2009-10-20 13:54:49 +02:00
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2021-05-06 09:16:54 +02:00
|
|
|
buildInputs = [popt avahi pkg-config python3 gtk3 autoconf automake which procps libiberty_static];
|
2012-12-26 23:32:23 +01:00
|
|
|
preConfigure =
|
|
|
|
''
|
2016-03-15 06:40:26 +01:00
|
|
|
export CPATH=$(ls -d ${gcc.cc}/lib/gcc/*/${gcc.cc.version}/plugin/include)
|
|
|
|
|
2012-12-26 23:32:23 +01:00
|
|
|
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
|
2021-05-06 09:16:54 +02:00
|
|
|
--with${if gtk3 != null then "" else "out"}-gtk
|
2012-12-26 23:32:23 +01:00
|
|
|
--without-gnome
|
|
|
|
--enable-rfc2553
|
|
|
|
--disable-Werror # a must on gcc 4.6
|
|
|
|
)
|
|
|
|
installFlags="sysconfdir=$out/etc";
|
2016-03-15 06:40:26 +01:00
|
|
|
|
|
|
|
./autogen.sh
|
2012-12-26 23:32:23 +01:00
|
|
|
'';
|
2009-10-20 13:54:49 +02:00
|
|
|
|
2012-12-26 23:32:23 +01:00
|
|
|
# The test suite fails because it uses hard-coded paths, i.e. /usr/bin/gcc.
|
|
|
|
doCheck = false;
|
2009-10-20 13:54:49 +02:00
|
|
|
|
2012-12-26 23:32:23 +01:00
|
|
|
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, ...
|
2015-03-25 03:13:43 +01:00
|
|
|
links = extraConfig: (runCommand "distcc-links" { passthru.gcc = gcc.cc; }
|
2012-12-26 23:32:23 +01:00
|
|
|
''
|
|
|
|
mkdir -p $out/bin
|
2015-01-15 05:44:00 +01:00
|
|
|
if [ -x "${gcc.cc}/bin/gcc" ]; then
|
2012-12-26 23:32:23 +01:00
|
|
|
cat > $out/bin/gcc << EOF
|
2019-02-26 12:45:54 +01:00
|
|
|
#!${runtimeShell}
|
2012-12-26 23:32:23 +01:00
|
|
|
${extraConfig}
|
|
|
|
exec ${distcc}/bin/distcc gcc "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/gcc
|
|
|
|
fi
|
2015-01-15 05:44:00 +01:00
|
|
|
if [ -x "${gcc.cc}/bin/g++" ]; then
|
2012-12-26 23:32:23 +01:00
|
|
|
cat > $out/bin/g++ << EOF
|
2019-02-26 12:45:54 +01:00
|
|
|
#!${runtimeShell}
|
2012-12-26 23:32:23 +01:00
|
|
|
${extraConfig}
|
|
|
|
exec ${distcc}/bin/distcc g++ "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/g++
|
|
|
|
fi
|
|
|
|
'');
|
|
|
|
};
|
2012-12-22 19:35:15 +01:00
|
|
|
|
2012-12-26 23:32:23 +01:00
|
|
|
meta = {
|
2016-06-20 12:53:46 +02:00
|
|
|
description = "A fast, free distributed C/C++ compiler";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://distcc.org";
|
2012-12-26 23:32:23 +01:00
|
|
|
license = "GPL";
|
2010-10-26 13:14:40 +02:00
|
|
|
|
2021-01-23 13:26:19 +01:00
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
maintainers = with lib.maintainers; [ anderspapitto ];
|
2012-12-26 23:32:23 +01:00
|
|
|
};
|
2009-10-20 13:54:49 +02:00
|
|
|
};
|
2012-12-22 19:35:15 +01:00
|
|
|
in
|
2012-12-26 23:32:23 +01:00
|
|
|
distcc
|