meson/ninja: add setup hooks (#28444)
* Add setupHook for meson/ninja build * libhttpseverywhere: Use meson/ninja setupHooks * jamomacore: Remove superfluous ninja buildInput * Remove obsolete ninja buildPhases These are all handled by ninja's setup hook. * lean2, xcbuild: fix build with ninja setup hook Ninja is a runtime dependency here. However, cmake can generate Ninja build files as well to satisfy the setup hook. * qtwebengine: fix build with ninja setup hook
This commit is contained in:
committed by
Robin Gloster
parent
cf7be87348
commit
f0a1ab78b4
@@ -18,6 +18,8 @@ python3Packages.buildPythonApplication rec {
|
||||
popd
|
||||
'';
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = http://mesonbuild.com;
|
||||
description = "SCons-like build system that use python as a front-end language and Ninja as a building backend";
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
mesonConfigurePhase() {
|
||||
runHook preConfigure
|
||||
|
||||
if [ -z "$dontAddPrefix" ]; then
|
||||
mesonFlags="--prefix=$prefix $mesonFlags"
|
||||
fi
|
||||
|
||||
# Build release by default.
|
||||
mesonFlags="--buildtype=${mesonBuildType:-release} $mesonFlags"
|
||||
|
||||
echo "meson flags: $mesonFlags ${mesonFlagsArray[@]}"
|
||||
|
||||
meson build $mesonFlags "${mesonFlagsArray[@]}"
|
||||
cd build
|
||||
|
||||
runHook postConfigure
|
||||
}
|
||||
|
||||
if [ -z "$dontUseMesonConfigure" -a -z "$configurePhase" ]; then
|
||||
setOutputFlags=
|
||||
configurePhase=mesonConfigurePhase
|
||||
fi
|
||||
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
|
||||
cp doc/manual.html $out/share/doc/ninja/
|
||||
'';
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Small build system with a focus on speed";
|
||||
longDescription = ''
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
ninjaBuildPhase() {
|
||||
runHook preBuild
|
||||
|
||||
if [[ -z "$ninjaFlags" && ! ( -e build.ninja ) ]]; then
|
||||
echo "no build.ninja, doing nothing"
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
local flagsArray=( \
|
||||
${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} \
|
||||
$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
|
||||
Reference in New Issue
Block a user