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