depot/third_party/nixpkgs/pkgs/by-name/me/meson/setup-hook.sh
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

87 lines
2.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# shellcheck shell=bash disable=SC2206
mesonConfigurePhase() {
runHook preConfigure
local flagsArray=()
if [ -z "${dontAddPrefix-}" ]; then
flagsArray+=("--prefix=$prefix")
fi
# See multiple-outputs.sh and mesons coredata.py
flagsArray+=(
"--libdir=${!outputLib}/lib"
"--libexecdir=${!outputLib}/libexec"
"--bindir=${!outputBin}/bin"
"--sbindir=${!outputBin}/sbin"
"--includedir=${!outputInclude}/include"
"--mandir=${!outputMan}/share/man"
"--infodir=${!outputInfo}/share/info"
"--localedir=${!outputLib}/share/locale"
"-Dauto_features=${mesonAutoFeatures:-enabled}"
"-Dwrap_mode=${mesonWrapMode:-nodownload}"
${crossMesonFlags}
"--buildtype=${mesonBuildType:-plain}"
)
flagsArray+=(
$mesonFlags
"${mesonFlagsArray[@]}"
)
echoCmd 'mesonConfigurePhase flags' "${flagsArray[@]}"
meson setup build "${flagsArray[@]}"
cd build || { echoCmd 'mesonConfigurePhase' "could not cd to build"; exit 1; }
if ! [[ -v enableParallelBuilding ]]; then
enableParallelBuilding=1
echoCmd 'mesonConfigurePhase' "enabled parallel building"
fi
if [[ ${checkPhase-ninjaCheckPhase} = ninjaCheckPhase && -z $dontUseMesonCheck ]]; then
checkPhase=mesonCheckPhase
fi
if [[ ${installPhase-ninjaInstallPhase} = ninjaInstallPhase && -z $dontUseMesonInstall ]]; then
installPhase=mesonInstallPhase
fi
runHook postConfigure
}
mesonCheckPhase() {
runHook preCheck
local flagsArray=($mesonCheckFlags "${mesonCheckFlagsArray[@]}")
echoCmd 'mesonCheckPhase flags' "${flagsArray[@]}"
meson test --no-rebuild --print-errorlogs "${flagsArray[@]}"
runHook postCheck
}
mesonInstallPhase() {
runHook preInstall
local flagsArray=()
if [[ -n "$mesonInstallTags" ]]; then
flagsArray+=("--tags" "${mesonInstallTags// /,}")
fi
flagsArray+=(
$mesonInstallFlags
"${mesonInstallFlagsArray[@]}"
)
echoCmd 'mesonInstallPhase flags' "${flagsArray[@]}"
meson install --no-rebuild "${flagsArray[@]}"
runHook postInstall
}
if [ -z "${dontUseMesonConfigure-}" ] && [ -z "${configurePhase-}" ]; then
# shellcheck disable=SC2034
setOutputFlags=
configurePhase=mesonConfigurePhase
fi