mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
Merging more distcc derivations, at the style of ccache
These allow building a Masquerade PATH for distccd, or overriding stdenv to use distcc.
This commit is contained in:
commit
63035ba87d
3 changed files with 97 additions and 7 deletions
|
@ -1,13 +1,12 @@
|
|||
{ stdenv, fetchurl, popt, avahi, pkgconfig, python, gtk
|
||||
{ stdenv, fetchurl, popt, avahi, pkgconfig, python, gtk, runCommand, gcc
|
||||
, sysconfDir ? "" # set this parameter to override the default value $out/etc
|
||||
, static ? false
|
||||
}:
|
||||
|
||||
let name = "distcc";
|
||||
version = "3.1";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
let
|
||||
name = "distcc";
|
||||
version = "3.1";
|
||||
distcc = stdenv.mkDerivation {
|
||||
name = "${name}-${version}";
|
||||
src = fetchurl {
|
||||
url = "http://distcc.googlecode.com/files/${name}-${version}.tar.bz2";
|
||||
|
@ -36,6 +35,32 @@ stdenv.mkDerivation {
|
|||
# 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
|
||||
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
|
||||
'');
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "a fast, free distributed C/C++ compiler";
|
||||
homepage = "http://distcc.org";
|
||||
|
@ -44,4 +69,6 @@ stdenv.mkDerivation {
|
|||
platforms = stdenv.lib.platforms.linux;
|
||||
maintainers = [ stdenv.lib.maintainers.simons ];
|
||||
};
|
||||
}
|
||||
};
|
||||
in
|
||||
distcc
|
||||
|
|
41
pkgs/development/tools/misc/distcc/masq.nix
Normal file
41
pkgs/development/tools/misc/distcc/masq.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ stdenv, gccRaw, binutils }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "distcc-masq-${gccRaw.name}";
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
ensureDir $out/bin
|
||||
|
||||
bin=${gccRaw}/bin
|
||||
|
||||
shopt -s nullglob
|
||||
if [ -f $bin/gcc ]; then
|
||||
ln -s $bin/gcc $out/bin
|
||||
else
|
||||
for a in $bin/*-gcc; do
|
||||
ln -s $bin/*-gcc $out/bin/gcc
|
||||
ln -s $bin/*-gcc $out/bin/cc
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -f $bin/g++ ]; then
|
||||
ln -s $bin/g++ $out/bin
|
||||
else
|
||||
for a in $bin/*-g++; do
|
||||
ln -sf $bin/*-g++ $out/bin/g++
|
||||
ln -sf $bin/*-g++ $out/bin/c++
|
||||
done
|
||||
fi
|
||||
|
||||
bbin=${binutils}/bin
|
||||
if [ -f $bbin/as ]; then
|
||||
ln -s $bbin/as $out/bin
|
||||
else
|
||||
for a in $bbin/*-as; do
|
||||
ln -sf $bbin/*-as $out/bin/as
|
||||
done
|
||||
fi
|
||||
|
||||
'';
|
||||
}
|
|
@ -3075,6 +3075,28 @@ let
|
|||
|
||||
distcc = callPackage ../development/tools/misc/distcc { };
|
||||
|
||||
# distccWrapper: wrapper that works as gcc or g++
|
||||
# It can be used by setting in nixpkgs config like this, for example:
|
||||
# replaceStdenv = { pkgs }: pkgs.distccStdenv;
|
||||
# But if you build in chroot, a default 'nix' will create
|
||||
# a new net namespace, and won't have network access.
|
||||
# You can use an override in packageOverrides to set extraConfig:
|
||||
# packageOverrides = pkgs: {
|
||||
# distccWrapper = pkgs.distccWrapper.override {
|
||||
# extraConfig = ''
|
||||
# DISTCC_HOSTS="myhost1 myhost2"
|
||||
# '';
|
||||
# };
|
||||
#
|
||||
distccWrapper = makeOverridable ({ extraConfig ? "" }:
|
||||
wrapGCC (distcc.links extraConfig)) {};
|
||||
distccStdenv = lowPrio (overrideGCC stdenv distccWrapper);
|
||||
|
||||
distccMasquerade = callPackage ../development/tools/misc/distcc/masq.nix {
|
||||
gccRaw = gcc.gcc;
|
||||
binutils = binutils;
|
||||
};
|
||||
|
||||
docutils = builderDefsPackage (import ../development/tools/documentation/docutils) {
|
||||
inherit python pil makeWrapper;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue