2017-08-27 18:42:21 +01:00
|
|
|
ninjaBuildPhase() {
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
if [[ -z "$ninjaFlags" && ! ( -e build.ninja ) ]]; then
|
|
|
|
echo "no build.ninja, doing nothing"
|
|
|
|
else
|
2017-12-04 15:15:58 +00:00
|
|
|
local buildCores=1
|
|
|
|
|
|
|
|
# Parallel building is enabled by default.
|
|
|
|
if [ "${enableParallelBuilding-1}" ]; then
|
|
|
|
buildCores="$NIX_BUILD_CORES"
|
|
|
|
fi
|
|
|
|
|
2017-08-27 18:42:21 +01:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
local flagsArray=( \
|
2017-12-04 15:15:58 +00:00
|
|
|
-j"$buildCores" -l"$NIX_BUILD_CORES" \
|
2017-08-27 18:42:21 +01:00
|
|
|
$ninjaFlags "${ninjaFlagsArray[@]}" \
|
|
|
|
$buildFlags "${buildFlagsArray[@]}")
|
|
|
|
|
|
|
|
echoCmd 'build flags' "${flagsArray[@]}"
|
|
|
|
ninja "${flagsArray[@]}"
|
|
|
|
unset flagsArray
|
|
|
|
fi
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "$dontUseNinjaBuild" -a -z "$buildPhase" ]; then
|
|
|
|
buildPhase=ninjaBuildPhase
|
|
|
|
fi
|
|
|
|
|
|
|
|
ninjaInstallPhase() {
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
installTargets="${installTargets:-install}"
|
|
|
|
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
local flagsArray=( $installTargets \
|
|
|
|
$ninjaFlags "${ninjaFlagsArray[@]}")
|
|
|
|
|
|
|
|
echoCmd 'install flags' "${flagsArray[@]}"
|
|
|
|
ninja "${flagsArray[@]}"
|
|
|
|
unset flagsArray
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "$dontUseNinjaInstall" -a -z "$installPhase" ]; then
|
|
|
|
installPhase=ninjaInstallPhase
|
|
|
|
fi
|