root/gzdoom.scm

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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
(define-module (hidamari-blue gzdoom)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system cmake)
  #:use-module ((guix licenses) #:renamer (symbol-prefix-proc 'license:))
  #:use-module (gnu packages)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages base)
  #:use-module (gnu packages sdl)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages bison)
  #:use-module (gnu packages flex)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages fonts)
  #:use-module (gnu packages image)
  #:use-module (gnu packages games)
  #:use-module (gnu packages game-development)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages audio)
  #:use-module (gnu packages music)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages mp3)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages fltk)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages imagemagick)

  #:use-module (gnu packages wxwidgets)
  #:use-module (gnu packages python))

;;; TODO unbundle everything
;;; * status
;;;   - must move into the share directory of the pk3 to start
;;;   - it works but bundles a shitload of libraries like: lzma bzip2
;;;   - only tested it with doom2.wad from gog, gotta test freedoom
;;;   - sound works

(define-public gzdoom
  (package
   (name "gzdoom")
   (version "3.2.0")
   (source (origin
            (method url-fetch)
            (uri
             (string-append "https://zdoom.org/files/gzdoom/src/gzdoom-g"
                            version ".zip"))
            (sha256
             (base32
              "0px0i5b9kzi10w554cwr9w9495hfsff5gn13hg9bgdq54fbglqn9"))
            (patches (search-patches "gzdoom-search-in-installed-share.patch"))))
   (arguments
    '(#:tests? #f
               #:configure-flags
               (let ((out (assoc-ref %outputs "out")))
                 (list
                  (string-append
                   "-DCMAKE_CXX_FLAGS:="
                   "-DSHARE_DIR=\\\"" out "/share/\\\" "
                   "-DGUIX_OUT_PK3=\\\"" out "/share/games/doom\\\"")
                  ;; look for libraries at buildtime instead of
                  ;; dynamically finding them at runtime
                  "-DDYN_OPENAL=OFF"
                  "-DDYN_FLUIDSYNTH=OFF"
                  "-DDYN_GTK=OFF"
                  "-DDYN_MPG123=OFF"
                  "-DDYN_SNDFILE=OFF"))
               #:phases
               (modify-phases
                %standard-phases
                (add-before
                 'configure 'substitute-bin-sh
                 (lambda* (#:key inputs outputs #:allow-other-keys)
                   (let ((out (assoc-ref outputs "out")))
                     ;; delete bundled libraries
                     (delete-file-recursively "bzip2")
                     (delete-file-recursively "game-music-emu")
                     ;; (delete-file-recursively "lzma")
                     ;; (delete-file-recursively "jpeg-6b")
                     (delete-file-recursively "zlib")

                     (substitute*
                      "src/CMakeLists.txt"
                      (("COMMAND /bin/sh")
                       (string-append "COMMAND " (which "sh"))))
                     #t))))))
   (build-system cmake-build-system)
   (inputs `(("mesa" ,mesa)
             ;; ("libjpeg" ,libjpeg6)
             ("sdl2" ,sdl2)
             ("openal" ,openal)
             ("libgme" ,libgme)
             ("mpg123" ,mpg123)
             ("timidity++" ,timidity++)
             ("fluidsynth" ,fluidsynth)
             ("gtk+3" ,gtk+)
             ("libsndfile" ,libsndfile)
             ("zlib" ,zlib)
             ("bzip2" ,bzip2)))
   (native-inputs `(("pkg-config" ,pkg-config)
                    ("unzip" ,unzip)))
   (synopsis "gzdoom")
   (description "gzdoom")
   (home-page "https://zdoom.org/")
   (license license:gpl3+)))

;;; TODO add this to freedoom package
;; (native-search-paths
;;  (list (search-path-specification
;;         (variable "DOOMWADDIR")
;;         (files "/share/games/doom")))
;;  (list (search-path-specification
;;         (variable "DOOMWADPATH")
;;         (files "/share/games/doom"))))

(define-public freedoom
  (package
   (name "freedoom")
   (version "0.11.3")
   (source (origin
            (method url-fetch)
            (uri (string-append "https://github.com/" name "/" name
                                "/archive/v" version ".tar.gz"))
            (file-name (string-append name "-" version ".tar.gz"))
            (sha256
             (base32
              "1bjijdfqhpazyifx1qda7scj7dry1azhjrnl8h8zn2vqfgdmlh0q"))))
   (build-system gnu-build-system)
   (arguments
    '(#:make-flags `(,(string-append "prefix=" (assoc-ref %outputs "out")))
                   #:parallel-build? #f
                   #:tests? #f ; no check target
                   #:phases
                   (modify-phases %standard-phases
                                  (replace 'configure
                                           (lambda* (#:key inputs outputs #:allow-other-keys)
                                             (let* ((dejavu (assoc-ref inputs "font-dejavu"))
                                                    (freedoom (assoc-ref outputs "out"))
                                                    (wad-dir (string-append freedoom "/share/games/doom")))
                                               ;; Replace the font-searching function in a shell
                                               ;; script with a direct path to the required font.
                                               ;; This is necessary because ImageMagick can only find the
                                               ;; most basic fonts while in the build environment.
                                               (substitute* "graphics/titlepic/create_caption"
                                                            (("font=\\$\\(find_font.*$")
                                                             (string-append
                                                              "font=" dejavu
                                                              "/share/fonts/truetype/DejaVuSansCondensed-Bold.ttf\n")))
                                               ;; Make icon creation reproducible.
                                               (substitute* "dist/Makefile"
                                                            (("freedm.png")
                                                             "-define png:exclude-chunks=date freedm.png")
                                                            (("freedoom1.png")
                                                             "-define png:exclude-chunks=date freedoom1.png")
                                                            (("freedoom2.png")
                                                             "-define png:exclude-chunks=date freedoom2.png"))
                                               ;; Make sure that the install scripts know where to find
                                               ;; the appropriate WAD files.
                                               (substitute* "dist/freedoom"
                                                            (("IWAD=freedm.wad")
                                                             (string-append "IWAD=" wad-dir "/freedm.wad"))
                                                            (("IWAD=freedoom1.wad")
                                                             (string-append "IWAD=" wad-dir "/freedoom1.wad"))
                                                            (("IWAD=freedoom2.wad")
                                                             (string-append "IWAD=" wad-dir "/freedoom2.wad")))
                                               #t))))))
   (native-search-paths
    (list (search-path-specification
           (variable "DOOMWADDIR")
           (files '("share/games/doom")))
          (search-path-specification
           (variable "DOOMWADPATH")
           (files '("share/games/doom")))))
   (native-inputs
    `(("asciidoc" ,asciidoc)
      ("deutex" ,deutex)
      ("font-dejavu" ,font-dejavu)
      ("imagemagick" ,imagemagick)
      ("python" ,python-2)))
   (inputs
    `(("prboom-plus" ,prboom-plus)))
   (home-page "https://freedoom.github.io/")
   (synopsis "Free content game based on the Doom engine")
   (description
    "The Freedoom project aims to create a complete free content first person
shooter game.  Freedoom by itself is just the raw material for a game: it must
be paired with a compatible game engine (such as @code{prboom-plus}) to be
played.  Freedoom complements the Doom engine with free levels, artwork, sound
effects and music to make a completely free game.")
   (license license:bsd-3)))

;;; build wxwidgets with --enable-mediactrl
;;; wait for slade to upgrade to gtk3
(define-public slade
  (package
   (name "slade")
   (version "3.1.1.5")
   (source (origin
            (method url-fetch)
            (uri (string-append "https://github.com/sirjuddington/SLADE/archive/" version
                                ".tar.gz"))
            (sha256
             (base32
              "0alf6vj719886n2m2kmpn5xpg0fas4lwczi9hxh9yx6qcy19w70v"))))
   (build-system cmake-build-system)
   (inputs `(("mesa" ,mesa)
             ("sdl2" ,sdl2)
             ("openal" ,openal)
             ("zlib" ,zlib)
             ("p7zip" ,p7zip)             ;lzma?
             ("bzip2" ,bzip2)
             ;; ("gtk2" ,gtk+-2)
             ("sfml" ,sfml)
             ("fluidsynth" ,fluidsynth)
             ("ftgl" ,ftgl)
             ("freeimage" ,freeimage)
             ("glew" ,glew)
             ("curl" ,curl)
             ("wxwidgets" ,wxwidgets-3.1)))
   (native-inputs `(("pkg-config" ,pkg-config)))
   (synopsis "gzdoom")
   (description "gzdoom")
   (home-page "https://zdoom.org/")
   (license license:gpl3+)))


(define-public eureka
  (package
   (name "eureka")
   (version "1.21")
   (source (origin
            (method url-fetch)
            (uri (string-append "mirror://sourceforge/eureka-editor/Eureka/"
                                version "/eureka-"
                                ;; version without dots e.g 1.21 => 121
                                (string-join (string-split version #\.) "")
                                "-source.tar.gz"))
            (sha256
             (base32
              "1a7pf7xi56fcz7jc8layih5gq5m66g2ss4x5j61kzgip07j6rkir"))))
   (build-system gnu-build-system)
   (arguments
    '(#:tests?
      #f
      #:make-flags
      (let ((out (assoc-ref %outputs "out")))
        (list (string-append "PREFIX=" out)))
      #:phases
      (modify-phases
       %standard-phases
       (delete 'configure)
       (add-before
        'build 'create-install-directories
        (lambda* (#:key outputs #:allow-other-keys)
          (let ((out (assoc-ref outputs "out")))
            (mkdir-p (string-append out "/bin"))
            (mkdir-p (string-append out "/share"))

            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ;; FIXME substitute* crashes because of an accent in the name of someone
            (system* (which "sed")
                     "-i" (string-append "s|/usr/local|" out "|")
                     "src/main.cc")
            ;; (substitute*
            ;;  "./src/main.cc"
            ;;  (("/usr/local")
            ;;   out))
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

            (substitute*
             "Makefile"
             (("-o root")
              ""))))))))
   (inputs `(("mesa" ,mesa)
             ("libxft" ,libxft)
             ("libxinerama" ,libxinerama)
             ("libfontconfig" ,fontconfig)
             ("libjpeg" ,libjpeg)
             ("libpng" ,libpng)
             ("fltk" ,fltk)
             ("zlib" ,zlib)))
   (native-inputs `(("pkg-config" ,pkg-config)
                    ("xdg-utils" ,xdg-utils)
                    ;; TODO remove when substitute* is fixed
                    ("sed" ,sed)
                    ("which" ,which)))
   (synopsis "gzdoom")
   (description "gzdoom")
   (home-page "https://zdoom.org/")
   (license license:gpl3+)))