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