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