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