summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2012-04-10 07:13:52 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2012-04-10 07:13:52 +0000
commit9595946c73a02af48695d07ca880451b32076d00 (patch)
tree9df05706f2d3a93652dfa5d5a5f6e4c40baf90f1 /pkgs/misc
parentb35d2c6b895607a939cfef446ca37b0d869fede6 (diff)
downloadnixlib-9595946c73a02af48695d07ca880451b32076d00.tar
nixlib-9595946c73a02af48695d07ca880451b32076d00.tar.gz
nixlib-9595946c73a02af48695d07ca880451b32076d00.tar.bz2
nixlib-9595946c73a02af48695d07ca880451b32076d00.tar.lz
nixlib-9595946c73a02af48695d07ca880451b32076d00.tar.xz
nixlib-9595946c73a02af48695d07ca880451b32076d00.tar.zst
nixlib-9595946c73a02af48695d07ca880451b32076d00.zip
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
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/misc.nix38
1 files changed, 36 insertions, 2 deletions
diff --git a/pkgs/misc/misc.nix b/pkgs/misc/misc.nix
index de23d6fa2c8d..df4a0ce81023 100644
--- a/pkgs/misc/misc.nix
+++ b/pkgs/misc/misc.nix
@@ -109,14 +109,15 @@ in
   # 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 @@ in
       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 {} \;
+    '';
   });
 }