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