Adam Faiz wrote 3 weeks ago
(address . guix-patches@gnu.org)(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(name . 宋文 武)(address . iyzsong@envs.net)
From 0300d45e1508ba1e763e07c71f202ba54180e368 Mon Sep 17 00:00:00 2001
Message-ID: <0300d45e1508ba1e763e07c71f202ba54180e368.1740888495.git.adam.faiz@disroot.org>
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Sun, 2 Mar 2025 12:00:30 +0800
Subject: [PATCH] gnu: Add opensludge.
* gnu/packages/patches/opensludge-support-datadir-variable.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/game-development.scm (opensludge): New variable.
---
gnu/local.mk | 1 +
gnu/packages/game-development.scm | 51 +++++++++++++++++++
.../opensludge-support-datadir-variable.patch | 33 ++++++++++++
3 files changed, 85 insertions(+)
create mode 100644 gnu/packages/patches/opensludge-support-datadir-variable.patch
Toggle diff (117 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 2ea3763d40..b7401b794d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1958,6 +1958,7 @@ dist_patch_DATA = \
%D%/packages/patches/openscad-with-cgal-5.3.patch \
%D%/packages/patches/openscad-with-cgal-5.4.patch \
%D%/packages/patches/opensles-add-license-file.patch \
+ %D%/packages/patches/opensludge-support-datadir-variable.patch \
%D%/packages/patches/openssl-1.1-c-rehash-in.patch \
%D%/packages/patches/openssl-3.0-c-rehash-in.patch \
%D%/packages/patches/openssl-hurd64.patch \
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index e014089c23..00b76ac21f 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -2955,6 +2955,57 @@ (define-public instead
(files '("share/instead/games")))))
(license license:expat)))
+(define-public opensludge
+ (let ((commit "a247b3669d41b3c2de0d06b88fc3e21ad4898a47")
+ (revision "0"))
+ (package
+ (name "opensludge")
+ (version (git-version "2.2.2" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/opensludge/opensludge")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1kl763j98398y1cbj36m45jbkwir7nj4wrq2sb6gl9vx90ipvsyg"))
+ (patches (search-patches "opensludge-support-datadir-variable.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ (substitute* "configure.ac"
+ (("openal") "libmodplug libmpg123 openal"))))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "--enable-devkit")
+ #:make-flags
+ #~(list "CXXFLAGS=-g")))
+ (native-inputs (list autoconf automake pkg-config))
+ (inputs
+ (list alure
+ dumb
+ flac
+ openal
+ glew
+ glib
+ gtk+-2
+ gtkglext
+ libmodplug
+ libogg
+ libpng
+ libvorbis
+ libvpx
+ mpg123
+ sdl12-compat))
+ (synopsis "Adventure game engine")
+ (description
+ "SLUDGE is a game development toolkit for making point-and-click style
+adventure games.")
+ (home-page "https://opensludge.github.io/")
+ (license license:gpl3+))))
+
(define-public openvr
(package
(name "openvr")
diff --git a/gnu/packages/patches/opensludge-support-datadir-variable.patch b/gnu/packages/patches/opensludge-support-datadir-variable.patch
new file mode 100644
index 0000000000..05cd88ec71
--- /dev/null
+++ b/gnu/packages/patches/opensludge-support-datadir-variable.patch
@@ -0,0 +1,33 @@
+From 6ec17f5595def22b0f7e4c2020571d3bd631e6dc Mon Sep 17 00:00:00 2001
+From: AwesomeAdam54321 <adam.faiz@disroot.org>
+Date: Sun, 2 Mar 2025 09:53:31 +0800
+Subject: [PATCH] opensludge: Support SLUDGE_DATADIR environment variable.
+
+This patch is from the Robin's Rescue game, and rebased on the latest
+commit:
+https://gitlab.com/Cheeseness/robins-rescue/-/raw/master/sludge/source_changes/main.cpp.diff
+---
+ source/Engine/main.cpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/source/Engine/main.cpp b/source/Engine/main.cpp
+index d3b9951..1418bbc 100755
+--- a/source/Engine/main.cpp
++++ b/source/Engine/main.cpp
+@@ -298,7 +298,12 @@ int main(int argc, char *argv[]) try
+ #ifdef __APPLE__
+ // bundleFolder is set in applicationDidFinishLaunching.
+ #elif defined __unix__
+- bundleFolder = copyString(DATADIR); // DATADIR is defined in the Makefile.
++ bundleFolder = getenv("SLUDGE_DATADIR");
++ if (bundleFolder == NULL)
++ {
++ bundleFolder = copyString(DATADIR); // DATADIR is defined in the Makefile.
++ fprintf(stderr, "SLUDGE_DATADIR not found, defaulting to %s\n", bundleFolder);
++ }
+ #else
+ bundleFolder = copyString(argv[0]);
+ int lastSlash = -1;
+--
+2.46.0
+
base-commit: 4b5f0408e66392ab745dc0f7830732217d88f17d
--
2.46.0