From 4745969cb31fb6155f5a2c4323117cd7effa05f2 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 17 Jan 2025 15:29:07 +0100 Subject: [PATCH] meson.setupHook: build test targets In Meson 1.7, these will no longer be built by default [1], so because we're running meson test with --no-rebuild, we need to build them before running the test. Doing this in checkPhase makes more sense than in buildPhase, because allows buildPhase to work without test-only dependencies, something we've had to work around in the past by adding options to packages to disable building the tests. The meson-test-prereq target has been available since Meson 0.63.0 according to the documentation, so we can do this ahead of actually upgrading to Meson 1.7.0. Link: https://mesonbuild.com/Release-notes-for-1-7-0.html#test-targets-no-longer-built-by-default [1] --- pkgs/by-name/me/meson/setup-hook.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/me/meson/setup-hook.sh b/pkgs/by-name/me/meson/setup-hook.sh index b2061a12058c..1885265eabbf 100644 --- a/pkgs/by-name/me/meson/setup-hook.sh +++ b/pkgs/by-name/me/meson/setup-hook.sh @@ -58,6 +58,14 @@ mesonCheckPhase() { flagsArray+=("--timeout-multiplier=0") fi + # Parallel building is enabled by default. + local buildCores=1 + if [ "${enableParallelBuilding-1}" ]; then + buildCores="$NIX_BUILD_CORES" + fi + + TERM=dumb ninja -j"$buildCores" $ninjaFlags "${ninjaFlagsArray[@]}" meson-test-prereq + echoCmd 'mesonCheckPhase flags' "${flagsArray[@]}" meson test --no-rebuild --print-errorlogs "${flagsArray[@]}"