Modifying the all-packages stdenv changer, so it allows having a global stdenv
wrapper. This will fail for crossStdenv, but it allows a wrapper that uses ccache for example. That's so described in all-packages.nix around 'ccache'. svn path=/nixpkgs/trunk/; revision=31747
This commit is contained in:
parent
9c55349494
commit
2f2ce81046
@ -1,10 +1,38 @@
|
|||||||
{stdenv, fetchurl}:
|
{stdenv, fetchurl, runCommand, gcc}:
|
||||||
|
|
||||||
|
let
|
||||||
|
ccache =
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "ccache-3.0";
|
name = "ccache-3.1.7";
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = http://samba.org/ftp/ccache/ccache-3.0.tar.gz;
|
url = http://samba.org/ftp/ccache/ccache-3.1.7.tar.gz;
|
||||||
sha256 = "0mi8sfnlcp2pmp7nzb7894rv85v13zxrj0v3qgnwhny3gx2p5pgk";
|
sha256 = "04ax6ks49b6rn57hx4v9wbvmsfmw6ipn0wyfqwhh4lzw70flv3r7";
|
||||||
|
};
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
# A derivation that provides gcc and g++ commands, but that
|
||||||
|
# will end up calling ccache for the given cacheDir
|
||||||
|
links = cacheDir : (runCommand "ccache-links"
|
||||||
|
{ inherit (gcc) langC langCC; }
|
||||||
|
''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
if [ $langC -eq 1 ]; then
|
||||||
|
cat > $out/bin/gcc << EOF
|
||||||
|
#!/bin/sh
|
||||||
|
export CCACHE_DIR=${cacheDir}
|
||||||
|
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/gcc "\$@"
|
||||||
|
EOF
|
||||||
|
chmod +x $out/bin/gcc
|
||||||
|
fi
|
||||||
|
if [ $langCC -eq 1 ]; then
|
||||||
|
cat > $out/bin/g++ << EOF
|
||||||
|
#!/bin/sh
|
||||||
|
export CCACHE_DIR=${cacheDir}
|
||||||
|
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/g++ "\$@"
|
||||||
|
EOF
|
||||||
|
chmod +x $out/bin/g++
|
||||||
|
fi
|
||||||
|
'');
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -12,4 +40,6 @@ stdenv.mkDerivation {
|
|||||||
homepage = http://ccache.samba.org/;
|
homepage = http://ccache.samba.org/;
|
||||||
license = "GPL";
|
license = "GPL";
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
in
|
||||||
|
ccache
|
||||||
|
@ -204,11 +204,15 @@ let
|
|||||||
|
|
||||||
stdenv =
|
stdenv =
|
||||||
if bootStdenv != null then (bootStdenv // {inherit platform;}) else
|
if bootStdenv != null then (bootStdenv // {inherit platform;}) else
|
||||||
let changer = getConfig ["replaceStdenv"] null;
|
let
|
||||||
|
changer = getConfig ["replaceStdenv"] null;
|
||||||
in if changer != null then
|
in if changer != null then
|
||||||
changer {
|
changer {
|
||||||
stdenv = stdenvCross;
|
# We import again all-packages to avoid recursivities.
|
||||||
overrideSetup = overrideSetup;
|
pkgs = import ./all-packages.nix {
|
||||||
|
# We remove packageOverrides to avoid recursivities
|
||||||
|
config = removeAttrs config [ "replaceStdenv" ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else if crossSystem != null then
|
else if crossSystem != null then
|
||||||
stdenvCross
|
stdenvCross
|
||||||
@ -2888,6 +2892,13 @@ let
|
|||||||
|
|
||||||
ccache = callPackage ../development/tools/misc/ccache { };
|
ccache = callPackage ../development/tools/misc/ccache { };
|
||||||
|
|
||||||
|
# Wrapper that works as gcc or g++
|
||||||
|
# It can be used by setting in nixpkgs config like this, for example:
|
||||||
|
# replaceStdenv = { pkgs }: (pkgs.ccacheStdenv "/var/ccache")
|
||||||
|
# But if you build in chroot, you should have that path in chroot
|
||||||
|
ccacheWrapper = cacheDir: wrapGCC (ccache.links cacheDir);
|
||||||
|
ccacheStdenv = cacheDir: overrideGCC stdenv (ccacheWrapper cacheDir);
|
||||||
|
|
||||||
complexity = callPackage ../development/tools/misc/complexity { };
|
complexity = callPackage ../development/tools/misc/complexity { };
|
||||||
|
|
||||||
ctags = callPackage ../development/tools/misc/ctags { };
|
ctags = callPackage ../development/tools/misc/ctags { };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user