minetest: add mainProgram and conditional test builds

This commit is contained in:
Peter Hoeg 2024-10-10 16:45:44 +02:00
parent 5633bcff0c
commit 7c010c25e5

View File

@ -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";
};
})