Fixing details of debugVersion, and adding a 'symbolsVersion'.
I could merge both into one, but I'll do that later. svn path=/nixpkgs/trunk/; revision=33715
This commit is contained in:
parent
b35d2c6b89
commit
9595946c73
@ -109,14 +109,15 @@ in
|
|||||||
# build a debug version of a package
|
# build a debug version of a package
|
||||||
debugVersion = pkg: lib.overrideDerivation pkg (attrs: {
|
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;
|
dontStrip = true;
|
||||||
|
|
||||||
CFLAGS="-ggdb -O0";
|
CFLAGS="-ggdb -O0";
|
||||||
CXXFLAGS="-ggdb -O0";
|
CXXFLAGS="-ggdb -O0";
|
||||||
|
|
||||||
preHook = ''
|
debugPhase = ''
|
||||||
s=$out/src
|
s=$out/src
|
||||||
mkdir -p $s; cd $s;
|
mkdir -p $s; cd $s;
|
||||||
export TMP=$s
|
export TMP=$s
|
||||||
@ -128,5 +129,38 @@ in
|
|||||||
echo "file should tell that executable has not been stripped"
|
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 {} \;
|
||||||
|
'';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user