nixpkgs/pkgs/development/tools/build-managers/scons/setup-hook.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

88 lines
2.0 KiB
Bash
Raw Normal View History

2023-09-05 02:22:33 +00:00
# shellcheck shell=bash disable=SC2206
sconsBuildPhase() {
runHook preBuild
if [ -n "$prefix" ]; then
mkdir -p "$prefix"
fi
if [ -z "${dontAddPrefix:-}" ] && [ -n "$prefix" ]; then
buildFlags="${prefixKey:-prefix=}$prefix $buildFlags"
fi
local flagsArray=(
${enableParallelBuilding:+-j${NIX_BUILD_CORES}}
$sconsFlags ${sconsFlagsArray[@]}
$buildFlags ${buildFlagsArray[@]}
)
2023-09-05 02:22:33 +00:00
echoCmd 'scons build flags' "${flagsArray[@]}"
scons "${flagsArray[@]}"
runHook postBuild
}
sconsInstallPhase() {
runHook preInstall
if [ -n "$prefix" ]; then
mkdir -p "$prefix"
fi
if [ -z "${dontAddPrefix:-}" ] && [ -n "$prefix" ]; then
installFlags="${prefixKey:-prefix=}$prefix $installFlags"
fi
local flagsArray=(
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
$sconsFlags ${sconsFlagsArray[@]}
$installFlags ${installFlagsArray[@]}
${installTargets:-install}
)
2023-09-05 02:22:33 +00:00
echoCmd 'scons install flags' "${flagsArray[@]}"
scons "${flagsArray[@]}"
runHook postInstall
}
sconsCheckPhase() {
runHook preCheck
if [ -z "${checkTarget:-}" ]; then
if scons -n check >/dev/null 2>&1; then
2023-09-05 02:22:33 +00:00
checkTarget="check"
elif scons -n test >/dev/null 2>&1; then
2023-09-05 02:22:33 +00:00
checkTarget="test"
fi
fi
if [ -z "${checkTarget:-}" ]; then
echo "no check/test target found, doing nothing"
else
local flagsArray=(
${enableParallelChecking:+-j${NIX_BUILD_CORES}}
$sconsFlags ${sconsFlagsArray[@]}
${checkFlagsArray[@]}
)
2023-09-05 02:22:33 +00:00
echoCmd 'scons check flags' "${flagsArray[@]}"
scons "${flagsArray[@]}"
fi
runHook postCheck
}
2023-09-05 02:22:33 +00:00
if [ -z "${dontUseSconsBuild-}" ] && [ -z "${buildPhase-}" ]; then
buildPhase=sconsBuildPhase
fi
2023-09-05 02:22:33 +00:00
if [ -z "${dontUseSconsCheck-}" ] && [ -z "${checkPhase-}" ]; then
checkPhase=sconsCheckPhase
fi
2023-09-05 02:22:33 +00:00
if [ -z "${dontUseSconsInstall-}" ] && [ -z "${installPhase-}" ]; then
installPhase=sconsInstallPhase
fi