summaryrefslogtreecommitdiff
path: root/nongnu/packages/game-development.scm
diff options
context:
space:
mode:
authorPierre Neidhardt <mail@ambrevar.xyz>2020-05-04 11:57:56 +0200
committerPierre Neidhardt <mail@ambrevar.xyz>2020-05-04 11:58:24 +0200
commit2f9c97e0b0e61b8061302d1c5aa750c2bec3edcf (patch)
tree59fa90a7335505fee970d1bada351160894f48dd /nongnu/packages/game-development.scm
parentbffbc6ccff5d11f4d9acf451456155c134f35afb (diff)
nongnu: Move eduke32 from the duke-nukem-3d channel to Nonguix.
* nongnu/packages/game-development.scm (eduke32): New variable.
Diffstat (limited to 'nongnu/packages/game-development.scm')
-rw-r--r--nongnu/packages/game-development.scm122
1 files changed, 121 insertions, 1 deletions
diff --git a/nongnu/packages/game-development.scm b/nongnu/packages/game-development.scm
index 6ae40b7..025dac8 100644
--- a/nongnu/packages/game-development.scm
+++ b/nongnu/packages/game-development.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2019, 2020 Pierre Neidhardt <mail@ambrevar.xyz>
;;;
;;; This file is not part of GNU Guix.
;;;
@@ -21,10 +21,18 @@
#:use-module ((nonguix licenses) :prefix license:)
#:use-module (guix packages)
#:use-module (nonguix build-system binary)
+ #:use-module (guix build-system gnu)
#:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (gnu packages audio)
#:use-module (gnu packages base)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gl)
+ #:use-module (gnu packages gtk)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages sdl)
+ #:use-module (gnu packages video)
+ #:use-module (gnu packages xiph)
#:use-module (gnu packages xorg))
(define nvidia-cg-toolkit-version "3.1")
@@ -163,3 +171,115 @@ development should opt for GLSL rather than Cg.")
(description "")
(license (license:nonfree
"https://raw.githubusercontent.com/ValveSoftware/source-sdk-2013/master/LICENSE"))))
+
+(define-public eduke32
+ ;; There are no official releases.
+ (let ((commit "26f683cadb3ca731cb8f19ae011cd6431f276827")
+ (revision "0")
+ (duke-nukem-3d-directory "share/dukenukem3d"))
+ (package
+ (name "eduke32")
+ (version (git-version "0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://voidpoint.io/terminx/eduke32.git")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "15y8p35wbb83k3yh4ydpibf64maqnmbqmw89dinlfhllcdm9154n"))
+ ;; Unbundle libxmp.
+ (modules '((guix build utils)))
+ (snippet
+ '(begin (delete-file-recursively "source/libxmp-lite") #t))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f
+ ;; Add glu to rpath so that SDL can dlopen it.
+ #:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
+ (assoc-ref %build-inputs "glu") "/lib"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'unbundle-libxmp
+ (lambda _
+ (substitute* "GNUmakefile"
+ (("-I\\$\\(libxmplite_inc\\)")
+ (string-append "-I" (assoc-ref %build-inputs "libxmp") "/include"))
+ (("^ *audiolib_deps \\+= libxmplite.*$") "")
+ (("-logg") "-logg -lxmp"))
+ (with-directory-excursion "source/audiolib/src"
+ (for-each (lambda (file) (substitute* file (("libxmp-lite/") "")))
+ '("multivoc.cpp" "xmp.cpp")))
+ #t))
+ (delete 'configure)
+ (add-after 'set-paths 'set-sdl-paths
+ ;; The makefile adds the output of `sdl2-config --cflags` to the
+ ;; compiler flags, but sdl2-config gives us the wrong directory to
+ ;; include. We have to add the SDL2 header directory ourselves.
+ (lambda* (#:key inputs #:allow-other-keys)
+ (pk (assoc-ref inputs "sdl-union"))
+ (setenv "CPLUS_INCLUDE_PATH"
+ (string-append (assoc-ref inputs "sdl-union")
+ "/include/SDL2"))
+ #t))
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (glu (assoc-ref inputs "glu"))
+ (eduke (string-append out "/bin/eduke32"))
+ (eduke-real (string-append out "/bin/.eduke32-real")))
+ ;; TODO: Install custom .desktop file? Need icon.
+ ;; See https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=eduke32.
+ (install-file "eduke32" (string-append out "/bin"))
+ (install-file "mapster32" (string-append out "/bin"))
+ (install-file "package/common/buildlic.txt"
+ (string-append out "/share/licenses"))
+ ;; Wrap program:
+ ;; - Make sure current directory is writable, else eduke32 will segfault.
+ ;; - Add ../share/dukenukem3d to the dir search list.
+ ;; TODO: Skip store duke3d.grp When ~/.config/eduke32/duke3d.grp is found.
+ (rename-file eduke eduke-real)
+ (call-with-output-file eduke
+ (lambda (p)
+ (format p "\
+#!~a
+mkdir -p ~~/.config/eduke32
+cd ~~/.config/eduke32
+exec -a \"$0\" ~a\
+ -g \"${0%/*}\"/../~a/*.grp\
+ -g \"${0%/*}\"/../~a/*.zip\
+ -g \"${0%/*}\"/../~a/*.map\
+ -g \"${0%/*}\"/../~a/*.con\
+ -g \"${0%/*}\"/../~a/*.def\
+ \"$@\"~%"
+ (which "bash") eduke-real
+ ,duke-nukem-3d-directory
+ ,duke-nukem-3d-directory
+ ,duke-nukem-3d-directory
+ ,duke-nukem-3d-directory
+ ,duke-nukem-3d-directory)))
+ (chmod eduke #o755)))))))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
+ (inputs
+ `(("sdl-union" ,(sdl-union (list sdl2 sdl2-mixer)))
+ ("glu" ,glu)
+ ("libvorbis" ,libvorbis)
+ ("libvpx" ,libvpx)
+ ("libxmp" ,libxmp)
+ ("flac" ,flac)
+ ("gtk+" ,gtk+-2)))
+ (synopsis "Engine of the classic PC first person shooter Duke Nukem 3D")
+ (description "EDuke32 is a free homebrew game engine and source port of the
+classic PC first person shooter Duke Nukem 3D—Duke3D for short. A thousands
+of features and upgrades were added for regular players and additional editing
+capabilities and scripting extensions for homebrew developers and mod
+creators. EDuke32 is open source but non-free software.
+
+This package does not contain any game file. You can either install packages
+with game files or or put @file{.grp} game files manually in
+@file{~/.config/eduke32/}.")
+ (home-page "https://eduke32.com/")
+ (license (license:nonfree
+ "https://eduke32.com/buildlic.txt")))))