summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2025-06-29 15:20:47 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2025-07-13 13:54:01 +0200
commitabbdfbb775d31c5ccc4f11abcb3650d123e28cc2 (patch)
tree2a4a13cf121e3fa71368cc3dba9281f349eab266
parent464c3b63401f213a13870146f4e592734972b54b (diff)
gnu: Rename minetest to luanti.
* gnu/packages/luanti.scm: New file. (luanti, luanti-server, luanti-topic, luanti-moreores, luanti-sound-api-core) (luanti-basic-materials, luanti-coloredwood, luanti-ethereal) (luanti-homedecor-modpack, luanti-mesecons, luanti-mineclone, luanti-mobs) (luanti-mobs-animal, luanti-mobs-monster, luanti-pipeworks, luanti-technic) (luanti-throwing, luanti-throwing-arrows, luanti-worldedit) (luanti-unifieddyes, luanti-unified-inventory, luanti-advtrains) (luanti-basic-trains, luanti-oneblock, luanti-wielded-light): New variables. * gnu/packages/minetest.scm: (minetest, minetest-server, minetest-topic, minetest-moreores) (minetest-sound-api-core, minetest-basic-materials, minetest-coloredwood) (minetest-ethereal, minetest-homedecor-modpack, minetest-mesecons) (minetest-mineclone, minetest-mobs, minetest-mobs-animal) (minetest-mobs-monster, minetest-pipeworks, minetest-technic) (minetest-throwing, minetest-throwing-arrows, minetest-worldedit) (minetest-unifieddyes, minetest-unified-inventory, minetest-advtrains) (minetest-basic-trains, minetest-oneblock, minetest-wielded-light): Deprecate in favor of the above. (minetest-game): Move to… * gnu/packages/luanti.scm (minetest-game): … here. * gnu/local.mk (GNU_SYSTEM_MODULES): Register luanti.scm. * guix/build-system/luanti.scm: New file. (luanti-mod-build-system): New public variable. * guix/build-system/minetest.scm (minetest-mod-build-system): Deprecate in favor of luanti-mod-build-system. * guix/build/luanti-build-system.scm: New file, renamed from… * guix/build/minetest-build-system.scm: … this. Deprecate in favor of luanti-build-system. * guix/import/luanti.scm: New file, renamed from guix/import/minetest.scm. (%contentdb-api): Switch to “https://content.luanti.org/api/”. (luanti-package?, latest-luanti-release, luanti->guix-package) (luanti-recursive-import, %luanti-updater): New public variables. * guix/import/minetest.scm (minetest-package?, latest-minetest-release) (minetest->guix-package, minetest-recursive-import, %minetest-updater): Deprecate in favor of the luanti variants above. * guix/scripts/import/luanti.scm: New file, renamed from guix/scripts/import/minetest.scm. (guix-import-luanti): New public variable. * guix/scripts/import/minetest.scm (guix-import-minetest): Deprecate in favor of guix-import-luanti. * tests/minetest.scm: Rename to… * tests/luanti.scm: … this. * Makefile.am (MODULES, SCM_TESTS): Adjust accordingly. * etc/teams.scm (games): Adjust accordingly. * CODEOWNERS: Adjust accordingly.
-rw-r--r--CODEOWNERS4
-rw-r--r--Makefile.am6
-rwxr-xr-xetc/teams.scm4
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/luanti.scm857
-rw-r--r--gnu/packages/minetest.scm807
-rw-r--r--guix/build-system/luanti.scm104
-rw-r--r--guix/build-system/minetest.scm86
-rw-r--r--guix/build/luanti-build-system.scm228
-rw-r--r--guix/build/minetest-build-system.scm214
-rw-r--r--guix/import/luanti.scm520
-rw-r--r--guix/import/minetest.scm519
-rw-r--r--guix/scripts/import.scm3
-rw-r--r--guix/scripts/import/luanti.scm118
-rw-r--r--guix/scripts/import/minetest.scm99
-rw-r--r--tests/luanti.scm (renamed from tests/minetest.scm)106
16 files changed, 1955 insertions, 1721 deletions
diff --git a/CODEOWNERS b/CODEOWNERS
index 6189423d285..b4f5ffe7379 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -143,10 +143,10 @@ gnu/packages/firmware\.scm @guix/embedded
143gnu/packages/emulators\.scm @guix/games 143gnu/packages/emulators\.scm @guix/games
144gnu/packages/games\.scm @guix/games 144gnu/packages/games\.scm @guix/games
145gnu/packages/game-development\.scm @guix/games 145gnu/packages/game-development\.scm @guix/games
146gnu/packages/minetest\.scm @guix/games 146gnu/packages/luanti\.scm @guix/games
147gnu/packages/esolangs\.scm @guix/games 147gnu/packages/esolangs\.scm @guix/games
148gnu/packages/motti\.scm @guix/games 148gnu/packages/motti\.scm @guix/games
149guix/build/minetest-build-system\.scm @guix/games 149guix/build/luanti-build-system\.scm @guix/games
150 150
151etc/teams/gnome @guix/gnome 151etc/teams/gnome @guix/gnome
152gnu/packages/glib\.scm @guix/gnome 152gnu/packages/glib\.scm @guix/gnome
diff --git a/Makefile.am b/Makefile.am
index 7305e76a6cd..c16ec7eec14 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -172,6 +172,7 @@ MODULES = \
172 guix/build-system/haskell.scm \ 172 guix/build-system/haskell.scm \
173 guix/build-system/julia.scm \ 173 guix/build-system/julia.scm \
174 guix/build-system/linux-module.scm \ 174 guix/build-system/linux-module.scm \
175 guix/build-system/luanti.scm \
175 guix/build-system/maven.scm \ 176 guix/build-system/maven.scm \
176 guix/build-system/meson.scm \ 177 guix/build-system/meson.scm \
177 guix/build-system/minetest.scm \ 178 guix/build-system/minetest.scm \
@@ -238,6 +239,7 @@ MODULES = \
238 guix/build/gnu-build-system.scm \ 239 guix/build/gnu-build-system.scm \
239 guix/build/gnu-dist.scm \ 240 guix/build/gnu-dist.scm \
240 guix/build/guile-build-system.scm \ 241 guix/build/guile-build-system.scm \
242 guix/build/luanti-build-system.scm \
241 guix/build/maven-build-system.scm \ 243 guix/build/maven-build-system.scm \
242 guix/build/minetest-build-system.scm \ 244 guix/build/minetest-build-system.scm \
243 guix/build/mix-build-system.scm \ 245 guix/build/mix-build-system.scm \
@@ -310,6 +312,7 @@ MODULES = \
310 guix/import/json.scm \ 312 guix/import/json.scm \
311 guix/import/kde.scm \ 313 guix/import/kde.scm \
312 guix/import/launchpad.scm \ 314 guix/import/launchpad.scm \
315 guix/import/luanti.scm \
313 guix/import/minetest.scm \ 316 guix/import/minetest.scm \
314 guix/import/nuget.scm \ 317 guix/import/nuget.scm \
315 guix/import/npm-binary.scm \ 318 guix/import/npm-binary.scm \
@@ -366,6 +369,7 @@ MODULES = \
366 guix/scripts/import/hackage.scm \ 369 guix/scripts/import/hackage.scm \
367 guix/scripts/import/hexpm.scm \ 370 guix/scripts/import/hexpm.scm \
368 guix/scripts/import/json.scm \ 371 guix/scripts/import/json.scm \
372 guix/scripts/import/luanti.scm \
369 guix/scripts/import/minetest.scm \ 373 guix/scripts/import/minetest.scm \
370 guix/scripts/import/npm-binary.scm \ 374 guix/scripts/import/npm-binary.scm \
371 guix/scripts/import/opam.scm \ 375 guix/scripts/import/opam.scm \
@@ -579,9 +583,9 @@ SCM_TESTS = \
579 tests/inferior.scm \ 583 tests/inferior.scm \
580 tests/ipfs.scm \ 584 tests/ipfs.scm \
581 tests/lint.scm \ 585 tests/lint.scm \
586 tests/luanti.scm \
582 tests/machine/hetzner.scm \ 587 tests/machine/hetzner.scm \
583 tests/machine/hetzner/http.scm \ 588 tests/machine/hetzner/http.scm \
584 tests/minetest.scm \
585 tests/modules.scm \ 589 tests/modules.scm \
586 tests/monads.scm \ 590 tests/monads.scm \
587 tests/nar.scm \ 591 tests/nar.scm \
diff --git a/etc/teams.scm b/etc/teams.scm
index 80eaa94847f..28f2504048b 100755
--- a/etc/teams.scm
+++ b/etc/teams.scm
@@ -621,10 +621,10 @@ ecosystem."
621 #:scope (list "gnu/packages/emulators.scm" 621 #:scope (list "gnu/packages/emulators.scm"
622 "gnu/packages/games.scm" 622 "gnu/packages/games.scm"
623 "gnu/packages/game-development.scm" 623 "gnu/packages/game-development.scm"
624 "gnu/packages/minetest.scm" 624 "gnu/packages/luanti.scm"
625 "gnu/packages/esolangs.scm" ; granted, rather niche 625 "gnu/packages/esolangs.scm" ; granted, rather niche
626 "gnu/packages/motti.scm" 626 "gnu/packages/motti.scm"
627 "guix/build/minetest-build-system.scm"))) 627 "guix/build/luanti-build-system.scm")))
628 628
629(define-team gnome 629(define-team gnome
630 (team 'gnome 630 (team 'gnome
diff --git a/gnu/local.mk b/gnu/local.mk
index b97021d8cea..3694772946f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -470,6 +470,7 @@ GNU_SYSTEM_MODULES = \
470 %D%/packages/loko.scm \ 470 %D%/packages/loko.scm \
471 %D%/packages/lsof.scm \ 471 %D%/packages/lsof.scm \
472 %D%/packages/lua.scm \ 472 %D%/packages/lua.scm \
473 %D%/packages/luanti.scm \
473 %D%/packages/lxde.scm \ 474 %D%/packages/lxde.scm \
474 %D%/packages/lxqt.scm \ 475 %D%/packages/lxqt.scm \
475 %D%/packages/m4.scm \ 476 %D%/packages/m4.scm \
diff --git a/gnu/packages/luanti.scm b/gnu/packages/luanti.scm
new file mode 100644
index 00000000000..0294f862a6f
--- /dev/null
+++ b/gnu/packages/luanti.scm
@@ -0,0 +1,857 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2015, 2016 David Thompson <dthompson2@worcester.edu>
3;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
4;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
5;;; Copyright © 2015, 2019 Mark H Weaver <mhw@netris.org>
6;;; Copyright © 2016, 2017, 2018, 2019 Kei Kebreau <kkebreau@posteo.net>
7;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
8;;; Copyright © 2019–2021 Tobias Geerinckx-Rice <me@tobias.gr>
9;;; Copyright © 2021 Trevor Hass <thass@okstate.edu>
10;;; Copyright © 2020, 2021, 2022, 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
11;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
12;;; Copyright © 2024 Jan Wielkiewicz <tona_kosmicznego_smiecia@interia.pl>
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27(define-module (gnu packages luanti)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages audio)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages check)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages curl)
34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages gl)
37 #:use-module (gnu packages image)
38 #:use-module (gnu packages lua)
39 #:use-module (gnu packages multiprecision)
40 #:use-module (gnu packages ncurses)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages sdl)
43 #:use-module (gnu packages serialization)
44 #:use-module (gnu packages sqlite)
45 #:use-module (gnu packages xiph)
46 #:use-module (gnu packages xorg)
47 #:use-module (guix packages)
48 #:use-module (guix gexp)
49 #:use-module (guix git-download)
50 #:use-module (guix utils)
51 #:use-module (guix build-system cmake)
52 #:use-module (guix build-system copy)
53 #:use-module (guix build-system luanti)
54 #:use-module ((guix licenses) #:prefix license:))
55
56(define-public luanti
57 (package
58 (name "luanti")
59 (version "5.12.0")
60 (source
61 (origin
62 (method git-fetch)
63 (uri (git-reference
64 (url "https://github.com/luanti-org/luanti")
65 (commit version)))
66 (file-name (git-file-name name version))
67 (sha256
68 (base32 "1l8kwy23p3gpk12nnhhq1lp4v0zj6kiygnmia043pdinmgzzd0xy"))
69 (modules '((guix build utils)
70 (srfi srfi-26)
71 (ice-9 ftw)))
72 ;; Delete bundled libraries.
73 ;; - Keep lib/sha256 because there's no good upstream, see:
74 ;; https://github.com/openssl/openssl/blob/master/crypto/sha/sha512.c
75 ;; "SHA512 low level APIs are deprecated for public use,
76 ;; but still ok for internal use." Also asked MT devs on IRC for this.
77 ;; - tiniergltf is intended for Luanti and diverged from upstream.
78 (snippet
79 '(let ((keep '("." ".." "sha256" "tiniergltf")))
80 (with-directory-excursion "lib"
81 (for-each delete-file-recursively
82 (scandir "." (negate (cut member <> keep)))))
83 ;; IrrlichtMT includes
84 (delete-file-recursively "irr/include/KHR")
85 (delete-file-recursively "irr/src/vendor")
86 (substitute* "irr/src/COpenGLCommon.h"
87 (("\"vendor/gl.h\"") "<GL/gl.h>"))
88 ;; Catch2
89 (substitute* "CMakeLists.txt"
90 (("add_subdirectory\\(lib/catch2\\)") "find_package(Catch2 3 REQUIRED)"))
91 (substitute* "src/catch.h"
92 (("catch_amalgamated.hpp") "catch2/catch_all.hpp"))
93 (substitute* "src/unittest/test_irr_rotation.cpp"
94 (("catch_amalgamated.hpp") "catch2/catch_all.hpp"))
95 (substitute* "src/unittest/test_irr_matrix4.cpp"
96 (("catch_amalgamated.hpp") "catch2/catch_all.hpp"))))))
97 (build-system cmake-build-system)
98 (arguments
99 (list
100 #:configure-flags
101 #~(list "-DENABLE_LTO=ON"
102 "-DENABLE_UPDATE_CHECKER=FALSE")
103 #:phases
104 #~(modify-phases %standard-phases
105 (delete 'check)
106 (add-after 'install 'check
107 (lambda* (#:key tests? #:allow-other-keys)
108 ;; Thanks to our substitutions, the tests should also run
109 ;; when invoked on the target outside of `guix build'.
110 (when tests?
111 (setenv "HOME" "/tmp")
112 (setenv "MINETEST_GAME_PATH"
113 (string-append (getcwd) "/../source/games"))
114 (invoke "../source/bin/luanti" "--run-unittests")
115 (invoke "../source/util/test_multiplayer.sh")))))))
116 (native-search-paths
117 (list (search-path-specification
118 (variable "MINETEST_GAME_PATH")
119 (files '("share/luanti/games")))
120 (search-path-specification
121 (variable "MINETEST_MOD_PATH")
122 (files '("share/luanti/mods")))))
123 (native-inputs (list catch2-3 pkg-config))
124 (inputs (list curl
125 freetype
126 gettext-minimal
127 gmp
128 jsoncpp
129 libjpeg-turbo
130 libpng
131 libogg
132 libvorbis
133 libxi
134 luajit
135 mesa
136 ncurses
137 openal
138 sdl2
139 sqlite
140 `(,zstd "lib")))
141 (outputs '("out" "debug"))
142 (synopsis "Voxel game engine")
143 (description
144 "Luanti is a voxel game engine that supports modding and game creation
145using its Lua modding API. It allows playing a wide range of voxel-based
146games, installing mods and texture packs. This package only provides the base
147platform, users need to install games themselves (for example,
148@code{luanti-game}), either through Guix, the built-in interface or other
149sources.")
150 (home-page "https://www.luanti.org/")
151 (license license:lgpl2.1+)))
152
153(define-public luanti-server
154 (package
155 (inherit luanti)
156 (name "luanti-server")
157 (arguments
158 (substitute-keyword-arguments (package-arguments luanti)
159 ((#:configure-flags configure-flags)
160 #~(cons* "-DBUILD_CLIENT=FALSE"
161 "-DBUILD_SERVER=TRUE"
162 #$configure-flags))
163 ((#:phases phases)
164 #~(modify-phases #$phases
165 (replace 'check
166 (lambda* (#:key tests? #:allow-other-keys)
167 (when tests?
168 (setenv "HOME" "/tmp")
169 (setenv "LUANTI_GAME_PATH"
170 (string-append (getcwd) "/../source/games"))
171 (invoke "../source/bin/luantiserver" "--run-unittests"))))))))
172 (inputs
173 (modify-inputs (package-inputs luanti)
174 (delete "libjpeg-turbo"
175 "libpng"
176 "libogg"
177 "libvorbis"
178 "libxxf86vm"
179 "mesa"
180 "openal")))
181 (synopsis "Infinite-world block sandbox game (server)")
182 (description
183 "Server for Luanti game engine and gaming platform. Allows hosting
184Luanti games with multiplayer support. This package provides
185@command{luantiserver} to run a Luanti server.")))
186
187(define-public minetest-game
188 (let ((commit "0351c6691595c6eb88a1bea2383f6fae46a686ce")
189 (revision "1"))
190 (package
191 (name "luanti-game")
192 (version (git-version "0.0.0" revision commit))
193 (source
194 (origin
195 (method git-fetch)
196 (uri (git-reference
197 (url "https://github.com/luanti-org/minetest_game")
198 (commit commit)))
199 (file-name (git-file-name name version))
200 (sha256
201 (base32 "13l33ghnm1g3ka0ivxljzdga50x0iv0fzyd7pqm15ickfbkwbm0v"))))
202 (build-system copy-build-system)
203 (arguments
204 (list
205 #:install-plan #~'(("." "/share/luanti/games/minetest_game"))))
206 (synopsis "Ex-official game for Luanti game engine")
207 (description
208 "This package provides the Minetest Game - a game for the
209Luanti game engine which used to be the official game for Luanti
210(formerly Minetest). It is currently in maintenance mode and gets no
211new features.")
212 (home-page "https://www.luanti.org/")
213 (license license:lgpl2.1+))))
214
215;; This package is deprecated. "Minetest Game" is no longer the official game.
216(define-public minetest-data
217 (deprecated-package "minetest-data" minetest-game))
218
219(define-public (luanti-topic topic-id)
220 "Return an URL (as a string) pointing to the forum topic with
221numeric identifier TOPIC-ID on the official Luanti forums."
222 (string-append "https://forum.luanti.net/viewtopic.php?t="
223 (number->string topic-id)))
224
225(define-public luanti-moreores
226 (package
227 (name "luanti-moreores")
228 (version "2.1.0")
229 (source
230 (origin
231 (method git-fetch)
232 (uri (git-reference
233 (url "https://github.com/minetest-mods/moreores")
234 (commit (string-append "v" version))))
235 (sha256 (base32 "1chfqbc6bb27aacjc67j5l5wcdvmcsvk2rfmangipd7nwini3y34"))
236 (file-name (git-file-name name version))))
237 (build-system luanti-mod-build-system)
238 (home-page (luanti-topic 549))
239 (synopsis "Additional ore types, tools, swords, and rails for Luanti")
240 (description
241 "This Luanti mod adds new ore types to the game (mithril, silver) as well
242as swords and tools made of different materials. It also adds copper rails.")
243 (license license:zlib)
244 (properties `((upstream-name . "Calinou/moreores")))))
245
246(define-public luanti-sound-api-core
247 (package
248 (name "luanti-sound-api-core")
249 ;; No tags, no releases. The author intended to let users use it as a
250 ;; submodules for other projects.
251 ;; https://github.com/mt-mods/basic_materials/issues/4
252 (version "2022-02-27")
253 (source
254 (origin
255 (method git-fetch)
256 (uri (git-reference
257 (url "https://github.com/mt-mods/sound_api_core")
258 (commit "6956e49e775f325116f8e0c643899c089c691e1e")))
259 (sha256
260 (base32 "1ys6g2skhkksa4cx9agxhsibj5js8z4y2q1ngis9ddr38p756pcy"))
261 (file-name (git-file-name name version))
262 (snippet
263 '(begin
264 (call-with-output-file "mod.conf"
265 (lambda (port)
266 (format port "\
267name = sound_api_core")))))))
268 (build-system luanti-mod-build-system)
269 (propagated-inputs '())
270 (home-page "https://github.com/mt-mods/sound_api_core")
271 (synopsis "Core for game agnostic sounds")
272 (description
273 "This library can be used to get some specific sounds, whatever the game.")
274 (license license:expat)))
275
276(define-public luanti-basic-materials
277 (package
278 (name "luanti-basic-materials")
279 ;; Upstream uses dates as version numbers.
280 (version "2022-03-28")
281 (source
282 (origin
283 (method git-fetch)
284 (uri (git-reference
285 (url "https://github.com/mt-mods/basic_materials")
286 (commit "9d55f9916d20779ecbf93c7e95dae8adebd2079b")))
287 (sha256
288 (base32 "0nzx5mdw26mk2by14hxyvbqckgz8k67vlh2ch30skssvh4984bjw"))
289 (file-name (git-file-name name version))
290 (snippet
291 '(begin
292 (use-modules (guix build utils))
293 (substitute* "mod.conf"
294 (("optional_depends =")
295 "depends = sound_api_core
296optional_depends ="))
297 (substitute* "nodes.lua"
298 (("basic_materials.modpath \\.\\. \"/sound_api_core/init.lua\"")
299 "minetest.get_modpath(\"sound_api_core\") .. \"/init.lua\""))))))
300 (build-system luanti-mod-build-system)
301 (propagated-inputs
302 ;; basic_materials:silver_wire cannot be crafted without
303 ;; moreores:silver_ingot.
304 (list luanti-moreores luanti-sound-api-core))
305 (home-page (luanti-topic 21000))
306 (synopsis "Some \"basic\" materials and items for other Luanti mods to use")
307 (description
308 "The Luanti mod \"basic_materials\" provides a small selection of
309\"basic\" materials and items that other mods should use when possible -- things
310like steel bars and chains, wire, plastic strips and sheets, and more.")
311 (license
312 (list license:cc-by-sa4.0 license:lgpl3))
313 (properties `((upstream-name . "VanessaE/basic_materials")))))
314
315(define-public luanti-coloredwood
316 (package
317 (name "luanti-coloredwood")
318 ;; Upstream uses dates as version numbers.
319 (version "2021-04-14-1")
320 (source
321 (origin
322 (method git-fetch)
323 (uri (git-reference
324 (url "https://gitlab.com/VanessaE/coloredwood")
325 (commit "be4df6fc889419155bed8638bbb752493e78cbd5")))
326 (sha256
327 (base32 "1swirfk6b4xfbiwv8adyw5yl2lyfpp8ymfipzq9ivyvmif8nl3ki"))
328 (file-name (git-file-name name version))))
329 (build-system luanti-mod-build-system)
330 (propagated-inputs
331 (list luanti-unifieddyes))
332 (home-page (luanti-topic 2411))
333 (synopsis "Painted wood in Luanti")
334 (description
335 "This Luanti mod provides hundreds of colours of wood and fences to
336Luanti, using Unified Dyes. If the \"moreblocks\" mod is active,
337coloured and cut wood shapes are provided as well.")
338 (license
339 ;; LGPL for code, CC-BY-SA for textures
340 (list license:cc-by-sa4.0 license:lgpl3))
341 (properties `((upstream-name . "VanessaE/coloredwood")))))
342
343(define-public luanti-ethereal
344 ;; ContentDB release 2021-07-28 is slightly ahead of the
345 ;; initial version 1.29 -- i.e., some released changes have been
346 ;; made to version 1.29 without a corresponding version bump.
347 (let ((commit "7670c1da9274901f57f6682384af2b3bae005a86")
348 (revision "0"))
349 (package
350 (name "luanti-ethereal")
351 (version (git-version "1.29" revision commit))
352 (source
353 (origin
354 (method git-fetch)
355 (uri (git-reference
356 (url "https://notabug.org/TenPlus1/ethereal")
357 (commit commit)))
358 (sha256
359 (base32 "1hal8bq4fydsip7s8rqz4vlaaqy9rhzxmryd0j2qnqm9286yjgkk"))
360 (file-name (git-file-name name version))))
361 (build-system luanti-mod-build-system)
362 (home-page (luanti-topic 14638))
363 (synopsis "The Ethereal mod adds many new biomes to Luanti")
364 (description
365 "The Ethereal Luanti mod uses the v7 map generator to add many new
366biomes to the world. It adds new trees, plants, food items, tweaks and some
367special items, intending to make an interesting adventure.")
368 ;; CC0: some textures
369 (license (list license:cc0 license:expat))
370 (properties `((upstream-name . "TenPlus1/ethereal"))))))
371
372(define-public luanti-homedecor-modpack
373 (package
374 (name "luanti-homedecor-modpack")
375 ;; Upstream doesn't tag releases, so use the release title from
376 ;; ContentDB as version.
377 (version "2022-05-18")
378 (source
379 (origin
380 (method git-fetch)
381 (uri (git-reference
382 (url "https://github.com/mt-mods/homedecor_modpack")
383 (commit "5ffdc26673169e05492141709fbb18e8fb6e5937")))
384 (sha256
385 (base32 "03pf254r3hnznklw7lf3q4rzqg0a1y4c9rjjhzssf1q7ai5pdrkn"))
386 (file-name (git-file-name name version))))
387 (build-system luanti-mod-build-system)
388 (propagated-inputs
389 (list luanti-basic-materials luanti-unifieddyes))
390 (home-page (luanti-topic 2041))
391 (synopsis "Home decor mod for Luanti")
392 (description
393 ;; TRANSLATORS: ‘homedecor’ is the name is the name of a Luanti mod
394 ;; and should not be translated.
395 "The homedecor Luanti mod provides a large seleection of items that
396might be found inside and around homes, such as sofas, chairs, tables, fences
397and a variety of other stuff.")
398 (license
399 (list license:cc-by-sa4.0 license:lgpl3))
400 (properties `((upstream-name . "VanessaE/homedecor_modpack")))))
401
402(define-public luanti-mesecons
403 ;; The release on ContentDB does not have its own version number.
404 (let ((commit "27c3c515b49af91c1dbc427f31a820722854eb24")
405 (revision "63"))
406 (package
407 (name "luanti-mesecons")
408 (version (git-version "1.2.1" revision commit))
409 (source
410 (origin
411 (method git-fetch)
412 (uri (git-reference
413 (url "https://github.com/minetest-mods/mesecons")
414 (commit commit)))
415 (sha256
416 (base32 "1l0kwjj8ns8hv6z520g6ph5swknar336dbi5qr3dfsy18ydk1j92"))
417 (file-name (git-file-name name version))))
418 (build-system luanti-mod-build-system)
419 (home-page "https://mesecons.net")
420 (synopsis
421 "Digital circuitry for Luanti, including wires, buttons and lights")
422 (description
423 "Mesecons is a mod for Luanti implementing various items related
424to digital circuitry, such as wires, buttons, lights and programmable
425controllers. Among other things, there are also pistons, solar panels,
426pressure plates and note blocks.
427
428Mesecons has a similar goal to Redstone in Minecraft, but works in its own way,
429with different rules and mechanics.")
430 ;; LGPL for code, CC-BY-SA for textures.
431 (license (list license:lgpl3 license:cc-by-sa3.0))
432 (properties `((upstream-name . "Jeija/mesecons"))))))
433
434(define-public luanti-mineclone
435 (package
436 (name "luanti-mineclone")
437 (version "0.80.1")
438 (source (origin
439 (method git-fetch)
440 (uri (git-reference
441 (url "https://git.minetest.land/MineClone2/MineClone2")
442 (commit version)))
443 (file-name (git-file-name name version))
444 (sha256
445 (base32
446 "0ndgzasjmj8397bb3y2aqalx9v72llwgvp9pv05mms3chpji2675"))))
447 (build-system copy-build-system)
448 (arguments
449 `(#:install-plan
450 '(("." "share/luanti/games/mineclone"))))
451 (synopsis "Minecraft clone based on Luanti engine")
452 (description
453 "MineClone is a Luanti subgame, that aims to recreate Minecraft as
454closely as the engine allows.")
455 (home-page "https://content.luanti.net/packages/Wuzzy/mineclone2/")
456 (license license:gpl3+)))
457
458(define-public luanti-mobs
459 (package
460 (name "luanti-mobs")
461 ;; Upstream does not tag release, so use the ContentDB release
462 ;; title instead.
463 (version "2021-12-12")
464 (source
465 (origin
466 (method git-fetch)
467 (uri (git-reference
468 (url "https://notabug.org/TenPlus1/mobs_redo")
469 (commit "6a4a02f3fbf1038c69e72aaafa52a1e7d6106da8")))
470 (sha256
471 (base32 "0vgv7jpm9v3dwq4l9jxdd5z14yq164w8kin1d05jfv3ck4hwlwvr"))
472 (file-name (git-file-name name version))))
473 (build-system luanti-mod-build-system)
474 (home-page (luanti-topic 9917))
475 (synopsis "Mob library for Luanti mods, for animals, monsters etc.")
476 (description
477 "This Luanti mod provides an API for adding mods (moving entities
478like animals and monsters), but does not include any mobs itself. To actually
479add some mobs, a mod like e.g. @code{mobs_animal} provided by the
480@code{luanti-mobs-animal} package needs to be enabled.")
481 ;; CC0: mob_swing.ogg
482 ;; CC-BY 3.0: mob_spell.ogg
483 ;; Expat: everything else
484 (license (list license:expat license:cc0 license:cc-by3.0))
485 (properties `((upstream-name . "TenPlus1/mobs")))))
486
487(define-public luanti-mobs-animal
488 (package
489 (name "luanti-mobs-animal")
490 ;; Upstream does not use version numbers, so use the release title
491 ;; from ContentDB instead;
492 (version "2021-11-14")
493 (source
494 (origin
495 (method git-fetch)
496 (uri (git-reference
497 (url "https://notabug.org/TenPlus1/mobs_animal")
498 (commit "3e15456bce7779aa0dc09a8890f7b5180c1ac771")))
499 (sha256
500 (base32 "08686mj3jh8fsziqp878jpaj5267s4n6i86dr1gnxyxbsrjraqpn"))
501 (file-name (git-file-name name version))))
502 (build-system luanti-mod-build-system)
503 (propagated-inputs
504 (list luanti-mobs))
505 (home-page "https://notabug.org/TenPlus1/mobs_animal")
506 (synopsis "Add animals to Luanti")
507 (description
508 "This Luanti mod adds various animals to Luanti, such as bees,
509bunnies, chickens, cows, kittens, rats, sheep, warthogs, penguins and pandas.")
510 ;; CC0: some textures and sounds
511 (license (list license:cc0 license:expat))
512 (properties `((upstream-name . "TenPlus1/mobs_animal")))))
513
514(define-public luanti-mobs-monster
515 (package
516 (name "luanti-mobs-monster")
517 ;; Upstream does not use version numbers, so use the release title
518 ;; from ContentDB instead;
519 (version "2022-12-10")
520 (source
521 (origin
522 (method git-fetch)
523 (uri (git-reference
524 (url "https://notabug.org/TenPlus1/mobs_monster")
525 (commit "1b197f9ae136179a764ef45824464b667ade52e6")))
526 (sha256
527 (base32 "15g8acrzvsiccxchfmgjhyf2lmkbrpdjqv3v7hmqz7xqypi8wm3h"))
528 (file-name (git-file-name name version))))
529 (build-system luanti-mod-build-system)
530 (propagated-inputs (list luanti-mobs))
531 (home-page "https://notabug.org/TenPlus1/mobs_monster")
532 (synopsis "Add monsters with Mobs Redo on luanti")
533 (description
534 "This Luanti mod adds many types of monsters to Luanti, that live on the
535surface or deep underground.")
536 (license license:expat)
537 (properties `((upstream-name . "TenPlus1/mobs_monster")))))
538
539(define-public luanti-pipeworks
540 (package
541 (name "luanti-pipeworks")
542 ;; Upstream uses dates as version numbers.
543 (version "2021-04-14-1")
544 (source
545 (origin
546 (method git-fetch)
547 (uri (git-reference
548 (url "https://gitlab.com/VanessaE/pipeworks")
549 (commit "db6d1bd9c109e1e543b97cc3fa8a11400da23bcd")))
550 (sha256
551 (base32 "1flhcnf17dn1v86kcg47a1n4cb0lybd11ncxrkxn3wmf10ibsrm0"))
552 (file-name (git-file-name name version))))
553 (build-system luanti-mod-build-system)
554 (propagated-inputs
555 (list luanti-basic-materials))
556 (home-page (luanti-topic 2155))
557 (synopsis "Pipes, item-transport tubes and related devices for Luanti")
558 (description
559 "Pipeworks is a mod for Luanti implementing 3D pipes and tubes for
560transporting liquids and items and some related devices. Pipes and tubes can
561go horizontally or vertically. Item tubes can also be used for sorting items
562and extracting items from chests or putting items in chests. Autocrafters can
563automatically follow craft recipes to make new items and can be fed by item
564tubes. Deployers can place items in the world as a player would. Node
565breakers simulate a player punching a node.")
566 ;; CC-BY-SA for textures, LGPL for code
567 (license (list license:cc-by-sa4.0 license:lgpl3))
568 (properties `((upstream-name . "VanessaE/pipeworks")))))
569
570(define-public luanti-technic
571 (package
572 (name "luanti-technic")
573 ;; Upstream doesn't keep version numbers, so use the release
574 ;; date on ContentDB instead.
575 (version "2022-10-30")
576 (source
577 (origin
578 (method git-fetch)
579 (uri (git-reference
580 (url "https://github.com/minetest-mods/technic")
581 (commit "6a9dfec36f7265f9328fe378732417d9b57060b4")))
582 (sha256
583 (base32 "0ng1aklm02n2lbar345yf88g3alzvnh0m0s5rb2bcw2k5lib8468"))
584 (file-name (git-file-name name version))))
585 (build-system luanti-mod-build-system)
586 (propagated-inputs
587 (list luanti-pipeworks luanti-basic-materials))
588 (home-page (luanti-topic 2538))
589 (synopsis "Machinery and automation for Luanti")
590 (description
591 "This Luanti mod adds machinery and automation to Luanti.
592It adds various ores that can be processed for constructing various
593machinery, such as power generators, force field emitters, quarries
594and a workshop for repairing tools. Most machines are electrically
595powered.")
596 ;; CC BY-SA 3.0: some texture
597 ;; WTFPL: some textures
598 ;; CC BY-SA3.0: some textures
599 ;; CC BY-SA4.0: some sounds
600 (license (list license:lgpl2.1+ license:cc-by-sa3.0 license:cc-by-sa4.0
601 license:wtfpl2))
602 (properties `((upstream-name . "RealBadAngel/technic")))))
603
604(define-public luanti-throwing
605 ;; The latest release on ContentDB is ahead of the latet
606 ;; tagged commit.
607 (let ((commit "31f0cf5f868673dc82f24ddc432b45c9cd282d27")
608 (revision "0"))
609 (package
610 (name "luanti-throwing")
611 (version (git-version "1.1" revision commit))
612 (source
613 (origin
614 (method git-fetch)
615 (uri (git-reference
616 (url "https://github.com/minetest-mods/throwing")
617 (commit commit)))
618 (sha256
619 (base32 "1s5kkr6rxxv2dhbbjzv62gw1s617hnpjavw1v9fv11v3mgigdfjb"))
620 (file-name (git-file-name name version))))
621 (build-system luanti-mod-build-system)
622 (home-page (luanti-topic 16365))
623 (synopsis "API for throwing things in Luanti")
624 (description
625 "This Luanti mod provides an API for registering throwable things and
626throwing things like arrows. However, this mod does not provide an actual
627arrow and bow, but @code{luanti-throwing-arrows} does.")
628 (license license:mpl2.0)
629 (properties `((upstream-name . "Palige/throwing"))))))
630
631(define-public luanti-throwing-arrows
632 ;; There is only one tagged commit (version 1.1),
633 ;; there are no releases on ContentDB and the latest
634 ;; commit has a compatibility fix for Luanti 5.4.0-dev.
635 (let ((commit "059cc897af0aebfbd2c54ac5588f2b842f44f159")
636 (revision "0"))
637 (package
638 (name "luanti-throwing-arrows")
639 (version (git-version "1.1" revision commit))
640 (source
641 (origin
642 (method git-fetch)
643 (uri (git-reference
644 (url "https://github.com/minetest-mods/throwing_arrows")
645 (commit commit)))
646 (sha256
647 (base32 "0m2pmccpfxn878zd00pmrpga2h6gknz4f3qprck0fq94mksmwqs3"))
648 (file-name (git-file-name name version))))
649 (build-system luanti-mod-build-system)
650 (propagated-inputs
651 (list luanti-throwing))
652 (home-page (luanti-topic 16365))
653 (synopsis "Arrows and bows for Luanti")
654 (description
655 ;; TRANSLATORS: "throwing" is the name of a Luanti mod and should
656 ;; not be translated.
657 "This mod adds arrows and bows to Luanti. It is a compatible
658replacement for the throwing mod by PilzAdam that uses the throwing API.")
659 (license license:mpl2.0))))
660
661(define-public luanti-worldedit
662 (package
663 (name "luanti-worldedit")
664 (version "1.3")
665 (source
666 (origin
667 (method git-fetch)
668 (uri (git-reference
669 (url "https://github.com/Uberi/Minetest-WorldEdit")
670 (commit "2f26fb76459c587868199160b9d7b5d6d7852e50")))
671 (sha256
672 (base32 "0lsvihkixi2na1b0vmml9vwgs0g24hqqshl73ffhkzh6jsq4cagq"))
673 (file-name (git-file-name name version))))
674 (build-system luanti-mod-build-system)
675 (home-page (luanti-topic 572))
676 (synopsis "In-game world editor for Luanti")
677 (description
678 "WorldEdit is a mod for Luanti. It allows for creating various
679geometric shapes and copying regions. It can also export and import regions
680to and from the file system.")
681 (license license:agpl3)
682 (properties `((upstream-name . "sfan5/worldedit")))))
683
684(define-public luanti-unifieddyes
685 (package
686 (name "luanti-unifieddyes")
687 ;; Upstream uses dates as version numbers.
688 (version "2021-04-20-1")
689 (source
690 (origin
691 (method git-fetch)
692 (uri (git-reference
693 (url "https://gitlab.com/VanessaE/unifieddyes")
694 (commit "ff3b2d30fa0df5c7181fdd401b989de6271c3bb3")))
695 (sha256
696 (base32 "0rba9n192xcpmxwnq7ixb6mn32gkpic247j3w4mwinrqcyscacsv"))
697 (file-name (git-file-name name version))))
698 (build-system luanti-mod-build-system)
699 (propagated-inputs
700 (list luanti-basic-materials))
701 (home-page (luanti-topic 2178))
702 (synopsis
703 "Unified Dyes expands the standard dye set of Luanti to up to 256 colours")
704 (description "The purpose of this mod originally was to supply a complete
705set of colours for Luanti mod authors to use for colourised nodes or
706reference in recipes. Since the advent of the default dyes mod in the standard
707Luanti game, this mod has become an extension of the default mod an a library
708for general colour handling.")
709 (license license:gpl2+)
710 (properties `((upstream-name . "VanessaE/unifieddyes")))))
711
712(define-public luanti-unified-inventory
713 (package
714 (name "luanti-unified-inventory")
715 ;; Upstream doesn't keep version numbers, so use the release title
716 ;; on ContentDB instead.
717 (version "2021-12-26")
718 (source
719 (origin
720 (method git-fetch)
721 (uri (git-reference
722 (url "https://github.com/minetest-mods/unified_inventory")
723 (commit "d6688872c84417d2f61d6f5e607aea39d78920aa")))
724 (sha256
725 (base32 "1rlw96s2yyxdbz0h9byayyx9nsbqdr4ric91w0k3dkjr71aj8a3b"))
726 (file-name (git-file-name name version))))
727 (build-system luanti-mod-build-system)
728 (home-page (luanti-topic 12767))
729 (synopsis "Replace the default inventory in Luanti and add a crafting guide")
730 (description
731 "The Unified Inventory Luanti mod relaces the default survival an
732creative inventory. It includes a node, item and tool browser, a crafting
733guide, a trash and refill slot for creative mode, bags and waypoints for keeping
734track of important locations.")
735 ;; CC-BY: some textures and icons
736 ;; CC-BY-SA: some textures and icons
737 ;; LGLPL2.1+: code and some textures
738 ;; GPL2+: some textures
739 ;; GPL3: bags.lua
740 ;; GFDL: some icons
741 ;; public domain, CC0: some icons
742 (license (list license:gpl3 license:gpl2+ license:lgpl2.1+ license:cc-by3.0
743 license:cc-by4.0 license:cc-by-sa3.0 license:public-domain
744 license:cc0 license:fdl1.2+))
745 (properties `((upstream-name . "RealBadAngel/unified_inventory")))))
746
747(define-public luanti-advtrains
748 (package
749 (name "luanti-advtrains")
750 (version "2.4.1")
751 (source
752 (origin
753 (method git-fetch)
754 (uri (git-reference
755 (url "https://git.bananach.space/advtrains.git")
756 (commit (string-append "release-" version))))
757 (sha256
758 (base32 "1q2jj8181pjgsakl28xadv0z4sszq1lb5rpgj070wr0px6mp447p"))
759 (file-name (git-file-name name version))))
760 (build-system luanti-mod-build-system)
761 (home-page "https://advtrains.de/")
762 (synopsis "Adds good-looking, realistic trains with realistic rails")
763 (description
764 "This mod features realistic trains and various equipment for railways,
765with a focus on automated train operation. This package contains no actual
766trains, please use @code{luanti-basic-trains}.
767
768Main features:
769
770@itemize
771@item
772almost-realistic tracks with actual curves and switches;
773@item
774railway signals, controllable by various means;
775@item
776ATC: simple, command-like automatic train control;
777@item
778LuaATC: Powerful Lua-scripted automatic train operation (requires some
779programming knowledge);
780@item
781an interlocking system, featuring track sections, routes and automatic
782stopping before signals.
783@end itemize")
784 (license (list license:cc-by-sa3.0 license:agpl3+))
785 (properties `((upstream-name . "orwell/advtrains")))))
786
787(define-public luanti-basic-trains
788 (package
789 (name "luanti-basic-trains")
790 (version "1.0.1")
791 (source
792 (origin
793 (method git-fetch)
794 (uri (git-reference
795 (url "http://git.bananach.space/basic_trains.git/")
796 (commit
797 "d44c410f7c2a7202ee68b66fc50febae89e0c5dc")))
798 (sha256
799 (base32
800 "0vvzndj48kgdz2bfgivfm217sbmc2lmxpp2mispcy7byn4i26prx"))
801 (file-name (git-file-name name version))))
802 (build-system luanti-mod-build-system)
803 (propagated-inputs
804 (list luanti-advtrains))
805 (home-page
806 "http://advtrains.de/wiki/doku.php?id=usage:trains:basic_trains")
807 (synopsis "Collection of basic trains for the Advanced Trains mod")
808 (description
809 "This modpack contains the trains which were the ``default'' trains in
810advtrains up to version 2.2.1.")
811 (license (list license:cc-by-sa3.0 license:agpl3+))
812 (properties `((upstream-name . "orwell/basic_trains")))))
813
814(define-public luanti-oneblock
815 (package
816 (name "luanti-oneblock")
817 (version "2022-09-01")
818 (source (origin
819 (method git-fetch)
820 (uri (git-reference
821 (url "https://github.com/NO411/oneblock")
822 (commit "3582c825137e61b3d2ae3d60b8b9746acd6dfe3d")))
823 (sha256
824 (base32
825 "1pkdrj99qqwmz7c86w2mh081ynyxhiwv2rl01xjm1wfpazx5zhdg"))
826 (file-name (git-file-name name version))))
827 (build-system luanti-mod-build-system)
828 (home-page "https://github.com/NO411/oneblock")
829 (synopsis "Build your island in the sky with random items!")
830 (description
831 "This package provides an extension of the Luanti game that lets you
832build your island in the sky. Every 30 seconds you will receive a random
833block or item from the oneblock to expand the island!")
834 (license license:gpl3+)
835 (properties `((upstream-name . "NO11/oneblock")))))
836
837(define-public luanti-wielded-light
838 (package
839 (name "luanti-wielded-light")
840 (version "2022-06-24")
841 (source (origin
842 (method git-fetch)
843 (uri (git-reference
844 (url "https://github.com/minetest-mods/wielded_light")
845 (commit "b5236562af9772dff8522fe2bda5b5f738e81b88")))
846 (sha256
847 (base32
848 "0m5rf8wkc9iq04xppjfva9d83qmhlnx8fibdbi2d3pkwwl6p2y5c"))
849 (file-name (git-file-name name version))))
850 (build-system luanti-mod-build-system)
851 (home-page (luanti-topic 19378))
852 (synopsis "Adds shining for wielded and dropped items")
853 (description
854 "With this Luanti extension, all bright nodes lighten the player
855environment if wielded.")
856 (license license:gpl3+)
857 (properties `((upstream-name . "bell07/wielded_light")))))
diff --git a/gnu/packages/minetest.scm b/gnu/packages/minetest.scm
index 6fed1b2aad2..0cd6907b7e3 100644
--- a/gnu/packages/minetest.scm
+++ b/gnu/packages/minetest.scm
@@ -24,834 +24,79 @@
24;;; 24;;;
25;;; You should have received a copy of the GNU General Public License 25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
27(define-module (gnu packages minetest) 28(define-module (gnu packages minetest)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages audio)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages check)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages curl)
34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages gl)
37 #:use-module (gnu packages image)
38 #:use-module (gnu packages lua)
39 #:use-module (gnu packages multiprecision)
40 #:use-module (gnu packages ncurses)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages sdl)
43 #:use-module (gnu packages serialization)
44 #:use-module (gnu packages sqlite)
45 #:use-module (gnu packages xiph)
46 #:use-module (gnu packages xorg)
47 #:use-module (guix packages) 29 #:use-module (guix packages)
48 #:use-module (guix gexp) 30 #:use-module (gnu packages luanti))
49 #:use-module (guix git-download)
50 #:use-module (guix utils)
51 #:use-module (guix build-system cmake)
52 #:use-module (guix build-system copy)
53 #:use-module (guix build-system minetest)
54 #:use-module ((guix licenses) #:prefix license:))
55 31
56(define-public minetest 32(define-public minetest
57 (package 33 (deprecated-package "minetest" luanti))
58 (name "minetest")
59 (version "5.12.0")
60 (source
61 (origin
62 (method git-fetch)
63 (uri (git-reference
64 (url "https://github.com/luanti-org/luanti")
65 (commit version)))
66 (file-name (git-file-name name version))
67 (sha256
68 (base32 "1l8kwy23p3gpk12nnhhq1lp4v0zj6kiygnmia043pdinmgzzd0xy"))
69 (modules '((guix build utils)
70 (srfi srfi-26)
71 (ice-9 ftw)))
72 ;; Delete bundled libraries.
73 ;; - Keep lib/sha256 because there's no good upstream, see:
74 ;; https://github.com/openssl/openssl/blob/master/crypto/sha/sha512.c
75 ;; "SHA512 low level APIs are deprecated for public use,
76 ;; but still ok for internal use." Also asked MT devs on IRC for this.
77 ;; - tiniergltf is intended for Minetest and diverged from upstream.
78 (snippet
79 '(let ((keep '("." ".." "sha256" "tiniergltf")))
80 (with-directory-excursion "lib"
81 (for-each delete-file-recursively
82 (scandir "." (negate (cut member <> keep)))))
83 ;; IrrlichtMT includes
84 (delete-file-recursively "irr/include/KHR")
85 (delete-file-recursively "irr/src/vendor")
86 (substitute* "irr/src/COpenGLCommon.h"
87 (("\"vendor/gl.h\"") "<GL/gl.h>"))
88 ;; Catch2
89 (substitute* "CMakeLists.txt"
90 (("add_subdirectory\\(lib/catch2\\)") "find_package(Catch2 3 REQUIRED)"))
91 (substitute* "src/catch.h"
92 (("catch_amalgamated.hpp") "catch2/catch_all.hpp"))
93 (substitute* "src/unittest/test_irr_rotation.cpp"
94 (("catch_amalgamated.hpp") "catch2/catch_all.hpp"))
95 (substitute* "src/unittest/test_irr_matrix4.cpp"
96 (("catch_amalgamated.hpp") "catch2/catch_all.hpp"))))))
97 (build-system cmake-build-system)
98 (arguments
99 (list
100 #:configure-flags
101 #~(list "-DENABLE_LTO=ON"
102 "-DENABLE_UPDATE_CHECKER=FALSE")
103 #:phases
104 #~(modify-phases %standard-phases
105 (delete 'check)
106 (add-after 'install 'check
107 (lambda* (#:key tests? #:allow-other-keys)
108 ;; Thanks to our substitutions, the tests should also run
109 ;; when invoked on the target outside of `guix build'.
110 (when tests?
111 (setenv "HOME" "/tmp")
112 (setenv "MINETEST_GAME_PATH"
113 (string-append (getcwd) "/../source/games"))
114 (invoke "../source/bin/luanti" "--run-unittests")
115 (invoke "../source/util/test_multiplayer.sh")))))))
116 (native-search-paths
117 (list (search-path-specification
118 (variable "MINETEST_GAME_PATH")
119 (files '("share/minetest/games")))
120 (search-path-specification
121 (variable "MINETEST_MOD_PATH")
122 (files '("share/minetest/mods")))))
123 (native-inputs (list catch2-3 pkg-config))
124 (inputs (list curl
125 freetype
126 gettext-minimal
127 gmp
128 jsoncpp
129 libjpeg-turbo
130 libpng
131 libogg
132 libvorbis
133 libxi
134 luajit
135 mesa
136 ncurses
137 openal
138 sdl2
139 sqlite
140 `(,zstd "lib")))
141 (outputs '("out" "debug"))
142 (synopsis "Voxel game engine")
143 (description
144 "Luanti is a voxel game engine that supports modding and game creation
145using its Lua modding API. It allows playing a wide range of voxel-based
146games, installing mods and texture packs. This package only provides the base
147platform, users need to install games themselves (for example,
148@code{minetest-game}), either through Guix, the built-in interface or other
149sources.")
150 (home-page "https://www.luanti.org/")
151 (license license:lgpl2.1+)))
152 34
153(define-public minetest-server 35(define-public minetest-server
154 (package 36 (deprecated-package "minetest-server" luanti-server))
155 (inherit minetest)
156 (name "minetest-server")
157 (arguments
158 (substitute-keyword-arguments (package-arguments minetest)
159 ((#:configure-flags configure-flags)
160 #~(cons* "-DBUILD_CLIENT=FALSE"
161 "-DBUILD_SERVER=TRUE"
162 #$configure-flags))
163 ((#:phases phases)
164 #~(modify-phases #$phases
165 (replace 'check
166 (lambda* (#:key tests? #:allow-other-keys)
167 (when tests?
168 (setenv "HOME" "/tmp")
169 (setenv "MINETEST_GAME_PATH"
170 (string-append (getcwd) "/../source/games"))
171 (invoke "../source/bin/luantiserver" "--run-unittests"))))))))
172 (inputs
173 (modify-inputs (package-inputs minetest)
174 (delete "libjpeg-turbo"
175 "libpng"
176 "libogg"
177 "libvorbis"
178 "libxxf86vm"
179 "mesa"
180 "openal")))
181 (synopsis "Infinite-world block sandbox game (server)")
182 (description
183 "Server for Luanti game engine and gaming platform. Allows hosting
184Luanti games with multiplayer support. This package provides
185@command{luantiserver} to run a Luanti server.")))
186
187(define-public minetest-game
188 (let ((commit "0351c6691595c6eb88a1bea2383f6fae46a686ce")
189 (revision "1"))
190 (package
191 (name "minetest-game")
192 (version (git-version "0.0.0" revision commit))
193 (source
194 (origin
195 (method git-fetch)
196 (uri (git-reference
197 (url "https://github.com/luanti-org/minetest_game")
198 (commit commit)))
199 (file-name (git-file-name name version))
200 (sha256
201 (base32 "13l33ghnm1g3ka0ivxljzdga50x0iv0fzyd7pqm15ickfbkwbm0v"))))
202 (build-system copy-build-system)
203 (arguments
204 (list
205 #:install-plan #~'(("." "/share/minetest/games/minetest_game"))))
206 (synopsis "Ex-official game for Luanti game engine")
207 (description
208 "This package provides the Minetest Game - a game for the
209Luanti game engine which used to be the official game for Luanti
210(formerly Minetest). It is currently in maintenance mode and gets no
211new features.")
212 (home-page "https://www.luanti.org/")
213 (license license:lgpl2.1+))))
214
215;; This package is deprecated. "Minetest Game" is no longer the official game.
216(define-public minetest-data
217 (deprecated-package "minetest-data" minetest-game))
218
219(define-public (minetest-topic topic-id)
220 "Return an URL (as a string) pointing to the forum topic with
221numeric identifier TOPIC-ID on the official Minetest forums."
222 (string-append "https://forum.minetest.net/viewtopic.php?t="
223 (number->string topic-id)))
224 37
225(define-public minetest-moreores 38(define-public minetest-moreores
226 (package 39 (deprecated-package "minetest-moreores" luanti-moreores))
227 (name "minetest-moreores")
228 (version "2.1.0")
229 (source
230 (origin
231 (method git-fetch)
232 (uri (git-reference
233 (url "https://github.com/minetest-mods/moreores")
234 (commit (string-append "v" version))))
235 (sha256 (base32 "1chfqbc6bb27aacjc67j5l5wcdvmcsvk2rfmangipd7nwini3y34"))
236 (file-name (git-file-name name version))))
237 (build-system minetest-mod-build-system)
238 (home-page (minetest-topic 549))
239 (synopsis "Additional ore types, tools, swords, and rails for Minetest")
240 (description
241 "This Minetest mod adds new ore types to the game (mithril, silver) as well
242as swords and tools made of different materials. It also adds copper rails.")
243 (license license:zlib)
244 (properties `((upstream-name . "Calinou/moreores")))))
245 40
246(define-public minetest-sound-api-core 41(define-public minetest-sound-api-core
247 (package 42 (deprecated-package "minetest-sound-api-core" luanti-sound-api-core))
248 (name "minetest-sound-api-core")
249 ;; No tags, no releases. The author intended to let users use it as a
250 ;; submodules for other projects.
251 ;; https://github.com/mt-mods/basic_materials/issues/4
252 (version "2022-02-27")
253 (source
254 (origin
255 (method git-fetch)
256 (uri (git-reference
257 (url "https://github.com/mt-mods/sound_api_core")
258 (commit "6956e49e775f325116f8e0c643899c089c691e1e")))
259 (sha256
260 (base32 "1ys6g2skhkksa4cx9agxhsibj5js8z4y2q1ngis9ddr38p756pcy"))
261 (file-name (git-file-name name version))
262 (snippet
263 '(begin
264 (call-with-output-file "mod.conf"
265 (lambda (port)
266 (format port "\
267name = sound_api_core")))))))
268 (build-system minetest-mod-build-system)
269 (propagated-inputs '())
270 (home-page "https://github.com/mt-mods/sound_api_core")
271 (synopsis "Core for game agnostic sounds")
272 (description
273 "This library can be used to get some specific sounds, whatever the game.")
274 (license license:expat)))
275 43
276(define-public minetest-basic-materials 44(define-public minetest-basic-materials
277 (package 45 (deprecated-package "minetest-basic-materials" luanti-basic-materials))
278 (name "minetest-basic-materials")
279 ;; Upstream uses dates as version numbers.
280 (version "2022-03-28")
281 (source
282 (origin
283 (method git-fetch)
284 (uri (git-reference
285 (url "https://github.com/mt-mods/basic_materials")
286 (commit "9d55f9916d20779ecbf93c7e95dae8adebd2079b")))
287 (sha256
288 (base32 "0nzx5mdw26mk2by14hxyvbqckgz8k67vlh2ch30skssvh4984bjw"))
289 (file-name (git-file-name name version))
290 (snippet
291 '(begin
292 (use-modules (guix build utils))
293 (substitute* "mod.conf"
294 (("optional_depends =")
295 "depends = sound_api_core
296optional_depends ="))
297 (substitute* "nodes.lua"
298 (("basic_materials.modpath \\.\\. \"/sound_api_core/init.lua\"")
299 "minetest.get_modpath(\"sound_api_core\") .. \"/init.lua\""))))))
300 (build-system minetest-mod-build-system)
301 (propagated-inputs
302 ;; basic_materials:silver_wire cannot be crafted without
303 ;; moreores:silver_ingot.
304 (list minetest-moreores minetest-sound-api-core))
305 (home-page (minetest-topic 21000))
306 (synopsis "Some \"basic\" materials and items for other Minetest mods to use")
307 (description
308 "The Minetest mod \"basic_materials\" provides a small selection of
309\"basic\" materials and items that other mods should use when possible -- things
310like steel bars and chains, wire, plastic strips and sheets, and more.")
311 (license
312 (list license:cc-by-sa4.0 license:lgpl3))
313 (properties `((upstream-name . "VanessaE/basic_materials")))))
314 46
315(define-public minetest-coloredwood 47(define-public minetest-coloredwood
316 (package 48 (deprecated-package "minetest-coloredwood" luanti-coloredwood))
317 (name "minetest-coloredwood")
318 ;; Upstream uses dates as version numbers.
319 (version "2021-04-14-1")
320 (source
321 (origin
322 (method git-fetch)
323 (uri (git-reference
324 (url "https://gitlab.com/VanessaE/coloredwood")
325 (commit "be4df6fc889419155bed8638bbb752493e78cbd5")))
326 (sha256
327 (base32 "1swirfk6b4xfbiwv8adyw5yl2lyfpp8ymfipzq9ivyvmif8nl3ki"))
328 (file-name (git-file-name name version))))
329 (build-system minetest-mod-build-system)
330 (propagated-inputs
331 (list minetest-unifieddyes))
332 (home-page (minetest-topic 2411))
333 (synopsis "Painted wood in Minetest")
334 (description
335 "This Minetest mod provides hundreds of colours of wood and fences to
336Minetest, using Unified Dyes. If the \"moreblocks\" mod is active,
337coloured and cut wood shapes are provided as well.")
338 (license
339 ;; LGPL for code, CC-BY-SA for textures
340 (list license:cc-by-sa4.0 license:lgpl3))
341 (properties `((upstream-name . "VanessaE/coloredwood")))))
342 49
343(define-public minetest-ethereal 50(define-public minetest-ethereal
344 ;; ContentDB release 2021-07-28 is slightly ahead of the 51 (deprecated-package "minetest-ethereal" luanti-ethereal))
345 ;; initial version 1.29 -- i.e., some released changes have been
346 ;; made to version 1.29 without a corresponding version bump.
347 (let ((commit "7670c1da9274901f57f6682384af2b3bae005a86")
348 (revision "0"))
349 (package
350 (name "minetest-ethereal")
351 (version (git-version "1.29" revision commit))
352 (source
353 (origin
354 (method git-fetch)
355 (uri (git-reference
356 (url "https://notabug.org/TenPlus1/ethereal")
357 (commit commit)))
358 (sha256
359 (base32 "1hal8bq4fydsip7s8rqz4vlaaqy9rhzxmryd0j2qnqm9286yjgkk"))
360 (file-name (git-file-name name version))))
361 (build-system minetest-mod-build-system)
362 (home-page (minetest-topic 14638))
363 (synopsis "The Ethereal mod adds many new biomes to Minetest")
364 (description
365 "The Ethereal Minetest mod uses the v7 map generator to add many new
366biomes to the world. It adds new trees, plants, food items, tweaks and some
367special items, intending to make an interesting adventure.")
368 ;; CC0: some textures
369 (license (list license:cc0 license:expat))
370 (properties `((upstream-name . "TenPlus1/ethereal"))))))
371 52
372(define-public minetest-homedecor-modpack 53(define-public minetest-homedecor-modpack
373 (package 54 (deprecated-package "minetest-homedecor-modpack" luanti-homedecor-modpack))
374 (name "minetest-homedecor-modpack")
375 ;; Upstream doesn't tag releases, so use the release title from
376 ;; ContentDB as version.
377 (version "2022-05-18")
378 (source
379 (origin
380 (method git-fetch)
381 (uri (git-reference
382 (url "https://github.com/mt-mods/homedecor_modpack")
383 (commit "5ffdc26673169e05492141709fbb18e8fb6e5937")))
384 (sha256
385 (base32 "03pf254r3hnznklw7lf3q4rzqg0a1y4c9rjjhzssf1q7ai5pdrkn"))
386 (file-name (git-file-name name version))))
387 (build-system minetest-mod-build-system)
388 (propagated-inputs
389 (list minetest-basic-materials minetest-unifieddyes))
390 (home-page (minetest-topic 2041))
391 (synopsis "Home decor mod for Minetest")
392 (description
393 ;; TRANSLATORS: ‘homedecor’ is the name is the name of a Minetest mod
394 ;; and should not be translated.
395 "The homedecor Minetest mod provides a large seleection of items that
396might be found inside and around homes, such as sofas, chairs, tables, fences
397and a variety of other stuff.")
398 (license
399 (list license:cc-by-sa4.0 license:lgpl3))
400 (properties `((upstream-name . "VanessaE/homedecor_modpack")))))
401 55
402(define-public minetest-mesecons 56(define-public minetest-mesecons
403 ;; The release on ContentDB does not have its own version number. 57 (deprecated-package "minetest-mesecons" luanti-mesecons))
404 (let ((commit "27c3c515b49af91c1dbc427f31a820722854eb24")
405 (revision "63"))
406 (package
407 (name "minetest-mesecons")
408 (version (git-version "1.2.1" revision commit))
409 (source
410 (origin
411 (method git-fetch)
412 (uri (git-reference
413 (url "https://github.com/minetest-mods/mesecons")
414 (commit commit)))
415 (sha256
416 (base32 "1l0kwjj8ns8hv6z520g6ph5swknar336dbi5qr3dfsy18ydk1j92"))
417 (file-name (git-file-name name version))))
418 (build-system minetest-mod-build-system)
419 (home-page "https://mesecons.net")
420 (synopsis
421 "Digital circuitry for Minetest, including wires, buttons and lights")
422 (description
423 "Mesecons is a mod for Minetest implementing various items related
424to digital circuitry, such as wires, buttons, lights and programmable
425controllers. Among other things, there are also pistons, solar panels,
426pressure plates and note blocks.
427
428Mesecons has a similar goal to Redstone in Minecraft, but works in its own way,
429with different rules and mechanics.")
430 ;; LGPL for code, CC-BY-SA for textures.
431 (license (list license:lgpl3 license:cc-by-sa3.0))
432 (properties `((upstream-name . "Jeija/mesecons"))))))
433 58
434(define-public minetest-mineclone 59(define-public minetest-mineclone
435 (package 60 (deprecated-package "minetest-mineclone" luanti-mineclone))
436 (name "minetest-mineclone")
437 (version "0.80.1")
438 (source (origin
439 (method git-fetch)
440 (uri (git-reference
441 (url "https://git.minetest.land/MineClone2/MineClone2")
442 (commit version)))
443 (file-name (git-file-name name version))
444 (sha256
445 (base32
446 "0ndgzasjmj8397bb3y2aqalx9v72llwgvp9pv05mms3chpji2675"))))
447 (build-system copy-build-system)
448 (arguments
449 `(#:install-plan
450 '(("." "share/minetest/games/mineclone"))))
451 (synopsis "Minecraft clone based on Minetest engine")
452 (description
453 "MineClone is a Minetest subgame, that aims to recreate Minecraft as
454closely as the engine allows.")
455 (home-page "https://content.minetest.net/packages/Wuzzy/mineclone2/")
456 (license license:gpl3+)))
457 61
458(define-public minetest-mobs 62(define-public minetest-mobs
459 (package 63 (deprecated-package "minetest-mobs" luanti-mobs))
460 (name "minetest-mobs")
461 ;; Upstream does not tag release, so use the ContentDB release
462 ;; title instead.
463 (version "2021-12-12")
464 (source
465 (origin
466 (method git-fetch)
467 (uri (git-reference
468 (url "https://notabug.org/TenPlus1/mobs_redo")
469 (commit "6a4a02f3fbf1038c69e72aaafa52a1e7d6106da8")))
470 (sha256
471 (base32 "0vgv7jpm9v3dwq4l9jxdd5z14yq164w8kin1d05jfv3ck4hwlwvr"))
472 (file-name (git-file-name name version))))
473 (build-system minetest-mod-build-system)
474 (home-page (minetest-topic 9917))
475 (synopsis "Mob library for Minetest mods, for animals, monsters etc.")
476 (description
477 "This Minetest mod provides an API for adding mods (moving entities
478like animals and monsters), but does not include any mobs itself. To actually
479add some mobs, a mod like e.g. @code{mobs_animal} provided by the
480@code{minetest-mobs-animal} package needs to be enabled.")
481 ;; CC0: mob_swing.ogg
482 ;; CC-BY 3.0: mob_spell.ogg
483 ;; Expat: everything else
484 (license (list license:expat license:cc0 license:cc-by3.0))
485 (properties `((upstream-name . "TenPlus1/mobs")))))
486 64
487(define-public minetest-mobs-animal 65(define-public minetest-mobs-animal
488 (package 66 (deprecated-package "minetest-mobs-animal" luanti-mobs-animal))
489 (name "minetest-mobs-animal")
490 ;; Upstream does not use version numbers, so use the release title
491 ;; from ContentDB instead;
492 (version "2021-11-14")
493 (source
494 (origin
495 (method git-fetch)
496 (uri (git-reference
497 (url "https://notabug.org/TenPlus1/mobs_animal")
498 (commit "3e15456bce7779aa0dc09a8890f7b5180c1ac771")))
499 (sha256
500 (base32 "08686mj3jh8fsziqp878jpaj5267s4n6i86dr1gnxyxbsrjraqpn"))
501 (file-name (git-file-name name version))))
502 (build-system minetest-mod-build-system)
503 (propagated-inputs
504 (list minetest-mobs))
505 (home-page "https://notabug.org/TenPlus1/mobs_animal")
506 (synopsis "Add animals to Minetest")
507 (description
508 "This Minetest mod adds various animals to Minetest, such as bees,
509bunnies, chickens, cows, kittens, rats, sheep, warthogs, penguins and pandas.")
510 ;; CC0: some textures and sounds
511 (license (list license:cc0 license:expat))
512 (properties `((upstream-name . "TenPlus1/mobs_animal")))))
513 67
514(define-public minetest-mobs-monster 68(define-public minetest-mobs-monster
515 (package 69 (deprecated-package "minetest-mobs-monster" luanti-mobs-monster))
516 (name "minetest-mobs-monster")
517 ;; Upstream does not use version numbers, so use the release title
518 ;; from ContentDB instead;
519 (version "2022-12-10")
520 (source
521 (origin
522 (method git-fetch)
523 (uri (git-reference
524 (url "https://notabug.org/TenPlus1/mobs_monster")
525 (commit "1b197f9ae136179a764ef45824464b667ade52e6")))
526 (sha256
527 (base32 "15g8acrzvsiccxchfmgjhyf2lmkbrpdjqv3v7hmqz7xqypi8wm3h"))
528 (file-name (git-file-name name version))))
529 (build-system minetest-mod-build-system)
530 (propagated-inputs (list minetest-mobs))
531 (home-page "https://notabug.org/TenPlus1/mobs_monster")
532 (synopsis "Add monsters with Mobs Redo on minetest")
533 (description
534 "This Minetest mod adds many types of monsters to Minetest, that live on the
535surface or deep underground.")
536 (license license:expat)
537 (properties `((upstream-name . "TenPlus1/mobs_monster")))))
538 70
539(define-public minetest-pipeworks 71(define-public minetest-pipeworks
540 (package 72 (deprecated-package "minetest-pipeworks" luanti-pipeworks))
541 (name "minetest-pipeworks")
542 ;; Upstream uses dates as version numbers.
543 (version "2021-04-14-1")
544 (source
545 (origin
546 (method git-fetch)
547 (uri (git-reference
548 (url "https://gitlab.com/VanessaE/pipeworks")
549 (commit "db6d1bd9c109e1e543b97cc3fa8a11400da23bcd")))
550 (sha256
551 (base32 "1flhcnf17dn1v86kcg47a1n4cb0lybd11ncxrkxn3wmf10ibsrm0"))
552 (file-name (git-file-name name version))))
553 (build-system minetest-mod-build-system)
554 (propagated-inputs
555 (list minetest-basic-materials))
556 (home-page (minetest-topic 2155))
557 (synopsis "Pipes, item-transport tubes and related devices for Minetest")
558 (description
559 "Pipeworks is a mod for Minetest implementing 3D pipes and tubes for
560transporting liquids and items and some related devices. Pipes and tubes can
561go horizontally or vertically. Item tubes can also be used for sorting items
562and extracting items from chests or putting items in chests. Autocrafters can
563automatically follow craft recipes to make new items and can be fed by item
564tubes. Deployers can place items in the world as a player would. Node
565breakers simulate a player punching a node.")
566 ;; CC-BY-SA for textures, LGPL for code
567 (license (list license:cc-by-sa4.0 license:lgpl3))
568 (properties `((upstream-name . "VanessaE/pipeworks")))))
569 73
570(define-public minetest-technic 74(define-public minetest-technic
571 (package 75 (deprecated-package "minetest-technic" luanti-technic))
572 (name "minetest-technic")
573 ;; Upstream doesn't keep version numbers, so use the release
574 ;; date on ContentDB instead.
575 (version "2022-10-30")
576 (source
577 (origin
578 (method git-fetch)
579 (uri (git-reference
580 (url "https://github.com/minetest-mods/technic")
581 (commit "6a9dfec36f7265f9328fe378732417d9b57060b4")))
582 (sha256
583 (base32 "0ng1aklm02n2lbar345yf88g3alzvnh0m0s5rb2bcw2k5lib8468"))
584 (file-name (git-file-name name version))))
585 (build-system minetest-mod-build-system)
586 (propagated-inputs
587 (list minetest-pipeworks minetest-basic-materials))
588 (home-page (minetest-topic 2538))
589 (synopsis "Machinery and automation for Minetest")
590 (description
591 "This Minetest mod adds machinery and automation to Minetest.
592It adds various ores that can be processed for constructing various
593machinery, such as power generators, force field emitters, quarries
594and a workshop for repairing tools. Most machines are electrically
595powered.")
596 ;; CC BY-SA 3.0: some texture
597 ;; WTFPL: some textures
598 ;; CC BY-SA3.0: some textures
599 ;; CC BY-SA4.0: some sounds
600 (license (list license:lgpl2.1+ license:cc-by-sa3.0 license:cc-by-sa4.0
601 license:wtfpl2))
602 (properties `((upstream-name . "RealBadAngel/technic")))))
603 76
604(define-public minetest-throwing 77(define-public minetest-throwing
605 ;; The latest release on ContentDB is ahead of the latet 78 (deprecated-package "minetest-throwing" luanti-throwing))
606 ;; tagged commit.
607 (let ((commit "31f0cf5f868673dc82f24ddc432b45c9cd282d27")
608 (revision "0"))
609 (package
610 (name "minetest-throwing")
611 (version (git-version "1.1" revision commit))
612 (source
613 (origin
614 (method git-fetch)
615 (uri (git-reference
616 (url "https://github.com/minetest-mods/throwing")
617 (commit commit)))
618 (sha256
619 (base32 "1s5kkr6rxxv2dhbbjzv62gw1s617hnpjavw1v9fv11v3mgigdfjb"))
620 (file-name (git-file-name name version))))
621 (build-system minetest-mod-build-system)
622 (home-page (minetest-topic 16365))
623 (synopsis "API for throwing things in Minetest")
624 (description
625 "This Minetest mod provides an API for registering throwable things and
626throwing things like arrows. However, this mod does not provide an actual
627arrow and bow, but @code{minetest-throwing-arrows} does.")
628 (license license:mpl2.0)
629 (properties `((upstream-name . "Palige/throwing"))))))
630 79
631(define-public minetest-throwing-arrows 80(define-public minetest-throwing-arrows
632 ;; There is only one tagged commit (version 1.1), 81 (deprecated-package "minetest-throwing-arrows" luanti-throwing-arrows))
633 ;; there are no releases on ContentDB and the latest
634 ;; commit has a compatibility fix for Minetest 5.4.0-dev.
635 (let ((commit "059cc897af0aebfbd2c54ac5588f2b842f44f159")
636 (revision "0"))
637 (package
638 (name "minetest-throwing-arrows")
639 (version (git-version "1.1" revision commit))
640 (source
641 (origin
642 (method git-fetch)
643 (uri (git-reference
644 (url "https://github.com/minetest-mods/throwing_arrows")
645 (commit commit)))
646 (sha256
647 (base32 "0m2pmccpfxn878zd00pmrpga2h6gknz4f3qprck0fq94mksmwqs3"))
648 (file-name (git-file-name name version))))
649 (build-system minetest-mod-build-system)
650 (propagated-inputs
651 (list minetest-throwing))
652 (home-page (minetest-topic 16365))
653 (synopsis "Arrows and bows for Minetest")
654 (description
655 ;; TRANSLATORS: "throwing" is the name of a Minetest mod and should
656 ;; not be translated.
657 "This mod adds arrows and bows to Minetest. It is a compatible
658replacement for the throwing mod by PilzAdam that uses the throwing API.")
659 (license license:mpl2.0))))
660 82
661(define-public minetest-worldedit 83(define-public minetest-worldedit
662 (package 84 (deprecated-package "minetest-worldedit" luanti-worldedit))
663 (name "minetest-worldedit")
664 (version "1.3")
665 (source
666 (origin
667 (method git-fetch)
668 (uri (git-reference
669 (url "https://github.com/Uberi/Minetest-WorldEdit")
670 (commit "2f26fb76459c587868199160b9d7b5d6d7852e50")))
671 (sha256
672 (base32 "0lsvihkixi2na1b0vmml9vwgs0g24hqqshl73ffhkzh6jsq4cagq"))
673 (file-name (git-file-name name version))))
674 (build-system minetest-mod-build-system)
675 (home-page (minetest-topic 572))
676 (synopsis "In-game world editor for Minetest")
677 (description
678 "WorldEdit is a mod for Minetest. It allows for creating various
679geometric shapes and copying regions. It can also export and import regions
680to and from the file system.")
681 (license license:agpl3)
682 (properties `((upstream-name . "sfan5/worldedit")))))
683 85
684(define-public minetest-unifieddyes 86(define-public minetest-unifieddyes
685 (package 87 (deprecated-package "minetest-unifieddyes" luanti-unifieddyes))
686 (name "minetest-unifieddyes")
687 ;; Upstream uses dates as version numbers.
688 (version "2021-04-20-1")
689 (source
690 (origin
691 (method git-fetch)
692 (uri (git-reference
693 (url "https://gitlab.com/VanessaE/unifieddyes")
694 (commit "ff3b2d30fa0df5c7181fdd401b989de6271c3bb3")))
695 (sha256
696 (base32 "0rba9n192xcpmxwnq7ixb6mn32gkpic247j3w4mwinrqcyscacsv"))
697 (file-name (git-file-name name version))))
698 (build-system minetest-mod-build-system)
699 (propagated-inputs
700 (list minetest-basic-materials))
701 (home-page (minetest-topic 2178))
702 (synopsis
703 "Unified Dyes expands the standard dye set of Minetest to up to 256 colours")
704 (description "The purpose of this mod originally was to supply a complete
705set of colours for Minetest mod authors to use for colourised nodes or
706reference in recipes. Since the advent of the default dyes mod in the standard
707Minetest game, this mod has become an extension of the default mod an a library
708for general colour handling.")
709 (license license:gpl2+)
710 (properties `((upstream-name . "VanessaE/unifieddyes")))))
711 88
712(define-public minetest-unified-inventory 89(define-public minetest-unified-inventory
713 (package 90 (deprecated-package "minetest-unified-inventory" luanti-unified-inventory))
714 (name "minetest-unified-inventory")
715 ;; Upstream doesn't keep version numbers, so use the release title
716 ;; on ContentDB instead.
717 (version "2021-12-26")
718 (source
719 (origin
720 (method git-fetch)
721 (uri (git-reference
722 (url "https://github.com/minetest-mods/unified_inventory")
723 (commit "d6688872c84417d2f61d6f5e607aea39d78920aa")))
724 (sha256
725 (base32 "1rlw96s2yyxdbz0h9byayyx9nsbqdr4ric91w0k3dkjr71aj8a3b"))
726 (file-name (git-file-name name version))))
727 (build-system minetest-mod-build-system)
728 (home-page (minetest-topic 12767))
729 (synopsis "Replace the default inventory in Minetest and add a crafting guide")
730 (description
731 "The Unified Inventory Minetest mod relaces the default survival an
732creative inventory. It includes a node, item and tool browser, a crafting
733guide, a trash and refill slot for creative mode, bags and waypoints for keeping
734track of important locations.")
735 ;; CC-BY: some textures and icons
736 ;; CC-BY-SA: some textures and icons
737 ;; LGLPL2.1+: code and some textures
738 ;; GPL2+: some textures
739 ;; GPL3: bags.lua
740 ;; GFDL: some icons
741 ;; public domain, CC0: some icons
742 (license (list license:gpl3 license:gpl2+ license:lgpl2.1+ license:cc-by3.0
743 license:cc-by4.0 license:cc-by-sa3.0 license:public-domain
744 license:cc0 license:fdl1.2+))
745 (properties `((upstream-name . "RealBadAngel/unified_inventory")))))
746 91
747(define-public minetest-advtrains 92(define-public minetest-advtrains
748 (package 93 (deprecated-package "minetest-advtrains" luanti-advtrains))
749 (name "minetest-advtrains")
750 (version "2.4.1")
751 (source
752 (origin
753 (method git-fetch)
754 (uri (git-reference
755 (url "https://git.bananach.space/advtrains.git")
756 (commit (string-append "release-" version))))
757 (sha256
758 (base32 "1q2jj8181pjgsakl28xadv0z4sszq1lb5rpgj070wr0px6mp447p"))
759 (file-name (git-file-name name version))))
760 (build-system minetest-mod-build-system)
761 (home-page "https://advtrains.de/")
762 (synopsis "Adds good-looking, realistic trains with realistic rails")
763 (description
764 "This mod features realistic trains and various equipment for railways,
765with a focus on automated train operation. This package contains no actual
766trains, please use @code{minetest-basic-trains}.
767
768Main features:
769
770@itemize
771@item
772almost-realistic tracks with actual curves and switches;
773@item
774railway signals, controllable by various means;
775@item
776ATC: simple, command-like automatic train control;
777@item
778LuaATC: Powerful Lua-scripted automatic train operation (requires some
779programming knowledge);
780@item
781an interlocking system, featuring track sections, routes and automatic
782stopping before signals.
783@end itemize")
784 (license (list license:cc-by-sa3.0 license:agpl3+))
785 (properties `((upstream-name . "orwell/advtrains")))))
786 94
787(define-public minetest-basic-trains 95(define-public minetest-basic-trains
788 (package 96 (deprecated-package "minetest-basic-trains" luanti-basic-trains))
789 (name "minetest-basic-trains")
790 (version "1.0.1")
791 (source
792 (origin
793 (method git-fetch)
794 (uri (git-reference
795 (url "http://git.bananach.space/basic_trains.git/")
796 (commit
797 "d44c410f7c2a7202ee68b66fc50febae89e0c5dc")))
798 (sha256
799 (base32
800 "0vvzndj48kgdz2bfgivfm217sbmc2lmxpp2mispcy7byn4i26prx"))
801 (file-name (git-file-name name version))))
802 (build-system minetest-mod-build-system)
803 (propagated-inputs
804 (list minetest-advtrains))
805 (home-page
806 "http://advtrains.de/wiki/doku.php?id=usage:trains:basic_trains")
807 (synopsis "Collection of basic trains for the Advanced Trains mod")
808 (description
809 "This modpack contains the trains which were the ``default'' trains in
810advtrains up to version 2.2.1.")
811 (license (list license:cc-by-sa3.0 license:agpl3+))
812 (properties `((upstream-name . "orwell/basic_trains")))))
813 97
814(define-public minetest-oneblock 98(define-public minetest-oneblock
815 (package 99 (deprecated-package "minetest-oneblock" luanti-oneblock))
816 (name "minetest-oneblock")
817 (version "2022-09-01")
818 (source (origin
819 (method git-fetch)
820 (uri (git-reference
821 (url "https://github.com/NO411/oneblock")
822 (commit "3582c825137e61b3d2ae3d60b8b9746acd6dfe3d")))
823 (sha256
824 (base32
825 "1pkdrj99qqwmz7c86w2mh081ynyxhiwv2rl01xjm1wfpazx5zhdg"))
826 (file-name (git-file-name name version))))
827 (build-system minetest-mod-build-system)
828 (home-page "https://github.com/NO411/oneblock")
829 (synopsis "Build your island in the sky with random items!")
830 (description
831 "This package provides an extension of the Minetest game that lets you
832build your island in the sky. Every 30 seconds you will receive a random
833block or item from the oneblock to expand the island!")
834 (license license:gpl3+)
835 (properties `((upstream-name . "NO11/oneblock")))))
836 100
837(define-public minetest-wielded-light 101(define-public minetest-wielded-light
838 (package 102 (deprecated-package "minetest-wielded-light" luanti-wielded-light))
839 (name "minetest-wielded-light")
840 (version "2022-06-24")
841 (source (origin
842 (method git-fetch)
843 (uri (git-reference
844 (url "https://github.com/minetest-mods/wielded_light")
845 (commit "b5236562af9772dff8522fe2bda5b5f738e81b88")))
846 (sha256
847 (base32
848 "0m5rf8wkc9iq04xppjfva9d83qmhlnx8fibdbi2d3pkwwl6p2y5c"))
849 (file-name (git-file-name name version))))
850 (build-system minetest-mod-build-system)
851 (home-page (minetest-topic 19378))
852 (synopsis "Adds shining for wielded and dropped items")
853 (description
854 "With this Minetest extension, all bright nodes lighten the player
855environment if wielded.")
856 (license license:gpl3+)
857 (properties `((upstream-name . "bell07/wielded_light")))))
diff --git a/guix/build-system/luanti.scm b/guix/build-system/luanti.scm
new file mode 100644
index 00000000000..89469162da5
--- /dev/null
+++ b/guix/build-system/luanti.scm
@@ -0,0 +1,104 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
3;;; Copyright © 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (guix build-system luanti)
21 #:use-module (guix build-system copy)
22 #:use-module (guix build-system gnu)
23 #:use-module (guix build-system)
24 #:use-module (guix utils)
25 #:export (luanti-mod-build-system))
26
27;;
28;; Build procedure for luanti mods. This is implemented as an extension
29;; of ‘copy-build-system’.
30;;
31;; Code:
32
33;; Lazily resolve the bindings to avoid circular dependencies.
34(define (default-optipng)
35 ;; Lazily resolve the binding to avoid a circular dependency.
36 (module-ref (resolve-interface '(gnu packages image)) 'optipng))
37
38(define (default-luanti)
39 (module-ref (resolve-interface '(gnu packages luanti)) 'luanti))
40
41(define (default-luanti-game)
42 (module-ref (resolve-interface '(gnu packages luanti)) 'minetest-game))
43
44(define (default-xvfb-run)
45 (module-ref (resolve-interface '(gnu packages xorg)) 'xvfb-run))
46
47(define %luanti-build-system-modules
48 ;; Build-side modules imported by default.
49 `((guix build luanti-build-system)
50 ,@%copy-build-system-modules))
51
52(define %default-modules
53 ;; Modules in scope in the build-side environment.
54 '((guix build gnu-build-system)
55 (guix build luanti-build-system)
56 (guix build utils)))
57
58(define (standard-luanti-packages)
59 "Return the list of (NAME PACKAGE OUTPUT) or (NAME PACKAGE) tuples of
60standard packages used as implicit inputs of the Luanti build system."
61 `(("xvfb-run" ,(default-xvfb-run))
62 ("optipng" ,(default-optipng))
63 ("luanti" ,(default-luanti))
64 ("luanti-game" ,(default-luanti-game))
65 ,@(filter (lambda (input)
66 (member (car input)
67 '("libc" "tar" "gzip" "bzip2" "xz" "locales")))
68 (standard-packages))))
69
70(define* (lower-mod name #:key (implicit-inputs? #t) #:allow-other-keys
71 #:rest arguments)
72 (define lower (build-system-lower gnu-build-system))
73 (apply lower
74 name
75 (substitute-keyword-arguments arguments
76 ;; luanti-mod-build-system adds implicit inputs by itself,
77 ;; so don't let gnu-build-system add its own implicit inputs
78 ;; as well.
79 ((#:implicit-inputs? implicit-inputs? #t)
80 #f)
81 ((#:implicit-cross-inputs? implicit-cross-inputs? #t)
82 #f)
83 ((#:imported-modules imported-modules %luanti-build-system-modules)
84 imported-modules)
85 ((#:modules modules %default-modules)
86 modules)
87 ((#:phases phases '%standard-phases)
88 phases)
89 ;; Ensure nothing sneaks into the closure.
90 ((#:allowed-references allowed-references '())
91 allowed-references)
92 ;; Add the implicit inputs.
93 ((#:native-inputs native-inputs '())
94 (if implicit-inputs?
95 (append native-inputs (standard-luanti-packages))
96 native-inputs)))))
97
98(define luanti-mod-build-system
99 (build-system
100 (name 'luanti-mod)
101 (description "The build system for Luanti mods")
102 (lower lower-mod)))
103
104;;; luanti.scm ends here
diff --git a/guix/build-system/minetest.scm b/guix/build-system/minetest.scm
index 9774c5882a5..775e609177b 100644
--- a/guix/build-system/minetest.scm
+++ b/guix/build-system/minetest.scm
@@ -1,5 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> 2;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
3;;; Copyright © 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
3;;; 4;;;
4;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
5;;; 6;;;
@@ -17,87 +18,8 @@
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18 19
19(define-module (guix build-system minetest) 20(define-module (guix build-system minetest)
20 #:use-module (guix build-system copy) 21 #:use-module (guix build-system luanti)
21 #:use-module (guix build-system gnu) 22 #:use-module (guix deprecation)
22 #:use-module (guix build-system)
23 #:use-module (guix utils)
24 #:export (minetest-mod-build-system)) 23 #:export (minetest-mod-build-system))
25 24
26;; 25(define-deprecated/alias minetest-mod-build-system luanti-mod-build-system)
27;; Build procedure for minetest mods. This is implemented as an extension
28;; of ‘copy-build-system’.
29;;
30;; Code:
31
32;; Lazily resolve the bindings to avoid circular dependencies.
33(define (default-optipng)
34 ;; Lazily resolve the binding to avoid a circular dependency.
35 (module-ref (resolve-interface '(gnu packages image)) 'optipng))
36
37(define (default-minetest)
38 (module-ref (resolve-interface '(gnu packages minetest)) 'minetest))
39
40(define (default-minetest-game)
41 (module-ref (resolve-interface '(gnu packages minetest)) 'minetest-game))
42
43(define (default-xvfb-run)
44 (module-ref (resolve-interface '(gnu packages xorg)) 'xvfb-run))
45
46(define %minetest-build-system-modules
47 ;; Build-side modules imported by default.
48 `((guix build minetest-build-system)
49 ,@%copy-build-system-modules))
50
51(define %default-modules
52 ;; Modules in scope in the build-side environment.
53 '((guix build gnu-build-system)
54 (guix build minetest-build-system)
55 (guix build utils)))
56
57(define (standard-minetest-packages)
58 "Return the list of (NAME PACKAGE OUTPUT) or (NAME PACKAGE) tuples of
59standard packages used as implicit inputs of the Minetest build system."
60 `(("xvfb-run" ,(default-xvfb-run))
61 ("optipng" ,(default-optipng))
62 ("minetest" ,(default-minetest))
63 ("minetest-game" ,(default-minetest-game))
64 ,@(filter (lambda (input)
65 (member (car input)
66 '("libc" "tar" "gzip" "bzip2" "xz" "locales")))
67 (standard-packages))))
68
69(define* (lower-mod name #:key (implicit-inputs? #t) #:allow-other-keys
70 #:rest arguments)
71 (define lower (build-system-lower gnu-build-system))
72 (apply lower
73 name
74 (substitute-keyword-arguments arguments
75 ;; minetest-mod-build-system adds implicit inputs by itself,
76 ;; so don't let gnu-build-system add its own implicit inputs
77 ;; as well.
78 ((#:implicit-inputs? implicit-inputs? #t)
79 #f)
80 ((#:implicit-cross-inputs? implicit-cross-inputs? #t)
81 #f)
82 ((#:imported-modules imported-modules %minetest-build-system-modules)
83 imported-modules)
84 ((#:modules modules %default-modules)
85 modules)
86 ((#:phases phases '%standard-phases)
87 phases)
88 ;; Ensure nothing sneaks into the closure.
89 ((#:allowed-references allowed-references '())
90 allowed-references)
91 ;; Add the implicit inputs.
92 ((#:native-inputs native-inputs '())
93 (if implicit-inputs?
94 (append native-inputs (standard-minetest-packages))
95 native-inputs)))))
96
97(define minetest-mod-build-system
98 (build-system
99 (name 'minetest-mod)
100 (description "The build system for minetest mods")
101 (lower lower-mod)))
102
103;;; minetest.scm ends here
diff --git a/guix/build/luanti-build-system.scm b/guix/build/luanti-build-system.scm
new file mode 100644
index 00000000000..212f84f16ff
--- /dev/null
+++ b/guix/build/luanti-build-system.scm
@@ -0,0 +1,228 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
3;;; Copyright © 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (guix build luanti-build-system)
21 #:use-module (guix build utils)
22 #:use-module (srfi srfi-1)
23 #:use-module (ice-9 format)
24 #:use-module (ice-9 match)
25 #:use-module (ice-9 rdelim)
26 #:use-module (ice-9 receive)
27 #:use-module (ice-9 regex)
28 #:use-module (ice-9 exceptions)
29 #:use-module ((guix build gnu-build-system) #:prefix gnu:)
30 #:use-module ((guix build copy-build-system) #:prefix copy:)
31 #:export (%standard-phases
32 mod-install-plan minimise-png read-mod-name check))
33
34;; (guix build copy-build-system) does not export 'install'.
35(define copy:install
36 (assoc-ref copy:%standard-phases 'install))
37
38(define (mod-install-plan mod-name)
39 `(("." ,(string-append "share/luanti/mods/" mod-name)
40 ;; Only install files that will actually be used at run time.
41 ;; This can save a little disk space.
42 ;;
43 ;; See <https://github.com/luanti/luanti/blob/master/doc/lua_api.txt>
44 ;; for an incomple list of files that can be found in mods.
45 #:include ("mod.conf" "modpack.conf" "settingtypes.txt" "depends.txt"
46 "description.txt" "config.txt" "_config.txt")
47 #:include-regexp (".lua$" ".png$" ".ogg$" ".obj$" ".b3d$" ".tr$"
48 ".mts$"))))
49
50(define* (guess-mod-name #:key inputs #:allow-other-keys)
51 "Try to determine the name of the mod or modpack that is being built.
52If it is unknown, make an educated guess."
53 ;; Luanti doesn't care about the directory names in "share/luanti/mods"
54 ;; so there is no technical problem if the directory names don't match
55 ;; the mod names. The directory can appear in the GUI if the modpack
56 ;; doesn't have the 'name' set though, so try to make a guess.
57 (define (guess)
58 (let* ((source (assoc-ref inputs "source"))
59 ;; Don't retain a reference to the store.
60 (file-name (strip-store-file-name source))
61 ;; The "luanti-" prefix is not informative, so strip it.
62 (file-name (if (string-prefix? "luanti-" file-name)
63 (substring file-name (string-length "luanti-"))
64 file-name))
65 ;; Strip "-checkout" suffixes of git checkouts.
66 (file-name (if (string-suffix? "-checkout" file-name)
67 (substring file-name
68 0
69 (- (string-length file-name)
70 (string-length "-checkout")))
71 file-name))
72 (first-dot (string-index file-name #\.))
73 ;; If the source code is in an archive (.tar.gz, .zip, ...),
74 ;; strip the extension.
75 (file-name (if first-dot
76 (substring file-name 0 first-dot)
77 file-name)))
78 (format (current-error-port)
79 "warning: the modpack ~a did not set 'name' in 'modpack.conf'~%"
80 file-name)
81 file-name))
82 (cond ((file-exists? "mod.conf")
83 ;; Mods must have 'name' set in "mod.conf", so don't guess.
84 (read-mod-name "mod.conf"))
85 ((file-exists? "modpack.conf")
86 ;; While it is recommended to have 'name' set in 'modpack.conf',
87 ;; it is optional, so guess a name if necessary.
88 (read-mod-name "modpack.conf" guess))
89 (#t (guess))))
90
91(define* (install #:key inputs #:allow-other-keys #:rest arguments)
92 (apply copy:install
93 #:install-plan (mod-install-plan (apply guess-mod-name arguments))
94 arguments))
95
96(define* (minimise-png #:key inputs native-inputs #:allow-other-keys)
97 "Minimise PNG images found in the working directory."
98 (define optipng (which "optipng"))
99 (define (optimise image)
100 (format #t "Optimising ~a~%" image)
101 (make-file-writable (dirname image))
102 (make-file-writable image)
103 (define old-size (stat:size (stat image)))
104 ;; The mod "technic" has a file "technic_music_player_top.png" that
105 ;; actually is a JPEG file, see
106 ;; <https://github.com/luanti-mods/technic/issues/590>.
107 (if (png-file? image)
108 (invoke optipng "-o4" "-quiet" image)
109 (format #t "warning: skipping ~a because it's not actually a PNG image~%"
110 image))
111 (define new-size (stat:size (stat image)))
112 (values old-size new-size))
113 (define files (find-files "." ".png$"))
114 (let loop ((total-old-size 0)
115 (total-new-size 0)
116 (images (find-files "." ".png$")))
117 (cond ((pair? images)
118 (receive (old-size new-size)
119 (optimise (car images))
120 (loop (+ total-old-size old-size)
121 (+ total-new-size new-size)
122 (cdr images))))
123 ((= total-old-size 0)
124 (format #t "There were no PNG images to minimise."))
125 (#t
126 (format #t "Minimisation reduced size of images by ~,2f% (~,2f MiB to ~,2f MiB)~%"
127 (* 100.0 (- 1 (/ total-new-size total-old-size)))
128 (/ total-old-size (expt 1024 2))
129 (/ total-new-size (expt 1024 2)))))))
130
131(define name-regexp
132 (make-regexp "^name[[:space:]]*=[[:space:]]*([[:graph:]]+)[[:space:]]*$"))
133
134(define* (read-mod-name mod.conf #:optional not-found)
135 "Read the name of a mod from MOD.CONF. If MOD.CONF
136does not have a name field and NOT-FOUND is #false, raise an
137error. If NOT-FOUND is TRUE, call NOT-FOUND instead."
138 (call-with-input-file mod.conf
139 (lambda (port)
140 (let loop ()
141 (define line (read-line port))
142 (if (eof-object? line)
143 (if not-found
144 (not-found)
145 (error "~a does not have a 'name' field" mod.conf))
146 (let ((match (regexp-exec name-regexp line)))
147 (if (regexp-match? match)
148 (string-trim-both (match:substring match 1) #\ )
149 (loop))))))))
150
151(define* (check #:key outputs tests? #:allow-other-keys)
152 "Test whether the mod loads. The mod must first be installed first."
153 (define (all-mod-names directories)
154 (append-map
155 (lambda (directory)
156 (map read-mod-name (find-files directory "mod.conf")))
157 directories))
158 (when tests?
159 (mkdir "guix_testworld")
160 ;; Add the mod to the mod search path, such that Luanti can find it.
161 (setenv "MINETEST_MOD_PATH"
162 (list->search-path-as-string
163 (cons
164 (string-append (assoc-ref outputs "out") "/share/luanti/mods")
165 (search-path-as-string->list
166 (or (getenv "MINETEST_MOD_PATH") "")))
167 ":"))
168 (with-directory-excursion "guix_testworld"
169 (setenv "HOME" (getcwd))
170 ;; Create a world in which all mods are loaded.
171 (call-with-output-file "world.mt"
172 (lambda (port)
173 (display
174 "gameid = minetest
175world_name = guix_testworld
176backend = sqlite3
177player_backend = sqlite3
178auth_backend = sqlite3
179" port)
180 (for-each
181 (lambda (mod)
182 (format port "load_mod_~a = true~%" mod))
183 (all-mod-names (search-path-as-string->list
184 (getenv "MINETEST_MOD_PATH"))))))
185 (receive (port pid)
186 ((@@ (guix build utils) open-pipe-with-stderr)
187 "xvfb-run" "--" "luanti" "--info" "--world" "." "--go")
188 (format #t "Started Luanti with all mods loaded for testing~%")
189 ;; Scan the output for error messages.
190 ;; When the player has joined the server, stop luanti.
191 (define (error? line)
192 (and (string? line)
193 (string-contains line ": ERROR[")))
194 (define (stop? line)
195 (and (string? line)
196 (string-contains line "ACTION[Server]: singleplayer [127.0.0.1] joins game.")))
197 (let loop ((has-errors? #f))
198 (match `(,(read-line port) ,has-errors?)
199 (((? error? line) _)
200 (display line)
201 (newline)
202 (loop #t))
203 (((? stop?) #f)
204 (kill pid SIGINT)
205 (close-port port)
206 (waitpid pid))
207 (((? eof-object?) #f)
208 (error "luanti didn't start"))
209 (((or (? stop?) (? eof-object?)) #t)
210 (error "luanti raised an error"))
211 (((? string? line) has-error?)
212 (display line)
213 (newline)
214 (loop has-error?))))))))
215
216(define %standard-phases
217 (modify-phases gnu:%standard-phases
218 (delete 'bootstrap)
219 (delete 'configure)
220 (add-before 'build 'minimise-png minimise-png)
221 (delete 'build)
222 (delete 'check)
223 (replace 'install install)
224 ;; The 'check' phase requires the mod to be installed,
225 ;; so move the 'check' phase after the 'install' phase.
226 (add-after 'install 'check check)))
227
228;;; luanti-build-system.scm ends here
diff --git a/guix/build/minetest-build-system.scm b/guix/build/minetest-build-system.scm
index 305e9dc1bac..007ff396f6f 100644
--- a/guix/build/minetest-build-system.scm
+++ b/guix/build/minetest-build-system.scm
@@ -1,5 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> 2;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
3;;; Copyright © 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
3;;; 4;;;
4;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
5;;; 6;;;
@@ -17,211 +18,10 @@
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18 19
19(define-module (guix build minetest-build-system) 20(define-module (guix build minetest-build-system)
20 #:use-module (guix build utils) 21 #:use-module (guix build luanti-build-system)
21 #:use-module (srfi srfi-1) 22 #:use-module (guix deprecation)
22 #:use-module (ice-9 format) 23 #:re-export (%standard-phases
23 #:use-module (ice-9 match) 24 mod-install-plan minimise-png read-mod-name check))
24 #:use-module (ice-9 rdelim)
25 #:use-module (ice-9 receive)
26 #:use-module (ice-9 regex)
27 #:use-module (ice-9 exceptions)
28 #:use-module ((guix build gnu-build-system) #:prefix gnu:)
29 #:use-module ((guix build copy-build-system) #:prefix copy:)
30 #:export (%standard-phases
31 mod-install-plan minimise-png read-mod-name check))
32 25
33;; (guix build copy-build-system) does not export 'install'. 26(warn-about-deprecation '(guix build minetest-build-system) #f
34(define copy:install 27 #:replacement '(guix build luanti-build-system))
35 (assoc-ref copy:%standard-phases 'install))
36
37(define (mod-install-plan mod-name)
38 `(("." ,(string-append "share/minetest/mods/" mod-name)
39 ;; Only install files that will actually be used at run time.
40 ;; This can save a little disk space.
41 ;;
42 ;; See <https://github.com/minetest/minetest/blob/master/doc/lua_api.txt>
43 ;; for an incomple list of files that can be found in mods.
44 #:include ("mod.conf" "modpack.conf" "settingtypes.txt" "depends.txt"
45 "description.txt" "config.txt" "_config.txt")
46 #:include-regexp (".lua$" ".png$" ".ogg$" ".obj$" ".b3d$" ".tr$"
47 ".mts$"))))
48
49(define* (guess-mod-name #:key inputs #:allow-other-keys)
50 "Try to determine the name of the mod or modpack that is being built.
51If it is unknown, make an educated guess."
52 ;; Minetest doesn't care about the directory names in "share/minetest/mods"
53 ;; so there is no technical problem if the directory names don't match
54 ;; the mod names. The directory can appear in the GUI if the modpack
55 ;; doesn't have the 'name' set though, so try to make a guess.
56 (define (guess)
57 (let* ((source (assoc-ref inputs "source"))
58 ;; Don't retain a reference to the store.
59 (file-name (strip-store-file-name source))
60 ;; The "minetest-" prefix is not informative, so strip it.
61 (file-name (if (string-prefix? "minetest-" file-name)
62 (substring file-name (string-length "minetest-"))
63 file-name))
64 ;; Strip "-checkout" suffixes of git checkouts.
65 (file-name (if (string-suffix? "-checkout" file-name)
66 (substring file-name
67 0
68 (- (string-length file-name)
69 (string-length "-checkout")))
70 file-name))
71 (first-dot (string-index file-name #\.))
72 ;; If the source code is in an archive (.tar.gz, .zip, ...),
73 ;; strip the extension.
74 (file-name (if first-dot
75 (substring file-name 0 first-dot)
76 file-name)))
77 (format (current-error-port)
78 "warning: the modpack ~a did not set 'name' in 'modpack.conf'~%"
79 file-name)
80 file-name))
81 (cond ((file-exists? "mod.conf")
82 ;; Mods must have 'name' set in "mod.conf", so don't guess.
83 (read-mod-name "mod.conf"))
84 ((file-exists? "modpack.conf")
85 ;; While it is recommended to have 'name' set in 'modpack.conf',
86 ;; it is optional, so guess a name if necessary.
87 (read-mod-name "modpack.conf" guess))
88 (#t (guess))))
89
90(define* (install #:key inputs #:allow-other-keys #:rest arguments)
91 (apply copy:install
92 #:install-plan (mod-install-plan (apply guess-mod-name arguments))
93 arguments))
94
95(define* (minimise-png #:key inputs native-inputs #:allow-other-keys)
96 "Minimise PNG images found in the working directory."
97 (define optipng (which "optipng"))
98 (define (optimise image)
99 (format #t "Optimising ~a~%" image)
100 (make-file-writable (dirname image))
101 (make-file-writable image)
102 (define old-size (stat:size (stat image)))
103 ;; The mod "technic" has a file "technic_music_player_top.png" that
104 ;; actually is a JPEG file, see
105 ;; <https://github.com/minetest-mods/technic/issues/590>.
106 (if (png-file? image)
107 (invoke optipng "-o4" "-quiet" image)
108 (format #t "warning: skipping ~a because it's not actually a PNG image~%"
109 image))
110 (define new-size (stat:size (stat image)))
111 (values old-size new-size))
112 (define files (find-files "." ".png$"))
113 (let loop ((total-old-size 0)
114 (total-new-size 0)
115 (images (find-files "." ".png$")))
116 (cond ((pair? images)
117 (receive (old-size new-size)
118 (optimise (car images))
119 (loop (+ total-old-size old-size)
120 (+ total-new-size new-size)
121 (cdr images))))
122 ((= total-old-size 0)
123 (format #t "There were no PNG images to minimise."))
124 (#t
125 (format #t "Minimisation reduced size of images by ~,2f% (~,2f MiB to ~,2f MiB)~%"
126 (* 100.0 (- 1 (/ total-new-size total-old-size)))
127 (/ total-old-size (expt 1024 2))
128 (/ total-new-size (expt 1024 2)))))))
129
130(define name-regexp
131 (make-regexp "^name[[:space:]]*=[[:space:]]*([[:graph:]]+)[[:space:]]*$"))
132
133(define* (read-mod-name mod.conf #:optional not-found)
134 "Read the name of a mod from MOD.CONF. If MOD.CONF
135does not have a name field and NOT-FOUND is #false, raise an
136error. If NOT-FOUND is TRUE, call NOT-FOUND instead."
137 (call-with-input-file mod.conf
138 (lambda (port)
139 (let loop ()
140 (define line (read-line port))
141 (if (eof-object? line)
142 (if not-found
143 (not-found)
144 (error "~a does not have a 'name' field" mod.conf))
145 (let ((match (regexp-exec name-regexp line)))
146 (if (regexp-match? match)
147 (string-trim-both (match:substring match 1) #\ )
148 (loop))))))))
149
150(define* (check #:key outputs tests? #:allow-other-keys)
151 "Test whether the mod loads. The mod must first be installed first."
152 (define (all-mod-names directories)
153 (append-map
154 (lambda (directory)
155 (map read-mod-name (find-files directory "mod.conf")))
156 directories))
157 (when tests?
158 (mkdir "guix_testworld")
159 ;; Add the mod to the mod search path, such that Minetest can find it.
160 (setenv "MINETEST_MOD_PATH"
161 (list->search-path-as-string
162 (cons
163 (string-append (assoc-ref outputs "out") "/share/minetest/mods")
164 (search-path-as-string->list
165 (or (getenv "MINETEST_MOD_PATH") "")))
166 ":"))
167 (with-directory-excursion "guix_testworld"
168 (setenv "HOME" (getcwd))
169 ;; Create a world in which all mods are loaded.
170 (call-with-output-file "world.mt"
171 (lambda (port)
172 (display
173 "gameid = minetest
174world_name = guix_testworld
175backend = sqlite3
176player_backend = sqlite3
177auth_backend = sqlite3
178" port)
179 (for-each
180 (lambda (mod)
181 (format port "load_mod_~a = true~%" mod))
182 (all-mod-names (search-path-as-string->list
183 (getenv "MINETEST_MOD_PATH"))))))
184 (receive (port pid)
185 ((@@ (guix build utils) open-pipe-with-stderr)
186 "xvfb-run" "--" "minetest" "--info" "--world" "." "--go")
187 (format #t "Started Minetest with all mods loaded for testing~%")
188 ;; Scan the output for error messages.
189 ;; When the player has joined the server, stop minetest.
190 (define (error? line)
191 (and (string? line)
192 (string-contains line ": ERROR[")))
193 (define (stop? line)
194 (and (string? line)
195 (string-contains line "ACTION[Server]: singleplayer [127.0.0.1] joins game.")))
196 (let loop ((has-errors? #f))
197 (match `(,(read-line port) ,has-errors?)
198 (((? error? line) _)
199 (display line)
200 (newline)
201 (loop #t))
202 (((? stop?) #f)
203 (kill pid SIGINT)
204 (close-port port)
205 (waitpid pid))
206 (((? eof-object?) #f)
207 (error "minetest didn't start"))
208 (((or (? stop?) (? eof-object?)) #t)
209 (error "minetest raised an error"))
210 (((? string? line) has-error?)
211 (display line)
212 (newline)
213 (loop has-error?))))))))
214
215(define %standard-phases
216 (modify-phases gnu:%standard-phases
217 (delete 'bootstrap)
218 (delete 'configure)
219 (add-before 'build 'minimise-png minimise-png)
220 (delete 'build)
221 (delete 'check)
222 (replace 'install install)
223 ;; The 'check' phase requires the mod to be installed,
224 ;; so move the 'check' phase after the 'install' phase.
225 (add-after 'install 'check check)))
226
227;;; minetest-build-system.scm ends here
diff --git a/guix/import/luanti.scm b/guix/import/luanti.scm
new file mode 100644
index 00000000000..1db660655ed
--- /dev/null
+++ b/guix/import/luanti.scm
@@ -0,0 +1,520 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
3;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
4;;; Copyright © 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (guix import luanti)
22 #:use-module (ice-9 match)
23 #:use-module (ice-9 threads)
24 #:use-module (ice-9 hash-table)
25 #:use-module (srfi srfi-1)
26 #:use-module (srfi srfi-34)
27 #:use-module (guix diagnostics)
28 #:use-module ((guix packages) #:prefix package:)
29 #:use-module (guix upstream)
30 #:use-module (guix i18n)
31 #:use-module (guix memoization)
32 #:use-module (guix serialization)
33 #:use-module (guix import utils)
34 #:use-module (guix import json)
35 #:use-module (json)
36 #:use-module (guix base32)
37 #:use-module (guix git)
38 #:use-module ((guix git-download) #:prefix download:)
39 #:use-module (guix hash)
40 #:use-module (guix store)
41 #:export (%default-sort-key
42 %contentdb-api
43 json->package
44 contentdb-fetch
45 elaborate-contentdb-name
46 luanti-package?
47 latest-luanti-release
48 luanti->guix-package
49 luanti-recursive-import
50 sort-packages
51 %luanti-updater))
52
53;; The ContentDB API is documented at
54;; <https://content.luanti.net>.
55
56(define %contentdb-api
57 (make-parameter "https://content.luanti.org/api/"))
58
59(define (string-or-false x)
60 (and (string? x) x))
61
62(define (natural-or-false x)
63 (and (exact-integer? x) (>= x 0) x))
64
65;; Descriptions on ContentDB use carriage returns, but Guix doesn't.
66(define (delete-cr text)
67 (string-delete #\cr text))
68
69
70
71;;;
72;;; JSON mappings
73;;;
74
75;; Luanti package.
76;;
77;; API endpoint: /packages/AUTHOR/NAME/
78(define-json-mapping <package> make-package package?
79 json->package
80 (author package-author) ; string
81 (creation-date package-creation-date ; string
82 "created_at")
83 (downloads package-downloads) ; integer
84 (forums package-forums "forums" natural-or-false)
85 (issue-tracker package-issue-tracker "issue_tracker") ; string
86 (license package-license) ; string
87 (long-description package-long-description "long_description") ; string
88 (maintainers package-maintainers ; list of strings
89 "maintainers" vector->list)
90 (media-license package-media-license "media_license") ; string
91 (name package-name) ; string
92 (provides package-provides ; list of strings
93 "provides" vector->list)
94 (release package-release) ; integer
95 (repository package-repository "repo" string-or-false)
96 (score package-score) ; flonum
97 (screenshots package-screenshots "screenshots" vector->list) ; list of strings
98 (short-description package-short-description "short_description") ; string
99 (state package-state) ; string
100 (tags package-tags "tags" vector->list) ; list of strings
101 (thumbnail package-thumbnail) ; string
102 (title package-title) ; string
103 (type package-type) ; string
104 (url package-url) ; string
105 (website package-website "website" string-or-false))
106
107(define-json-mapping <release> make-release release?
108 json->release
109 ;; If present, a git commit identified by its hash
110 (commit release-commit "commit" string-or-false)
111 (downloads release-downloads) ; integer
112 (id release-id) ; integer
113 (max-luanti-version release-max-luanti-version string-or-false)
114 (min-luanti-version release-min-luanti-version string-or-false)
115 (release-date release-data) ; string
116 (title release-title) ; string
117 (url release-url)) ; string
118
119(define-json-mapping <dependency> make-dependency dependency?
120 json->dependency
121 (optional? dependency-optional? "is_optional") ; bool
122 (name dependency-name) ; string
123 (packages dependency-packages "packages" vector->list)) ; list of strings
124
125;; A structure returned by the /api/packages/?fmt=keys endpoint
126(define-json-mapping <package-keys> make-package-keys package-keys?
127 json->package-keys
128 (author package-keys-author) ; string
129 (name package-keys-name) ; string
130 (type package-keys-type)) ; string
131
132(define (package-mod? package)
133 "Is the ContentDB package PACKAGE a mod?"
134 ;; ContentDB also has ‘games’ and ‘texture packs’.
135 (string=? (package-type package) "mod"))
136
137
138
139;;;
140;;; Manipulating names of packages
141;;;
142;;; There are three kind of names:
143;;;
144;;; * names of guix packages, e.g. luanti-basic-materials.
145;;; * names of mods on ContentDB, e.g. basic_materials
146;;; * a combination of author and mod name on ContentDB, e.g. VanessaE/basic_materials
147;;;
148
149(define (%construct-full-name author name)
150 (string-append author "/" name))
151
152(define (package-full-name package)
153 "Given a <package> object, return the corresponding AUTHOR/NAME string."
154 (%construct-full-name (package-author package) (package-name package)))
155
156(define (package-keys-full-name package)
157 "Given a <package-keys> object, return the corresponding AUTHOR/NAME string."
158 (%construct-full-name (package-keys-author package)
159 (package-keys-name package)))
160
161(define (contentdb->package-name author/name)
162 "Given the AUTHOR/NAME of a package on ContentDB, return a Guix-compliant
163name for the package."
164 ;; The author is not included, as the names of popular mods
165 ;; tend to be unique.
166 (string-append "luanti-" (snake-case (author/name->name author/name))))
167
168(define (author/name->name author/name)
169 "Extract NAME from the AUTHOR/NAME string, or raise an error if AUTHOR/NAME
170is ill-formatted."
171 (match (string-split author/name #\/)
172 ((author name)
173 (when (string-null? author)
174 (leave
175 (G_ "In ~a: author names must consist of at least a single character.~%")
176 author/name))
177 (when (string-null? name)
178 (leave
179 (G_ "In ~a: mod names must consist of at least a single character.~%")
180 author/name))
181 name)
182 ((too many . components)
183 (leave
184 (G_ "In ~a: author names and mod names may not contain forward slashes.~%")
185 author/name))
186 ((name)
187 (if (string-null? name)
188 (leave (G_ "mod names may not be empty.~%"))
189 (leave (G_ "The name of the author is missing in ~a.~%")
190 author/name)))))
191
192(define* (elaborate-contentdb-name name #:key (sort %default-sort-key))
193 "If NAME is an AUTHOR/NAME string, return it. Otherwise, try to determine
194the author and return an appropriate AUTHOR/NAME string. If that fails,
195raise an exception."
196 (if (or (string-contains name "/") (string-null? name))
197 ;; Call 'author/name->name' to verify that NAME seems reasonable
198 ;; and raise an appropriate exception if it isn't.
199 (begin
200 (author/name->name name)
201 name)
202 (let* ((package-keys (contentdb-query-packages name #:sort sort))
203 (correctly-named
204 (filter (lambda (package-key)
205 (string=? name (package-keys-name package-key)))
206 package-keys)))
207 (match correctly-named
208 ((one) (package-keys-full-name one))
209 ((too . many)
210 (warning (G_ "~a is ambiguous, presuming ~a (other options include: ~a)~%")
211 name (package-keys-full-name too)
212 (map package-keys-full-name many))
213 (package-keys-full-name too))
214 (()
215 (leave (G_ "No mods with name ~a were found.~%") name))))))
216
217
218
219;;;
220;;; API endpoints
221;;;
222
223(define contentdb-fetch
224 (mlambda (author/name)
225 "Return a <package> record for package AUTHOR/NAME, or #f on failure."
226 (and=> (json-fetch
227 (string-append (%contentdb-api) "packages/" author/name "/"))
228 json->package)))
229
230(define (contentdb-fetch-releases author/name)
231 "Return a list of <release> records for package NAME by AUTHOR, or #f
232on failure."
233 (and=> (json-fetch (string-append (%contentdb-api) "packages/" author/name
234 "/releases/"))
235 (lambda (json)
236 (map json->release (vector->list json)))))
237
238(define (latest-release author/name)
239 "Return the latest source release for package NAME by AUTHOR,
240or #f if this package does not exist."
241 (and=> (contentdb-fetch-releases author/name)
242 car))
243
244(define (contentdb-fetch-dependencies author/name)
245 "Return an alist of lists of <dependency> records for package NAME by AUTHOR
246and possibly some other packages as well, or #f on failure."
247 (define url (string-append (%contentdb-api) "packages/" author/name
248 "/dependencies/"))
249 (and=> (json-fetch url)
250 (lambda (json)
251 (map (match-lambda
252 ((key . value)
253 (cons key (map json->dependency (vector->list value)))))
254 json))))
255
256(define* (contentdb-query-packages q #:key
257 (type "mod")
258 (limit 50)
259 (sort %default-sort-key)
260 (order "desc"))
261 "Search ContentDB for Q (a string). Sort by SORT, in ascending order
262if ORDER is \"asc\" or descending order if ORDER is \"desc\". TYPE must
263be \"mod\", \"game\" or \"txp\", restricting the search results to
264respectively mods, games and texture packs. Limit to at most LIMIT
265results. The return value is a list of <package-keys> records."
266 ;; XXX does Guile have something for constructing (and, when necessary,
267 ;; escaping) query strings?
268 (define url (string-append (%contentdb-api) "packages/?type=" type
269 "&q=" q "&fmt=keys"
270 "&limit=" (number->string limit)
271 "&order=" order
272 "&sort=" sort))
273 (let ((json (json-fetch url)))
274 (if json
275 (map json->package-keys (vector->list json))
276 (leave
277 (G_ "The package search API doesn't exist anymore.~%")))))
278
279
280
281;; XXX copied from (guix import elpa)
282(define* (download-git-repository url ref)
283 "Fetch the given REF from the Git repository at URL."
284 (with-store store
285 (latest-repository-commit store url #:ref ref)))
286
287(define (make-luanti-sexp author/name version repository commit
288 inputs home-page synopsis
289 description media-license license)
290 "Return a S-expression for the luanti package with the given author/NAME,
291VERSION, REPOSITORY, COMMIT, INPUTS, HOME-PAGE, SYNOPSIS, DESCRIPTION,
292MEDIA-LICENSE and LICENSE."
293 `(package
294 (name ,(contentdb->package-name author/name))
295 (version ,version)
296 (source
297 (origin
298 (method git-fetch)
299 (uri (git-reference
300 (url ,repository)
301 (commit ,commit)))
302 (sha256
303 (base32
304 ;; The git commit is not always available.
305 ,(and commit
306 (bytevector->nix-base32-string
307 (file-hash*
308 (download-git-repository repository
309 `(commit . ,commit))
310 ;; 'download-git-repository' already filtered out the '.git'
311 ;; directory.
312 #:select? (const #true)
313 #:recursive? #true)))))
314 (file-name (git-file-name name version))))
315 (build-system luanti-mod-build-system)
316 ,@(maybe-propagated-inputs (map contentdb->package-name inputs))
317 (home-page ,home-page)
318 (synopsis ,(delete-cr synopsis))
319 (description ,(beautify-description (delete-cr description)))
320 (license ,(if (eq? media-license license)
321 license
322 `(list ,media-license ,license)))
323 ;; The Luanti updater (not yet in Guix; it requires not-yet-submitted
324 ;; patches to (guix upstream) that require some work) needs to know both
325 ;; the author name and mod name for efficiency.
326 (properties ,(list 'quasiquote `((upstream-name . ,author/name))))))
327
328(define (package-home-page package)
329 "Guess the home page of the ContentDB package PACKAGE.
330
331In order of preference, try the 'website', the forum topic on the
332official Luanti forum and the Git repository (if any)."
333 (define (topic->url-sexp topic)
334 ;; 'luanti-topic' is a procedure defined in (gnu packages luanti)
335 `(luanti-topic ,topic))
336 (or (package-website package)
337 (and=> (package-forums package) topic->url-sexp)
338 (package-repository package)))
339
340(define (release-version release)
341 "Guess the version of RELEASE from the release title."
342 (define title (release-title release))
343 (if (string-prefix? "v" title)
344 ;; Remove "v" prefix from release titles like ‘v1.0.1’.
345 (substring title 1)
346 title))
347
348(define (version-style version)
349 "Determine the kind of version number VERSION is -- a date, or a conventional
350conventional version number."
351 (define dots? (->bool (string-index version #\.)))
352 (define hyphens? (->bool (string-index version #\-)))
353 (match (cons dots? hyphens?)
354 ((#true . #false) 'regular) ; something like "0.1"
355 ((#false . #false) 'regular) ; single component version number
356 ((#true . #true) 'regular) ; result of 'git-version'
357 ((#false . #true) 'date))) ; something like "2021-01-25"
358
359;; If the default sort key is changed, make sure to modify 'show-help'
360;; in (guix scripts import luanti) appropriately as well.
361(define %default-sort-key "score")
362
363(define* (sort-packages packages #:key (sort %default-sort-key))
364 "Sort PACKAGES by SORT, in descending order."
365 (define package->key
366 (match sort
367 ("score" package-score)
368 ("downloads" package-downloads)))
369 (define (greater x y)
370 (> (package->key x) (package->key y)))
371 (sort-list packages greater))
372
373(define builtin-mod?
374 (let ((%builtin-mods
375 (alist->hash-table
376 (map (lambda (x) (cons x #t))
377 '("beds" "binoculars" "boats" "bones" "bucket" "butterflies"
378 "carts" "creative" "default" "doors" "dungeon_loot" "dye"
379 "env_sounds" "farming" "fire" "fireflies" "flowers"
380 "game_commands" "give_initial_stuff" "map" "mtg_craftguide"
381 "player_api" "screwdriver" "sethome" "sfinv" "spawn" "stairs"
382 "tnt" "vessels" "walls" "weather" "wool" "xpanes")))))
383 (lambda (mod)
384 "Is MOD provided by the default luanti subgame?"
385 (hash-ref %builtin-mods mod))))
386
387(define* (important-dependencies dependencies author/name
388 #:key (sort %default-sort-key))
389 "Return the hard dependencies of AUTHOR/NAME in the association list
390DEPENDENCIES as a list of AUTHOR/NAME strings."
391 (define dependency-list
392 (assoc-ref dependencies author/name))
393 ;; A mod can have multiple dependencies implemented by the same mod,
394 ;; so remove duplicate mod names.
395 (define (filter-deduplicate-map f list)
396 (delete-duplicates (filter-map f list)))
397 (filter-deduplicate-map
398 (lambda (dependency)
399 (and (not (dependency-optional? dependency))
400 (not (builtin-mod? (dependency-name dependency)))
401 ;; The dependency information contains symbolic names
402 ;; that can be ‘provided’ by multiple mods, so we need to choose one
403 ;; of the implementations.
404 (let* ((implementations
405 (par-map contentdb-fetch (dependency-packages dependency)))
406 ;; Fetching package information about the packages is racy:
407 ;; some packages might be removed from ContentDB between the
408 ;; construction of DEPENDENCIES and the call to
409 ;; 'contentdb-fetch'. So filter out #f.
410 ;;
411 ;; Filter out ‘games’ that include the requested mod -- it's
412 ;; the mod itself we want.
413 (mods (filter (lambda (p) (and=> p package-mod?))
414 implementations))
415 (sorted-mods (sort-packages mods #:sort sort)))
416 (match sorted-mods
417 ((package) (package-full-name package))
418 ((too . many)
419 (warning
420 (G_ "The dependency ~a of ~a has multiple different implementations ~a.~%")
421 (dependency-name dependency)
422 author/name
423 (map package-full-name sorted-mods))
424 (match sort
425 ("score"
426 (warning
427 (G_ "The implementation with the highest score will be chosen!~%")))
428 ("downloads"
429 (warning
430 (G_ "The implementation that has been downloaded the most will be chosen!~%"))))
431 (package-full-name too))
432 (()
433 (warning
434 (G_ "The dependency ~a of ~a does not have any implementation. It will be ignored!~%")
435 (dependency-name dependency) author/name)
436 #f)))))
437 dependency-list))
438
439(define* (%luanti->guix-package author/name #:key (sort %default-sort-key)
440 #:allow-other-keys)
441 "Fetch the metadata for AUTHOR/NAME from https://content.luanti.net, and
442return the 'package' S-expression corresponding to that package, or raise an
443exception on failure. On success, also return the upstream dependencies as a
444list of AUTHOR/NAME strings."
445 ;; Call 'author/name->name' to verify that AUTHOR/NAME seems reasonable.
446 (author/name->name author/name)
447 (define package (contentdb-fetch author/name))
448 (unless package
449 (leave (G_ "no package metadata for ~a on ContentDB~%") author/name))
450 (define dependencies (contentdb-fetch-dependencies author/name))
451 (unless dependencies
452 (leave (G_ "no dependency information for ~a on ContentDB~%") author/name))
453 (define release (latest-release author/name))
454 (unless release
455 (leave (G_ "no release of ~a on ContentDB~%") author/name))
456 (define important-upstream-dependencies
457 (important-dependencies dependencies author/name #:sort sort))
458 (values (make-luanti-sexp author/name
459 (release-version release)
460 (package-repository package)
461 (release-commit release)
462 important-upstream-dependencies
463 (package-home-page package)
464 (package-short-description package)
465 (package-long-description package)
466 (spdx-string->license
467 (package-media-license package))
468 (spdx-string->license
469 (package-license package)))
470 important-upstream-dependencies))
471
472(define luanti->guix-package
473 (memoize %luanti->guix-package))
474
475(define* (luanti-recursive-import author/name #:key (sort %default-sort-key))
476 (define* (luanti->guix-package* author/name #:key version #:allow-other-keys)
477 (luanti->guix-package author/name #:sort sort))
478 (recursive-import author/name
479 #:repo->guix-package luanti->guix-package*
480 #:guix-name contentdb->package-name))
481
482(define (luanti-package? pkg)
483 "Is PKG a Luanti mod on ContentDB?"
484 (and (string-prefix? "luanti-" (package:package-name pkg))
485 (assq-ref (package:package-properties pkg) 'upstream-name)))
486
487(define* (latest-luanti-release pkg #:key version partial-version?)
488 "Return an <upstream-source> for the latest release of the package PKG,
489or #false if the latest release couldn't be determined."
490 (define author/name
491 (assq-ref (package:package-properties pkg) 'upstream-name))
492 (define contentdb-package (contentdb-fetch author/name)) ; TODO warn if #f?
493 (define release (latest-release author/name))
494 (define source (package:package-source pkg))
495
496 (when version
497 (raise
498 (formatted-message
499 (G_ "~a updater doesn't support updating to a specific version, sorry.")
500 "luanti")))
501 (and contentdb-package release
502 (release-commit release) ; not always set
503 ;; Only continue if both the old and new version number are both
504 ;; dates or regular version numbers, as two different styles confuses
505 ;; the logic for determining which version is newer.
506 (eq? (version-style (release-version release))
507 (version-style (package:package-version pkg)))
508 (upstream-source
509 (package (package:package-name pkg))
510 (version (release-version release))
511 (urls (download:git-reference
512 (url (package-repository contentdb-package))
513 (commit (release-commit release)))))))
514
515(define %luanti-updater
516 (upstream-updater
517 (name 'luanti)
518 (description "Updater for Luanti packages on ContentDB")
519 (pred luanti-package?)
520 (import latest-luanti-release)))
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index a46296cdc4a..c20a6732000 100644
--- a/guix/import/minetest.scm
+++ b/guix/import/minetest.scm
@@ -1,6 +1,7 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be> 2;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
3;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com> 3;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
4;;; Copyright © 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
4;;; 5;;;
5;;; This file is part of GNU Guix. 6;;; This file is part of GNU Guix.
6;;; 7;;;
@@ -18,502 +19,22 @@
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 20
20(define-module (guix import minetest) 21(define-module (guix import minetest)
21 #:use-module (ice-9 match) 22 #:use-module (guix deprecation)
22 #:use-module (ice-9 threads) 23 #:use-module (guix import luanti)
23 #:use-module (ice-9 hash-table) 24 #:re-export (%default-sort-key
24 #:use-module (srfi srfi-1) 25 %contentdb-api
25 #:use-module (srfi srfi-34) 26 json->package
26 #:use-module (guix diagnostics) 27 contentdb-fetch
27 #:use-module ((guix packages) #:prefix package:) 28 elaborate-contentdb-name
28 #:use-module (guix upstream) 29 sort-packages)
29 #:use-module (guix i18n) 30 #:export (minetest-package?
30 #:use-module (guix memoization) 31 latest-minetest-release
31 #:use-module (guix serialization) 32 minetest->guix-package
32 #:use-module (guix import utils) 33 minetest-recursive-import
33 #:use-module (guix import json) 34 %minetest-updater))
34 #:use-module (json) 35
35 #:use-module (guix base32) 36(define-deprecated/alias minetest-package? luanti-package?)
36 #:use-module (guix git) 37(define-deprecated/alias latest-minetest-release latest-luanti-release)
37 #:use-module ((guix git-download) #:prefix download:) 38(define-deprecated/alias minetest->guix-package luanti->guix-package)
38 #:use-module (guix hash) 39(define-deprecated/alias minetest-recursive-import luanti-recursive-import)
39 #:use-module (guix store) 40(define-deprecated/alias %minetest-updater %luanti-updater)
40 #:export (%default-sort-key
41 %contentdb-api
42 json->package
43 contentdb-fetch
44 elaborate-contentdb-name
45 minetest-package?
46 latest-minetest-release
47 minetest->guix-package
48 minetest-recursive-import
49 sort-packages
50 %minetest-updater))
51
52;; The ContentDB API is documented at
53;; <https://content.minetest.net>.
54
55(define %contentdb-api
56 (make-parameter "https://content.minetest.net/api/"))
57
58(define (string-or-false x)
59 (and (string? x) x))
60
61(define (natural-or-false x)
62 (and (exact-integer? x) (>= x 0) x))
63
64;; Descriptions on ContentDB use carriage returns, but Guix doesn't.
65(define (delete-cr text)
66 (string-delete #\cr text))
67
68
69
70;;;
71;;; JSON mappings
72;;;
73
74;; Minetest package.
75;;
76;; API endpoint: /packages/AUTHOR/NAME/
77(define-json-mapping <package> make-package package?
78 json->package
79 (author package-author) ; string
80 (creation-date package-creation-date ; string
81 "created_at")
82 (downloads package-downloads) ; integer
83 (forums package-forums "forums" natural-or-false)
84 (issue-tracker package-issue-tracker "issue_tracker") ; string
85 (license package-license) ; string
86 (long-description package-long-description "long_description") ; string
87 (maintainers package-maintainers ; list of strings
88 "maintainers" vector->list)
89 (media-license package-media-license "media_license") ; string
90 (name package-name) ; string
91 (provides package-provides ; list of strings
92 "provides" vector->list)
93 (release package-release) ; integer
94 (repository package-repository "repo" string-or-false)
95 (score package-score) ; flonum
96 (screenshots package-screenshots "screenshots" vector->list) ; list of strings
97 (short-description package-short-description "short_description") ; string
98 (state package-state) ; string
99 (tags package-tags "tags" vector->list) ; list of strings
100 (thumbnail package-thumbnail) ; string
101 (title package-title) ; string
102 (type package-type) ; string
103 (url package-url) ; string
104 (website package-website "website" string-or-false))
105
106(define-json-mapping <release> make-release release?
107 json->release
108 ;; If present, a git commit identified by its hash
109 (commit release-commit "commit" string-or-false)
110 (downloads release-downloads) ; integer
111 (id release-id) ; integer
112 (max-minetest-version release-max-minetest-version string-or-false)
113 (min-minetest-version release-min-minetest-version string-or-false)
114 (release-date release-data) ; string
115 (title release-title) ; string
116 (url release-url)) ; string
117
118(define-json-mapping <dependency> make-dependency dependency?
119 json->dependency
120 (optional? dependency-optional? "is_optional") ; bool
121 (name dependency-name) ; string
122 (packages dependency-packages "packages" vector->list)) ; list of strings
123
124;; A structure returned by the /api/packages/?fmt=keys endpoint
125(define-json-mapping <package-keys> make-package-keys package-keys?
126 json->package-keys
127 (author package-keys-author) ; string
128 (name package-keys-name) ; string
129 (type package-keys-type)) ; string
130
131(define (package-mod? package)
132 "Is the ContentDB package PACKAGE a mod?"
133 ;; ContentDB also has ‘games’ and ‘texture packs’.
134 (string=? (package-type package) "mod"))
135
136
137
138;;;
139;;; Manipulating names of packages
140;;;
141;;; There are three kind of names:
142;;;
143;;; * names of guix packages, e.g. minetest-basic-materials.
144;;; * names of mods on ContentDB, e.g. basic_materials
145;;; * a combination of author and mod name on ContentDB, e.g. VanessaE/basic_materials
146;;;
147
148(define (%construct-full-name author name)
149 (string-append author "/" name))
150
151(define (package-full-name package)
152 "Given a <package> object, return the corresponding AUTHOR/NAME string."
153 (%construct-full-name (package-author package) (package-name package)))
154
155(define (package-keys-full-name package)
156 "Given a <package-keys> object, return the corresponding AUTHOR/NAME string."
157 (%construct-full-name (package-keys-author package)
158 (package-keys-name package)))
159
160(define (contentdb->package-name author/name)
161 "Given the AUTHOR/NAME of a package on ContentDB, return a Guix-compliant
162name for the package."
163 ;; The author is not included, as the names of popular mods
164 ;; tend to be unique.
165 (string-append "minetest-" (snake-case (author/name->name author/name))))
166
167(define (author/name->name author/name)
168 "Extract NAME from the AUTHOR/NAME string, or raise an error if AUTHOR/NAME
169is ill-formatted."
170 (match (string-split author/name #\/)
171 ((author name)
172 (when (string-null? author)
173 (leave
174 (G_ "In ~a: author names must consist of at least a single character.~%")
175 author/name))
176 (when (string-null? name)
177 (leave
178 (G_ "In ~a: mod names must consist of at least a single character.~%")
179 author/name))
180 name)
181 ((too many . components)
182 (leave
183 (G_ "In ~a: author names and mod names may not contain forward slashes.~%")
184 author/name))
185 ((name)
186 (if (string-null? name)
187 (leave (G_ "mod names may not be empty.~%"))
188 (leave (G_ "The name of the author is missing in ~a.~%")
189 author/name)))))
190
191(define* (elaborate-contentdb-name name #:key (sort %default-sort-key))
192 "If NAME is an AUTHOR/NAME string, return it. Otherwise, try to determine
193the author and return an appropriate AUTHOR/NAME string. If that fails,
194raise an exception."
195 (if (or (string-contains name "/") (string-null? name))
196 ;; Call 'author/name->name' to verify that NAME seems reasonable
197 ;; and raise an appropriate exception if it isn't.
198 (begin
199 (author/name->name name)
200 name)
201 (let* ((package-keys (contentdb-query-packages name #:sort sort))
202 (correctly-named
203 (filter (lambda (package-key)
204 (string=? name (package-keys-name package-key)))
205 package-keys)))
206 (match correctly-named
207 ((one) (package-keys-full-name one))
208 ((too . many)
209 (warning (G_ "~a is ambiguous, presuming ~a (other options include: ~a)~%")
210 name (package-keys-full-name too)
211 (map package-keys-full-name many))
212 (package-keys-full-name too))
213 (()
214 (leave (G_ "No mods with name ~a were found.~%") name))))))
215
216
217
218;;;
219;;; API endpoints
220;;;
221
222(define contentdb-fetch
223 (mlambda (author/name)
224 "Return a <package> record for package AUTHOR/NAME, or #f on failure."
225 (and=> (json-fetch
226 (string-append (%contentdb-api) "packages/" author/name "/"))
227 json->package)))
228
229(define (contentdb-fetch-releases author/name)
230 "Return a list of <release> records for package NAME by AUTHOR, or #f
231on failure."
232 (and=> (json-fetch (string-append (%contentdb-api) "packages/" author/name
233 "/releases/"))
234 (lambda (json)
235 (map json->release (vector->list json)))))
236
237(define (latest-release author/name)
238 "Return the latest source release for package NAME by AUTHOR,
239or #f if this package does not exist."
240 (and=> (contentdb-fetch-releases author/name)
241 car))
242
243(define (contentdb-fetch-dependencies author/name)
244 "Return an alist of lists of <dependency> records for package NAME by AUTHOR
245and possibly some other packages as well, or #f on failure."
246 (define url (string-append (%contentdb-api) "packages/" author/name
247 "/dependencies/"))
248 (and=> (json-fetch url)
249 (lambda (json)
250 (map (match-lambda
251 ((key . value)
252 (cons key (map json->dependency (vector->list value)))))
253 json))))
254
255(define* (contentdb-query-packages q #:key
256 (type "mod")
257 (limit 50)
258 (sort %default-sort-key)
259 (order "desc"))
260 "Search ContentDB for Q (a string). Sort by SORT, in ascending order
261if ORDER is \"asc\" or descending order if ORDER is \"desc\". TYPE must
262be \"mod\", \"game\" or \"txp\", restricting the search results to
263respectively mods, games and texture packs. Limit to at most LIMIT
264results. The return value is a list of <package-keys> records."
265 ;; XXX does Guile have something for constructing (and, when necessary,
266 ;; escaping) query strings?
267 (define url (string-append (%contentdb-api) "packages/?type=" type
268 "&q=" q "&fmt=keys"
269 "&limit=" (number->string limit)
270 "&order=" order
271 "&sort=" sort))
272 (let ((json (json-fetch url)))
273 (if json
274 (map json->package-keys (vector->list json))
275 (leave
276 (G_ "The package search API doesn't exist anymore.~%")))))
277
278
279
280;; XXX copied from (guix import elpa)
281(define* (download-git-repository url ref)
282 "Fetch the given REF from the Git repository at URL."
283 (with-store store
284 (latest-repository-commit store url #:ref ref)))
285
286(define (make-minetest-sexp author/name version repository commit
287 inputs home-page synopsis
288 description media-license license)
289 "Return a S-expression for the minetest package with the given author/NAME,
290VERSION, REPOSITORY, COMMIT, INPUTS, HOME-PAGE, SYNOPSIS, DESCRIPTION,
291MEDIA-LICENSE and LICENSE."
292 `(package
293 (name ,(contentdb->package-name author/name))
294 (version ,version)
295 (source
296 (origin
297 (method git-fetch)
298 (uri (git-reference
299 (url ,repository)
300 (commit ,commit)))
301 (sha256
302 (base32
303 ;; The git commit is not always available.
304 ,(and commit
305 (bytevector->nix-base32-string
306 (file-hash*
307 (download-git-repository repository
308 `(commit . ,commit))
309 ;; 'download-git-repository' already filtered out the '.git'
310 ;; directory.
311 #:select? (const #true)
312 #:recursive? #true)))))
313 (file-name (git-file-name name version))))
314 (build-system minetest-mod-build-system)
315 ,@(maybe-propagated-inputs (map contentdb->package-name inputs))
316 (home-page ,home-page)
317 (synopsis ,(delete-cr synopsis))
318 (description ,(beautify-description (delete-cr description)))
319 (license ,(if (eq? media-license license)
320 license
321 `(list ,media-license ,license)))
322 ;; The Minetest updater (not yet in Guix; it requires not-yet-submitted
323 ;; patches to (guix upstream) that require some work) needs to know both
324 ;; the author name and mod name for efficiency.
325 (properties ,(list 'quasiquote `((upstream-name . ,author/name))))))
326
327(define (package-home-page package)
328 "Guess the home page of the ContentDB package PACKAGE.
329
330In order of preference, try the 'website', the forum topic on the
331official Minetest forum and the Git repository (if any)."
332 (define (topic->url-sexp topic)
333 ;; 'minetest-topic' is a procedure defined in (gnu packages minetest)
334 `(minetest-topic ,topic))
335 (or (package-website package)
336 (and=> (package-forums package) topic->url-sexp)
337 (package-repository package)))
338
339(define (release-version release)
340 "Guess the version of RELEASE from the release title."
341 (define title (release-title release))
342 (if (string-prefix? "v" title)
343 ;; Remove "v" prefix from release titles like ‘v1.0.1’.
344 (substring title 1)
345 title))
346
347(define (version-style version)
348 "Determine the kind of version number VERSION is -- a date, or a conventional
349conventional version number."
350 (define dots? (->bool (string-index version #\.)))
351 (define hyphens? (->bool (string-index version #\-)))
352 (match (cons dots? hyphens?)
353 ((#true . #false) 'regular) ; something like "0.1"
354 ((#false . #false) 'regular) ; single component version number
355 ((#true . #true) 'regular) ; result of 'git-version'
356 ((#false . #true) 'date))) ; something like "2021-01-25"
357
358;; If the default sort key is changed, make sure to modify 'show-help'
359;; in (guix scripts import minetest) appropriately as well.
360(define %default-sort-key "score")
361
362(define* (sort-packages packages #:key (sort %default-sort-key))
363 "Sort PACKAGES by SORT, in descending order."
364 (define package->key
365 (match sort
366 ("score" package-score)
367 ("downloads" package-downloads)))
368 (define (greater x y)
369 (> (package->key x) (package->key y)))
370 (sort-list packages greater))
371
372(define builtin-mod?
373 (let ((%builtin-mods
374 (alist->hash-table
375 (map (lambda (x) (cons x #t))
376 '("beds" "binoculars" "boats" "bones" "bucket" "butterflies"
377 "carts" "creative" "default" "doors" "dungeon_loot" "dye"
378 "env_sounds" "farming" "fire" "fireflies" "flowers"
379 "game_commands" "give_initial_stuff" "map" "mtg_craftguide"
380 "player_api" "screwdriver" "sethome" "sfinv" "spawn" "stairs"
381 "tnt" "vessels" "walls" "weather" "wool" "xpanes")))))
382 (lambda (mod)
383 "Is MOD provided by the default minetest subgame?"
384 (hash-ref %builtin-mods mod))))
385
386(define* (important-dependencies dependencies author/name
387 #:key (sort %default-sort-key))
388 "Return the hard dependencies of AUTHOR/NAME in the association list
389DEPENDENCIES as a list of AUTHOR/NAME strings."
390 (define dependency-list
391 (assoc-ref dependencies author/name))
392 ;; A mod can have multiple dependencies implemented by the same mod,
393 ;; so remove duplicate mod names.
394 (define (filter-deduplicate-map f list)
395 (delete-duplicates (filter-map f list)))
396 (filter-deduplicate-map
397 (lambda (dependency)
398 (and (not (dependency-optional? dependency))
399 (not (builtin-mod? (dependency-name dependency)))
400 ;; The dependency information contains symbolic names
401 ;; that can be ‘provided’ by multiple mods, so we need to choose one
402 ;; of the implementations.
403 (let* ((implementations
404 (par-map contentdb-fetch (dependency-packages dependency)))
405 ;; Fetching package information about the packages is racy:
406 ;; some packages might be removed from ContentDB between the
407 ;; construction of DEPENDENCIES and the call to
408 ;; 'contentdb-fetch'. So filter out #f.
409 ;;
410 ;; Filter out ‘games’ that include the requested mod -- it's
411 ;; the mod itself we want.
412 (mods (filter (lambda (p) (and=> p package-mod?))
413 implementations))
414 (sorted-mods (sort-packages mods #:sort sort)))
415 (match sorted-mods
416 ((package) (package-full-name package))
417 ((too . many)
418 (warning
419 (G_ "The dependency ~a of ~a has multiple different implementations ~a.~%")
420 (dependency-name dependency)
421 author/name
422 (map package-full-name sorted-mods))
423 (match sort
424 ("score"
425 (warning
426 (G_ "The implementation with the highest score will be chosen!~%")))
427 ("downloads"
428 (warning
429 (G_ "The implementation that has been downloaded the most will be chosen!~%"))))
430 (package-full-name too))
431 (()
432 (warning
433 (G_ "The dependency ~a of ~a does not have any implementation. It will be ignored!~%")
434 (dependency-name dependency) author/name)
435 #f)))))
436 dependency-list))
437
438(define* (%minetest->guix-package author/name #:key (sort %default-sort-key)
439 #:allow-other-keys)
440 "Fetch the metadata for AUTHOR/NAME from https://content.minetest.net, and
441return the 'package' S-expression corresponding to that package, or raise an
442exception on failure. On success, also return the upstream dependencies as a
443list of AUTHOR/NAME strings."
444 ;; Call 'author/name->name' to verify that AUTHOR/NAME seems reasonable.
445 (author/name->name author/name)
446 (define package (contentdb-fetch author/name))
447 (unless package
448 (leave (G_ "no package metadata for ~a on ContentDB~%") author/name))
449 (define dependencies (contentdb-fetch-dependencies author/name))
450 (unless dependencies
451 (leave (G_ "no dependency information for ~a on ContentDB~%") author/name))
452 (define release (latest-release author/name))
453 (unless release
454 (leave (G_ "no release of ~a on ContentDB~%") author/name))
455 (define important-upstream-dependencies
456 (important-dependencies dependencies author/name #:sort sort))
457 (values (make-minetest-sexp author/name
458 (release-version release)
459 (package-repository package)
460 (release-commit release)
461 important-upstream-dependencies
462 (package-home-page package)
463 (package-short-description package)
464 (package-long-description package)
465 (spdx-string->license
466 (package-media-license package))
467 (spdx-string->license
468 (package-license package)))
469 important-upstream-dependencies))
470
471(define minetest->guix-package
472 (memoize %minetest->guix-package))
473
474(define* (minetest-recursive-import author/name #:key (sort %default-sort-key))
475 (define* (minetest->guix-package* author/name #:key version #:allow-other-keys)
476 (minetest->guix-package author/name #:sort sort))
477 (recursive-import author/name
478 #:repo->guix-package minetest->guix-package*
479 #:guix-name contentdb->package-name))
480
481(define (minetest-package? pkg)
482 "Is PKG a Minetest mod on ContentDB?"
483 (and (string-prefix? "minetest-" (package:package-name pkg))
484 (assq-ref (package:package-properties pkg) 'upstream-name)))
485
486(define* (latest-minetest-release pkg #:key version partial-version?)
487 "Return an <upstream-source> for the latest release of the package PKG,
488or #false if the latest release couldn't be determined."
489 (define author/name
490 (assq-ref (package:package-properties pkg) 'upstream-name))
491 (define contentdb-package (contentdb-fetch author/name)) ; TODO warn if #f?
492 (define release (latest-release author/name))
493 (define source (package:package-source pkg))
494
495 (when version
496 (raise
497 (formatted-message
498 (G_ "~a updater doesn't support updating to a specific version, sorry.")
499 "minetest")))
500 (and contentdb-package release
501 (release-commit release) ; not always set
502 ;; Only continue if both the old and new version number are both
503 ;; dates or regular version numbers, as two different styles confuses
504 ;; the logic for determining which version is newer.
505 (eq? (version-style (release-version release))
506 (version-style (package:package-version pkg)))
507 (upstream-source
508 (package (package:package-name pkg))
509 (version (release-version release))
510 (urls (download:git-reference
511 (url (package-repository contentdb-package))
512 (commit (release-commit release)))))))
513
514(define %minetest-updater
515 (upstream-updater
516 (name 'minetest)
517 (description "Updater for Minetest packages on ContentDB")
518 (pred minetest-package?)
519 (import latest-minetest-release)))
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index 0d5256a8159..9db49191562 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -50,7 +50,8 @@
50;; The list of all known importers. These are printed in order by SHOW-HELP, so 50;; The list of all known importers. These are printed in order by SHOW-HELP, so
51;; please keep this list alphabetically sorted! 51;; please keep this list alphabetically sorted!
52(define importers '("composer" "cpan" "cran" "crate" "egg" "elm" "elpa" 52(define importers '("composer" "cpan" "cran" "crate" "egg" "elm" "elpa"
53 "gem" "gnu" "go" "hackage" "hexpm" "json" "minetest" 53 "gem" "gnu" "go" "hackage" "hexpm" "json" "luanti"
54 "minetest" ; deprecated
54 "npm-binary" "nuget" "opam" "pypi" "stackage" "texlive")) 55 "npm-binary" "nuget" "opam" "pypi" "stackage" "texlive"))
55 56
56(define (resolve-importer name) 57(define (resolve-importer name)
diff --git a/guix/scripts/import/luanti.scm b/guix/scripts/import/luanti.scm
new file mode 100644
index 00000000000..51355abbbf0
--- /dev/null
+++ b/guix/scripts/import/luanti.scm
@@ -0,0 +1,118 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 David Thompson <davet@gnu.org>
3;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
4;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
5;;; Copyright © 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (guix scripts import luanti)
23 #:use-module (guix ui)
24 #:use-module (guix utils)
25 #:use-module (guix scripts)
26 #:use-module (guix import luanti)
27 #:use-module (guix import utils)
28 #:use-module (guix scripts import)
29 #:use-module (srfi srfi-1)
30 #:use-module (srfi srfi-11)
31 #:use-module (srfi srfi-37)
32 #:use-module (ice-9 match)
33 #:use-module (ice-9 format)
34 #:export (guix-import-luanti))
35
36
37;;;
38;;; Command-line options.
39;;;
40
41(define %default-options
42 `((sort . ,%default-sort-key)))
43
44(define (show-help)
45 (display (G_ "Usage: guix import luanti AUTHOR/NAME
46Import and convert the Luanti mod NAME by AUTHOR from ContentDB.\n"))
47 (display (G_ "
48 -h, --help display this help and exit"))
49 (display (G_ "
50 -r, --recursive import packages recursively"))
51 (display (G_ "
52 -V, --version display version information and exit"))
53 (display (G_ "
54 --sort=KEY when choosing between multiple implementations,
55 choose the one with the highest value for KEY
56 (one of \"score\" (standard) or \"downloads\")"))
57 (newline)
58 (show-bug-report-information))
59
60(define (verify-sort-order sort)
61 "Verify SORT can be used to sort mods by."
62 (unless (member sort '("score" "downloads" "reviews"))
63 (leave (G_ "~a: not a valid key to sort by~%") sort))
64 sort)
65
66(define %options
67 ;; Specification of the command-line options.
68 (cons* (option '(#\h "help") #f #f
69 (lambda args
70 (show-help)
71 (exit 0)))
72 (option '(#\V "version") #f #f
73 (lambda args
74 (show-version-and-exit "guix import luanti")))
75 (option '(#\r "recursive") #f #f
76 (lambda (opt name arg result)
77 (alist-cons 'recursive #t result)))
78 (option '("sort") #t #f
79 (lambda (opt name arg result)
80 (alist-cons 'sort (verify-sort-order arg) result)))
81 %standard-import-options))
82
83
84;;;
85;;; Entry point.
86;;;
87
88(define (guix-import-luanti . args)
89 (define (parse-options)
90 ;; Return the alist of option values.
91 (args-fold* args %options
92 (lambda (opt name arg result)
93 (leave (G_ "~A: unrecognized option~%") name))
94 (lambda (arg result)
95 (alist-cons 'argument arg result))
96 %default-options))
97
98 (let* ((opts (parse-options))
99 (args (filter-map (match-lambda
100 (('argument . value)
101 value)
102 (_ #f))
103 (reverse opts))))
104 (match args
105 ((name)
106 (with-error-handling
107 (let* ((sort (assoc-ref opts 'sort))
108 (author/name (elaborate-contentdb-name name #:sort sort)))
109 (if (assoc-ref opts 'recursive)
110 ;; Recursive import
111 (filter-map package->definition
112 (luanti-recursive-import author/name #:sort sort))
113 ;; Single import
114 (luanti->guix-package author/name #:sort sort)))))
115 (()
116 (leave (G_ "too few arguments~%")))
117 ((many ...)
118 (leave (G_ "too many arguments~%"))))))
diff --git a/guix/scripts/import/minetest.scm b/guix/scripts/import/minetest.scm
index 5f204d90fce..2bfbbd3c021 100644
--- a/guix/scripts/import/minetest.scm
+++ b/guix/scripts/import/minetest.scm
@@ -2,6 +2,7 @@
2;;; Copyright © 2014 David Thompson <davet@gnu.org> 2;;; Copyright © 2014 David Thompson <davet@gnu.org>
3;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> 3;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
4;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> 4;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
5;;; Copyright © 2025 Liliana Marie Prikler <liliana.prikler@gmail.com>
5;;; 6;;;
6;;; This file is part of GNU Guix. 7;;; This file is part of GNU Guix.
7;;; 8;;;
@@ -19,99 +20,11 @@
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 21
21(define-module (guix scripts import minetest) 22(define-module (guix scripts import minetest)
22 #:use-module (guix ui) 23 #:use-module (guix scripts import luanti)
23 #:use-module (guix utils) 24 #:use-module (guix deprecation)
24 #:use-module (guix scripts)
25 #:use-module (guix import minetest)
26 #:use-module (guix import utils)
27 #:use-module (guix scripts import)
28 #:use-module (srfi srfi-1)
29 #:use-module (srfi srfi-11)
30 #:use-module (srfi srfi-37)
31 #:use-module (ice-9 match)
32 #:use-module (ice-9 format)
33 #:export (guix-import-minetest)) 25 #:export (guix-import-minetest))
34 26
35
36;;;
37;;; Command-line options.
38;;;
39
40(define %default-options
41 `((sort . ,%default-sort-key)))
42
43(define (show-help)
44 (display (G_ "Usage: guix import minetest AUTHOR/NAME
45Import and convert the Minetest mod NAME by AUTHOR from ContentDB.\n"))
46 (display (G_ "
47 -h, --help display this help and exit"))
48 (display (G_ "
49 -r, --recursive import packages recursively"))
50 (display (G_ "
51 -V, --version display version information and exit"))
52 (display (G_ "
53 --sort=KEY when choosing between multiple implementations,
54 choose the one with the highest value for KEY
55 (one of \"score\" (standard) or \"downloads\")"))
56 (newline)
57 (show-bug-report-information))
58
59(define (verify-sort-order sort)
60 "Verify SORT can be used to sort mods by."
61 (unless (member sort '("score" "downloads" "reviews"))
62 (leave (G_ "~a: not a valid key to sort by~%") sort))
63 sort)
64
65(define %options
66 ;; Specification of the command-line options.
67 (cons* (option '(#\h "help") #f #f
68 (lambda args
69 (show-help)
70 (exit 0)))
71 (option '(#\V "version") #f #f
72 (lambda args
73 (show-version-and-exit "guix import minetest")))
74 (option '(#\r "recursive") #f #f
75 (lambda (opt name arg result)
76 (alist-cons 'recursive #t result)))
77 (option '("sort") #t #f
78 (lambda (opt name arg result)
79 (alist-cons 'sort (verify-sort-order arg) result)))
80 %standard-import-options))
81
82
83;;;
84;;; Entry point.
85;;;
86
87(define (guix-import-minetest . args) 27(define (guix-import-minetest . args)
88 (define (parse-options) 28 (warn-about-deprecation 'guix-import-minetest #f
89 ;; Return the alist of option values. 29 #:replacement 'guix-import-luanti)
90 (args-fold* args %options 30 (apply guix-import-luanti args))
91 (lambda (opt name arg result)
92 (leave (G_ "~A: unrecognized option~%") name))
93 (lambda (arg result)
94 (alist-cons 'argument arg result))
95 %default-options))
96
97 (let* ((opts (parse-options))
98 (args (filter-map (match-lambda
99 (('argument . value)
100 value)
101 (_ #f))
102 (reverse opts))))
103 (match args
104 ((name)
105 (with-error-handling
106 (let* ((sort (assoc-ref opts 'sort))
107 (author/name (elaborate-contentdb-name name #:sort sort)))
108 (if (assoc-ref opts 'recursive)
109 ;; Recursive import
110 (filter-map package->definition
111 (minetest-recursive-import author/name #:sort sort))
112 ;; Single import
113 (minetest->guix-package author/name #:sort sort)))))
114 (()
115 (leave (G_ "too few arguments~%")))
116 ((many ...)
117 (leave (G_ "too many arguments~%"))))))
diff --git a/tests/minetest.scm b/tests/luanti.scm
index bf1313ee220..6ee0340e935 100644
--- a/tests/minetest.scm
+++ b/tests/luanti.scm
@@ -16,17 +16,17 @@
16;;; You should have received a copy of the GNU General Public License 16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18 18
19(define-module (test-minetest) 19(define-module (test-luanti)
20 #:use-module (guix build-system minetest) 20 #:use-module (guix build-system luanti)
21 #:use-module (guix upstream) 21 #:use-module (guix upstream)
22 #:use-module (guix memoization) 22 #:use-module (guix memoization)
23 #:use-module (guix import minetest) 23 #:use-module (guix import luanti)
24 #:use-module (guix import utils) 24 #:use-module (guix import utils)
25 #:use-module (guix tests) 25 #:use-module (guix tests)
26 #:use-module (guix packages) 26 #:use-module (guix packages)
27 #:use-module (guix git-download) 27 #:use-module (guix git-download)
28 #:use-module ((gnu packages minetest) 28 #:use-module ((gnu packages luanti)
29 #:select (minetest minetest-technic)) 29 #:select (luanti luanti-technic))
30 #:use-module ((gnu packages base) 30 #:use-module ((gnu packages base)
31 #:select (hello)) 31 #:select (hello))
32 #:use-module (json) 32 #:use-module (json)
@@ -40,7 +40,7 @@
40;; Some procedures for populating a ‘fake’ ContentDB server. 40;; Some procedures for populating a ‘fake’ ContentDB server.
41 41
42(define* (make-package-sexp #:key 42(define* (make-package-sexp #:key
43 (guix-name "minetest-foo") 43 (guix-name "luanti-foo")
44 ;; This is not a proper version number but 44 ;; This is not a proper version number but
45 ;; ContentDB often does not include version 45 ;; ContentDB often does not include version
46 ;; numbers. 46 ;; numbers.
@@ -66,7 +66,7 @@
66 (sha256 66 (sha256
67 (base32 #f)) 67 (base32 #f))
68 (file-name (git-file-name name version)))) 68 (file-name (git-file-name name version))))
69 (build-system minetest-mod-build-system) 69 (build-system luanti-mod-build-system)
70 ,@(maybe-propagated-inputs inputs) 70 ,@(maybe-propagated-inputs inputs)
71 (home-page ,home-page) 71 (home-page ,home-page)
72 (synopsis ,synopsis) 72 (synopsis ,synopsis)
@@ -112,7 +112,7 @@
112 ("thumbnail" . null) 112 ("thumbnail" . null)
113 ("title" . "The name") 113 ("title" . "The name")
114 ("type" . ,type) 114 ("type" . ,type)
115 ("url" . ,(string-append "https://content.minetest.net/packages/" 115 ("url" . ,(string-append "https://content.luanti.net/packages/"
116 author "/" name "/download/")) 116 author "/" name "/download/"))
117 ("website" . ,website))) 117 ("website" . ,website)))
118 118
@@ -120,8 +120,8 @@
120 `#((("commit" . ,commit) 120 `#((("commit" . ,commit)
121 ("downloads" . 469) 121 ("downloads" . 469)
122 ("id" . 8614) 122 ("id" . 8614)
123 ("max_minetest_version" . null) 123 ("max_luanti_version" . null)
124 ("min_minetest_version" . null) 124 ("min_luanti_version" . null)
125 ("release_date" . "2021-07-25T01:10:23.207584") 125 ("release_date" . "2021-07-25T01:10:23.207584")
126 ("title" . ,title)))) 126 ("title" . ,title))))
127 127
@@ -149,7 +149,7 @@
149(define (call-with-packages thunk . argument-lists) 149(define (call-with-packages thunk . argument-lists)
150 ;; Don't reuse results from previous tests. 150 ;; Don't reuse results from previous tests.
151 (invalidate-memoization! contentdb-fetch) 151 (invalidate-memoization! contentdb-fetch)
152 (invalidate-memoization! minetest->guix-package) 152 (invalidate-memoization! luanti->guix-package)
153 (define (scm->json-port scm) 153 (define (scm->json-port scm)
154 (open-input-string (scm->json-string scm))) 154 (open-input-string (scm->json-string scm)))
155 (define (handle-package url requested-author requested-name . rest) 155 (define (handle-package url requested-author requested-name . rest)
@@ -215,10 +215,10 @@
215 (parameterize ((%contentdb-api "mock://api/")) 215 (parameterize ((%contentdb-api "mock://api/"))
216 (thunk)))) 216 (thunk))))
217 217
218(define* (minetest->guix-package* #:key (author "Author") (name "foo") 218(define* (luanti->guix-package* #:key (author "Author") (name "foo")
219 (sort %default-sort-key) 219 (sort %default-sort-key)
220 #:allow-other-keys) 220 #:allow-other-keys)
221 (minetest->guix-package (string-append author "/" name) #:sort sort)) 221 (luanti->guix-package (string-append author "/" name) #:sort sort))
222 222
223(define (imported-package-sexp* primary-arguments . secondary-arguments) 223(define (imported-package-sexp* primary-arguments . secondary-arguments)
224 "Ask the importer to import a package specified by PRIMARY-ARGUMENTS, 224 "Ask the importer to import a package specified by PRIMARY-ARGUMENTS,
@@ -227,7 +227,7 @@ SECONDARY-ARGUMENTS are available on ContentDB."
227 (apply call-with-packages 227 (apply call-with-packages
228 (lambda () 228 (lambda ()
229 ;; The memoization cache is reset by call-with-packages 229 ;; The memoization cache is reset by call-with-packages
230 (apply minetest->guix-package* primary-arguments)) 230 (apply luanti->guix-package* primary-arguments))
231 primary-arguments 231 primary-arguments
232 secondary-arguments)) 232 secondary-arguments))
233 233
@@ -247,14 +247,14 @@ during a dynamic extent where that package is available on ContentDB."
247 (apply make-package-sexp primary-arguments) 247 (apply make-package-sexp primary-arguments)
248 (imported-package-sexp* primary-arguments extra-arguments ...))) 248 (imported-package-sexp* primary-arguments extra-arguments ...)))
249 249
250(test-begin "minetest") 250(test-begin "luanti")
251 251
252 252
253;; Package names 253;; Package names
254(test-package "minetest->guix-package") 254(test-package "luanti->guix-package")
255(test-package "minetest->guix-package, _ → - in package name" 255(test-package "luanti->guix-package, _ → - in package name"
256 #:name "foo_bar" 256 #:name "foo_bar"
257 #:guix-name "minetest-foo-bar" 257 #:guix-name "luanti-foo-bar"
258 #:upstream-name "Author/foo_bar") 258 #:upstream-name "Author/foo_bar")
259 259
260(test-equal "elaborate names, unambiguous" 260(test-equal "elaborate names, unambiguous"
@@ -284,19 +284,19 @@ during a dynamic extent where that package is available on ContentDB."
284 284
285 285
286;; Determining the home page 286;; Determining the home page
287(test-package "minetest->guix-package, website is used as home page" 287(test-package "luanti->guix-package, website is used as home page"
288 #:home-page "web://site" 288 #:home-page "web://site"
289 #:website "web://site") 289 #:website "web://site")
290(test-package "minetest->guix-package, if absent, the forum is used" 290(test-package "luanti->guix-package, if absent, the forum is used"
291 #:home-page '(minetest-topic 628) 291 #:home-page '(luanti-topic 628)
292 #:forums 628 292 #:forums 628
293 #:website 'null) 293 #:website 'null)
294(test-package "minetest->guix-package, if absent, the git repo is used" 294(test-package "luanti->guix-package, if absent, the git repo is used"
295 #:home-page "https://github.com/minetest-mods/mesecons" 295 #:home-page "https://github.com/luanti-mods/mesecons"
296 #:forums 'null 296 #:forums 'null
297 #:website 'null 297 #:website 'null
298 #:repo "https://github.com/minetest-mods/mesecons") 298 #:repo "https://github.com/luanti-mods/mesecons")
299(test-package "minetest->guix-package, all home page information absent" 299(test-package "luanti->guix-package, all home page information absent"
300 #:home-page #f 300 #:home-page #f
301 #:forums 'null 301 #:forums 'null
302 #:website 'null 302 #:website 'null
@@ -316,55 +316,55 @@ during a dynamic extent where that package is available on ContentDB."
316 316
317 317
318;; Dependencies 318;; Dependencies
319(test-package* "minetest->guix-package, unambiguous dependency" 319(test-package* "luanti->guix-package, unambiguous dependency"
320 (list #:requirements '(("mesecons" #f 320 (list #:requirements '(("mesecons" #f
321 ("Jeija/mesecons" 321 ("Jeija/mesecons"
322 "some-modpack/containing-mese"))) 322 "some-modpack/containing-mese")))
323 #:inputs '("minetest-mesecons")) 323 #:inputs '("luanti-mesecons"))
324 (list #:author "Jeija" #:name "mesecons") 324 (list #:author "Jeija" #:name "mesecons")
325 (list #:author "some-modpack" #:name "containing-mese" #:type "modpack")) 325 (list #:author "some-modpack" #:name "containing-mese" #:type "modpack"))
326 326
327(test-package* "minetest->guix-package, ambiguous dependency (highest score)" 327(test-package* "luanti->guix-package, ambiguous dependency (highest score)"
328 (list #:name "frobnicate" 328 (list #:name "frobnicate"
329 #:guix-name "minetest-frobnicate" 329 #:guix-name "luanti-frobnicate"
330 #:upstream-name "Author/frobnicate" 330 #:upstream-name "Author/frobnicate"
331 #:requirements '(("frob" #f 331 #:requirements '(("frob" #f
332 ("Author/foo" "Author/bar"))) 332 ("Author/foo" "Author/bar")))
333 ;; #:sort "score" is the default 333 ;; #:sort "score" is the default
334 #:inputs '("minetest-bar")) 334 #:inputs '("luanti-bar"))
335 (list #:author "Author" #:name "foo" #:score 0) 335 (list #:author "Author" #:name "foo" #:score 0)
336 (list #:author "Author" #:name "bar" #:score 9999)) 336 (list #:author "Author" #:name "bar" #:score 9999))
337 337
338(test-package* "minetest->guix-package, ambiguous dependency (most downloads)" 338(test-package* "luanti->guix-package, ambiguous dependency (most downloads)"
339 (list #:name "frobnicate" 339 (list #:name "frobnicate"
340 #:guix-name "minetest-frobnicate" 340 #:guix-name "luanti-frobnicate"
341 #:upstream-name "Author/frobnicate" 341 #:upstream-name "Author/frobnicate"
342 #:requirements '(("frob" #f 342 #:requirements '(("frob" #f
343 ("Author/foo" "Author/bar"))) 343 ("Author/foo" "Author/bar")))
344 #:inputs '("minetest-bar") 344 #:inputs '("luanti-bar")
345 #:sort "downloads") 345 #:sort "downloads")
346 (list #:author "Author" #:name "foo" #:downloads 0) 346 (list #:author "Author" #:name "foo" #:downloads 0)
347 (list #:author "Author" #:name "bar" #:downloads 9999)) 347 (list #:author "Author" #:name "bar" #:downloads 9999))
348 348
349(test-package "minetest->guix-package, optional dependency" 349(test-package "luanti->guix-package, optional dependency"
350 #:requirements '(("mesecons" #t 350 #:requirements '(("mesecons" #t
351 ("Jeija/mesecons" 351 ("Jeija/mesecons"
352 "some-modpack/containing-mese"))) 352 "some-modpack/containing-mese")))
353 #:inputs '()) 353 #:inputs '())
354 354
355;; See e.g. 'orwell/basic_trains' 355;; See e.g. 'orwell/basic_trains'
356(test-package* "minetest->guix-package, multiple dependencies implemented by one mod" 356(test-package* "luanti->guix-package, multiple dependencies implemented by one mod"
357 (list #:name "frobnicate" 357 (list #:name "frobnicate"
358 #:guix-name "minetest-frobnicate" 358 #:guix-name "luanti-frobnicate"
359 #:upstream-name "Author/frobnicate" 359 #:upstream-name "Author/frobnicate"
360 #:requirements '(("frob" #f ("Author/frob")) 360 #:requirements '(("frob" #f ("Author/frob"))
361 ("frob_x" #f ("Author/frob"))) 361 ("frob_x" #f ("Author/frob")))
362 #:inputs '("minetest-frob")) 362 #:inputs '("luanti-frob"))
363 (list #:author "Author" #:name "frob")) 363 (list #:author "Author" #:name "frob"))
364 364
365 365
366;; License 366;; License
367(test-package "minetest->guix-package, identical licenses" 367(test-package "luanti->guix-package, identical licenses"
368 #:guix-license 'license:lgpl3+ 368 #:guix-license 'license:lgpl3+
369 #:license "LGPL-3.0-or-later" 369 #:license "LGPL-3.0-or-later"
370 #:media-license "LGPL-3.0-or-later") 370 #:media-license "LGPL-3.0-or-later")
@@ -397,7 +397,7 @@ during a dynamic extent where that package is available on ContentDB."
397 397
398(define* (expected-sexp #:key 398(define* (expected-sexp #:key
399 (repo "https://example.org/foo.git") 399 (repo "https://example.org/foo.git")
400 (guix-name "minetest-foo") 400 (guix-name "luanti-foo")
401 (new-version "0.8") 401 (new-version "0.8")
402 (commit "44941798d222901b8f381b3210957d880b90a2fc") 402 (commit "44941798d222901b8f381b3210957d880b90a2fc")
403 #:allow-other-keys) 403 #:allow-other-keys)
@@ -410,7 +410,7 @@ during a dynamic extent where that package is available on ContentDB."
410 (commit "44941798d222901b8f381b3210957d880b90a2fc") 410 (commit "44941798d222901b8f381b3210957d880b90a2fc")
411 #:allow-other-keys) 411 #:allow-other-keys)
412 (package 412 (package
413 (name "minetest-foo") 413 (name "luanti-foo")
414 (version old-version) 414 (version old-version)
415 (source 415 (source
416 (if (eq? source 'auto) 416 (if (eq? source 'auto)
@@ -422,7 +422,7 @@ during a dynamic extent where that package is available on ContentDB."
422 (sha256 #f) ; not important for the following tests 422 (sha256 #f) ; not important for the following tests
423 (file-name (git-file-name name version))) 423 (file-name (git-file-name name version)))
424 source)) 424 source))
425 (build-system minetest-mod-build-system) 425 (build-system luanti-mod-build-system)
426 (license #f) 426 (license #f)
427 (synopsis #f) 427 (synopsis #f)
428 (description #f) 428 (description #f)
@@ -434,7 +434,7 @@ during a dynamic extent where that package is available on ContentDB."
434 (expected-sexp . arguments) 434 (expected-sexp . arguments)
435 (and=> 435 (and=>
436 (call-with-packages 436 (call-with-packages
437 (cut latest-minetest-release (example-package . arguments)) 437 (cut latest-luanti-release (example-package . arguments))
438 (list . arguments)) 438 (list . arguments))
439 upstream-source->sexp))) 439 upstream-source->sexp)))
440 440
@@ -442,7 +442,7 @@ during a dynamic extent where that package is available on ContentDB."
442 (test-equal test-case 442 (test-equal test-case
443 #f 443 #f
444 (call-with-packages 444 (call-with-packages
445 (cut latest-minetest-release (example-package . arguments)) 445 (cut latest-luanti-release (example-package . arguments))
446 (list . arguments)))) 446 (list . arguments))))
447 447
448(test-release "same version" 448(test-release "same version"
@@ -474,25 +474,25 @@ during a dynamic extent where that package is available on ContentDB."
474 #:old-version "2014-11-07" #:title "0.8" 474 #:old-version "2014-11-07" #:title "0.8"
475 #:commit "c8855b991880897b2658dc90164e29c96e2aeb3a") 475 #:commit "c8855b991880897b2658dc90164e29c96e2aeb3a")
476 476
477;; Don't let "guix refresh -t minetest" tell there are new versions 477;; Don't let "guix refresh -t luanti" tell there are new versions
478;; if Guix has insufficient information to actually perform the update, 478;; if Guix has insufficient information to actually perform the update,
479;; when using --with-latest or "guix refresh -u". 479;; when using --with-latest or "guix refresh -u".
480(test-no-release "no commit information, no new release" 480(test-no-release "no commit information, no new release"
481 #:old-version "0.8" #:title "0.9.0" #:new-version "0.9.0" 481 #:old-version "0.8" #:title "0.9.0" #:new-version "0.9.0"
482 #:commit #false) 482 #:commit #false)
483 483
484(test-assert "minetest is not a minetest mod" 484(test-assert "luanti is not a luanti mod"
485 (not (minetest-package? minetest))) 485 (not (luanti-package? luanti)))
486(test-assert "GNU hello is not a minetest mod" 486(test-assert "GNU hello is not a luanti mod"
487 (not (minetest-package? hello))) 487 (not (luanti-package? hello)))
488(test-assert "technic is a minetest mod" 488(test-assert "technic is a luanti mod"
489 (minetest-package? minetest-technic)) 489 (luanti-package? luanti-technic))
490(test-assert "upstream-name is required" 490(test-assert "upstream-name is required"
491 (not (minetest-package? 491 (not (luanti-package?
492 (package (inherit minetest-technic) 492 (package (inherit luanti-technic)
493 (properties '()))))) 493 (properties '())))))
494 494
495(test-end "minetest") 495(test-end "luanti")
496 496
497;;; Local Variables: 497;;; Local Variables:
498;;; eval: (put 'test-package* 'scheme-indent-function 1) 498;;; eval: (put 'test-package* 'scheme-indent-function 1)