Author: viric
Date: Tue Apr 10 07:13:52 2012
New Revision: 33715
URL: https://nixos.org/websvn/nix/?rev=33715&sc=1
Log:
Fixing details of debugVersion, and adding a 'symbolsVersion'.
I could merge both into one, but I'll do that later.
Modified:
nixpkgs/trunk/pkgs/misc/misc.nix
Modified: nixpkgs/trunk/pkgs/misc/misc.nix
==============================================================================
--- nixpkgs/trunk/pkgs/misc/misc.nix Mon Apr 9 21:02:17 2012 (r33714)
+++ nixpkgs/trunk/pkgs/misc/misc.nix Tue Apr 10 07:13:52 2012 (r33715)
@@ -109,14 +109,15 @@
# build a debug version of a package
debugVersion = pkg: lib.overrideDerivation pkg (attrs: {
- prePhases = ["preHook"] ++ lib.optionals (pkgs ? prePhases) pkgs.prePhases;
+ prePhases = ["debugPhase"] ++ lib.optionals (attrs ? prePhases)
attrs.prePhases;
+ postPhases = ["objectsPhase"] ++ lib.optionals (attrs ? postPhases)
attrs.postPhases;
dontStrip = true;
CFLAGS="-ggdb -O0";
CXXFLAGS="-ggdb -O0";
- preHook = ''
+ debugPhase = ''
s=$out/src
mkdir -p $s; cd $s;
export TMP=$s
@@ -128,5 +129,38 @@
echo "file should tell that executable has not been stripped"
'';
+ objectsPhase = ''
+ cd $out/src
+ find . -name "*.o" -exec rm {} \;
+ '';
+ });
+
+ # build an optimized ersion of a package but with symbols and source
+ symbolsVersion = pkg: lib.overrideDerivation pkg (attrs: {
+
+ prePhases = ["debugPhase"] ++ lib.optionals (attrs ? prePhases)
attrs.prePhases;
+ postPhases = ["objectsPhase"] ++ lib.optionals (attrs ? postPhases)
attrs.postPhases;
+
+ dontStrip = true;
+
+ CFLAGS="-g -O2";
+ CXXFLAGS="-g -O2";
+
+ debugPhase = ''
+ s=$out/src
+ mkdir -p $s; cd $s;
+ export TMP=$s
+ export TEMP=$s
+
+ for var in CFLAGS CXXFLAGS NIX_CFLAGS_COMPILE; do
+ declare -x "$var=''${!var} -g -O2"
+ done
+ echo "file should tell that executable has not been stripped"
+ '';
+
+ objectsPhase = ''
+ cd $out/src
+ find . -name "*.o" -exec rm {} \;
+ '';
});
}
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits