2012-12-22 19:35:15 +01:00
|
|
|
{ stdenv, fetchurl, popt, avahi, pkgconfig, python, gtk, runCommand, gcc
|
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
|
|
|
|
name = "distcc";
|
|
|
|
version = "3.1";
|
|
|
|
distcc = stdenv.mkDerivation {
|
2009-10-20 13:54:49 +02:00
|
|
|
name = "${name}-${version}";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://distcc.googlecode.com/files/${name}-${version}.tar.bz2";
|
|
|
|
sha256 = "f55dbafd76bed3ce57e1bbcdab1329227808890d90f4c724fcd2d53f934ddd89";
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [popt avahi pkgconfig python gtk];
|
|
|
|
preConfigure =
|
|
|
|
''
|
|
|
|
configureFlagsArray=( CFLAGS="-O2 -fno-strict-aliasing"
|
|
|
|
CXXFLAGS="-O2 -fno-strict-aliasing"
|
2010-12-06 19:01:40 +01:00
|
|
|
--mandir=$out/share/man
|
2010-10-26 13:14:40 +02:00
|
|
|
${if sysconfDir == "" then "" else "--sysconfdir=${sysconfDir}"}
|
2010-01-21 16:40:43 +01:00
|
|
|
${if static then "LDFLAGS=-static" else ""}
|
|
|
|
--with${if static == true || popt == null then "" else "out"}-included-popt
|
2009-10-20 13:54:49 +02:00
|
|
|
--with${if avahi != null then "" else "out"}-avahi
|
|
|
|
--with${if gtk != null then "" else "out"}-gtk
|
|
|
|
--without-gnome
|
|
|
|
--enable-rfc2553
|
2012-12-22 17:13:32 +01:00
|
|
|
--disable-Werror # a must on gcc 4.6
|
2009-10-20 13:54:49 +02:00
|
|
|
)
|
2010-10-26 13:14:40 +02:00
|
|
|
installFlags="sysconfdir=$out/etc";
|
2009-10-20 13:54:49 +02:00
|
|
|
'';
|
2010-01-21 16:40:48 +01:00
|
|
|
patches = [ ./20-minute-io-timeout.patch ];
|
2009-10-20 13:54:49 +02:00
|
|
|
|
|
|
|
# The test suite fails because it uses hard-coded paths, i.e. /usr/bin/gcc.
|
|
|
|
doCheck = false;
|
|
|
|
|
2012-12-22 19:35:15 +01:00
|
|
|
passthru = {
|
|
|
|
# A derivation that provides gcc and g++ commands, but that
|
|
|
|
# will end up calling distcc for the given cacheDir
|
|
|
|
links = extraConfig : (runCommand "distcc-links"
|
|
|
|
{ inherit (gcc) langC langCC; }
|
|
|
|
''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
if [ $langC -eq 1 ]; then
|
|
|
|
cat > $out/bin/gcc << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
${extraConfig}
|
|
|
|
exec ${distcc}/bin/distcc gcc "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/gcc
|
|
|
|
fi
|
|
|
|
if [ $langCC -eq 1 ]; then
|
|
|
|
cat > $out/bin/g++ << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
${extraConfig}
|
|
|
|
exec ${distcc}/bin/distcc g++ "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/g++
|
|
|
|
fi
|
|
|
|
'');
|
|
|
|
};
|
|
|
|
|
2009-10-20 13:54:49 +02:00
|
|
|
meta = {
|
|
|
|
description = "a fast, free distributed C/C++ compiler";
|
|
|
|
homepage = "http://distcc.org";
|
|
|
|
license = "GPL";
|
2010-10-26 13:14:40 +02:00
|
|
|
|
2011-01-05 11:11:06 +01:00
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2010-10-26 13:14:40 +02:00
|
|
|
maintainers = [ stdenv.lib.maintainers.simons ];
|
2009-10-20 13:54:49 +02:00
|
|
|
};
|
2012-12-22 19:35:15 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
distcc
|