From 7c010c25e52098d9252445eaf9b313f327115384 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 10 Oct 2024 16:45:44 +0200 Subject: [PATCH] minetest: add mainProgram and conditional test builds --- pkgs/games/minetest/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/games/minetest/default.nix b/pkgs/games/minetest/default.nix index f4ccf5ac71e9..de566217b1ba 100644 --- a/pkgs/games/minetest/default.nix +++ b/pkgs/games/minetest/default.nix @@ -54,6 +54,7 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ (lib.cmakeBool "BUILD_CLIENT" buildClient) (lib.cmakeBool "BUILD_SERVER" buildServer) + (lib.cmakeBool "BUILD_UNITTESTS" (finalAttrs.doCheck or false)) (lib.cmakeBool "ENABLE_PROMETHEUS" buildServer) (lib.cmakeBool "USE_SDL2" useSDL2) # Ensure we use system libraries @@ -91,7 +92,7 @@ stdenv.mkDerivation (finalAttrs: { gmp libspatialindex ] ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform luajit) luajit - ++ lib.optionals stdenv.hostPlatform.isDarwin [ + ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv OpenGL OpenAL @@ -118,7 +119,8 @@ stdenv.mkDerivation (finalAttrs: { ]; postPatch = '' - substituteInPlace src/filesys.cpp --replace "/bin/rm" "${coreutils}/bin/rm" + substituteInPlace src/filesys.cpp \ + --replace-fail "/bin/rm" "${coreutils}/bin/rm" '' + lib.optionalString stdenv.hostPlatform.isDarwin '' sed -i '/pagezero_size/d;/fixup_bundle/d' src/CMakeLists.txt ''; @@ -130,6 +132,8 @@ stdenv.mkDerivation (finalAttrs: { mv $out/minetest.app $out/Applications ''; + doCheck = true; + passthru.updateScript = gitUpdater { allowedVersions = "\\."; ignoredVersions = "-android$"; @@ -141,5 +145,6 @@ stdenv.mkDerivation (finalAttrs: { license = licenses.lgpl21Plus; platforms = platforms.linux ++ platforms.darwin; maintainers = with maintainers; [ pyrolagus fpletz fgaz ]; + mainProgram = if buildClient then "minetest" else "minetestserver"; }; })