about summary refs log tree commit diff
path: root/pkgs/stdenv/adapters.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-05 14:11:21 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-05 19:18:33 +0100
commit80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b (patch)
treee23432117b0cdfdec490c68e80da1d8e181f7b61 /pkgs/stdenv/adapters.nix
parentbea2b3c5177a9fae5df5598574bd25bca8f6cb09 (diff)
downloadnixlib-80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b.tar
nixlib-80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b.tar.gz
nixlib-80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b.tar.bz2
nixlib-80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b.tar.lz
nixlib-80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b.tar.xz
nixlib-80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b.tar.zst
nixlib-80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b.zip
Turn the coverage analysis stdenv adapters into setup hooks
Stdenv adapters are kinda weird and un-idiomatic (especially when they
don't actually change stdenv).  It's more idiomatic to say

  buildInputs = [ makeCoverageAnalysisReport ];
Diffstat (limited to 'pkgs/stdenv/adapters.nix')
-rw-r--r--pkgs/stdenv/adapters.nix24
1 files changed, 1 insertions, 23 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index 3bac53411549..cb7e3ba925f5 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -231,29 +231,7 @@ rec {
      programs like lcov to produce pretty-printed reports.
   */
   addCoverageInstrumentation = stdenv:
-    # Object files instrumented with coverage analysis write runtime
-    # coverage data to <path>/<object>.gcda, where <path> is the
-    # location where gcc originally created the object file.  That
-    # would be /tmp/nix-build-<something>, which will be long gone by
-    # the time we run the program.  Furthermore, the <object>.gcno
-    # files created at compile time are also written there.  And to
-    # make nice coverage reports with lcov, we need the source code.
-    # So we have to use the `keepBuildTree' adapter as well.
-    let stdenv' = cleanupBuildTree (keepBuildTree stdenv); in
-    { mkDerivation = args: stdenv'.mkDerivation (args // {
-        NIX_CFLAGS_COMPILE = toString (args.NIX_CFLAGS_COMPILE or "") + " -O0 --coverage";
-        postUnpack =
-          ''
-            # This is an uberhack to prevent libtool from removing gcno
-            # files.  This has been fixed in libtool, but there are
-            # packages out there with old ltmain.sh scripts.
-            # See http://www.mail-archive.com/libtool@gnu.org/msg10725.html
-            for i in $(find -name ltmain.sh); do
-                substituteInPlace $i --replace '*.$objext)' '*.$objext | *.gcno)'
-            done
-          '' + args.postUnpack or "";
-      });
-    };
+    cleanupBuildTree (keepBuildTree (overrideInStdenv stdenv [ pkgs.enableCoverageInstrumentation ]));
 
 
   /* Replace the meta.maintainers field of a derivation.  This is useful