gnu: luanti: Prefix search paths with LUANTI.

* gnu/packages/patches/luanti-paths.patch: New file.
* gnu/packages/luanti.scm (luanti)[source]: Use it.
[#:phases]<check>: Use LUANTI_GAME_PATH.
[native-search-paths]: Rename “MINETEST_GAME_PATH” to “LUANTI_GAME_PATH”.
Rename “MINETEST_MOD_PATH” to “LUANTI_MOD_PATH”.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* guix/build/luanti-build-system.scm (check): Use LUANTI_MOD_PATH.
This commit is contained in:
Liliana Marie Prikler 2025-06-29 15:58:35 +02:00
parent abbdfbb775
commit 9a75c8ac13
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87
4 changed files with 84 additions and 6 deletions

View file

@ -1840,6 +1840,7 @@ dist_patch_DATA = \
%D%/packages/patches/lua-liblua-so.patch \
%D%/packages/patches/lua-5.4-pkgconfig.patch \
%D%/packages/patches/lua-5.4-liblua-so.patch \
%D%/packages/patches/luanti-paths.patch \
%D%/packages/patches/lugaru-fix-sound.patch \
%D%/packages/patches/luit-posix.patch \
%D%/packages/patches/lxc-no-static-bin.patch \

View file

@ -69,6 +69,7 @@
(modules '((guix build utils)
(srfi srfi-26)
(ice-9 ftw)))
(patches (search-patches "luanti-paths.patch"))
;; Delete bundled libraries.
;; - Keep lib/sha256 because there's no good upstream, see:
;; https://github.com/openssl/openssl/blob/master/crypto/sha/sha512.c
@ -109,16 +110,16 @@
;; when invoked on the target outside of `guix build'.
(when tests?
(setenv "HOME" "/tmp")
(setenv "MINETEST_GAME_PATH"
(setenv "LUANTI_GAME_PATH"
(string-append (getcwd) "/../source/games"))
(invoke "../source/bin/luanti" "--run-unittests")
(invoke "../source/util/test_multiplayer.sh")))))))
(native-search-paths
(list (search-path-specification
(variable "MINETEST_GAME_PATH")
(variable "LUANTI_GAME_PATH")
(files '("share/luanti/games")))
(search-path-specification
(variable "MINETEST_MOD_PATH")
(variable "LUANTI_MOD_PATH")
(files '("share/luanti/mods")))))
(native-inputs (list catch2-3 pkg-config))
(inputs (list curl

View file

@ -0,0 +1,76 @@
Index: luanti/src/content/subgames.cpp
===================================================================
--- luanti.orig/src/content/subgames.cpp
+++ luanti/src/content/subgames.cpp
@@ -63,19 +63,21 @@ struct GameFindPath
std::string getSubgamePathEnv()
{
static bool has_warned = false;
- char *subgame_path = getenv("MINETEST_SUBGAME_PATH");
- if (subgame_path && !has_warned) {
- warningstream << "MINETEST_SUBGAME_PATH is deprecated, use MINETEST_GAME_PATH instead."
+
+ if (char *luanti_game_path = getenv ("LUANTI_GAME_PATH"))
+ return std::string(luanti_game_path);
+ else if (char *minetest_game_path = getenv ("MINETEST_GAME_PATH")) {
+ warningstream << "MINETEST_GAME_PATH is deprecated, use LUANTI_GAME_PATH instead."
<< std::endl;
has_warned = true;
+ return std::string(minetest_game_path);
+ }
+ else if (char *minetest_subgame_path = getenv ("MINETEST_SUBGAME_PATH")) {
+ warningstream << "MINETEST_SUBGAME_PATH is deprecated, use LUANTI_GAME_PATH instead."
+ << std::endl;
+ has_warned = true;
+ return std::string(minetest_subgame_path);
}
-
- char *game_path = getenv("MINETEST_GAME_PATH");
-
- if (game_path)
- return std::string(game_path);
- else if (subgame_path)
- return std::string(subgame_path);
return "";
}
@@ -277,8 +279,17 @@ std::string getWorldGameId(const std::st
std::string getWorldPathEnv()
{
- char *world_path = getenv("MINETEST_WORLD_PATH");
- return world_path ? std::string(world_path) : "";
+ static bool has_warned = false;
+ char *world_path = nullptr;
+ if (world_path = getenv("LUANTI_WORLD_PATH"))
+ return std::string(world_path);
+ else if (world_path = getenv("MINETEST_WORLD_PATH")) {
+ warningstream << "MINETEST_WORLD_PATH is deprecated, use LUANTI_WORLD_PATH instead."
+ << std::endl;
+ return std::string(world_path);
+ }
+ else
+ return "";
}
std::vector<WorldSpec> getAvailableWorlds()
@@ -411,8 +422,18 @@ void loadGameConfAndInitWorld(const std:
std::vector<std::string> getEnvModPaths()
{
- const char *c_mod_path = getenv("MINETEST_MOD_PATH");
+ static bool has_warned = false;
std::vector<std::string> paths;
+ if (const char *c_mod_path = getenv("MINETEST_MOD_PATH")) {
+ warningstream << "MINETEST_MOD_PATH is deprecated, use LUANTI_MOD_PATH instead."
+ << std::endl;
+ has_warned = true;
+ Strfnd search_paths(c_mod_path ? c_mod_path : "");
+ while (!search_paths.at_end())
+ paths.push_back(search_paths.next(PATH_DELIM));
+
+ }
+ const char *c_mod_path = getenv("LUANTI_MOD_PATH");
Strfnd search_paths(c_mod_path ? c_mod_path : "");
while (!search_paths.at_end())
paths.push_back(search_paths.next(PATH_DELIM));

View file

@ -158,12 +158,12 @@ error. If NOT-FOUND is TRUE, call NOT-FOUND instead."
(when tests?
(mkdir "guix_testworld")
;; Add the mod to the mod search path, such that Luanti can find it.
(setenv "MINETEST_MOD_PATH"
(setenv "LUANTI_MOD_PATH"
(list->search-path-as-string
(cons
(string-append (assoc-ref outputs "out") "/share/luanti/mods")
(search-path-as-string->list
(or (getenv "MINETEST_MOD_PATH") "")))
(or (getenv "LUANTI_MOD_PATH") "")))
":"))
(with-directory-excursion "guix_testworld"
(setenv "HOME" (getcwd))
@ -181,7 +181,7 @@ auth_backend = sqlite3
(lambda (mod)
(format port "load_mod_~a = true~%" mod))
(all-mod-names (search-path-as-string->list
(getenv "MINETEST_MOD_PATH"))))))
(getenv "LUANTI_MOD_PATH"))))))
(receive (port pid)
((@@ (guix build utils) open-pipe-with-stderr)
"xvfb-run" "--" "luanti" "--info" "--world" "." "--go")