gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / sdl.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2017 David Thompson <dthompson2@worcester.edu>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015, 2017 Sou Bunnbu <iyzsong@member.fsf.org>
5 ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
6 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
8 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
10 ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
11 ;;; Copyright © 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
12 ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
13 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
14 ;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
15 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
16 ;;;
17 ;;; This file is part of GNU Guix.
18 ;;;
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
23 ;;;
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
28 ;;;
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32 (define-module (gnu packages sdl)
33 #:use-module (ice-9 match)
34 #:use-module (srfi srfi-1)
35 #:use-module (srfi srfi-26)
36 #:use-module (gnu packages)
37 #:use-module ((guix licenses) #:hide (freetype))
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix utils)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system trivial)
44 #:use-module (gnu packages audio)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages fcitx)
47 #:use-module (gnu packages fontutils)
48 #:use-module (gnu packages freedesktop)
49 #:use-module (gnu packages glib)
50 #:use-module (gnu packages gtk)
51 #:use-module (gnu packages guile)
52 #:use-module (gnu packages ibus)
53 #:use-module (gnu packages image)
54 #:use-module (gnu packages linux)
55 #:use-module (gnu packages mono)
56 #:use-module (gnu packages mp3)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages pulseaudio)
59 #:use-module (gnu packages gl)
60 #:use-module (gnu packages xdisorg)
61 #:use-module (gnu packages xiph)
62 #:use-module (gnu packages xorg)
63 #:export (sdl-union))
64
65 (define-public sdl
66 (package
67 (name "sdl")
68 (version "1.2.15")
69 (source (origin
70 (method url-fetch)
71 (uri
72 (string-append "https://libsdl.org/release/SDL-"
73 version ".tar.gz"))
74 (sha256
75 (base32
76 "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn"))
77 (patches (search-patches "sdl-libx11-1.6.patch"))))
78 (build-system gnu-build-system)
79 (arguments
80 '(;; Explicitly link against shared libraries instead of dlopening them.
81 ;; For X11, ALSA, and PulseAudio.
82 ;; OpenGL library is still dlopened at runtime.
83 #:configure-flags '("--disable-alsa-shared"
84 "--disable-pulseaudio-shared"
85 "--disable-x11-shared"
86 ;; Explicitly link with mesa.
87 ;; This add mesa to libsdl's RUNPATH, to make dlopen
88 ;; finding the libGL from mesa at runtime.
89 "LDFLAGS=-lGL")
90
91 #:make-flags '("V=1") ;build verbosely
92
93 #:tests? #f)) ; no check target
94 (propagated-inputs
95 ;; SDL headers include X11 headers.
96 `(("libx11" ,libx11)
97 ("libcap" ,libcap) ; 'libSDL.la' contain `-lcap'.
98 ;; TODO: Since building Mesa with Meson it is now necessary that Mesa is
99 ;; a propogated input. We still need to figure out why, possibly due to a
100 ;; change in pkg-config.
101 ("mesa" ,mesa)))
102 (native-inputs `(("pkg-config" ,pkg-config)))
103 (inputs `(("libxrandr" ,libxrandr)
104 ("glu" ,glu)
105 ("alsa-lib" ,alsa-lib)
106 ("pulseaudio" ,pulseaudio)))
107 (outputs '("out" "debug"))
108 (synopsis "Cross platform game development library")
109 (description "Simple DirectMedia Layer is a cross-platform development
110 library designed to provide low level access to audio, keyboard, mouse,
111 joystick, and graphics hardware.")
112 (home-page "https://libsdl.org/")
113 (license lgpl2.1)))
114
115 (define-public sdl2
116 (package (inherit sdl)
117 (name "sdl2")
118 (version "2.0.12")
119 (source (origin
120 (method url-fetch)
121 (uri
122 (string-append "https://libsdl.org/release/SDL2-"
123 version ".tar.gz"))
124 (sha256
125 (base32
126 "0qy8wbqvfkb5ps8kxgaaf2zzpkjqbsw712hlp74znbn0jpv6i4il"))))
127 (arguments
128 (substitute-keyword-arguments (package-arguments sdl)
129 ((#:configure-flags flags)
130 `(append '("--disable-wayland-shared" "--enable-video-kmsdrm"
131 "--disable-kmsdrm-shared")
132 ,flags))
133 ((#:make-flags flags ''())
134 `(cons*
135 ;; SDL dlopens libudev, so make sure it is in rpath. This overrides
136 ;; the LDFLAG set in sdl’s configure-flags, which isn’t necessary
137 ;; as sdl2 includes Mesa by default.
138 (string-append "LDFLAGS=-Wl,-rpath,"
139 (assoc-ref %build-inputs "eudev") "/lib")
140 ,flags))))
141 (inputs
142 ;; SDL2 needs to be built with ibus support otherwise some systems
143 ;; experience a bug where input events are doubled.
144 ;;
145 ;; For more information, see: https://dev.solus-project.com/T1721
146 (append `(("dbus" ,dbus)
147 ("eudev" ,eudev) ; for discovering input devices
148 ("fcitx" ,fcitx) ; helps with CJK input
149 ("glib" ,glib)
150 ("ibus" ,ibus)
151 ("libxkbcommon" ,libxkbcommon)
152 ("libxcursor" ,libxcursor) ; enables X11 cursor support
153 ("wayland" ,wayland)
154 ("wayland-protocols" ,wayland-protocols))
155 (package-inputs sdl)))
156 (license bsd-3)))
157
158 (define-public libmikmod
159 (package
160 (name "libmikmod")
161 (version "3.3.11.1")
162 (source (origin
163 (method url-fetch)
164 (uri (list
165 (string-append "mirror://sourceforge/mikmod/libmikmod/"
166 version "/libmikmod-" version ".tar.gz")
167 ;; Older versions are sometimes moved to:
168 (string-append "mirror://sourceforge/mikmod/"
169 "outdated_versions/libmikmod/"
170 version "/libmikmod-" version ".tar.gz")))
171 (sha256
172 (base32
173 "06bdnhb0l81srdzg6gn2v2ydhhaazza7rshrcj3q8dpqr3gn97dd"))))
174 (build-system gnu-build-system)
175 (arguments
176 ;; By default, libmikmod tries to dlopen libasound etc., which won't work
177 ;; unless the right libalsa happens to be in $LD_LIBRARY_PATH. Pass
178 ;; '--disable-dl' to avoid that.
179 '(#:configure-flags '("--disable-dl")))
180 (synopsis "Library for module sound formats")
181 (description
182 "MikMod is able to play a wide range of module formats, as well as
183 digital sound files. It can take advantage of particular features of your
184 system, such as sound redirection over the network.")
185 (license lgpl2.1)
186 (home-page "http://mikmod.sourceforge.net/")))
187
188 (define-public sdl-gfx
189 (package
190 (name "sdl-gfx")
191 (version "2.0.26")
192 (source (origin
193 (method url-fetch)
194 (uri
195 (string-append "http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-"
196 version ".tar.gz"))
197 (sha256
198 (base32
199 "0ijljhs0v99dj6y27hc10z6qchyp8gdp4199y6jzngy6dzxlzsvw"))))
200 (build-system gnu-build-system)
201 (outputs '("out" "debug"))
202 (arguments
203 `(,@(if (any (cute string-prefix? <> (or (%current-system)
204 (%current-target-system)))
205 '("x86_64" "i686"))
206 ;; mmx is supported only on Intel processors.
207 '()
208 '(#:configure-flags '("--disable-mmx")))))
209 (propagated-inputs `(("sdl" ,sdl)))
210 (synopsis "SDL graphics primitives library")
211 (description "SDL_gfx provides graphics drawing primitives, rotozoom and
212 other supporting functions for SDL.")
213 (home-page "http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx")
214 (license zlib)))
215
216 (define-public sdl-image
217 (package
218 (name "sdl-image")
219 (version "1.2.12")
220 (source (origin
221 (method url-fetch)
222 (uri
223 (string-append "https://www.libsdl.org/projects/SDL_image/release/SDL_image-"
224 version ".tar.gz"))
225 (sha256
226 (base32
227 "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b"))))
228 (build-system gnu-build-system)
229 (outputs '("out" "debug"))
230 (arguments
231 ;; Explicitly link against shared libraries instead of dlopening them.
232 '(#:configure-flags '("--disable-jpg-shared"
233 "--disable-png-shared"
234 "--disable-tif-shared"
235 "--disable-webp-shared")))
236 (native-inputs `(("pkg-config" ,pkg-config)))
237 ;; libjpeg, libpng, and libtiff are propagated inputs because the
238 ;; SDL_image headers include the headers of these libraries. SDL is a
239 ;; propagated input because the pkg-config file refers to SDL's pkg-config
240 ;; file.
241 (propagated-inputs `(("sdl" ,sdl)
242 ("libjpeg" ,libjpeg-turbo)
243 ("libpng" ,libpng)
244 ("libtiff" ,libtiff)
245 ("libwebp" ,libwebp)))
246 (synopsis "SDL image loading library")
247 (description "SDL_image is an image file loading library for SDL that
248 supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF,
249 WEBP, XCF, XPM, and XV.")
250 (home-page "https://www.libsdl.org/projects/SDL_image/")
251 (license zlib)))
252
253 (define-public sdl-mixer
254 (package
255 (name "sdl-mixer")
256 (version "1.2.12")
257 (source (origin
258 (method url-fetch)
259 (uri
260 (string-append "https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-"
261 version ".tar.gz"))
262 (sha256
263 (base32
264 "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"))))
265 (build-system gnu-build-system)
266 (outputs '("out" "debug"))
267 (arguments
268 `(#:tests? #f ; No check target.
269 #:configure-flags
270 '("--enable-music-mp3-mad-gpl" ; Use libmad instead of smpeg.
271 ;; Explicitly link against shared libraries instead of dlopening them.
272 "--disable-music-flac-shared"
273 "--disable-music-fluidsynth-shared"
274 "--disable-music-mod-shared"
275 "--disable-music-ogg-shared")
276 #:phases
277 (modify-phases %standard-phases
278 (add-after 'unpack 'fix-fluidsynth
279 (lambda* (#:key inputs #:allow-other-keys)
280 (substitute* "configure"
281 (("EXTRA_LDFLAGS -lfluidsynth")
282 (string-append "EXTRA_LDFLAGS "
283 "-L"
284 (assoc-ref inputs "fluidsynth")
285 "/lib -lfluidsynth")))
286 #t)))))
287 (inputs
288 `(("fluidsynth" ,fluidsynth)
289 ("libflac" ,flac)
290 ("libmad" ,libmad)
291 ("libmikmod" ,libmikmod)
292 ("libvorbis" ,libvorbis)))
293 (propagated-inputs `(("sdl" ,sdl)))
294 (synopsis "SDL multi-channel audio mixer library")
295 (description "SDL_mixer is a multi-channel audio mixer library for SDL.
296 It supports any number of simultaneously playing channels of 16 bit stereo
297 audio, plus a single channel of music. Supported formats include FLAC, MOD,
298 MIDI, Ogg Vorbis, and MP3.
299
300 This package supports two MIDI backends, selectable at runtime. To use the
301 newer @code{fluidsynth} library, install a soundfont such as @code{fluid-3}
302 and specify it using the @code{SDL_SOUNDFONTS} environment variable. For the
303 legacy @code{timidity} backend, install a patch set such as @code{freepats}
304 and set the path to the configuration file with @code{TIMIDITY_CFG}.")
305 (home-page "https://www.libsdl.org/projects/SDL_mixer/")
306 (license zlib)))
307
308 (define-public sdl-net
309 (package
310 (name "sdl-net")
311 (version "1.2.8")
312 (source (origin
313 (method url-fetch)
314 (uri
315 (string-append "https://www.libsdl.org/projects/SDL_net/release/SDL_net-"
316 version ".tar.gz"))
317 (sha256
318 (base32
319 "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz"))))
320 (build-system gnu-build-system)
321 (propagated-inputs `(("sdl" ,sdl)))
322 (native-inputs `(("pkg-config" ,pkg-config)))
323 (outputs '("out" "debug"))
324 (synopsis "SDL networking library")
325 (description "SDL_net is a small, cross-platform networking library for
326 SDL.")
327 (home-page "https://www.libsdl.org/projects/SDL_net/")
328 (license zlib)))
329
330 (define-public sdl-pango
331 (package
332 (name "sdl-pango")
333 (version "0.1.2")
334 (source
335 (origin
336 (method url-fetch)
337 (uri (string-append
338 "mirror://sourceforge/sdlpango/SDL_Pango/" version "/"
339 "SDL_Pango-" version ".tar.gz"))
340 (sha256
341 (base32 "197baw1dsg0p4pljs5k0fshbyki00r4l49m1drlpqw6ggawx6xbz"))
342 (patches (search-patches "sdl-pango-api_additions.patch"
343 "sdl-pango-blit_overflow.patch"
344 "sdl-pango-fillrect_crash.patch"
345 "sdl-pango-header-guard.patch"
346 "sdl-pango-matrix_declarations.patch"
347 "sdl-pango-sans-serif.patch"))))
348 (build-system gnu-build-system)
349 (arguments
350 `(#:configure-flags (list "--disable-static")
351 #:phases
352 (modify-phases %standard-phases
353 (add-after 'unpack 'autogen
354 ;; Force reconfiguration because the included libtool
355 ;; generates linking errors.
356 (lambda _ (invoke "autoreconf" "-vif"))))))
357 (native-inputs
358 `(("autoconf" ,autoconf)
359 ("automake" ,automake)
360 ("libtool" ,libtool)
361 ("pkg-config" ,pkg-config)))
362 (inputs
363 `(("fontconfig" ,fontconfig)
364 ("freetype" ,freetype)
365 ("glib" ,glib)
366 ("harfbuzz" ,harfbuzz)
367 ("pango" ,pango)
368 ("sdl" ,sdl)))
369 (home-page "http://sdlpango.sourceforge.net")
370 (synopsis "Pango SDL binding")
371 (description "This library is a wrapper around the Pango library.
372 It allows you to use TrueType fonts to render internationalized and
373 tagged text in SDL applications.")
374 (license lgpl2.1)))
375
376 (define-public sdl-ttf
377 (package
378 (name "sdl-ttf")
379 (version "2.0.11")
380 (source (origin
381 (method url-fetch)
382 (uri
383 (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-"
384 version ".tar.gz"))
385 (sha256
386 (base32
387 "1dydxd4f5kb1288i5n5568kdk2q7f8mqjr7i7sd33nplxjaxhk3j"))))
388 (build-system gnu-build-system)
389 (propagated-inputs `(("sdl" ,sdl)))
390 (inputs `(("freetype" ,freetype)
391 ("mesa" ,mesa)))
392 (native-inputs `(("pkg-config" ,pkg-config)))
393 (outputs '("out" "debug"))
394 (synopsis "SDL TrueType font library")
395 (description "SDL_ttf is a TrueType font rendering library for SDL.")
396 (home-page "https://www.libsdl.org/projects/SDL_ttf/")
397 (license zlib)))
398
399 (define* (sdl-union #:optional (packages (list sdl sdl-gfx sdl-net sdl-ttf
400 sdl-image sdl-mixer)))
401 "Return 'sdl-union' package which is a union of PACKAGES.
402 If PACKAGES are not specified, all SDL packages are used."
403 (package
404 (name "sdl-union")
405 (version (package-version sdl))
406 (source #f)
407 (build-system trivial-build-system)
408 (arguments
409 '(#:modules ((guix build union))
410 #:builder (begin
411 (use-modules (ice-9 match)
412 (guix build union))
413 (match %build-inputs
414 (((names . directories) ...)
415 (union-build (assoc-ref %outputs "out")
416 directories)
417 #t)))))
418 (inputs (map (lambda (package)
419 (list (package-name package) package))
420 packages))
421 (synopsis "Union of SDL libraries")
422 (description
423 "A union of SDL and its extension libraries. A union is required because
424 sdl-config assumes that all of the headers and libraries are in the same
425 directory.")
426 (home-page (package-home-page sdl))
427 (license (package-license sdl))))
428
429 (define (propagated-inputs-with-sdl2 package)
430 "Replace the \"sdl\" propagated input of PACKAGE with SDL2."
431 (map (match-lambda
432 (("sdl" _)
433 `("sdl2" ,sdl2))
434 (other other))
435 (package-propagated-inputs package)))
436
437 (define-public sdl2-gfx
438 (package (inherit sdl-gfx)
439 (name "sdl2-gfx")
440 (version "1.0.4")
441 (source (origin
442 (method url-fetch)
443 (uri
444 (string-append "https://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-"
445 version ".tar.gz"))
446 (sha256
447 (base32
448 "0qk2ax7f7grlxb13ba0ll3zlm8780s7j8fmrhlpxzjgdvldf1q33"))))
449 (propagated-inputs
450 (propagated-inputs-with-sdl2 sdl-gfx))))
451
452 (define-public sdl2-image
453 (package (inherit sdl-image)
454 (name "sdl2-image")
455 (version "2.0.5")
456 (source
457 (origin
458 (method url-fetch)
459 (uri
460 (string-append "https://www.libsdl.org/projects/SDL_image/release/"
461 "SDL2_image-" version ".tar.gz"))
462 (sha256
463 (base32 "1l0864kas9cwpp2d32yxl81g98lx40dhbdp03dz7sbv84vhgdmdx"))))
464 (propagated-inputs
465 (propagated-inputs-with-sdl2 sdl-image))))
466
467 (define-public sdl2-mixer
468 (package (inherit sdl-mixer)
469 (name "sdl2-mixer")
470 (version "2.0.4")
471 (source
472 (origin
473 (method url-fetch)
474 (uri
475 (string-append "http://www.libsdl.org/projects/SDL_mixer/release/"
476 "SDL2_mixer-" version ".tar.gz"))
477 (modules '((guix build utils)))
478 (snippet '(begin
479 ;; Remove bundled libraries.
480 (delete-file-recursively "external")
481 #t))
482 (sha256
483 (base32 "0694vsz5bjkcdgfdra6x9fq8vpzrl8m6q96gh58df7065hw5mkxl"))))
484 (arguments
485 (substitute-keyword-arguments (package-arguments sdl-mixer)
486 ((#:configure-flags flags)
487 `(cons*
488 "--disable-music-opus-shared"
489 ;; These options were renamed in SDL2 mixer. Keeping the inherited
490 ;; variants produces a harmless warning.
491 "--disable-music-mod-modplug-shared"
492 "--disable-music-midi-fluidsynth-shared"
493 ,flags))))
494 (inputs
495 `(("opusfile" ,opusfile)
496 ;; The default MOD library changed in SDL2 mixer.
497 ("libmodplug" ,libmodplug)
498 ,@(alist-delete "libmikmod" (package-inputs sdl-mixer))))
499 (native-inputs
500 `(("pkgconfig" ,pkg-config))) ; Needed to find the opus library.
501 (propagated-inputs
502 (propagated-inputs-with-sdl2 sdl-mixer))))
503
504 (define-public sdl2-net
505 (package (inherit sdl-net)
506 (name "sdl2-net")
507 (version "2.0.1")
508 (source
509 (origin
510 (method url-fetch)
511 (uri
512 (string-append "http://www.libsdl.org/projects/SDL_net/release/"
513 "SDL2_net-" version ".tar.gz"))
514 (sha256
515 (base32
516 "08cxc1bicmyk89kiks7izw1rlx5ng5n6xpy8fy0zxni3b9z8mkhm"))))
517 (propagated-inputs
518 (propagated-inputs-with-sdl2 sdl-net))))
519
520 (define-public sdl2-ttf
521 (package (inherit sdl-ttf)
522 (name "sdl2-ttf")
523 (version "2.0.15")
524 (source (origin
525 (method url-fetch)
526 (uri
527 (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-"
528 version ".tar.gz"))
529 (modules '((guix build utils)))
530 (snippet (begin
531 ;; Remove bundled libraries.
532 '(delete-file-recursively "external")
533 #t))
534 (sha256
535 (base32
536 "0cyd48dipc0m399qy8s03lci8b0bpiy8xlkvrm2ia7wcv0dfpv59"))))
537 (propagated-inputs
538 (propagated-inputs-with-sdl2 sdl-ttf))))
539
540 (define-public guile-sdl
541 (package
542 (name "guile-sdl")
543 (version "0.5.2")
544 (source (origin
545 (method url-fetch)
546 (uri
547 (string-append "mirror://gnu/guile-sdl/guile-sdl-"
548 version ".tar.xz"))
549 (sha256
550 (base32
551 "0cjgs012a9922hn6xqwj66w6qmfs3nycnm56hyykx5n3g5p7ag01"))))
552 (build-system gnu-build-system)
553 (native-inputs
554 `(("pkg-config" ,pkg-config)
555 ;; Required by test suite.
556 ("xorg-server" ,xorg-server)
557 ("libjpeg" ,libjpeg-turbo)))
558 (inputs
559 `(("guile" ,guile-2.2)
560 ("sdl-union" ,(sdl-union))))
561 (arguments
562 '(#:configure-flags
563 (list (string-append "--with-sdl-prefix="
564 (assoc-ref %build-inputs "sdl-union")))
565 #:modules ((ice-9 popen)
566 (guix build utils)
567 (guix build gnu-build-system))
568
569 #:parallel-build? #f ; parallel build fails
570
571 #:phases
572 (modify-phases %standard-phases
573 (add-before 'configure 'fix-env-and-patch
574 (lambda* (#:key inputs #:allow-other-keys)
575 (setenv "GUILE_AUTO_COMPILE" "0")
576 ;; SDL_image needs to dlopen libjpeg in the test suite.
577 (setenv "LD_LIBRARY_PATH"
578 (string-append (assoc-ref inputs "libjpeg") "/lib"))
579
580 ;; Change the site directory /site/X.Y like Guile expects.
581 (substitute* "build-aux/guile-baux/re-prefixed-site-dirs"
582 (("\"/site\"")
583 (let ((effective
584 (read
585 (open-pipe* OPEN_READ
586 "guile" "-c"
587 "(write (effective-version))"))))
588 (string-append "\"/site/" effective "\""))))
589
590 ;; Skip tests that rely on sound support, which is unavailable in
591 ;; the build environment.
592 (substitute* "test/Makefile.in"
593 (("HAVE_MIXER = .*$")
594 "HAVE_MIXER = 0\n"))
595 #t))
596 (add-before 'check 'start-xorg-server
597 (lambda* (#:key inputs #:allow-other-keys)
598 ;; The test suite requires a running X server.
599 (system (format #f "~a/bin/Xvfb :1 &"
600 (assoc-ref inputs "xorg-server")))
601 (setenv "DISPLAY" ":1")
602 #t))
603 (add-before 'check 'skip-cursor-test
604 (lambda _
605 ;; XXX: This test sometimes enters an endless loop, and sometimes
606 ;; crashes with:
607 ;; guile: xcb_io.c:147: append_pending_request: Assertion `!xcb_xlib_unknown_seq_number' failed.
608 ;; Skip it.
609 (substitute* "test/cursor.scm"
610 (("\\(SDL:init .*" all)
611 (string-append "(exit 77) ;" all "\n")))
612 #t)))))
613 (synopsis "Guile interface for SDL (Simple DirectMedia Layer)")
614 (description "Guile-SDL is a set of bindings to the Simple DirectMedia
615 Layer (SDL). With them, Guile programmers can have easy access to graphics,
616 sound and device input (keyboards, joysticks, mice, etc.).")
617 (home-page "https://www.gnu.org/software/guile-sdl/")
618 (license gpl3+)))
619
620 (define-public guile-sdl2
621 (package
622 (name "guile-sdl2")
623 (version "0.5.0")
624 (source (origin
625 (method url-fetch)
626 (uri (string-append "https://files.dthompson.us/guile-sdl2/"
627 "guile-sdl2-" version ".tar.gz"))
628 (sha256
629 (base32
630 "118x0cg7fzbsyrfhy5f9ab7dqp9czgia0ycgzp6sn3nlsdrcnr4m"))))
631 (build-system gnu-build-system)
632 (arguments
633 '(#:make-flags '("GUILE_AUTO_COMPILE=0")))
634 (native-inputs
635 `(("guile" ,guile-2.2)
636 ("pkg-config" ,pkg-config)))
637 (inputs
638 `(("sdl2" ,sdl2)
639 ("sdl2-image" ,sdl2-image)
640 ("sdl2-mixer" ,sdl2-mixer)
641 ("sdl2-ttf" ,sdl2-ttf)))
642 (synopsis "Guile bindings for SDL2")
643 (home-page "https://dthompson.us/projects/guile-sdl2.html")
644 (description
645 "Guile-SDL2 provides Guile Scheme bindings for the SDL2 C shared library.
646 The bindings are written in pure Scheme using Guile's foreign function
647 interface.")
648 (license lgpl3+)))
649
650 (define-public guile3.0-sdl2
651 (package/inherit guile-sdl2
652 (name "guile3.0-sdl2")
653 (native-inputs
654 `(("guile" ,guile-3.0)
655 ("pkg-config" ,pkg-config)))))
656
657 (define-public sdl2-cs
658 (let ((commit "1a3556441e1394eb0b5d46aeb514b8d1090b93f8"))
659 (package
660 (name "sdl2-cs")
661 (version (git-version "B1" "1" commit))
662 (source (origin
663 (method git-fetch)
664 (uri (git-reference
665 (url "https://github.com/flibitijibibo/SDL2-CS")
666 (commit commit)))
667 (file-name (git-file-name name version))
668 (sha256
669 (base32
670 "007mzkqr9nmvfrvvhs2r6cm36lzgsww24kwshsz9c4fd97f9qk58"))))
671 (build-system gnu-build-system)
672 (arguments
673 '(#:tests? #f ; No tests.
674 #:phases
675 (modify-phases %standard-phases
676 (delete 'configure)
677 (replace 'build
678 (lambda _
679 (invoke "make" "release")))
680 (replace 'install
681 (lambda* (#:key outputs #:allow-other-keys)
682 (let ((out (assoc-ref outputs "out")))
683 (install-file "bin/Release/SDL2-CS.dll" (string-append out "/lib"))
684 #t))))))
685 (native-inputs
686 `(("mono" ,mono)))
687 (inputs
688 `(("sdl2" ,sdl2)
689 ("sdl2-image" ,sdl2-image)
690 ("sdl2-mixer" ,sdl2-mixer)
691 ("sdl2-ttf" ,sdl2-ttf)))
692 (home-page "https://dthompson.us/projects/guile-sdl2.html")
693 (synopsis "C# wrapper for SDL2")
694 (description
695 "SDL2-CS provides C# bindings for the SDL2 C shared library.
696 The C# wrapper was written to be used for FNA's platform support. However, this
697 is written in a way that can be used for any general C# application.")
698 (license zlib))))