* Factor out an adapter to clean up the build tree.
svn path=/nixpkgs/trunk/; revision=16920
This commit is contained in:
parent
3d7152db82
commit
f782f14e58
|
@ -137,6 +137,23 @@ rec {
|
||||||
} stdenv;
|
} stdenv;
|
||||||
|
|
||||||
|
|
||||||
|
cleanupBuildTree = stdenv:
|
||||||
|
addAttrsToDerivation
|
||||||
|
{ postPhases = "cleanupBuildDir";
|
||||||
|
|
||||||
|
# Get rid of everything that isn't a gcno file or a C source
|
||||||
|
# file. This also includes the gcda files; we're not
|
||||||
|
# interested in coverage resulting from the package's own test
|
||||||
|
# suite.
|
||||||
|
cleanupBuildDir =
|
||||||
|
''
|
||||||
|
find $out/.build/ -type f -a ! \
|
||||||
|
\( -name "*.c" -o -name "*.h" -o -name "*.gcno" \) \
|
||||||
|
| xargs rm -f --
|
||||||
|
'';
|
||||||
|
} stdenv;
|
||||||
|
|
||||||
|
|
||||||
/* Return a modified stdenv that builds packages with GCC's coverage
|
/* Return a modified stdenv that builds packages with GCC's coverage
|
||||||
instrumentation. The coverage note files (*.gcno) are stored in
|
instrumentation. The coverage note files (*.gcno) are stored in
|
||||||
$out/.build, along with the source code of the package, to enable
|
$out/.build, along with the source code of the package, to enable
|
||||||
|
@ -146,8 +163,6 @@ rec {
|
||||||
addAttrsToDerivation
|
addAttrsToDerivation
|
||||||
{ NIX_CFLAGS_COMPILE = "-O0 --coverage";
|
{ NIX_CFLAGS_COMPILE = "-O0 --coverage";
|
||||||
|
|
||||||
postPhases = "cleanupBuildDir";
|
|
||||||
|
|
||||||
# This is an uberhack to prevent libtool from removing gcno
|
# This is an uberhack to prevent libtool from removing gcno
|
||||||
# files. This has been fixed in libtool, but there are
|
# files. This has been fixed in libtool, but there are
|
||||||
# packages out there with old ltmain.sh scripts.
|
# packages out there with old ltmain.sh scripts.
|
||||||
|
@ -158,17 +173,6 @@ rec {
|
||||||
substituteInPlace $i --replace '*.$objext)' '*.$objext | *.gcno)'
|
substituteInPlace $i --replace '*.$objext)' '*.$objext | *.gcno)'
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Get rid of everything that isn't a gcno file or a C source
|
|
||||||
# file. This also includes the gcda files; we're not
|
|
||||||
# interested in coverage resulting from the package's own test
|
|
||||||
# suite.
|
|
||||||
cleanupBuildDir =
|
|
||||||
''
|
|
||||||
find $out/.build/ -type f -a ! \
|
|
||||||
\( -name "*.c" -o -name "*.gcno" -o -name "*.h" \) \
|
|
||||||
| xargs rm -f --
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Object files instrumented with coverage analysis write
|
# Object files instrumented with coverage analysis write
|
||||||
|
@ -180,6 +184,6 @@ rec {
|
||||||
# written there. And to make nice coverage reports with lcov,
|
# written there. And to make nice coverage reports with lcov,
|
||||||
# we need the source code. So we have to use the
|
# we need the source code. So we have to use the
|
||||||
# `keepBuildTree' adapter as well.
|
# `keepBuildTree' adapter as well.
|
||||||
(keepBuildTree stdenv);
|
(cleanupBuildTree (keepBuildTree stdenv));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ let
|
||||||
inherit (import ../stdenv/adapters.nix {inherit (pkgs) dietlibc fetchurl runCommand;})
|
inherit (import ../stdenv/adapters.nix {inherit (pkgs) dietlibc fetchurl runCommand;})
|
||||||
overrideGCC overrideInStdenv overrideSetup
|
overrideGCC overrideInStdenv overrideSetup
|
||||||
useDietLibC useKlibc makeStaticBinaries addAttrsToDerivation
|
useDietLibC useKlibc makeStaticBinaries addAttrsToDerivation
|
||||||
keepBuildTree addCoverageInstrumentation;
|
keepBuildTree cleanupBuildTree addCoverageInstrumentation;
|
||||||
|
|
||||||
|
|
||||||
### BUILD SUPPORT
|
### BUILD SUPPORT
|
||||||
|
|
Loading…
Reference in a new issue