2014-03-03 12:39:30 +00:00
|
|
|
postPhases+=" cleanupBuildDir"
|
|
|
|
|
2014-02-05 13:11:21 +00:00
|
|
|
# Force GCC to build with coverage instrumentation. Also disable
|
|
|
|
# optimisation, since it may confuse things.
|
2020-02-28 11:31:50 +00:00
|
|
|
export NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE:-} -O0 --coverage"
|
2014-03-03 12:39:30 +00:00
|
|
|
|
|
|
|
# Get rid of everything that isn't a gcno file or a C source file.
|
|
|
|
# Also strip the `.tmp_' prefix from gcno files. (The Linux kernel
|
|
|
|
# creates these.)
|
|
|
|
cleanupBuildDir() {
|
|
|
|
if ! [ -e $out/.build ]; then return; fi
|
|
|
|
|
|
|
|
find $out/.build/ -type f -a ! \
|
|
|
|
\( -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.h" -o -name "*.hh" -o -name "*.y" -o -name "*.l" -o -name "*.gcno" \) \
|
|
|
|
| xargs rm -f --
|
|
|
|
|
|
|
|
for i in $(find $out/.build/ -name ".tmp_*.gcno"); do
|
|
|
|
mv "$i" "$(echo $i | sed s/.tmp_//)"
|
|
|
|
done
|
|
|
|
}
|