Author: viric
Date: Sat Jan 21 01:29:06 2012
New Revision: 31753
URL: https://nixos.org/websvn/nix/?rev=31753&sc=1
Log:
Making the ccacheWrapper a bit nicer. More flexible, specifically.
Modified:
nixpkgs/trunk/pkgs/development/tools/misc/ccache/default.nix
nixpkgs/trunk/pkgs/top-level/all-packages.nix
Modified: nixpkgs/trunk/pkgs/development/tools/misc/ccache/default.nix
==============================================================================
--- nixpkgs/trunk/pkgs/development/tools/misc/ccache/default.nix Sat Jan
21 00:47:03 2012 (r31752)
+++ nixpkgs/trunk/pkgs/development/tools/misc/ccache/default.nix Sat Jan
21 01:29:06 2012 (r31753)
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, runCommand, gcc}:
+{stdenv, fetchurl, runCommand, gcc, zlib}:
let
ccache =
@@ -9,17 +9,19 @@
sha256 = "04ax6ks49b6rn57hx4v9wbvmsfmw6ipn0wyfqwhh4lzw70flv3r7";
};
+ buildInputs = [ zlib ];
+
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"
+ links = extraConfig : (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}
+ ${extraConfig}
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/gcc "\$@"
EOF
chmod +x $out/bin/gcc
@@ -27,7 +29,7 @@
if [ $langCC -eq 1 ]; then
cat > $out/bin/g++ << EOF
#!/bin/sh
- export CCACHE_DIR=${cacheDir}
+ ${extraConfig}
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/g++ "\$@"
EOF
chmod +x $out/bin/g++
Modified: nixpkgs/trunk/pkgs/top-level/all-packages.nix
==============================================================================
--- nixpkgs/trunk/pkgs/top-level/all-packages.nix Sat Jan 21 00:47:03
2012 (r31752)
+++ nixpkgs/trunk/pkgs/top-level/all-packages.nix Sat Jan 21 01:29:06
2012 (r31753)
@@ -2895,10 +2895,12 @@
# 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");
+ # replaceStdenv = { pkgs }: pkgs.ccacheStdenv "exports
CCACHE_DIR=/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);
+ # If instantiated directly, it will use the HOME/.ccache as cache directory.
+ ccacheWrapper = { extraConfig ? "" }: wrapGCC (ccache.links extraConfig);
+ ccacheStdenv = extraConfig: overrideGCC stdenv
+ (ccacheWrapper { inherit extraConfig; } );
complexity = callPackage ../development/tools/misc/complexity { };
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits