2017-08-27 19:42:21 +02:00
|
|
|
ninjaBuildPhase() {
|
|
|
|
runHook preBuild
|
|
|
|
|
2018-11-16 23:22:11 +01:00
|
|
|
local buildCores=1
|
2017-12-04 16:15:58 +01:00
|
|
|
|
2018-11-16 23:22:11 +01:00
|
|
|
# Parallel building is enabled by default.
|
|
|
|
if [ "${enableParallelBuilding-1}" ]; then
|
|
|
|
buildCores="$NIX_BUILD_CORES"
|
|
|
|
fi
|
2017-12-04 16:15:58 +01:00
|
|
|
|
2018-11-16 23:22:11 +01:00
|
|
|
local flagsArray=(
|
2018-11-19 02:29:51 +01:00
|
|
|
-j$buildCores -l$NIX_BUILD_CORES
|
2018-11-16 23:22:11 +01:00
|
|
|
$ninjaFlags "${ninjaFlagsArray[@]}"
|
|
|
|
)
|
2017-08-27 19:42:21 +02:00
|
|
|
|
2018-11-16 23:22:11 +01:00
|
|
|
echoCmd 'build flags' "${flagsArray[@]}"
|
|
|
|
ninja "${flagsArray[@]}"
|
2017-08-27 19:42:21 +02:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "$dontUseNinjaBuild" -a -z "$buildPhase" ]; then
|
|
|
|
buildPhase=ninjaBuildPhase
|
|
|
|
fi
|
|
|
|
|
|
|
|
ninjaInstallPhase() {
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
# shellcheck disable=SC2086
|
2018-11-16 23:22:11 +01:00
|
|
|
local flagsArray=(
|
|
|
|
$ninjaFlags "${ninjaFlagsArray[@]}"
|
|
|
|
${installTargets:-install}
|
|
|
|
)
|
2017-08-27 19:42:21 +02:00
|
|
|
|
|
|
|
echoCmd 'install flags' "${flagsArray[@]}"
|
|
|
|
ninja "${flagsArray[@]}"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "$dontUseNinjaInstall" -a -z "$installPhase" ]; then
|
|
|
|
installPhase=ninjaInstallPhase
|
|
|
|
fi
|
2018-11-16 23:22:11 +01:00
|
|
|
|
|
|
|
ninjaCheckPhase() {
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
if [ -z "${checkTarget:-}" ]; then
|
2018-11-19 01:07:56 +01:00
|
|
|
if ninja -t query test >/dev/null 2>&1; then
|
2018-11-16 23:22:11 +01:00
|
|
|
checkTarget=test
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${checkTarget:-}" ]; then
|
2018-11-18 02:08:47 +01:00
|
|
|
echo "no test target found in ninja, doing nothing"
|
2018-11-16 23:22:11 +01:00
|
|
|
else
|
|
|
|
local buildCores=1
|
|
|
|
|
|
|
|
if [ "${enableParallelChecking-1}" ]; then
|
|
|
|
buildCores="$NIX_BUILD_CORES"
|
|
|
|
fi
|
|
|
|
|
|
|
|
local flagsArray=(
|
2018-11-19 02:29:51 +01:00
|
|
|
-j$buildCores -l$NIX_BUILD_CORES
|
2018-11-16 23:22:11 +01:00
|
|
|
$ninjaFlags "${ninjaFlagsArray[@]}"
|
|
|
|
$checkTarget
|
|
|
|
)
|
|
|
|
|
|
|
|
echoCmd 'check flags' "${flagsArray[@]}"
|
|
|
|
ninja "${flagsArray[@]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "$dontUseNinjaCheck" -a -z "$checkPhase" ]; then
|
|
|
|
checkPhase=ninjaCheckPhase
|
|
|
|
fi
|