You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
7.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(define-module (my-gzdoom)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system cmake)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages)
#:use-module (gnu packages compression)
#:use-module (gnu packages audio)
#:use-module (gnu packages gtk)
#:use-module (gnu packages image)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages gl)
#:use-module (gnu packages mp3)
#:use-module (gnu packages sdl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages glib)
#:use-module (gnu packages linux)
#:use-module (gnu packages video))
(define-public zmusic
(package
(name "zmusic")
(version "1.1.14")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ZDoom/ZMusic")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "19arzkbwdj84vw1cfawc6930dfxdhhq4k6yawkkppaphj8qkfhdc"))))
(build-system cmake-build-system)
(inputs (list alsa-lib))
(native-inputs (list pkg-config
glib))
(arguments
(list
#:tests? #f
#:configure-flags
#~(list
(string-append
"-DYN_SNDFILE=off"
"-DYN_MPG123=off"))))
(synopsis "GZDoom's music system as a standalone library")
(description "This library for use with the projects GZDoom, Raze, and the newer PrBoom+.")
(home-page "https://zdoom.org/index")
;; the source uses x86 assembly
(supported-systems '("x86_64-linux" "i686-linux"))
(license (list license:gpl3
license:lgpl2.1))))
(define-public gzdoom
(package
(name "gzdoom")
(version "4.13.2")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ZDoom/gzdoom")
(commit (string-append "g" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0zlvrdayrj1rk5x2hwnc57l8pl29bl64zmfq3qc9yfypknj1syfy"))
;; (patches (search-patches "gzdoom-search-in-installed-share.patch"
;; ;; "gzdoom-find-system-libgme.patch"
;; ))
(modules '((guix build utils)
(ice-9 regex)))
;; (snippet
;; '(begin
;; ;; remove files which mustn't be commercially redistributed. see
;; ;; <https://zdoom.org/wiki/license#commercial_use>, the contribution
;; ;; guidelines at <https://github.com/zdoom>, and guix issue #73435.
;; (for-each
;; (lambda (directory)
;; (delete-file-recursively directory)
;; (substitute* "CMakeLists.txt"
;; (((string-append "add_subdirectory\\([[:blank:]]*"
;; directory
;; "[[:blank:]]*\\)"))
;; "")))
;; '( ;; "wadsrc_extra" ;game_support.pk3
;; "wadsrc_bm")) ;brightmaps.pk3
;; ;; removing game_support.pk3 entirely would break freedoom & remove
;; ;; users' ability to play commercial games, despite owning (only) the
;; ;; non-functional data. that can't be right. out of an abundance of
;; ;; caution, remove anything from the pk3 that could conceivably be
;; ;; derived from copyrightable data that's not freely redistributable.
;; ;; (display "keeping only the following game_support.pk3 files:\n")
;; ;; (let* ((regexps (list "/font\\.inf$"
;; ;; "/harmony/.*\\.(txt|zs)$"
;; ;; "/(iwadinfo|mapinfo|sprofs)\\.txt$"
;; ;; "\\.z$"))
;; ;; (regexp* (format #f "(~{~a~^|~})" regexps))
;; ;; (regexp (make-regexp regexp* regexp/icase)))
;; ;; (define (keep-file? file stat)
;; ;; (let ((keep? (regexp-exec regexp file)))
;; ;; (when keep?
;; ;; (format #t " ~a~%" file))
;; ;; keep?))
;; ;; (for-each delete-file (find-files "wadsrc_extra/static"
;; ;; (negate keep-file?))))
;; ;; remove some bundled libraries. xxx there are more, but removing
;; ;; them would require, at least, patching the build system.
;; (with-directory-excursion "libraries"
;; (delete-file-recursively "bzip2")
;; )))
))
(arguments
(list
#:tests? #f
#:configure-flags
#~(list
(string-append
"-DCMAKE_CXX_FLAGS:="
"-DSHARE_DIR=\\\"" #$output "/share\\\" "
"-DGUIX_OUT_PK3=\\\"" #$output "/share/games/doom\\\"")
;; the build requires some extra convincing not to use the bundled
;; libgme previously deleted in the soure snippet.
;; "-dforce_internal_gme=off"
;; link libraries at build time instead of loading them at run time.
"-DDYN_OPENAL=off"
"-DDYN_FLUIDSYNTH=off"
"-DDYN_GTK=off"
"-DDYN_MPG123=off"
"-DDYN_SNDFILE=off"
;; Pointing CMake to precompiled binaries in library so that they can be statically linked into
)
#:phases
#~(modify-phases %standard-phases
(add-before 'configure 'fix-file-names
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "src/CMakeLists.txt"
(("command /bin/sh")
(string-append "command " (which "sh"))))
;; (substitute*
;; "libraries/zmusic/mididevices/music_fluidsynth_mididevice.cpp"
;; (("/usr/share/sounds/sf2/fluidr3_gm.sf2")
;; (search-input-file inputs
;; "share/soundfonts/fluidr3mono_gm.sf3")))
;; (substitute*
;; "libraries/zmusic/mididevices/music_timiditypp_mididevice.cpp"
;; (("(exename = \")(timidity)(\".*)" _ prefix exe suffix)
;; (string-append prefix
;; (search-input-file inputs
;; (string-append "bin/" exe))
;; suffix)))
)))))
(build-system cmake-build-system)
(inputs (list bzip2
fluid-3
fluidsynth
gtk+
libgme
libjpeg-turbo
libsndfile
libvpx
mesa
mpg123
openal
sdl2
timidity++
zlib
zmusic))
(native-inputs (list pkg-config unzip))
(synopsis "modern doom 2 source port")
(description "gzdoom is a port of the doom 2 game engine, with a modern
renderer. it improves modding support with zdoom's advanced mapping features
and the new zscript language. in addition to doom, it supports heretic, hexen,
strife, chex quest, and fan-created games like harmony, hacx and freedoom.")
(home-page "https://zdoom.org/index")
;; the source uses x86 assembly
(supported-systems '("x86_64-linux" "i686-linux"))
(license (list license:gpl3+ ; gzdoom game
license:lgpl3+ ; gzdoom renderer
license:expat ; gdtoa
(license:non-copyleft ; modified dumb
"file://dumb/licence.txt"
"dumb license, explicitly gpl compatible.")))))
gzdoom