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:
parent
cf7be87348
commit
f0a1ab78b4
|
@ -67,10 +67,6 @@ stdenv.mkDerivation rec {
|
||||||
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:$(echo "${jamomacore}/jamoma/share/cmake/Jamoma")"
|
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:$(echo "${jamomacore}/jamoma/share/cmake/Jamoma")"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preBuild = ''
|
|
||||||
ninja
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
cmake --build . --target install
|
cmake --build . --target install
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -18,7 +18,6 @@ stdenv.mkDerivation rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
cmakeFlags = "-G Ninja";
|
cmakeFlags = "-G Ninja";
|
||||||
buildPhase = "ninja";
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
ninja install
|
ninja install
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
|
||||||
cd src
|
cd src
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
cmakeFlags = [ "-GNinja" ];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
wrapProgram $out/bin/linja --prefix PATH : $out/bin:${ninja}/bin
|
wrapProgram $out/bin/linja --prefix PATH : $out/bin:${ninja}/bin
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ stdenv, fetchFromGitHub, pkgconfig, alsaLib, portaudio, portmidi, libsndfile, cmake, libxml2, ninja }:
|
{ stdenv, fetchFromGitHub, pkgconfig, alsaLib, portaudio, portmidi, libsndfile, cmake, libxml2 }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "1.0-beta.1";
|
version = "1.0-beta.1";
|
||||||
|
@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "1hb9b6qc18rsvzvixgllknn756m6zwcn22c79rdibbyz1bhrcnln";
|
sha256 = "1hb9b6qc18rsvzvixgllknn756m6zwcn22c79rdibbyz1bhrcnln";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ pkgconfig alsaLib portaudio portmidi libsndfile cmake libxml2 ninja ];
|
buildInputs = [ pkgconfig alsaLib portaudio portmidi libsndfile cmake libxml2 ];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "A C++ platform for building dynamic and reflexive systems with an emphasis on audio and media";
|
description = "A C++ platform for building dynamic and reflexive systems with an emphasis on audio and media";
|
||||||
|
|
|
@ -15,18 +15,6 @@ stdenv.mkDerivation rec {
|
||||||
nativeBuildInputs = [ gnome3.vala valadoc gobjectIntrospection meson ninja pkgconfig ];
|
nativeBuildInputs = [ gnome3.vala valadoc gobjectIntrospection meson ninja pkgconfig ];
|
||||||
buildInputs = [ glib gnome3.libgee libxml2 json_glib libsoup libarchive ];
|
buildInputs = [ glib gnome3.libgee libxml2 json_glib libsoup libarchive ];
|
||||||
|
|
||||||
configurePhase = ''
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
meson --prefix "$out" ..
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
ninja
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = "ninja install";
|
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
checkPhase = "./httpseverywhere_test";
|
checkPhase = "./httpseverywhere_test";
|
||||||
|
|
|
@ -100,6 +100,10 @@ qtSubmodule {
|
||||||
xlibs.libXcomposite
|
xlibs.libXcomposite
|
||||||
];
|
];
|
||||||
patches = optional stdenv.needsPax ./qtwebengine-paxmark-mksnapshot.patch;
|
patches = optional stdenv.needsPax ./qtwebengine-paxmark-mksnapshot.patch;
|
||||||
|
|
||||||
|
dontUseNinjaBuild = true;
|
||||||
|
dontUseNinjaInstall = true;
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
cat > $out/libexec/qt.conf <<EOF
|
cat > $out/libexec/qt.conf <<EOF
|
||||||
[Paths]
|
[Paths]
|
||||||
|
|
|
@ -18,6 +18,8 @@ python3Packages.buildPythonApplication rec {
|
||||||
popd
|
popd
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = http://mesonbuild.com;
|
homepage = http://mesonbuild.com;
|
||||||
description = "SCons-like build system that use python as a front-end language and Ninja as a building backend";
|
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/
|
cp doc/manual.html $out/share/doc/ninja/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Small build system with a focus on speed";
|
description = "Small build system with a focus on speed";
|
||||||
longDescription = ''
|
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
|
|
@ -50,6 +50,8 @@ in stdenv.mkDerivation rec {
|
||||||
|
|
||||||
NIX_CFLAGS_COMPILE = "-Wno-error=strict-aliasing";
|
NIX_CFLAGS_COMPILE = "-Wno-error=strict-aliasing";
|
||||||
|
|
||||||
|
cmakeFlags = [ "-GNinja" ];
|
||||||
|
|
||||||
buildInputs = [ cmake zlib libxml2 libpng ninja ]
|
buildInputs = [ cmake zlib libxml2 libpng ninja ]
|
||||||
++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices CoreGraphics ImageIO ];
|
++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices CoreGraphics ImageIO ];
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@ stdenv.mkDerivation rec {
|
||||||
bash ./configure
|
bash ./configure
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
ninja
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
mv illum-d $out/bin
|
mv illum-d $out/bin
|
||||||
|
|
Loading…
Reference in New Issue