# zmusic.scm -rw-r--r-- 3.4 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
(define-public zmusic
  (package
    (name "zmusic")
    (version "1.1.3")
    (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
                "0vpr79gpdbhslg5qxyd1qxlv5akgli26skm1vb94yd8v69ymdcy2"))
       ;(patches (search-patches "zmusic-search-in-installed-share.patch"
                                ;"zmusic-find-system-libgme.patch"))
       (modules '((guix build utils)))
       (snippet
        ;; Remove some bundled libraries.  XXX There are more, but removing
        ;; them would require, at least, patching the build system.
        #~(with-directory-excursion "thirdparty"
            (delete-file-recursively "game-music-emu")
            (delete-file-recursively "zlib")))))
    (build-system cmake-build-system)
    (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_MPG123=OFF"
                   "-DDYN_SNDFILE=OFF")
           #:phases
           #~(modify-phases %standard-phases
               (add-before 'configure 'fix-referenced-paths
                 (lambda* (#:key inputs outputs #:allow-other-keys)
                   (substitute* "CMakeLists.txt"
                     (("/bin/sh")
                      (search-input-file inputs "bin/sh")))

                   (substitute* (string-append "source/mididevices/"
                                               "music_fluidsynth_mididevice.cpp")
                     (("/usr/share/sounds/sf2/FluidR3_GM.sf2")
                      (search-input-file
                       inputs "share/soundfonts/FluidR3Mono_GM.sf3"))))))))
    ;;TODO ADL and OPl are not present
    ;;I think it'll use the ones in thirdparty/ idk
    (inputs
     (list fluid-3 fluidsynth libgme libsndfile mpg123
           openal wildmidi timidity++ libtimidity zlib))
    (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 (list "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.")))))