projects/guix·blob ruby-team · refs

915 lines · 34.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2015, 2017 David Thompson <[email protected]>
3;;; Copyright © 2014 Mark H Weaver <[email protected]>
4;;; Copyright © 2015, 2017 Sou Bunnbu <[email protected]>
5;;; Copyright © 2015 Alex Kost <[email protected]>
6;;; Copyright © 2016, 2017, 2021 Efraim Flashner <[email protected]>
7;;; Copyright © 2017, 2018, 2019 Rutger Helling <[email protected]>
8;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <[email protected]>
9;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <[email protected]>
10;;; Copyright © 2019 Kei Kebreau <[email protected]>
11;;; Copyright © 2019, 2020 Nicolas Goaziou <[email protected]>
12;;; Copyright © 2019, 2022 Marius Bakke <[email protected]>
13;;; Copyright © 2019 Pierre Neidhardt <[email protected]>
14;;; Copyright © 2020 Timotej Lazar <[email protected]>
15;;; Copyright © 2020 Oleg Pykhalov <[email protected]>
16;;; Copyright © 2022 Maxim Cournoyer <[email protected]>
17;;; Copyright © 2023 Evgeny Pisemsky <[email protected]>
18;;; Copyright © 2023, 2024 dan <[email protected]>
19;;; Copyright © 2025 Zheng Junjie <[email protected]>
20;;; Copyright © 2025 Eric Bavier <[email protected]>
21;;; Copyright © 2025 Janneke Nieuwenhuizen <[email protected]>
22;;;
23;;; This file is part of GNU Guix.
24;;;
25;;; GNU Guix is free software; you can redistribute it and/or modify it
26;;; under the terms of the GNU General Public License as published by
27;;; the Free Software Foundation; either version 3 of the License, or (at
28;;; your option) any later version.
29;;;
30;;; GNU Guix is distributed in the hope that it will be useful, but
31;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33;;; GNU General Public License for more details.
34;;;
35;;; You should have received a copy of the GNU General Public License
36;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
37
38(define-module (gnu packages sdl)
39 #:use-module (ice-9 match)
40 #:use-module (srfi srfi-1)
41 #:use-module (srfi srfi-26)
42 #:use-module (gnu packages)
43 #:use-module (guix gexp)
44 #:use-module ((guix licenses) #:prefix license:)
45 #:use-module (guix packages)
46 #:use-module (guix download)
47 #:use-module (guix git-download)
48 #:use-module (guix utils)
49 #:use-module (guix build-system cmake)
50 #:use-module (guix build-system copy)
51 #:use-module (guix build-system gnu)
52 #:use-module (guix build-system trivial)
53 #:use-module (gnu packages audio)
54 #:use-module (gnu packages autotools)
55 #:use-module (gnu packages compression)
56 #:use-module (gnu packages fontutils)
57 #:use-module (gnu packages freedesktop)
58 #:use-module (gnu packages glib)
59 #:use-module (gnu packages gtk)
60 #:use-module (gnu packages guile)
61 #:use-module (gnu packages ibus)
62 #:use-module (gnu packages image)
63 #:use-module (gnu packages linux)
64 #:use-module (gnu packages mp3)
65 #:use-module (gnu packages pkg-config)
66 #:use-module (gnu packages pulseaudio)
67 #:use-module (gnu packages gl)
68 #:use-module (gnu packages vulkan)
69 #:use-module (gnu packages xdisorg)
70 #:use-module (gnu packages xiph)
71 #:use-module (gnu packages xorg)
72 #:export (sdl-union))
73
74(define-public sdl2
75 (package
76 (name "sdl2")
77 (version "2.30.8")
78 (source (origin
79 (method url-fetch)
80 (uri
81 (string-append "https://libsdl.org/release/SDL2-"
82 version ".tar.gz"))
83 (sha256
84 (base32
85 "0n006l1zds2av8a9p6m6l0mj7jwb3jbr6mq7j0nxg6vblxg2j31q"))))
86 (build-system gnu-build-system)
87 (arguments
88 (list
89 #:tests? #f ;no check target
90 ;; Explicitly link against shared libraries instead of dlopening them.
91 ;; For X11, ALSA, and PulseAudio.
92 ;; OpenGL library is still dlopened at runtime.
93 #:configure-flags
94 #~(append
95 '("--disable-wayland-shared"
96 "--enable-video-kmsdrm"
97 "--disable-kmsdrm-shared")
98 '("--disable-alsa-shared"
99 "--disable-pulseaudio-shared"
100 "--disable-x11-shared"
101 ;; Explicitly link with mesa.
102 ;; This add mesa to libsdl's RUNPATH, to make dlopen
103 ;; finding the libGL from mesa at runtime.
104 "LDFLAGS=-lGL"))
105 #:make-flags
106 #~(cons*
107 ;; SDL dlopens libudev and libvulkan, so make sure they are in
108 ;; rpath. This overrides the LDFLAG set in sdl’s configure-flags,
109 ;; which isn’t necessary as sdl2 includes Mesa by default.
110 (string-append "LDFLAGS=-Wl,-rpath,"
111 #$(this-package-input "eudev") "/lib"
112 ",-rpath,"
113 #$(this-package-input "vulkan-loader") "/lib")
114 '("V=1")))) ;build verbosely
115 (propagated-inputs
116 ;; SDL headers include X11 headers.
117 (list libx11
118 libcap ; 'libSDL.la' contain `-lcap'.
119 ;; TODO: Since building Mesa with Meson it is now necessary that Mesa is
120 ;; a propagated input. We still need to figure out why, possibly due to a
121 ;; change in pkg-config.
122 mesa))
123 (native-inputs (list pkg-config))
124 (inputs
125 ;; SDL2 needs to be built with ibus support otherwise some systems
126 ;; experience a bug where input events are doubled.
127 ;;
128 ;; For more information, see: https://dev.solus-project.com/T1721
129 (list
130 libxrandr
131 glu
132 alsa-lib
133 pulseaudio
134 dbus
135 eudev ;for discovering input devices
136 glib
137 ibus-minimal
138 libxkbcommon
139 libxcursor ;enables X11 cursor support
140 vulkan-loader
141 wayland
142 wayland-protocols))
143 (outputs '("out" "debug"))
144 (synopsis "Cross platform game development library")
145 (description
146 "Simple DirectMedia Layer is a cross-platform development library designed to
147provide low level access to audio, keyboard, mouse, joystick, and graphics
148hardware.")
149 (home-page "https://libsdl.org/")
150 (license license:bsd-3)))
151
152(define-public sdl3
153 (package
154 (inherit sdl2)
155 (name "sdl3")
156 (version "3.4.14")
157 (source
158 (origin
159 (method url-fetch)
160 (uri (string-append "https://github.com/libsdl-org/SDL/"
161 "releases/download/release-"
162 version "/SDL3-" version ".tar.gz"))
163 (sha256
164 (base32
165 "1srs2nrfyicwpgkm0w92qmnbnzli5zkx9zrdnd182w9p60msmm1h"))))
166 (build-system cmake-build-system)
167 (arguments
168 (list
169 #:tests? #f ;no check target
170 #:configure-flags
171 #~(list "-DSDL_SHARED=ON"
172 "-DSDL_ALSA_SHARED=OFF"
173 "-DSDL_PULSEAUDIO_SHARED=OFF"
174 "-DSDL_PIPEWIRE_SHARED=OFF"
175 "-DSDL_X11_SHARED=OFF"
176 "-DSDL_WAYLAND_SHARED=OFF"
177 "-DSDL_WAYLAND_LIBDECOR_SHARED=OFF"
178 "-DSDL_KMSDRM=ON"
179 "-DSDL_KMSDRM_SHARED=OFF"
180 (string-append
181 "-DCMAKE_INSTALL_RPATH="
182 (string-join
183 (list
184 (string-append #$(this-package-input "eudev") "/lib")
185 (string-append #$(this-package-input "vulkan-loader") "/lib"))
186 ";")))))
187 ;; Many inputs need to be propagated for the sake of pkg-config.
188 (propagated-inputs
189 (list alsa-lib
190 libdecor
191 libxcursor ;enables X11 cursor support
192 libxi
193 libxkbcommon
194 libxrandr
195 libxscrnsaver
196 libxtst
197 mesa ;required by wayland
198 pipewire-minimal
199 pulseaudio
200 wayland))
201 (inputs
202 (list dbus
203 eudev ;for discovering input devices
204 glib
205 ibus-minimal
206 libdecor
207 vulkan-loader
208 wayland-protocols))))
209
210(define-public sdl2-compat
211 (package
212 (name "sdl2-compat")
213 (version "2.32.66")
214 (source (origin
215 (method git-fetch)
216 (uri (git-reference
217 (url "https://github.com/libsdl-org/sdl2-compat")
218 (commit (string-append "release-" version))))
219 (file-name (git-file-name name version))
220 (sha256
221 (base32
222 "1las3lq2sn7hiwpcdzf1rpcjz2g3dfrnl83b8n78v8y665fmbbk4"))))
223 (build-system cmake-build-system)
224 (arguments
225 (list #:phases
226 #~(modify-phases %standard-phases
227 (add-before 'configure 'qualify-libsdl3
228 (lambda _
229 (substitute* "src/sdl2_compat.c"
230 (("libSDL3[.]so[.]0")
231 (string-append #$(this-package-input "sdl3")
232 "/lib/libSDL3.so.0")))))
233 (add-after 'install 'install-sdl2.pc
234 (lambda _
235 (let ((pcdir (string-append #$output
236 "/lib/pkgconfig")))
237 (symlink (string-append pcdir "/sdl2-compat.pc")
238 (string-append pcdir "/sdl2.pc"))))))))
239 (inputs (list sdl3))
240 (propagated-inputs (list libx11)) ;required by SDL_syswm.h
241 (synopsis "Compatibility layer for the SDL2 game development library")
242 (description "Simple DirectMedia Layer is a cross-platform development library
243designed to provide low level access to audio, keyboard, mouse, joystick, and
244graphics hardware. This package is a compatibility layer; it provides a binary and
245source compatible API for programs written against SDL2, but it uses SDL3 behind the
246scenes.")
247 (home-page "https://libsdl.org/")
248 (license license:zlib)))
249
250(define-public sdl12-compat
251 (package
252 (name "sdl12-compat")
253 (version "1.2.68")
254 (source (origin
255 (method git-fetch)
256 (uri (git-reference
257 (url "https://github.com/libsdl-org/sdl12-compat")
258 (commit (string-append "release-" version))))
259 (file-name (git-file-name name version))
260 (sha256
261 (base32
262 "0qsjlzi1wqszi6k4pc3k9xdvzid5cx6ql8wbjw6qdapzpvf6arvz"))))
263 (build-system cmake-build-system)
264 (arguments
265 (list #:tests? #f ;no check target
266 #:configure-flags
267 ;; This add SDL2 to sdl12-compat's RUNPATH, to make dlopen finding the
268 ;; libSDL2 at runtime.
269 #~'("-DCMAKE_SHARED_LINKER_FLAGS=-lSDL2")
270 #:phases
271 #~(modify-phases %standard-phases
272 (add-after 'unpack 'patch-sdl-config
273 (lambda _
274 ;; Keep the old behaviour to honour "--prefix" option for
275 ;; "--cflags" and "--libs", required by 'perl-alien-sdl'.
276 (substitute* "sdl-config.in"
277 (("echo -I[$][{]includedir[}]") "echo -I${prefix}/include")
278 (("echo -L[$][{]libdir[}]") "echo -L${prefix}/lib"))))
279 (add-after 'install 'install-sdl.pc
280 (lambda _
281 (let ((pcdir (string-append #$output
282 "/lib/pkgconfig")))
283 (symlink (string-append pcdir "/sdl12_compat.pc")
284 (string-append pcdir "/sdl.pc"))))))))
285 (inputs (list sdl2))
286 (propagated-inputs (list glu)) ;required by SDL_opengl.h
287 (synopsis "Cross platform game development library")
288 (description "Simple DirectMedia Layer is a cross-platform development library
289designed to provide low level access to audio, keyboard, mouse, joystick, and
290graphics hardware. This package is a compatibility layer; it provides a binary and
291source compatible API for programs written against SDL 1.2, but it uses SDL 2.0
292behind the scenes.")
293 (home-page "https://libsdl.org/")
294 ;; dr_mp3 code are under public domain.
295 (license (list license:zlib license:public-domain))))
296
297(define-public sdl sdl12-compat)
298
299(define-public libmikmod
300 (package
301 (name "libmikmod")
302 (version "3.3.11.1")
303 (source (origin
304 (method url-fetch)
305 (uri (list
306 (string-append "mirror://sourceforge/mikmod/libmikmod/"
307 version "/libmikmod-" version ".tar.gz")
308 ;; Older versions are sometimes moved to:
309 (string-append "mirror://sourceforge/mikmod/"
310 "outdated_versions/libmikmod/"
311 version "/libmikmod-" version ".tar.gz")))
312 (sha256
313 (base32
314 "06bdnhb0l81srdzg6gn2v2ydhhaazza7rshrcj3q8dpqr3gn97dd"))))
315 (build-system gnu-build-system)
316 (arguments
317 ;; By default, libmikmod tries to dlopen libasound etc., which won't work
318 ;; unless the right libalsa happens to be in $LD_LIBRARY_PATH. Pass
319 ;; '--disable-dl' to avoid that.
320 '(#:configure-flags '("--disable-dl")))
321 (synopsis "Library for module sound formats")
322 (description
323 "MikMod is able to play a wide range of module formats, as well as
324digital sound files. It can take advantage of particular features of your
325system, such as sound redirection over the network.")
326 (license license:lgpl2.1)
327 (home-page "https://mikmod.sourceforge.net/")))
328
329(define-public sdl-gfx
330 (package
331 (name "sdl-gfx")
332 (version "2.0.26")
333 (source (origin
334 (method url-fetch)
335 (uri
336 (string-append "http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-"
337 version ".tar.gz"))
338 (sha256
339 (base32
340 "0ijljhs0v99dj6y27hc10z6qchyp8gdp4199y6jzngy6dzxlzsvw"))))
341 (build-system gnu-build-system)
342 (outputs '("out" "debug"))
343 (arguments
344 `(,@(if (any (cute string-prefix? <> (or (%current-system)
345 (%current-target-system)))
346 '("x86_64" "i686"))
347 ;; mmx is supported only on Intel processors.
348 '()
349 '(#:configure-flags '("--disable-mmx")))))
350 (propagated-inputs (list sdl))
351 (synopsis "SDL graphics primitives library")
352 (description "SDL_gfx provides graphics drawing primitives, rotozoom and
353other supporting functions for SDL.")
354 (home-page "http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx")
355 (license license:zlib)))
356
357(define-public sdl-image
358 (package
359 (name "sdl-image")
360 (version "1.2.12")
361 (source (origin
362 (method url-fetch)
363 (uri
364 (string-append "https://www.libsdl.org/projects/SDL_image/release/SDL_image-"
365 version ".tar.gz"))
366 (sha256
367 (base32
368 "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b"))))
369 (build-system gnu-build-system)
370 (outputs '("out" "debug"))
371 (arguments
372 (list
373 #:configure-flags
374 ;; Relax gcc-14's strictness.
375 #~(list "CFLAGS=-g -O2 -Wno-error=incompatible-pointer-types"
376 ;; Explicitly link against shared libraries instead of dlopening them.
377 "--disable-jpg-shared"
378 "--disable-png-shared"
379 "--disable-tif-shared"
380 "--disable-webp-shared")))
381 (native-inputs (list pkg-config))
382 ;; libjpeg, libpng, and libtiff are propagated inputs because the
383 ;; SDL_image headers include the headers of these libraries. SDL is a
384 ;; propagated input because the pkg-config file refers to SDL's pkg-config
385 ;; file.
386 (propagated-inputs `(("sdl" ,sdl)
387 ("libjpeg" ,libjpeg-turbo)
388 ("libpng" ,libpng)
389 ("libtiff" ,libtiff)
390 ("libwebp" ,libwebp)))
391 (synopsis "SDL image loading library")
392 (description "SDL_image is an image file loading library for SDL that
393supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF,
394WEBP, XCF, XPM, and XV.")
395 (home-page "https://github.com/libsdl-org/SDL_image")
396 (license license:zlib)))
397
398(define-public sdl-mixer
399 (package
400 (name "sdl-mixer")
401 (version "1.2.12")
402 (source (origin
403 (method url-fetch)
404 (uri
405 (string-append "https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-"
406 version ".tar.gz"))
407 (sha256
408 (base32
409 "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"))))
410 (build-system gnu-build-system)
411 (outputs '("out" "debug"))
412 (arguments
413 `(#:tests? #f ; No check target.
414 #:configure-flags
415 `(,(string-append "CFLAGS=-g -O2"
416 " -Wno-error=implicit-function-declaration"
417 " -Wno-error=incompatible-pointer-types"
418 " -Wno-error=return-mismatch")
419 "--enable-music-mp3-mad-gpl" ; Use libmad instead of smpeg.
420 ;; Explicitly link against shared libraries instead of dlopening them.
421 "--disable-music-flac-shared"
422 "--disable-music-fluidsynth-shared"
423 ;; Explicitly link against shared libraries instead of dlopening them.
424 "--disable-music-flac-shared"
425 "--disable-music-fluidsynth-shared"
426 "--disable-music-mod-shared"
427 "--disable-music-ogg-shared")
428 #:phases
429 (modify-phases %standard-phases
430 (add-after 'unpack 'fix-fluidsynth
431 (lambda* (#:key inputs #:allow-other-keys)
432 (substitute* "configure"
433 (("EXTRA_LDFLAGS -lfluidsynth")
434 (string-append "EXTRA_LDFLAGS "
435 "-L"
436 (assoc-ref inputs "fluidsynth")
437 "/lib -lfluidsynth")))
438 #t)))))
439 (inputs
440 `(("fluidsynth" ,fluidsynth)
441 ("libflac" ,flac)
442 ("libmad" ,libmad)
443 ("libmikmod" ,libmikmod)
444 ("libvorbis" ,libvorbis)))
445 (propagated-inputs (list sdl))
446 (synopsis "SDL multi-channel audio mixer library")
447 (description "SDL_mixer is a multi-channel audio mixer library for SDL.
448It supports any number of simultaneously playing channels of 16 bit stereo
449audio, plus a single channel of music. Supported formats include FLAC, MOD,
450MIDI, Ogg Vorbis, and MP3.
451
452This package supports two MIDI backends, selectable at runtime. To use the
453newer @code{fluidsynth} library, install a soundfont such as @code{fluid-3}
454and specify it using the @code{SDL_SOUNDFONTS} environment variable. For the
455legacy @code{timidity} backend, install a patch set such as @code{freepats}
456and set the path to the configuration file with @code{TIMIDITY_CFG}.")
457 (home-page "https://www.libsdl.org/projects/SDL_mixer/")
458 (license license:zlib)))
459
460(define-public sdl-net
461 (package
462 (name "sdl-net")
463 (version "1.2.8")
464 (source (origin
465 (method url-fetch)
466 (uri
467 (string-append "https://www.libsdl.org/projects/SDL_net/release/SDL_net-"
468 version ".tar.gz"))
469 (sha256
470 (base32
471 "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz"))))
472 (build-system gnu-build-system)
473 (propagated-inputs (list sdl))
474 (native-inputs (list pkg-config))
475 (outputs '("out" "debug"))
476 (synopsis "SDL networking library")
477 (description "SDL_net is a small, cross-platform networking library for
478SDL.")
479 (home-page "https://www.libsdl.org/projects/SDL_net/")
480 (license license:zlib)))
481
482(define-public sdl-pango
483 (package
484 (name "sdl-pango")
485 (version "0.1.2")
486 (source
487 (origin
488 (method url-fetch)
489 (uri (string-append
490 "mirror://sourceforge/sdlpango/SDL_Pango/" version "/"
491 "SDL_Pango-" version ".tar.gz"))
492 (sha256
493 (base32 "197baw1dsg0p4pljs5k0fshbyki00r4l49m1drlpqw6ggawx6xbz"))
494 (patches (search-patches "sdl-pango-api_additions.patch"
495 "sdl-pango-blit_overflow.patch"
496 "sdl-pango-fillrect_crash.patch"
497 "sdl-pango-header-guard.patch"
498 "sdl-pango-matrix_declarations.patch"
499 "sdl-pango-sans-serif.patch"))))
500 (build-system gnu-build-system)
501 (arguments
502 `(#:configure-flags (list "--disable-static")
503 #:phases
504 (modify-phases %standard-phases
505 (add-after 'unpack 'autogen
506 ;; Force reconfiguration because the included libtool
507 ;; generates linking errors.
508 (lambda _ (invoke "autoreconf" "-vif"))))))
509 (native-inputs
510 (list autoconf automake libtool pkg-config))
511 (inputs
512 `(("fontconfig" ,fontconfig)
513 ("freetype" ,freetype)
514 ("glib" ,glib)
515 ("harfbuzz" ,harfbuzz)
516 ("pango" ,pango)
517 ("sdl" ,sdl)))
518 (home-page "https://sdlpango.sourceforge.net")
519 (synopsis "Pango SDL binding")
520 (description "This library is a wrapper around the Pango library.
521It allows you to use TrueType fonts to render internationalized and
522tagged text in SDL applications.")
523 (license license:lgpl2.1)))
524
525(define-public sdl2-pango
526 (package
527 (name "sdl2-pango")
528 (version "2.1.5")
529 (home-page "https://github.com/markuskimius/SDL2_Pango")
530 (source
531 (origin
532 (method git-fetch)
533 (uri (git-reference
534 (url home-page)
535 (commit (string-append "v" version))))
536 (file-name (git-file-name name version))
537 (sha256
538 (base32 "0ivngl3bsy2aq8pqdh96nzrfnln6linz50mp5bpb9wv2bk5gj8pi"))))
539 (build-system gnu-build-system)
540 (arguments
541 `(#:configure-flags (list "--disable-static")))
542 (native-inputs
543 (list autoconf automake libtool pkg-config))
544 (inputs
545 (list freetype pango sdl2))
546 (synopsis "Pango SDL2 binding")
547 (description "This library is a wrapper around the Pango library.
548It allows you to use TrueType fonts to render internationalized and
549tagged text in SDL2 applications.")
550 (license license:lgpl2.1)))
551
552(define-public sdl-ttf
553 (package
554 (name "sdl-ttf")
555 (version "2.0.11.1")
556 ;; No release tarball for 2.0.11.1, changes:
557 ;; <https://github.com/libsdl-org/SDL_ttf/commit/e31d11a692>
558 (source (origin
559 (method git-fetch)
560 (uri (git-reference
561 (url "https://github.com/libsdl-org/SDL_ttf")
562 (commit "e31d11a692e5b55e8e624ad766e4e44d655422c8")))
563 (file-name (git-file-name name version))
564 (sha256
565 (base32
566 "1id1cdign615wd5rq0g4ppzwclvhkwd61yb5rwvvvakkpplp3lvd"))
567 ;; Remove bundled libraries.
568 (modules '((guix build utils)))
569 (snippet '(delete-file-recursively "external"))))
570 (build-system gnu-build-system)
571 (propagated-inputs (list sdl))
572 (inputs (list freetype mesa))
573 (native-inputs (list pkg-config))
574 (outputs '("out" "debug"))
575 (synopsis "SDL TrueType font library")
576 (description "SDL_ttf is a TrueType font rendering library for SDL.")
577 (home-page "https://www.libsdl.org/projects/SDL_ttf/")
578 (license license:zlib)))
579
580(define* (sdl-union #:optional (packages (list sdl sdl-gfx sdl-net sdl-ttf
581 sdl-image sdl-mixer)))
582 "Return 'sdl-union' package which is a union of PACKAGES.
583If PACKAGES are not specified, all SDL packages are used."
584 (package
585 (name "sdl-union")
586 (version (package-version sdl))
587 (source #f)
588 (build-system trivial-build-system)
589 (arguments
590 '(#:modules ((guix build union))
591 #:builder (begin
592 (use-modules (ice-9 match)
593 (guix build union))
594 (match %build-inputs
595 (((names . directories) ...)
596 (union-build (assoc-ref %outputs "out")
597 directories)
598 #t)))))
599 (inputs (map (lambda (package)
600 (list (package-name package) package))
601 packages))
602 (synopsis "Union of SDL libraries")
603 (description
604 "A union of SDL and its extension libraries. A union is required because
605sdl-config assumes that all of the headers and libraries are in the same
606directory.")
607 (home-page (package-home-page sdl))
608 (license (package-license sdl))))
609
610(define (propagated-inputs-with-sdl2 package)
611 "Replace the \"sdl\" propagated input of PACKAGE with SDL2."
612 (map (match-lambda
613 (("sdl" _)
614 `("sdl2" ,sdl2))
615 (("sdl12-compat" _)
616 `("sdl2" ,sdl2))
617 (other other))
618 (package-propagated-inputs package)))
619
620(define-public sdl2-gfx
621 (package (inherit sdl-gfx)
622 (name "sdl2-gfx")
623 (version "1.0.4")
624 (source (origin
625 (method url-fetch)
626 (uri
627 (string-append "https://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-"
628 version ".tar.gz"))
629 (sha256
630 (base32
631 "0qk2ax7f7grlxb13ba0ll3zlm8780s7j8fmrhlpxzjgdvldf1q33"))))
632 (propagated-inputs
633 (propagated-inputs-with-sdl2 sdl-gfx))))
634
635(define-public sdl2-image
636 (package (inherit sdl-image)
637 (name "sdl2-image")
638 (version "2.8.8")
639 (source
640 (origin
641 (method url-fetch)
642 (uri
643 (string-append "https://www.libsdl.org/projects/SDL_image/release/"
644 "SDL2_image-" version ".tar.gz"))
645 (sha256
646 (base32 "02p3gh4mc8dgf26bl30rfirwi0qspq6453lcwg8208pzv9pva4r2"))))
647 (propagated-inputs
648 (propagated-inputs-with-sdl2 sdl-image))
649 (properties '((upstream-name . "SDL2_image")))))
650
651(define-public sdl2-mixer
652 (package (inherit sdl-mixer)
653 (name "sdl2-mixer")
654 (version "2.6.3")
655 (source
656 (origin
657 (method url-fetch)
658 (uri
659 (string-append "http://www.libsdl.org/projects/SDL_mixer/release/"
660 "SDL2_mixer-" version ".tar.gz"))
661 (modules '((guix build utils)))
662 (snippet '(begin
663 ;; Remove bundled libraries.
664 (delete-file-recursively "external")))
665 (sha256
666 (base32 "13zadq6lmzdglvp0arl7x5y7zihv31vr4pisgrhwwj468xmahsvs"))))
667 (arguments
668 (list #:tests? #f ;no tests
669 #:configure-flags
670 #~'(;; Prefer system libraries to bundled codecs.
671 "--enable-music-flac-libflac"
672 "--enable-music-midi-fluidsynth"
673 "--enable-music-mod-modplug"
674 "--enable-music-mp3-mpg123"
675 "--enable-music-ogg-vorbis"
676 "--enable-music-opus"
677 ;; Link the libraries instead of dlopening them.
678 "--enable-music-flac-libflac-shared=no"
679 "--enable-music-midi-fluidsynth-shared=no"
680 "--enable-music-mod-modplug-shared=no"
681 "--enable-music-mp3-mpg123-shared=no"
682 "--enable-music-ogg-vorbis-shared=no"
683 "--enable-music-opus-shared=no")))
684 (native-inputs
685 (list pkg-config))
686 (inputs '())
687 (propagated-inputs
688 (modify-inputs (propagated-inputs-with-sdl2 sdl-mixer)
689 ;; In Requires.private of SDL2_mixer.pc.
690 (append flac fluidsynth libmodplug libmpg123 libvorbis opusfile)))
691 (properties '((upstream-name . "SDL2_mixer")))))
692
693(define-public sdl2-mixer-x
694 (package
695 (inherit sdl2-mixer)
696 (name "sdl2-mixer-x")
697 (version "2.6.0")
698 (source (origin
699 (method git-fetch)
700 (uri (git-reference
701 (url "https://github.com/WohlSoft/SDL-Mixer-X")
702 (commit version)))
703 (file-name (git-file-name name version))
704 (sha256
705 (base32
706 "17l0l89q4az6lmmvpqpymjgs64nc52r140301dcf54vsh76mzd2c"))))
707 (build-system cmake-build-system)
708 (arguments
709 (list #:tests? #f ;no tests
710 #:configure-flags
711 #~(list "-DBUILD_SHARED_LIBS=ON")))
712 (synopsis "This package is a fork of SDL mixer")
713 (description "A fork of SDL mixer with the goal of fixing various issues
714and supporting more audio formats.")))
715
716(define-public sdl2-net
717 (package (inherit sdl-net)
718 (name "sdl2-net")
719 (version "2.2.0")
720 (source
721 (origin
722 (method url-fetch)
723 (uri
724 (string-append "http://www.libsdl.org/projects/SDL_net/release/"
725 "SDL2_net-" version ".tar.gz"))
726 (sha256
727 (base32
728 "1svzhpf7k48jfga8ph127l99lwpgs5g5isgl9ybp2qiii0cqjjjf"))))
729 (propagated-inputs
730 (propagated-inputs-with-sdl2 sdl-net))
731 (properties '((upstream-name . "SDL2_net")))))
732
733(define-public sdl2-ttf
734 (package (inherit sdl-ttf)
735 (name "sdl2-ttf")
736 (version "2.20.2")
737 (source (origin
738 (method url-fetch)
739 (uri
740 (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-"
741 version ".tar.gz"))
742 (modules '((guix build utils)))
743 (snippet
744 ;; Remove bundled libraries.
745 '(delete-file-recursively "external"))
746 (sha256
747 (base32
748 "0lr0l8c19fg6anq2cp6xppv65ys3pyk9qjicg881nll76kcixiwx"))))
749 (arguments
750 (list #:configure-flags #~'("--enable-freetype-builtin=no"
751 "--enable-harfbuzz-builtin=no")))
752 (propagated-inputs
753 (modify-inputs (propagated-inputs-with-sdl2 sdl-ttf)
754 ;; In Requires.private of SDL2_ttf.pc.
755 (prepend harfbuzz freetype)))
756 (properties '((upstream-name . "SDL2_ttf")))))
757
758(define-public sdl2-gamecontrollerdb
759 (let ((commit "414eaee7aacc0d2ccdf281663c3d3bc65a8dbedd")
760 (revision "2"))
761 (package
762 (name "sdl2-gamecontrollerdb")
763 (version (git-version "0" revision commit))
764 (source
765 (origin
766 (method git-fetch)
767 (uri (git-reference
768 (url "https://github.com/mdqinc/SDL_GameControllerDB")
769 (commit commit)))
770 (file-name (git-file-name name version))
771 (sha256
772 (base32 "04x3g7vshagxaklwm5hxawh1pk6j1h0rip9xccpgr1r3gpxqs5df"))))
773 (build-system copy-build-system)
774 (arguments
775 '(#:install-plan '(("gamecontrollerdb.txt" "share/sdl2/"))))
776 (home-page "https://github.com/mdqinc/SDL_GameControllerDB")
777 (synopsis "SDL2 game controller database")
778 (description
779 "This package provides a community sourced database of game controller
780mappings intended for the use with SDL2's game controller functionality.")
781 (license license:zlib))))
782
783(define-public sdl3-gfx
784 (package
785 (name "sdl3-gfx")
786 (version "1.0.1")
787 (source (origin
788 (method git-fetch)
789 (uri (git-reference
790 (url "https://github.com/sabdul-khabir/SDL3_gfx")
791 (commit (string-append "v" version))))
792 (file-name (git-file-name name version))
793 (sha256
794 (base32
795 "18g9qavk0wh1bvfh6gdi5q75fd57dk0gp5r20c80x7xnp2ywywih"))))
796 (build-system cmake-build-system)
797 (arguments (list #:tests? #f
798 #:configure-flags
799 #~(list "-DBUILD_TESTS=ON")))
800 (propagated-inputs (list sdl3))
801 (home-page "https://github.com/sabdul-khabir/SDL3_gfx")
802 (synopsis "SDL3 graphics drawing primitives")
803 (description
804 "This package provides Graphics drawing primitives
805and other support functions wrapped up in an add-on, C-based library
806for the Simple Direct Media (SDL) cross-platform API layer.")
807 (license license:zlib)
808 (properties '((upstream-name . "SDL3_gfx")))))
809
810(define-public sdl3-image
811 (package (inherit sdl2-image)
812 (name "sdl3-image")
813 (version "3.2.4")
814 (source
815 (origin
816 (method url-fetch)
817 (uri
818 (string-append "https://www.libsdl.org/projects/SDL_image/release/"
819 "SDL3_image-" version ".tar.gz"))
820 (sha256
821 (base32 "10n1rxyswchd8vppalh2bl3ah5fww5chd5cdvnhds7r60invs9d7"))))
822 (build-system cmake-build-system)
823 (arguments
824 ;; Link the libraries instead of dlopening them.
825 '(#:configure-flags '("-DSDLIMAGE_AVIF_SHARED=OFF"
826 "-DSDLIMAGE_TIF_SHARED=OFF"
827 "-DSDLIMAGE_WEBP_SHARED=OFF"
828 "-DSDLIMAGE_TESTS=ON")))
829 (propagated-inputs
830 (list sdl3 libavif libjpeg-turbo libpng libtiff libwebp))
831 (properties '((upstream-name . "SDL3_image")))))
832
833(define-public sdl3-net
834 (package
835 (inherit sdl-net)
836 (name "sdl3-net")
837 (version "3.2.0")
838 (source
839 (origin
840 (method git-fetch)
841 (uri (git-reference
842 (url "https://github.com/libsdl-org/SDL_net")
843 (commit (string-append "release-" version))))
844 (file-name (git-file-name name version))
845 (sha256
846 (base32
847 "1cjmlv9718ay0hbh4v0i2aifn4s110drgq9gq3ykwcafl5bf8f9w"))))
848 (build-system cmake-build-system)
849 (arguments
850 (list #:configure-flags
851 #~(list "-DBUILD_SHARED_LIBS=ON")
852 #:tests? #f))
853 (propagated-inputs (list sdl3))
854 (properties '((upstream-name . "SDL3_net")))))
855
856(define-public sdl3-ttf
857 (package
858 (name "sdl3-ttf")
859 (version "3.2.2")
860 (source (origin
861 (method git-fetch)
862 (uri (git-reference
863 (url "https://github.com/libsdl-org/SDL_ttf.git")
864 (commit (string-append "release-" version))))
865 (file-name (git-file-name name version))
866 (sha256
867 (base32
868 "09jiajs9imscwa7b0q4z20znxcvazilks5ilggdvxjiv3cpxzcl3"))))
869 (build-system cmake-build-system)
870 (arguments
871 (list #:tests? #f)) ; no tests
872 (native-inputs
873 (list pkg-config))
874 (propagated-inputs
875 (list sdl3))
876 (inputs
877 (list harfbuzz freetype))
878 (synopsis "TrueType fonts in SDL3")
879 (description "This package provides a library to load TrueType (.ttf)
880font files with Simple Directmedia Layer.")
881 (home-page "https://wiki.libsdl.org/SDL3/FrontPage")
882 (license license:zlib)))
883
884(define-public guile-sdl2
885 (package
886 (name "guile-sdl2")
887 (version "0.8.0")
888 (source (origin
889 (method url-fetch)
890 (uri (string-append "https://files.dthompson.us/guile-sdl2/"
891 "guile-sdl2-" version ".tar.gz"))
892 (sha256
893 (base32
894 "1v57ghgqp9m32b2x47dya9zb0xvvfs5v8q8ak2wi8fzabajfpxap"))))
895 (build-system gnu-build-system)
896 (arguments
897 '(#:make-flags '("GUILE_AUTO_COMPILE=0")))
898 (native-inputs
899 (list guile-3.0 pkg-config))
900 (inputs
901 (list sdl2 sdl2-image sdl2-mixer sdl2-ttf))
902 (synopsis "Guile bindings for SDL2")
903 (home-page "https://dthompson.us/projects/guile-sdl2.html")
904 (description
905 "Guile-SDL2 provides Guile Scheme bindings for the SDL2 C shared library.
906The bindings are written in pure Scheme using Guile's foreign function
907interface.")
908 (license license:lgpl3+)))
909
910(define-public guile2.2-sdl2
911 (package/inherit guile-sdl2
912 (name "guile2.2-sdl2")
913 (native-inputs
914 `(("guile" ,guile-2.2)
915 ("pkg-config" ,pkg-config)))))