2023-08-04 22:07:22 +00:00
|
|
|
# shellcheck shell=bash disable=SC2086,SC2154,SC2206
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
addMakeFlags() {
|
|
|
|
export prefix="$out"
|
|
|
|
export MANDIR="${!outputMan}/share/man"
|
|
|
|
export MANTARGET=man
|
|
|
|
export BINOWN=
|
|
|
|
export STRIP_FLAG=
|
|
|
|
}
|
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
bmakeBuildPhase() {
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
local flagsArray=(
|
|
|
|
${enableParallelBuilding:+-j${NIX_BUILD_CORES}}
|
2023-08-04 22:07:22 +00:00
|
|
|
SHELL="$SHELL"
|
2021-04-17 00:35:05 +00:00
|
|
|
)
|
2024-09-19 14:19:46 +00:00
|
|
|
concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray
|
2021-04-17 00:35:05 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}"
|
2021-04-17 00:35:05 +00:00
|
|
|
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
}
|
|
|
|
|
|
|
|
bmakeCheckPhase() {
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
if [ -z "${checkTarget:-}" ]; then
|
|
|
|
#TODO(@oxij): should flagsArray influence make -n?
|
|
|
|
if bmake -n ${makefile:+-f $makefile} check >/dev/null 2>&1; then
|
2023-08-04 22:07:22 +00:00
|
|
|
checkTarget="check"
|
2021-04-17 00:35:05 +00:00
|
|
|
elif bmake -n ${makefile:+-f $makefile} test >/dev/null 2>&1; then
|
2023-08-04 22:07:22 +00:00
|
|
|
checkTarget="test"
|
2021-04-17 00:35:05 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${checkTarget:-}" ]; then
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: no test target found in bmake, doing nothing"
|
2021-04-17 00:35:05 +00:00
|
|
|
else
|
|
|
|
local flagsArray=(
|
|
|
|
${enableParallelChecking:+-j${NIX_BUILD_CORES}}
|
2023-08-04 22:07:22 +00:00
|
|
|
SHELL="$SHELL"
|
2021-04-17 00:35:05 +00:00
|
|
|
)
|
2024-09-19 14:19:46 +00:00
|
|
|
concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget
|
2021-04-17 00:35:05 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}"
|
2021-04-17 00:35:05 +00:00
|
|
|
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
}
|
|
|
|
|
|
|
|
bmakeInstallPhase() {
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
if [ -n "$prefix" ]; then
|
|
|
|
mkdir -p "$prefix"
|
|
|
|
fi
|
|
|
|
|
|
|
|
local flagsArray=(
|
2023-03-27 19:17:25 +00:00
|
|
|
${enableParallelInstalling:+-j${NIX_BUILD_CORES}}
|
2023-08-04 22:07:22 +00:00
|
|
|
SHELL="$SHELL"
|
2021-04-17 00:35:05 +00:00
|
|
|
)
|
2024-09-19 14:19:46 +00:00
|
|
|
concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install
|
2021-04-17 00:35:05 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}"
|
2021-04-17 00:35:05 +00:00
|
|
|
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
}
|
|
|
|
|
|
|
|
bmakeDistPhase() {
|
|
|
|
runHook preDist
|
|
|
|
|
|
|
|
if [ -n "$prefix" ]; then
|
|
|
|
mkdir -p "$prefix"
|
|
|
|
fi
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
local flagsArray=()
|
|
|
|
concatTo flagsArray distFlags distFlagsArray distTarget=dist
|
2021-04-17 00:35:05 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: flagsArray: ${flagsArray[@]}"
|
2021-04-17 00:35:05 +00:00
|
|
|
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
|
|
|
|
|
|
|
|
if [ "${dontCopyDist:-0}" != 1 ]; then
|
|
|
|
mkdir -p "$out/tarballs"
|
|
|
|
|
|
|
|
# Note: don't quote $tarballs, since we explicitly permit
|
|
|
|
# wildcards in there.
|
|
|
|
cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs"
|
|
|
|
fi
|
|
|
|
|
|
|
|
runHook postDist
|
|
|
|
}
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
preConfigureHooks+=(addMakeFlags)
|
|
|
|
|
|
|
|
if [ -z "${dontUseBmakeBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
|
|
|
buildPhase=bmakeBuildPhase
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: set buildPhase to bmakeBuildPhase"
|
2023-08-04 22:07:22 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${dontUseBmakeCheck-}" ] && [ -z "${checkPhase-}" ]; then
|
|
|
|
checkPhase=bmakeCheckPhase
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: set checkPhase to bmakeCheckPhase"
|
2023-08-04 22:07:22 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${dontUseBmakeInstall-}" ] && [ -z "${installPhase-}" ]; then
|
|
|
|
installPhase=bmakeInstallPhase
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: set installPhase to bmakeInstallPhase"
|
2023-08-04 22:07:22 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${dontUseBmakeDist-}" ] && [ -z "${distPhase-}" ]; then
|
2021-04-17 00:35:05 +00:00
|
|
|
distPhase=bmakeDistPhase
|
2024-09-19 14:19:46 +00:00
|
|
|
nixInfoLog "${FUNCNAME[0]}: set distPhase to bmakeDistPhase"
|
2021-04-17 00:35:05 +00:00
|
|
|
fi
|