diff --git a/pkgs/games/minetest/0000-mark-rm-for-substitution.patch b/pkgs/games/minetest/0000-mark-rm-for-substitution.patch new file mode 100644 index 0000000000000..8890dc2544a04 --- /dev/null +++ b/pkgs/games/minetest/0000-mark-rm-for-substitution.patch @@ -0,0 +1,13 @@ +diff --git a/src/filesys.cpp b/src/filesys.cpp +index 8881eb2ca..e02d87a9f 100644 +--- a/src/filesys.cpp ++++ b/src/filesys.cpp +@@ -384,7 +384,7 @@ bool RecursiveDelete(const std::string &path) + if (child_pid == 0) { + // Child + std::array argv = { +- "rm", ++ "@RM_COMMAND@", + "-rf", + path.c_str(), + nullptr diff --git a/pkgs/games/minetest/default.nix b/pkgs/games/minetest/default.nix index ce7fee501eb32..f77eb46ff6136 100644 --- a/pkgs/games/minetest/default.nix +++ b/pkgs/games/minetest/default.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, gitUpdater, + substitute, cmake, coreutils, libpng, @@ -43,15 +44,30 @@ stdenv.mkDerivation (finalAttrs: { pname = "minetest"; - version = "5.9.1"; + version = "5.10.0"; src = fetchFromGitHub { owner = "minetest"; repo = "minetest"; rev = finalAttrs.version; - hash = "sha256-0WTDhFt7GDzN4AK8U17iLkjeSMK+gOWZRq46HBTeO3w="; + hash = "sha256-sumwm8mJghpSriVflMQSHQM4BTmAhfI/Wl/FroLTVts="; }; + patches = [ + (substitute { + src = ./0000-mark-rm-for-substitution.patch; + substitutions = [ + "--subst-var-by" + "RM_COMMAND" + "${coreutils}/bin/rm" + ]; + }) + ]; + + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + sed -i '/pagezero_size/d;/fixup_bundle/d' src/CMakeLists.txt + ''; + cmakeFlags = [ (lib.cmakeBool "BUILD_CLIENT" buildClient) (lib.cmakeBool "BUILD_SERVER" buildServer) @@ -125,15 +141,6 @@ stdenv.mkDerivation (finalAttrs: { prometheus-cpp ]; - postPatch = - '' - 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 - ''; - postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' patchShebangs $out