2018-11-10 20:30:48 +00:00
|
|
|
wafConfigurePhase() {
|
|
|
|
runHook preConfigure
|
|
|
|
|
2019-03-28 17:30:07 +00:00
|
|
|
if ! [ -f "${wafPath:=./waf}" ]; then
|
|
|
|
echo "copying waf to $wafPath..."
|
|
|
|
cp @waf@ "$wafPath"
|
2018-11-10 20:30:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then
|
|
|
|
configureFlags="${prefixKey:---prefix=}$prefix $configureFlags"
|
|
|
|
fi
|
|
|
|
|
2019-03-28 19:02:08 +00:00
|
|
|
local flagsArray=(@crossFlags@);
|
2019-03-28 17:33:08 +00:00
|
|
|
for flag in $configureFlags "${configureFlagsArray[@]}";
|
|
|
|
do
|
2019-03-28 18:59:16 +00:00
|
|
|
if [[
|
2019-03-28 17:33:08 +00:00
|
|
|
# waf does not support these flags, but they are "blindly" added by the
|
|
|
|
# pkgsStatic overlay, for example.
|
2019-03-28 18:59:16 +00:00
|
|
|
$flag != "--enable-static"
|
2019-03-28 17:33:08 +00:00
|
|
|
&& $flag != "--disable-static"
|
|
|
|
&& $flag != "--enable-shared"
|
2019-03-28 18:59:16 +00:00
|
|
|
&& $flag != "--disable-shared"
|
|
|
|
# these flags are added by configurePlatforms but waf just uses them
|
|
|
|
# to bail out in cross compilation cases
|
|
|
|
&& $flag != --build=*
|
|
|
|
&& $flag != --host=*
|
|
|
|
]];
|
2019-03-28 17:33:08 +00:00
|
|
|
then
|
|
|
|
flagsArray=("${flagsArray[@]}" "$flag");
|
|
|
|
fi;
|
|
|
|
done
|
|
|
|
flagsArray=(
|
|
|
|
"${flagsArray[@]}"
|
2018-11-10 20:30:48 +00:00
|
|
|
${configureTargets:-configure}
|
|
|
|
)
|
|
|
|
echoCmd 'configure flags' "${flagsArray[@]}"
|
2019-03-28 17:30:07 +00:00
|
|
|
python "$wafPath" "${flagsArray[@]}"
|
2018-11-10 20:30:48 +00:00
|
|
|
|
|
|
|
runHook postConfigure
|
|
|
|
}
|
|
|
|
|
|
|
|
wafBuildPhase () {
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
# set to empty if unset
|
|
|
|
: ${wafFlags=}
|
|
|
|
|
|
|
|
local flagsArray=(
|
|
|
|
${enableParallelBuilding:+-j ${NIX_BUILD_CORES}}
|
|
|
|
$wafFlags ${wafFlagsArray[@]}
|
|
|
|
$buildFlags ${buildFlagsArray[@]}
|
|
|
|
${buildTargets:-build}
|
|
|
|
)
|
|
|
|
|
|
|
|
echoCmd 'build flags' "${flagsArray[@]}"
|
2019-03-28 17:30:07 +00:00
|
|
|
python "$wafPath" "${flagsArray[@]}"
|
2018-11-10 20:30:48 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
}
|
|
|
|
|
|
|
|
wafInstallPhase() {
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
if [ -n "$prefix" ]; then
|
|
|
|
mkdir -p "$prefix"
|
|
|
|
fi
|
|
|
|
|
|
|
|
local flagsArray=(
|
|
|
|
$wafFlags ${wafFlagsArray[@]}
|
|
|
|
$installFlags ${installFlagsArray[@]}
|
|
|
|
${installTargets:-install}
|
|
|
|
)
|
|
|
|
|
|
|
|
echoCmd 'install flags' "${flagsArray[@]}"
|
2019-03-28 17:30:07 +00:00
|
|
|
python "$wafPath" "${flagsArray[@]}"
|
2018-11-10 20:30:48 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
}
|
|
|
|
|
|
|
|
configurePhase=wafConfigurePhase
|
|
|
|
buildPhase=wafBuildPhase
|
|
|
|
installPhase=wafInstallPhase
|