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