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