2017-08-27 17:42:21 +00: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=(
|
2018-11-19 01:29:51 +00:00
|
|
|
-j$buildCores -l$NIX_BUILD_CORES
|
2018-11-16 22:22:11 +00:00
|
|
|
$ninjaFlags "${ninjaFlagsArray[@]}"
|
|
|
|
)
|
2017-08-27 17:42:21 +00:00
|
|
|
|
2018-11-16 22:22:11 +00:00
|
|
|
echoCmd 'build flags' "${flagsArray[@]}"
|
|
|
|
ninja "${flagsArray[@]}"
|
2017-08-27 17:42:21 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
}
|
|
|
|
|
2019-10-31 17:59:18 +00:00
|
|
|
if [ -z "${dontUseNinjaBuild-}" -a -z "${buildPhase-}" ]; then
|
2017-08-27 17:42:21 +00:00
|
|
|
buildPhase=ninjaBuildPhase
|
|
|
|
fi
|
|
|
|
|
|
|
|
ninjaInstallPhase() {
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
# shellcheck disable=SC2086
|
2018-11-16 22:22:11 +00:00
|
|
|
local flagsArray=(
|
|
|
|
$ninjaFlags "${ninjaFlagsArray[@]}"
|
|
|
|
${installTargets:-install}
|
|
|
|
)
|
2017-08-27 17:42:21 +00:00
|
|
|
|
|
|
|
echoCmd 'install flags' "${flagsArray[@]}"
|
|
|
|
ninja "${flagsArray[@]}"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
}
|
|
|
|
|
2019-10-31 17:59:18 +00:00
|
|
|
if [ -z "${dontUseNinjaInstall-}" -a -z "${installPhase-}" ]; then
|
2017-08-27 17:42:21 +00:00
|
|
|
installPhase=ninjaInstallPhase
|
|
|
|
fi
|
2018-11-16 22:22:11 +00:00
|
|
|
|
|
|
|
ninjaCheckPhase() {
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
if [ -z "${checkTarget:-}" ]; then
|
2018-11-19 00:07:56 +00:00
|
|
|
if ninja -t query test >/dev/null 2>&1; then
|
2018-11-16 22:22:11 +00:00
|
|
|
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=(
|
2018-11-19 01:29:51 +00:00
|
|
|
-j$buildCores -l$NIX_BUILD_CORES
|
2018-11-16 22:22:11 +00:00
|
|
|
$ninjaFlags "${ninjaFlagsArray[@]}"
|
|
|
|
$checkTarget
|
|
|
|
)
|
|
|
|
|
|
|
|
echoCmd 'check flags' "${flagsArray[@]}"
|
|
|
|
ninja "${flagsArray[@]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
}
|
|
|
|
|
2019-10-31 17:59:18 +00:00
|
|
|
if [ -z "${dontUseNinjaCheck-}" -a -z "${checkPhase-}" ]; then
|
2018-11-16 22:22:11 +00:00
|
|
|
checkPhase=ninjaCheckPhase
|
|
|
|
fi
|