pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / build-support / setup-hooks / enable-coverage-instrumentation.sh
blob61e9ed5705f4796a41237e9cd204664dffbfe61b
1 appendToVar postPhases cleanupBuildDir
3 # Force GCC to build with coverage instrumentation. Also disable
4 # optimisation, since it may confuse things.
5 export NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE:-} -O0 --coverage"
7 # Get rid of everything that isn't a gcno file or a C source file.
8 # Also strip the `.tmp_' prefix from gcno files. (The Linux kernel
9 # creates these.)
10 cleanupBuildDir() {
11 if ! [ -e $out/.build ]; then return; fi
13 find $out/.build/ -type f -a ! \
14 \( -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.h" -o -name "*.hh" -o -name "*.y" -o -name "*.l" -o -name "*.gcno" \) \
15 | xargs rm -f --
17 for i in $(find $out/.build/ -name ".tmp_*.gcno"); do
18 mv "$i" "$(echo $i | sed s/.tmp_//)"
19 done