mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-29 06:45:54 +03:00
Adding wrappers for distcc, similar to those of ccache.
This commit is contained in:
parent
d67da925a6
commit
3e57886620
@ -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
|
||||
|
@ -3075,6 +3075,23 @@ 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);
|
||||
|
||||
docutils = builderDefsPackage (import ../development/tools/documentation/docutils) {
|
||||
inherit python pil makeWrapper;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user