about summary refs log tree commit diff
path: root/pkgs/stdenv/adapters.nix
diff options
context:
space:
mode:
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