Commit | Line | Data |
---|---|---|
c3c516ea | 1 | ;;; GNU Guix --- Functional package management for GNU |
e0101b54 | 2 | ;;; Copyright © 2013, 2015, 2017 David Thompson <dthompson2@worcester.edu> |
9cb3036f | 3 | ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> |
df05d80a | 4 | ;;; Copyright © 2015, 2017 Sou Bunnbu <iyzsong@member.fsf.org> |
40e94665 | 5 | ;;; Copyright © 2015 Alex Kost <alezost@gmail.com> |
8df1ee3f | 6 | ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il> |
39f2433c | 7 | ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com> |
c3c516ea DT |
8 | ;;; |
9 | ;;; This file is part of GNU Guix. | |
10 | ;;; | |
11 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
12 | ;;; under the terms of the GNU General Public License as published by | |
13 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
14 | ;;; your option) any later version. | |
15 | ;;; | |
16 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
17 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;;; GNU General Public License for more details. | |
20 | ;;; | |
21 | ;;; You should have received a copy of the GNU General Public License | |
22 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | (define-module (gnu packages sdl) | |
6813f70a | 25 | #:use-module (ice-9 match) |
8df1ee3f EF |
26 | #:use-module (srfi srfi-1) |
27 | #:use-module (srfi srfi-26) | |
c3c516ea | 28 | #:use-module (gnu packages) |
890024c5 | 29 | #:use-module ((guix licenses) #:hide (freetype)) |
c3c516ea DT |
30 | #:use-module (guix packages) |
31 | #:use-module (guix download) | |
39f2433c | 32 | #:use-module (guix utils) |
c3c516ea | 33 | #:use-module (guix build-system gnu) |
d6f74baf | 34 | #:use-module (guix build-system trivial) |
a313e085 | 35 | #:use-module (gnu packages audio) |
543bd0ee | 36 | #:use-module (gnu packages fcitx) |
890024c5 | 37 | #:use-module (gnu packages fontutils) |
39f2433c | 38 | #:use-module (gnu packages freedesktop) |
e0101b54 | 39 | #:use-module (gnu packages glib) |
bcc046fc | 40 | #:use-module (gnu packages guile) |
e0101b54 | 41 | #:use-module (gnu packages ibus) |
e55354b8 | 42 | #:use-module (gnu packages image) |
c3c516ea | 43 | #:use-module (gnu packages linux) |
5cf3bcd4 | 44 | #:use-module (gnu packages mp3) |
8bf8d7c7 DT |
45 | #:use-module (gnu packages pkg-config) |
46 | #:use-module (gnu packages pulseaudio) | |
200726ed | 47 | #:use-module (gnu packages gl) |
39f2433c | 48 | #:use-module (gnu packages xdisorg) |
54ff0b7d | 49 | #:use-module (gnu packages xiph) |
c3c516ea | 50 | #:use-module (gnu packages xorg) |
0160458b | 51 | #:export (sdl-union)) |
8bf8d7c7 | 52 | |
0160458b | 53 | (define-public sdl |
8bf8d7c7 DT |
54 | (package |
55 | (name "sdl") | |
56 | (version "1.2.15") | |
57 | (source (origin | |
58 | (method url-fetch) | |
59 | (uri | |
5d5790ce | 60 | (string-append "https://libsdl.org/release/SDL-" |
8bf8d7c7 DT |
61 | version ".tar.gz")) |
62 | (sha256 | |
63 | (base32 | |
9cb3036f | 64 | "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn")) |
fc1adab1 | 65 | (patches (search-patches "sdl-libx11-1.6.patch")))) |
8bf8d7c7 | 66 | (build-system gnu-build-system) |
22f33e61 | 67 | (arguments |
666aa995 | 68 | '(;; Explicitly link against shared libraries instead of dlopening them. |
83bb3a3e SB |
69 | ;; For X11, ALSA, and PulseAudio. |
70 | ;; OpenGL library is still dlopened at runtime. | |
71 | #:configure-flags '("--disable-alsa-shared" | |
72 | "--disable-pulseaudio-shared" | |
07780c71 SB |
73 | "--disable-x11-shared" |
74 | ;; Explicitly link with mesa. | |
75 | ;; This add mesa to libsdl's RUNPATH, to make dlopen | |
76 | ;; finding the libGL from mesa at runtime. | |
77 | "LDFLAGS=-lGL") | |
22f33e61 LC |
78 | |
79 | #:tests? #f)) ; no check target | |
558a5122 LC |
80 | (propagated-inputs |
81 | ;; SDL headers include X11 headers. | |
666aa995 SB |
82 | `(("libx11" ,libx11) |
83 | ("libcap" ,libcap))) ; 'libSDL.la' contain `-lcap'. | |
22f33e61 | 84 | (native-inputs `(("pkg-config" ,pkg-config))) |
558a5122 | 85 | (inputs `(("libxrandr" ,libxrandr) |
8bf8d7c7 | 86 | ("mesa" ,mesa) |
83bb3a3e | 87 | ("glu" ,glu) |
8bf8d7c7 | 88 | ("alsa-lib" ,alsa-lib) |
8bf8d7c7 | 89 | ("pulseaudio" ,pulseaudio))) |
38033318 | 90 | (outputs '("out" "debug")) |
8bf8d7c7 DT |
91 | (synopsis "Cross platform game development library") |
92 | (description "Simple DirectMedia Layer is a cross-platform development | |
93 | library designed to provide low level access to audio, keyboard, mouse, | |
94 | joystick, and graphics hardware.") | |
5d5790ce | 95 | (home-page "https://libsdl.org/") |
8bf8d7c7 DT |
96 | (license lgpl2.1))) |
97 | ||
0160458b | 98 | (define-public sdl2 |
8bf8d7c7 DT |
99 | (package (inherit sdl) |
100 | (name "sdl2") | |
39f2433c | 101 | (version "2.0.7") |
8bf8d7c7 DT |
102 | (source (origin |
103 | (method url-fetch) | |
104 | (uri | |
5d5790ce | 105 | (string-append "https://libsdl.org/release/SDL2-" |
8bf8d7c7 DT |
106 | version ".tar.gz")) |
107 | (sha256 | |
108 | (base32 | |
39f2433c RH |
109 | "0pjdpxla5kh1w1b0shxrx97a116vyy31njxi0jhyvqhk8d6cfdgf")))) |
110 | (arguments | |
111 | (substitute-keyword-arguments (package-arguments sdl) | |
112 | ((#:configure-flags flags) | |
113 | `(append '("--disable-wayland-shared") | |
114 | ,flags)))) | |
e0101b54 DT |
115 | (inputs |
116 | ;; SDL2 needs to be built with ibus support otherwise some systems | |
117 | ;; experience a bug where input events are doubled. | |
118 | ;; | |
119 | ;; For more information, see: https://dev.solus-project.com/T1721 | |
120 | (append `(("dbus" ,dbus) | |
543bd0ee | 121 | ("fcitx" ,fcitx) ; helps with CJK input |
e0101b54 | 122 | ("glib" ,glib) |
39f2433c RH |
123 | ("ibus" ,ibus) |
124 | ("libxkbcommon", libxkbcommon) | |
125 | ("wayland", wayland) | |
126 | ("wayland-protocols", wayland-protocols)) | |
e0101b54 | 127 | (package-inputs sdl))) |
8bf8d7c7 | 128 | (license bsd-3))) |
c3c516ea | 129 | |
0160458b | 130 | (define-public libmikmod |
c3c516ea DT |
131 | (package |
132 | (name "libmikmod") | |
7d876afd | 133 | (version "3.3.10") |
c3c516ea DT |
134 | (source (origin |
135 | (method url-fetch) | |
1934769b MW |
136 | (uri (list |
137 | (string-append "mirror://sourceforge/mikmod/libmikmod/" | |
138 | version "/libmikmod-" version ".tar.gz") | |
139 | ;; Older versions are sometimes moved to: | |
140 | (string-append "mirror://sourceforge/mikmod/" | |
141 | "outdated_versions/libmikmod/" | |
142 | version "/libmikmod-" version ".tar.gz"))) | |
c3c516ea DT |
143 | (sha256 |
144 | (base32 | |
7d876afd | 145 | "0j7g4jpa2zgzw7x6s3rldypa7zlwjvn97rwx0sylx1iihhlzbcq0")))) |
c3c516ea | 146 | (build-system gnu-build-system) |
03920078 LC |
147 | (arguments |
148 | ;; By default, libmikmod tries to dlopen libasound etc., which won't work | |
149 | ;; unless the right libalsa happens to be in $LD_LIBRARY_PATH. Pass | |
150 | ;; '--disable-dl' to avoid that. | |
151 | '(#:configure-flags '("--disable-dl"))) | |
9e771e3b | 152 | (synopsis "Library for module sound formats") |
c3c516ea DT |
153 | (description |
154 | "MikMod is able to play a wide range of module formats, as well as | |
35b9e423 | 155 | digital sound files. It can take advantage of particular features of your |
c3c516ea DT |
156 | system, such as sound redirection over the network.") |
157 | (license lgpl2.1) | |
158 | (home-page "http://mikmod.sourceforge.net/"))) | |
5cf3bcd4 | 159 | |
0160458b | 160 | (define-public sdl-gfx |
5cf3bcd4 DT |
161 | (package |
162 | (name "sdl-gfx") | |
b5ceea9f | 163 | (version "2.0.26") |
5cf3bcd4 DT |
164 | (source (origin |
165 | (method url-fetch) | |
166 | (uri | |
167 | (string-append "http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-" | |
168 | version ".tar.gz")) | |
169 | (sha256 | |
170 | (base32 | |
b5ceea9f | 171 | "0ijljhs0v99dj6y27hc10z6qchyp8gdp4199y6jzngy6dzxlzsvw")))) |
5cf3bcd4 | 172 | (build-system gnu-build-system) |
38033318 | 173 | (outputs '("out" "debug")) |
8df1ee3f EF |
174 | (arguments |
175 | `(,@(if (any (cute string-prefix? <> (or (%current-system) | |
176 | (%current-target-system))) | |
177 | '("x86_64" "i686")) | |
178 | ;; mmx is supported only on Intel processors. | |
179 | '() | |
180 | '(#:configure-flags '("--disable-mmx"))))) | |
5cf3bcd4 | 181 | (propagated-inputs `(("sdl" ,sdl))) |
5cf3bcd4 DT |
182 | (synopsis "SDL graphics primitives library") |
183 | (description "SDL_gfx provides graphics drawing primitives, rotozoom and | |
184 | other supporting functions for SDL.") | |
185 | (home-page "http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx") | |
8df1ee3f | 186 | (license zlib))) |
5cf3bcd4 | 187 | |
0160458b | 188 | (define-public sdl-image |
5cf3bcd4 DT |
189 | (package |
190 | (name "sdl-image") | |
191 | (version "1.2.12") | |
192 | (source (origin | |
193 | (method url-fetch) | |
194 | (uri | |
5d5790ce | 195 | (string-append "https://www.libsdl.org/projects/SDL_image/release/SDL_image-" |
5cf3bcd4 DT |
196 | version ".tar.gz")) |
197 | (sha256 | |
198 | (base32 | |
199 | "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b")))) | |
200 | (build-system gnu-build-system) | |
38033318 | 201 | (outputs '("out" "debug")) |
7c3e60fb SB |
202 | (arguments |
203 | ;; Explicitly link against shared libraries instead of dlopening them. | |
204 | '(#:configure-flags '("--disable-jpg-shared" | |
205 | "--disable-png-shared" | |
206 | "--disable-tif-shared" | |
207 | "--disable-webp-shared"))) | |
586b6d4d | 208 | (native-inputs `(("pkg-config" ,pkg-config))) |
586b6d4d DT |
209 | ;; libjpeg, libpng, and libtiff are propagated inputs because the |
210 | ;; SDL_image headers include the headers of these libraries. SDL is a | |
211 | ;; propagated input because the pkg-config file refers to SDL's pkg-config | |
212 | ;; file. | |
213 | (propagated-inputs `(("sdl" ,sdl) | |
214 | ("libjpeg" ,libjpeg) | |
215 | ("libpng" ,libpng) | |
6a51e95b DT |
216 | ("libtiff" ,libtiff) |
217 | ("libwebp" ,libwebp))) | |
5cf3bcd4 DT |
218 | (synopsis "SDL image loading library") |
219 | (description "SDL_image is an image file loading library for SDL that | |
220 | supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, | |
221 | WEBP, XCF, XPM, and XV.") | |
5d5790ce | 222 | (home-page "https://www.libsdl.org/projects/SDL_image/") |
5cf3bcd4 DT |
223 | (license zlib))) |
224 | ||
0160458b | 225 | (define-public sdl-mixer |
5cf3bcd4 DT |
226 | (package |
227 | (name "sdl-mixer") | |
228 | (version "1.2.12") | |
229 | (source (origin | |
230 | (method url-fetch) | |
231 | (uri | |
5d5790ce | 232 | (string-append "https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-" |
5cf3bcd4 DT |
233 | version ".tar.gz")) |
234 | (sha256 | |
235 | (base32 | |
236 | "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n")))) | |
237 | (build-system gnu-build-system) | |
38033318 | 238 | (outputs '("out" "debug")) |
5cf3bcd4 DT |
239 | ;; no check target |
240 | ;; use libmad instead of smpeg | |
3ff73390 | 241 | ;; explicitly link against shared libraries instead of dlopening them |
5cf3bcd4 | 242 | (arguments `(#:tests? #f |
3ff73390 SB |
243 | #:configure-flags '("--enable-music-mp3-mad-gpl" |
244 | "--disable-music-mod-shared" | |
245 | "--disable-music-fluidsynth-shared" | |
246 | "--disable-music-ogg-shared" | |
247 | "--disable-music-flac-shared" | |
248 | "--disable-music-mp3-shared"))) | |
5cf3bcd4 DT |
249 | (inputs `(("libvorbis" ,libvorbis) |
250 | ("libflac" ,flac) | |
251 | ("libmad" ,libmad) | |
a313e085 DT |
252 | ("libmikmod" ,libmikmod) |
253 | ("libmodplug" ,libmodplug))) | |
5cf3bcd4 DT |
254 | ;; FIXME: Add libfluidsynth |
255 | (propagated-inputs `(("sdl" ,sdl))) | |
256 | (synopsis "SDL multi-channel audio mixer library") | |
257 | (description "SDL_mixer is a multi-channel audio mixer library for SDL. | |
258 | It supports any number of simultaneously playing channels of 16 bit stereo | |
259 | audio, plus a single channel of music. Supported format include FLAC, MOD, | |
260 | MIDI, Ogg Vorbis, and MP3.") | |
5d5790ce | 261 | (home-page "https://www.libsdl.org/projects/SDL_mixer/") |
5cf3bcd4 DT |
262 | (license zlib))) |
263 | ||
0160458b | 264 | (define-public sdl-net |
5cf3bcd4 DT |
265 | (package |
266 | (name "sdl-net") | |
267 | (version "1.2.8") | |
268 | (source (origin | |
269 | (method url-fetch) | |
270 | (uri | |
5d5790ce | 271 | (string-append "https://www.libsdl.org/projects/SDL_net/release/SDL_net-" |
5cf3bcd4 DT |
272 | version ".tar.gz")) |
273 | (sha256 | |
274 | (base32 | |
275 | "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz")))) | |
276 | (build-system gnu-build-system) | |
277 | (propagated-inputs `(("sdl" ,sdl))) | |
41eb1198 | 278 | (native-inputs `(("pkg-config" ,pkg-config))) |
38033318 | 279 | (outputs '("out" "debug")) |
5cf3bcd4 DT |
280 | (synopsis "SDL networking library") |
281 | (description "SDL_net is a small, cross-platform networking library for | |
282 | SDL.") | |
5d5790ce | 283 | (home-page "https://www.libsdl.org/projects/SDL_net/") |
5cf3bcd4 DT |
284 | (license zlib))) |
285 | ||
0160458b | 286 | (define-public sdl-ttf |
5cf3bcd4 DT |
287 | (package |
288 | (name "sdl-ttf") | |
289 | (version "2.0.11") | |
290 | (source (origin | |
291 | (method url-fetch) | |
292 | (uri | |
5d5790ce | 293 | (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-" |
5cf3bcd4 DT |
294 | version ".tar.gz")) |
295 | (sha256 | |
296 | (base32 | |
297 | "1dydxd4f5kb1288i5n5568kdk2q7f8mqjr7i7sd33nplxjaxhk3j")))) | |
298 | (build-system gnu-build-system) | |
299 | (propagated-inputs `(("sdl" ,sdl))) | |
890024c5 | 300 | (inputs `(("freetype" ,freetype) |
41eb1198 LC |
301 | ("mesa" ,mesa))) |
302 | (native-inputs `(("pkg-config" ,pkg-config))) | |
38033318 | 303 | (outputs '("out" "debug")) |
5cf3bcd4 DT |
304 | (synopsis "SDL TrueType font library") |
305 | (description "SDL_ttf is a TrueType font rendering library for SDL.") | |
5d5790ce | 306 | (home-page "https://www.libsdl.org/projects/SDL_ttf/") |
5cf3bcd4 | 307 | (license zlib))) |
d6f74baf | 308 | |
40e94665 AK |
309 | (define* (sdl-union #:optional (packages (list sdl sdl-gfx sdl-net sdl-ttf |
310 | sdl-image sdl-mixer))) | |
311 | "Return 'sdl-union' package which is a union of PACKAGES. | |
312 | If PACKAGES are not specified, all SDL packages are used." | |
d6f74baf DT |
313 | (package |
314 | (name "sdl-union") | |
315 | (version (package-version sdl)) | |
316 | (source #f) | |
317 | (build-system trivial-build-system) | |
318 | (arguments | |
319 | '(#:modules ((guix build union)) | |
320 | #:builder (begin | |
321 | (use-modules (ice-9 match) | |
322 | (guix build union)) | |
323 | (match %build-inputs | |
324 | (((names . directories) ...) | |
325 | (union-build (assoc-ref %outputs "out") | |
326 | directories)))))) | |
40e94665 AK |
327 | (inputs (map (lambda (package) |
328 | (list (package-name package) package)) | |
329 | packages)) | |
330 | (synopsis "Union of SDL libraries") | |
d6f74baf DT |
331 | (description |
332 | "A union of SDL and its extension libraries. A union is required because | |
333 | sdl-config assumes that all of the headers and libraries are in the same | |
334 | directory.") | |
335 | (home-page (package-home-page sdl)) | |
336 | (license (package-license sdl)))) | |
bcc046fc | 337 | |
6813f70a DT |
338 | (define (propagated-inputs-with-sdl2 package) |
339 | "Replace the \"sdl\" propagated input of PACKAGE with SDL2." | |
340 | (map (match-lambda | |
341 | (("sdl" _) | |
342 | `("sdl2" ,sdl2)) | |
343 | (other other)) | |
344 | (package-propagated-inputs package))) | |
345 | ||
346 | (define-public sdl2-image | |
347 | (package (inherit sdl-image) | |
348 | (name "sdl2-image") | |
64ee72e1 | 349 | (version "2.0.1") |
6813f70a DT |
350 | (source (origin |
351 | (method url-fetch) | |
352 | (uri | |
5d5790ce | 353 | (string-append "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-" |
6813f70a DT |
354 | version ".tar.gz")) |
355 | (sha256 | |
356 | (base32 | |
64ee72e1 | 357 | "0r3z1l7fdn76qkpy7snpkcjqz8dkv2zp6lsqpq25q4m5xsyaygis")))) |
6813f70a DT |
358 | (propagated-inputs |
359 | (propagated-inputs-with-sdl2 sdl-image)))) | |
360 | ||
855e2939 DT |
361 | (define-public sdl2-mixer |
362 | (package (inherit sdl-mixer) | |
363 | (name "sdl2-mixer") | |
efd75ade | 364 | (version "2.0.1") |
855e2939 DT |
365 | (source (origin |
366 | (method url-fetch) | |
367 | (uri | |
368 | (string-append "http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-" | |
369 | version ".tar.gz")) | |
efd75ade DT |
370 | (modules '((guix build utils))) |
371 | (snippet | |
372 | ;; Remove bundled libraries. | |
373 | '(delete-file-recursively "external")) | |
855e2939 DT |
374 | (sha256 |
375 | (base32 | |
efd75ade | 376 | "0pv9jzjpcjlbiaybvwrb4avmv46qk7iqxlnqrd2dfj82c4mgc92s")))) |
855e2939 DT |
377 | (propagated-inputs |
378 | (propagated-inputs-with-sdl2 sdl-mixer)))) | |
379 | ||
d3f6a1de DT |
380 | (define-public sdl2-ttf |
381 | (package (inherit sdl-ttf) | |
382 | (name "sdl2-ttf") | |
8d506323 | 383 | (version "2.0.14") |
d3f6a1de DT |
384 | (source (origin |
385 | (method url-fetch) | |
386 | (uri | |
5d5790ce | 387 | (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-" |
d3f6a1de | 388 | version ".tar.gz")) |
8d506323 DT |
389 | (modules '((guix build utils))) |
390 | (snippet | |
391 | ;; Remove bundled libraries. | |
392 | '(delete-file-recursively "external")) | |
d3f6a1de DT |
393 | (sha256 |
394 | (base32 | |
8d506323 | 395 | "0xljwcpvd2knrjdfag5b257xqayplz55mqlszrqp0kpnphh5xnrl")))) |
d3f6a1de DT |
396 | (propagated-inputs |
397 | (propagated-inputs-with-sdl2 sdl-ttf)))) | |
398 | ||
bcc046fc DT |
399 | (define-public guile-sdl |
400 | (package | |
401 | (name "guile-sdl") | |
af87a551 | 402 | (version "0.5.2") |
bcc046fc DT |
403 | (source (origin |
404 | (method url-fetch) | |
405 | (uri | |
406 | (string-append "mirror://gnu/guile-sdl/guile-sdl-" | |
407 | version ".tar.xz")) | |
408 | (sha256 | |
409 | (base32 | |
af87a551 | 410 | "0cjgs012a9922hn6xqwj66w6qmfs3nycnm56hyykx5n3g5p7ag01")))) |
bcc046fc DT |
411 | (build-system gnu-build-system) |
412 | (native-inputs | |
413 | `(("pkg-config" ,pkg-config) | |
414 | ;; Required by test suite. | |
415 | ("xorg-server" ,xorg-server) | |
416 | ("libjpeg" ,libjpeg))) | |
417 | (inputs | |
8380a181 | 418 | `(("guile" ,guile-2.2) |
40e94665 | 419 | ("sdl-union" ,(sdl-union)))) |
bcc046fc DT |
420 | (arguments |
421 | '(#:configure-flags | |
422 | (list (string-append "--with-sdl-prefix=" | |
423 | (assoc-ref %build-inputs "sdl-union"))) | |
4fa3f796 LC |
424 | #:modules ((ice-9 popen) |
425 | (guix build utils) | |
426 | (guix build gnu-build-system)) | |
427 | ||
bcc046fc | 428 | #:parallel-build? #f ; parallel build fails |
4fa3f796 | 429 | |
bcc046fc | 430 | #:phases |
dc1d3cde KK |
431 | (modify-phases %standard-phases |
432 | (add-before 'configure 'fix-env-and-patch | |
433 | (lambda* (#:key inputs #:allow-other-keys) | |
434 | (setenv "GUILE_AUTO_COMPILE" "0") | |
435 | ;; SDL_image needs to dlopen libjpeg in the test suite. | |
436 | (setenv "LD_LIBRARY_PATH" | |
437 | (string-append (assoc-ref inputs "libjpeg") "/lib")) | |
4fa3f796 LC |
438 | |
439 | ;; Change the site directory /site/X.Y like Guile expects. | |
dc1d3cde | 440 | (substitute* "build-aux/guile-baux/re-prefixed-site-dirs" |
4fa3f796 LC |
441 | (("\"/site\"") |
442 | (let ((effective | |
443 | (read | |
444 | (open-pipe* OPEN_READ | |
445 | "guile" "-c" | |
446 | "(write (effective-version))")))) | |
447 | (string-append "\"/site/" effective "\"")))) | |
af87a551 | 448 | |
dc1d3cde KK |
449 | ;; Skip tests that rely on sound support, which is unavailable in |
450 | ;; the build environment. | |
451 | (substitute* "test/Makefile.in" | |
452 | (("HAVE_MIXER = .*$") | |
453 | "HAVE_MIXER = 0\n")) | |
454 | #t)) | |
455 | (add-before 'check 'start-xorg-server | |
456 | (lambda* (#:key inputs #:allow-other-keys) | |
457 | ;; The test suite requires a running X server. | |
458 | (system (format #f "~a/bin/Xvfb :1 &" | |
459 | (assoc-ref inputs "xorg-server"))) | |
460 | (setenv "DISPLAY" ":1") | |
8380a181 LC |
461 | #t)) |
462 | (add-before 'check 'skip-cursor-test | |
463 | (lambda _ | |
464 | ;; XXX: This test sometimes enters an endless loop, and sometimes | |
465 | ;; crashes with: | |
466 | ;; guile: xcb_io.c:147: append_pending_request: Assertion `!xcb_xlib_unknown_seq_number' failed. | |
467 | ;; Skip it. | |
468 | (substitute* "test/cursor.scm" | |
469 | (("\\(SDL:init .*" all) | |
470 | (string-append "(exit 77) ;" all "\n"))) | |
dc1d3cde | 471 | #t))))) |
bcc046fc DT |
472 | (synopsis "Guile interface for SDL (Simple DirectMedia Layer)") |
473 | (description "Guile-SDL is a set of bindings to the Simple DirectMedia | |
474 | Layer (SDL). With them, Guile programmers can have easy access to graphics, | |
475 | sound and device input (keyboards, joysticks, mice, etc.).") | |
6fd52309 | 476 | (home-page "https://www.gnu.org/software/guile-sdl/") |
bcc046fc | 477 | (license gpl3+))) |
df05d80a SB |
478 | |
479 | (define-public guile-sdl2 | |
480 | (package | |
481 | (name "guile-sdl2") | |
482 | (version "0.2.0") | |
483 | (source (origin | |
484 | (method url-fetch) | |
485 | (uri (string-append | |
486 | "https://files.dthompson.us/guile-sdl2/guile-sdl2-" | |
487 | version ".tar.gz")) | |
488 | (sha256 | |
489 | (base32 | |
490 | "0yq9lsl17cdvj77padvpk3jcw2g6g0pck9jrchc7n2767rrc012b")))) | |
491 | (build-system gnu-build-system) | |
492 | (arguments | |
493 | '(#:make-flags '("GUILE_AUTO_COMPILE=0") | |
494 | #:configure-flags | |
495 | (list (string-append "--with-libsdl2-prefix=" | |
496 | (assoc-ref %build-inputs "sdl2")) | |
497 | (string-append "--with-libsdl2-image-prefix=" | |
498 | (assoc-ref %build-inputs "sdl2-image")) | |
499 | (string-append "--with-libsdl2-ttf-prefix=" | |
500 | (assoc-ref %build-inputs "sdl2-ttf")) | |
501 | (string-append "--with-libsdl2-mixer-prefix=" | |
502 | (assoc-ref %build-inputs "sdl2-mixer"))))) | |
503 | (native-inputs | |
504 | `(("guile" ,guile-2.0) | |
505 | ("pkg-config" ,pkg-config))) | |
506 | (inputs | |
507 | `(("sdl2" ,sdl2) | |
508 | ("sdl2-image" ,sdl2-image) | |
509 | ("sdl2-mixer" ,sdl2-mixer) | |
510 | ("sdl2-ttf" ,sdl2-ttf))) | |
511 | (synopsis "Guile bindings for SDL2") | |
512 | (home-page "https://dthompson.us/projects/guile-sdl2.html") | |
513 | (description | |
514 | "Guile-SDL2 provides Guile Scheme bindings for the SDL2 C shared library. | |
515 | The bindings are written in pure Scheme using Guile's foreign function | |
516 | interface.") | |
517 | (license lgpl3+))) |