projects/guix·blob python-team · refs

914 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 vulkan-loader
207 wayland-protocols))))
208
209(define-public sdl2-compat
210 (package
211 (name "sdl2-compat")
212 (version "2.32.66")
213 (source (origin
214 (method git-fetch)
215 (uri (git-reference
216 (url "https://github.com/libsdl-org/sdl2-compat")
217 (commit (string-append "release-" version))))
218 (file-name (git-file-name name version))
219 (sha256
220 (base32
221 "1las3lq2sn7hiwpcdzf1rpcjz2g3dfrnl83b8n78v8y665fmbbk4"))))
222 (build-system cmake-build-system)
223 (arguments
224 (list #:phases
225 #~(modify-phases %standard-phases
226 (add-before 'configure 'qualify-libsdl3
227 (lambda _
228 (substitute* "src/sdl2_compat.c"
229 (("libSDL3[.]so[.]0")
230 (string-append #$(this-package-input "sdl3")
231 "/lib/libSDL3.so.0")))))
232 (add-after 'install 'install-sdl2.pc
233 (lambda _
234 (let ((pcdir (string-append #$output
235 "/lib/pkgconfig")))
236 (symlink (string-append pcdir "/sdl2-compat.pc")
237 (string-append pcdir "/sdl2.pc"))))))))
238 (inputs (list sdl3))
239 (propagated-inputs (list libx11)) ;required by SDL_syswm.h
240 (synopsis "Compatibility layer for the SDL2 game development library")
241 (description "Simple DirectMedia Layer is a cross-platform development library
242designed to provide low level access to audio, keyboard, mouse, joystick, and
243graphics hardware. This package is a compatibility layer; it provides a binary and
244source compatible API for programs written against SDL2, but it uses SDL3 behind the
245scenes.")
246 (home-page "https://libsdl.org/")
247 (license license:zlib)))
248
249(define-public sdl12-compat
250 (package
251 (name "sdl12-compat")
252 (version "1.2.68")
253 (source (origin
254 (method git-fetch)
255 (uri (git-reference
256 (url "https://github.com/libsdl-org/sdl12-compat")
257 (commit (string-append "release-" version))))
258 (file-name (git-file-name name version))
259 (sha256
260 (base32
261 "0qsjlzi1wqszi6k4pc3k9xdvzid5cx6ql8wbjw6qdapzpvf6arvz"))))
262 (build-system cmake-build-system)
263 (arguments
264 (list #:tests? #f ;no check target
265 #:configure-flags
266 ;; This add SDL2 to sdl12-compat's RUNPATH, to make dlopen finding the
267 ;; libSDL2 at runtime.
268 #~'("-DCMAKE_SHARED_LINKER_FLAGS=-lSDL2")
269 #:phases
270 #~(modify-phases %standard-phases
271 (add-after 'unpack 'patch-sdl-config
272 (lambda _
273 ;; Keep the old behaviour to honour "--prefix" option for
274 ;; "--cflags" and "--libs", required by 'perl-alien-sdl'.
275 (substitute* "sdl-config.in"
276 (("echo -I[$][{]includedir[}]") "echo -I${prefix}/include")
277 (("echo -L[$][{]libdir[}]") "echo -L${prefix}/lib"))))
278 (add-after 'install 'install-sdl.pc
279 (lambda _
280 (let ((pcdir (string-append #$output
281 "/lib/pkgconfig")))
282 (symlink (string-append pcdir "/sdl12_compat.pc")
283 (string-append pcdir "/sdl.pc"))))))))
284 (inputs (list sdl2))
285 (propagated-inputs (list glu)) ;required by SDL_opengl.h
286 (synopsis "Cross platform game development library")
287 (description "Simple DirectMedia Layer is a cross-platform development library
288designed to provide low level access to audio, keyboard, mouse, joystick, and
289graphics hardware. This package is a compatibility layer; it provides a binary and
290source compatible API for programs written against SDL 1.2, but it uses SDL 2.0
291behind the scenes.")
292 (home-page "https://libsdl.org/")
293 ;; dr_mp3 code are under public domain.
294 (license (list license:zlib license:public-domain))))
295
296(define-public sdl sdl12-compat)
297
298(define-public libmikmod
299 (package
300 (name "libmikmod")
301 (version "3.3.11.1")
302 (source (origin
303 (method url-fetch)
304 (uri (list
305 (string-append "mirror://sourceforge/mikmod/libmikmod/"
306 version "/libmikmod-" version ".tar.gz")
307 ;; Older versions are sometimes moved to:
308 (string-append "mirror://sourceforge/mikmod/"
309 "outdated_versions/libmikmod/"
310 version "/libmikmod-" version ".tar.gz")))
311 (sha256
312 (base32
313 "06bdnhb0l81srdzg6gn2v2ydhhaazza7rshrcj3q8dpqr3gn97dd"))))
314 (build-system gnu-build-system)
315 (arguments
316 ;; By default, libmikmod tries to dlopen libasound etc., which won't work
317 ;; unless the right libalsa happens to be in $LD_LIBRARY_PATH. Pass
318 ;; '--disable-dl' to avoid that.
319 '(#:configure-flags '("--disable-dl")))
320 (synopsis "Library for module sound formats")
321 (description
322 "MikMod is able to play a wide range of module formats, as well as
323digital sound files. It can take advantage of particular features of your
324system, such as sound redirection over the network.")
325 (license license:lgpl2.1)
326 (home-page "https://mikmod.sourceforge.net/")))
327
328(define-public sdl-gfx
329 (package
330 (name "sdl-gfx")
331 (version "2.0.26")
332 (source (origin
333 (method url-fetch)
334 (uri
335 (string-append "http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-"
336 version ".tar.gz"))
337 (sha256
338 (base32
339 "0ijljhs0v99dj6y27hc10z6qchyp8gdp4199y6jzngy6dzxlzsvw"))))
340 (build-system gnu-build-system)
341 (outputs '("out" "debug"))
342 (arguments
343 `(,@(if (any (cute string-prefix? <> (or (%current-system)
344 (%current-target-system)))
345 '("x86_64" "i686"))
346 ;; mmx is supported only on Intel processors.
347 '()
348 '(#:configure-flags '("--disable-mmx")))))
349 (propagated-inputs (list sdl))
350 (synopsis "SDL graphics primitives library")
351 (description "SDL_gfx provides graphics drawing primitives, rotozoom and
352other supporting functions for SDL.")
353 (home-page "http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx")
354 (license license:zlib)))
355
356(define-public sdl-image
357 (package
358 (name "sdl-image")
359 (version "1.2.12")
360 (source (origin
361 (method url-fetch)
362 (uri
363 (string-append "https://www.libsdl.org/projects/SDL_image/release/SDL_image-"
364 version ".tar.gz"))
365 (sha256
366 (base32
367 "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b"))))
368 (build-system gnu-build-system)
369 (outputs '("out" "debug"))
370 (arguments
371 (list
372 #:configure-flags
373 ;; Relax gcc-14's strictness.
374 #~(list "CFLAGS=-g -O2 -Wno-error=incompatible-pointer-types"
375 ;; Explicitly link against shared libraries instead of dlopening them.
376 "--disable-jpg-shared"
377 "--disable-png-shared"
378 "--disable-tif-shared"
379 "--disable-webp-shared")))
380 (native-inputs (list pkg-config))
381 ;; libjpeg, libpng, and libtiff are propagated inputs because the
382 ;; SDL_image headers include the headers of these libraries. SDL is a
383 ;; propagated input because the pkg-config file refers to SDL's pkg-config
384 ;; file.
385 (propagated-inputs `(("sdl" ,sdl)
386 ("libjpeg" ,libjpeg-turbo)
387 ("libpng" ,libpng)
388 ("libtiff" ,libtiff)
389 ("libwebp" ,libwebp)))
390 (synopsis "SDL image loading library")
391 (description "SDL_image is an image file loading library for SDL that
392supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF,
393WEBP, XCF, XPM, and XV.")
394 (home-page "https://github.com/libsdl-org/SDL_image")
395 (license license:zlib)))
396
397(define-public sdl-mixer
398 (package
399 (name "sdl-mixer")
400 (version "1.2.12")
401 (source (origin
402 (method url-fetch)
403 (uri
404 (string-append "https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-"
405 version ".tar.gz"))
406 (sha256
407 (base32
408 "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"))))
409 (build-system gnu-build-system)
410 (outputs '("out" "debug"))
411 (arguments
412 `(#:tests? #f ; No check target.
413 #:configure-flags
414 `(,(string-append "CFLAGS=-g -O2"
415 " -Wno-error=implicit-function-declaration"
416 " -Wno-error=incompatible-pointer-types"
417 " -Wno-error=return-mismatch")
418 "--enable-music-mp3-mad-gpl" ; Use libmad instead of smpeg.
419 ;; Explicitly link against shared libraries instead of dlopening them.
420 "--disable-music-flac-shared"
421 "--disable-music-fluidsynth-shared"
422 ;; Explicitly link against shared libraries instead of dlopening them.
423 "--disable-music-flac-shared"
424 "--disable-music-fluidsynth-shared"
425 "--disable-music-mod-shared"
426 "--disable-music-ogg-shared")
427 #:phases
428 (modify-phases %standard-phases
429 (add-after 'unpack 'fix-fluidsynth
430 (lambda* (#:key inputs #:allow-other-keys)
431 (substitute* "configure"
432 (("EXTRA_LDFLAGS -lfluidsynth")
433 (string-append "EXTRA_LDFLAGS "
434 "-L"
435 (assoc-ref inputs "fluidsynth")
436 "/lib -lfluidsynth")))
437 #t)))))
438 (inputs
439 `(("fluidsynth" ,fluidsynth)
440 ("libflac" ,flac)
441 ("libmad" ,libmad)
442 ("libmikmod" ,libmikmod)
443 ("libvorbis" ,libvorbis)))
444 (propagated-inputs (list sdl))
445 (synopsis "SDL multi-channel audio mixer library")
446 (description "SDL_mixer is a multi-channel audio mixer library for SDL.
447It supports any number of simultaneously playing channels of 16 bit stereo
448audio, plus a single channel of music. Supported formats include FLAC, MOD,
449MIDI, Ogg Vorbis, and MP3.
450
451This package supports two MIDI backends, selectable at runtime. To use the
452newer @code{fluidsynth} library, install a soundfont such as @code{fluid-3}
453and specify it using the @code{SDL_SOUNDFONTS} environment variable. For the
454legacy @code{timidity} backend, install a patch set such as @code{freepats}
455and set the path to the configuration file with @code{TIMIDITY_CFG}.")
456 (home-page "https://www.libsdl.org/projects/SDL_mixer/")
457 (license license:zlib)))
458
459(define-public sdl-net
460 (package
461 (name "sdl-net")
462 (version "1.2.8")
463 (source (origin
464 (method url-fetch)
465 (uri
466 (string-append "https://www.libsdl.org/projects/SDL_net/release/SDL_net-"
467 version ".tar.gz"))
468 (sha256
469 (base32
470 "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz"))))
471 (build-system gnu-build-system)
472 (propagated-inputs (list sdl))
473 (native-inputs (list pkg-config))
474 (outputs '("out" "debug"))
475 (synopsis "SDL networking library")
476 (description "SDL_net is a small, cross-platform networking library for
477SDL.")
478 (home-page "https://www.libsdl.org/projects/SDL_net/")
479 (license license:zlib)))
480
481(define-public sdl-pango
482 (package
483 (name "sdl-pango")
484 (version "0.1.2")
485 (source
486 (origin
487 (method url-fetch)
488 (uri (string-append
489 "mirror://sourceforge/sdlpango/SDL_Pango/" version "/"
490 "SDL_Pango-" version ".tar.gz"))
491 (sha256
492 (base32 "197baw1dsg0p4pljs5k0fshbyki00r4l49m1drlpqw6ggawx6xbz"))
493 (patches (search-patches "sdl-pango-api_additions.patch"
494 "sdl-pango-blit_overflow.patch"
495 "sdl-pango-fillrect_crash.patch"
496 "sdl-pango-header-guard.patch"
497 "sdl-pango-matrix_declarations.patch"
498 "sdl-pango-sans-serif.patch"))))
499 (build-system gnu-build-system)
500 (arguments
501 `(#:configure-flags (list "--disable-static")
502 #:phases
503 (modify-phases %standard-phases
504 (add-after 'unpack 'autogen
505 ;; Force reconfiguration because the included libtool
506 ;; generates linking errors.
507 (lambda _ (invoke "autoreconf" "-vif"))))))
508 (native-inputs
509 (list autoconf automake libtool pkg-config))
510 (inputs
511 `(("fontconfig" ,fontconfig)
512 ("freetype" ,freetype)
513 ("glib" ,glib)
514 ("harfbuzz" ,harfbuzz)
515 ("pango" ,pango)
516 ("sdl" ,sdl)))
517 (home-page "https://sdlpango.sourceforge.net")
518 (synopsis "Pango SDL binding")
519 (description "This library is a wrapper around the Pango library.
520It allows you to use TrueType fonts to render internationalized and
521tagged text in SDL applications.")
522 (license license:lgpl2.1)))
523
524(define-public sdl2-pango
525 (package
526 (name "sdl2-pango")
527 (version "2.1.5")
528 (home-page "https://github.com/markuskimius/SDL2_Pango")
529 (source
530 (origin
531 (method git-fetch)
532 (uri (git-reference
533 (url home-page)
534 (commit (string-append "v" version))))
535 (file-name (git-file-name name version))
536 (sha256
537 (base32 "0ivngl3bsy2aq8pqdh96nzrfnln6linz50mp5bpb9wv2bk5gj8pi"))))
538 (build-system gnu-build-system)
539 (arguments
540 `(#:configure-flags (list "--disable-static")))
541 (native-inputs
542 (list autoconf automake libtool pkg-config))
543 (inputs
544 (list freetype pango sdl2))
545 (synopsis "Pango SDL2 binding")
546 (description "This library is a wrapper around the Pango library.
547It allows you to use TrueType fonts to render internationalized and
548tagged text in SDL2 applications.")
549 (license license:lgpl2.1)))
550
551(define-public sdl-ttf
552 (package
553 (name "sdl-ttf")
554 (version "2.0.11.1")
555 ;; No release tarball for 2.0.11.1, changes:
556 ;; <https://github.com/libsdl-org/SDL_ttf/commit/e31d11a692>
557 (source (origin
558 (method git-fetch)
559 (uri (git-reference
560 (url "https://github.com/libsdl-org/SDL_ttf")
561 (commit "e31d11a692e5b55e8e624ad766e4e44d655422c8")))
562 (file-name (git-file-name name version))
563 (sha256
564 (base32
565 "1id1cdign615wd5rq0g4ppzwclvhkwd61yb5rwvvvakkpplp3lvd"))
566 ;; Remove bundled libraries.
567 (modules '((guix build utils)))
568 (snippet '(delete-file-recursively "external"))))
569 (build-system gnu-build-system)
570 (propagated-inputs (list sdl))
571 (inputs (list freetype mesa))
572 (native-inputs (list pkg-config))
573 (outputs '("out" "debug"))
574 (synopsis "SDL TrueType font library")
575 (description "SDL_ttf is a TrueType font rendering library for SDL.")
576 (home-page "https://www.libsdl.org/projects/SDL_ttf/")
577 (license license:zlib)))
578
579(define* (sdl-union #:optional (packages (list sdl sdl-gfx sdl-net sdl-ttf
580 sdl-image sdl-mixer)))
581 "Return 'sdl-union' package which is a union of PACKAGES.
582If PACKAGES are not specified, all SDL packages are used."
583 (package
584 (name "sdl-union")
585 (version (package-version sdl))
586 (source #f)
587 (build-system trivial-build-system)
588 (arguments
589 '(#:modules ((guix build union))
590 #:builder (begin
591 (use-modules (ice-9 match)
592 (guix build union))
593 (match %build-inputs
594 (((names . directories) ...)
595 (union-build (assoc-ref %outputs "out")
596 directories)
597 #t)))))
598 (inputs (map (lambda (package)
599 (list (package-name package) package))
600 packages))
601 (synopsis "Union of SDL libraries")
602 (description
603 "A union of SDL and its extension libraries. A union is required because
604sdl-config assumes that all of the headers and libraries are in the same
605directory.")
606 (home-page (package-home-page sdl))
607 (license (package-license sdl))))
608
609(define (propagated-inputs-with-sdl2 package)
610 "Replace the \"sdl\" propagated input of PACKAGE with SDL2."
611 (map (match-lambda
612 (("sdl" _)
613 `("sdl2" ,sdl2))
614 (("sdl12-compat" _)
615 `("sdl2" ,sdl2))
616 (other other))
617 (package-propagated-inputs package)))
618
619(define-public sdl2-gfx
620 (package (inherit sdl-gfx)
621 (name "sdl2-gfx")
622 (version "1.0.4")
623 (source (origin
624 (method url-fetch)
625 (uri
626 (string-append "https://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-"
627 version ".tar.gz"))
628 (sha256
629 (base32
630 "0qk2ax7f7grlxb13ba0ll3zlm8780s7j8fmrhlpxzjgdvldf1q33"))))
631 (propagated-inputs
632 (propagated-inputs-with-sdl2 sdl-gfx))))
633
634(define-public sdl2-image
635 (package (inherit sdl-image)
636 (name "sdl2-image")
637 (version "2.8.8")
638 (source
639 (origin
640 (method url-fetch)
641 (uri
642 (string-append "https://www.libsdl.org/projects/SDL_image/release/"
643 "SDL2_image-" version ".tar.gz"))
644 (sha256
645 (base32 "02p3gh4mc8dgf26bl30rfirwi0qspq6453lcwg8208pzv9pva4r2"))))
646 (propagated-inputs
647 (propagated-inputs-with-sdl2 sdl-image))
648 (properties '((upstream-name . "SDL2_image")))))
649
650(define-public sdl2-mixer
651 (package (inherit sdl-mixer)
652 (name "sdl2-mixer")
653 (version "2.6.3")
654 (source
655 (origin
656 (method url-fetch)
657 (uri
658 (string-append "http://www.libsdl.org/projects/SDL_mixer/release/"
659 "SDL2_mixer-" version ".tar.gz"))
660 (modules '((guix build utils)))
661 (snippet '(begin
662 ;; Remove bundled libraries.
663 (delete-file-recursively "external")))
664 (sha256
665 (base32 "13zadq6lmzdglvp0arl7x5y7zihv31vr4pisgrhwwj468xmahsvs"))))
666 (arguments
667 (list #:tests? #f ;no tests
668 #:configure-flags
669 #~'(;; Prefer system libraries to bundled codecs.
670 "--enable-music-flac-libflac"
671 "--enable-music-midi-fluidsynth"
672 "--enable-music-mod-modplug"
673 "--enable-music-mp3-mpg123"
674 "--enable-music-ogg-vorbis"
675 "--enable-music-opus"
676 ;; Link the libraries instead of dlopening them.
677 "--enable-music-flac-libflac-shared=no"
678 "--enable-music-midi-fluidsynth-shared=no"
679 "--enable-music-mod-modplug-shared=no"
680 "--enable-music-mp3-mpg123-shared=no"
681 "--enable-music-ogg-vorbis-shared=no"
682 "--enable-music-opus-shared=no")))
683 (native-inputs
684 (list pkg-config))
685 (inputs '())
686 (propagated-inputs
687 (modify-inputs (propagated-inputs-with-sdl2 sdl-mixer)
688 ;; In Requires.private of SDL2_mixer.pc.
689 (append flac fluidsynth libmodplug libmpg123 libvorbis opusfile)))
690 (properties '((upstream-name . "SDL2_mixer")))))
691
692(define-public sdl2-mixer-x
693 (package
694 (inherit sdl2-mixer)
695 (name "sdl2-mixer-x")
696 (version "2.6.0")
697 (source (origin
698 (method git-fetch)
699 (uri (git-reference
700 (url "https://github.com/WohlSoft/SDL-Mixer-X")
701 (commit version)))
702 (file-name (git-file-name name version))
703 (sha256
704 (base32
705 "17l0l89q4az6lmmvpqpymjgs64nc52r140301dcf54vsh76mzd2c"))))
706 (build-system cmake-build-system)
707 (arguments
708 (list #:tests? #f ;no tests
709 #:configure-flags
710 #~(list "-DBUILD_SHARED_LIBS=ON")))
711 (synopsis "This package is a fork of SDL mixer")
712 (description "A fork of SDL mixer with the goal of fixing various issues
713and supporting more audio formats.")))
714
715(define-public sdl2-net
716 (package (inherit sdl-net)
717 (name "sdl2-net")
718 (version "2.2.0")
719 (source
720 (origin
721 (method url-fetch)
722 (uri
723 (string-append "http://www.libsdl.org/projects/SDL_net/release/"
724 "SDL2_net-" version ".tar.gz"))
725 (sha256
726 (base32
727 "1svzhpf7k48jfga8ph127l99lwpgs5g5isgl9ybp2qiii0cqjjjf"))))
728 (propagated-inputs
729 (propagated-inputs-with-sdl2 sdl-net))
730 (properties '((upstream-name . "SDL2_net")))))
731
732(define-public sdl2-ttf
733 (package (inherit sdl-ttf)
734 (name "sdl2-ttf")
735 (version "2.20.2")
736 (source (origin
737 (method url-fetch)
738 (uri
739 (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-"
740 version ".tar.gz"))
741 (modules '((guix build utils)))
742 (snippet
743 ;; Remove bundled libraries.
744 '(delete-file-recursively "external"))
745 (sha256
746 (base32
747 "0lr0l8c19fg6anq2cp6xppv65ys3pyk9qjicg881nll76kcixiwx"))))
748 (arguments
749 (list #:configure-flags #~'("--enable-freetype-builtin=no"
750 "--enable-harfbuzz-builtin=no")))
751 (propagated-inputs
752 (modify-inputs (propagated-inputs-with-sdl2 sdl-ttf)
753 ;; In Requires.private of SDL2_ttf.pc.
754 (prepend harfbuzz freetype)))
755 (properties '((upstream-name . "SDL2_ttf")))))
756
757(define-public sdl2-gamecontrollerdb
758 (let ((commit "414eaee7aacc0d2ccdf281663c3d3bc65a8dbedd")
759 (revision "2"))
760 (package
761 (name "sdl2-gamecontrollerdb")
762 (version (git-version "0" revision commit))
763 (source
764 (origin
765 (method git-fetch)
766 (uri (git-reference
767 (url "https://github.com/mdqinc/SDL_GameControllerDB")
768 (commit commit)))
769 (file-name (git-file-name name version))
770 (sha256
771 (base32 "04x3g7vshagxaklwm5hxawh1pk6j1h0rip9xccpgr1r3gpxqs5df"))))
772 (build-system copy-build-system)
773 (arguments
774 '(#:install-plan '(("gamecontrollerdb.txt" "share/sdl2/"))))
775 (home-page "https://github.com/mdqinc/SDL_GameControllerDB")
776 (synopsis "SDL2 game controller database")
777 (description
778 "This package provides a community sourced database of game controller
779mappings intended for the use with SDL2's game controller functionality.")
780 (license license:zlib))))
781
782(define-public sdl3-gfx
783 (package
784 (name "sdl3-gfx")
785 (version "1.0.1")
786 (source (origin
787 (method git-fetch)
788 (uri (git-reference
789 (url "https://github.com/sabdul-khabir/SDL3_gfx")
790 (commit (string-append "v" version))))
791 (file-name (git-file-name name version))
792 (sha256
793 (base32
794 "18g9qavk0wh1bvfh6gdi5q75fd57dk0gp5r20c80x7xnp2ywywih"))))
795 (build-system cmake-build-system)
796 (arguments (list #:tests? #f
797 #:configure-flags
798 #~(list "-DBUILD_TESTS=ON")))
799 (propagated-inputs (list sdl3))
800 (home-page "https://github.com/sabdul-khabir/SDL3_gfx")
801 (synopsis "SDL3 graphics drawing primitives")
802 (description
803 "This package provides Graphics drawing primitives
804and other support functions wrapped up in an add-on, C-based library
805for the Simple Direct Media (SDL) cross-platform API layer.")
806 (license license:zlib)
807 (properties '((upstream-name . "SDL3_gfx")))))
808
809(define-public sdl3-image
810 (package (inherit sdl2-image)
811 (name "sdl3-image")
812 (version "3.2.4")
813 (source
814 (origin
815 (method url-fetch)
816 (uri
817 (string-append "https://www.libsdl.org/projects/SDL_image/release/"
818 "SDL3_image-" version ".tar.gz"))
819 (sha256
820 (base32 "10n1rxyswchd8vppalh2bl3ah5fww5chd5cdvnhds7r60invs9d7"))))
821 (build-system cmake-build-system)
822 (arguments
823 ;; Link the libraries instead of dlopening them.
824 '(#:configure-flags '("-DSDLIMAGE_AVIF_SHARED=OFF"
825 "-DSDLIMAGE_TIF_SHARED=OFF"
826 "-DSDLIMAGE_WEBP_SHARED=OFF"
827 "-DSDLIMAGE_TESTS=ON")))
828 (propagated-inputs
829 (list sdl3 libavif libjpeg-turbo libpng libtiff libwebp))
830 (properties '((upstream-name . "SDL3_image")))))
831
832(define-public sdl3-net
833 (package
834 (inherit sdl-net)
835 (name "sdl3-net")
836 (version "3.2.0")
837 (source
838 (origin
839 (method git-fetch)
840 (uri (git-reference
841 (url "https://github.com/libsdl-org/SDL_net")
842 (commit (string-append "release-" version))))
843 (file-name (git-file-name name version))
844 (sha256
845 (base32
846 "1cjmlv9718ay0hbh4v0i2aifn4s110drgq9gq3ykwcafl5bf8f9w"))))
847 (build-system cmake-build-system)
848 (arguments
849 (list #:configure-flags
850 #~(list "-DBUILD_SHARED_LIBS=ON")
851 #:tests? #f))
852 (propagated-inputs (list sdl3))
853 (properties '((upstream-name . "SDL3_net")))))
854
855(define-public sdl3-ttf
856 (package
857 (name "sdl3-ttf")
858 (version "3.2.2")
859 (source (origin
860 (method git-fetch)
861 (uri (git-reference
862 (url "https://github.com/libsdl-org/SDL_ttf.git")
863 (commit (string-append "release-" version))))
864 (file-name (git-file-name name version))
865 (sha256
866 (base32
867 "09jiajs9imscwa7b0q4z20znxcvazilks5ilggdvxjiv3cpxzcl3"))))
868 (build-system cmake-build-system)
869 (arguments
870 (list #:tests? #f)) ; no tests
871 (native-inputs
872 (list pkg-config))
873 (propagated-inputs
874 (list sdl3))
875 (inputs
876 (list harfbuzz freetype))
877 (synopsis "TrueType fonts in SDL3")
878 (description "This package provides a library to load TrueType (.ttf)
879font files with Simple Directmedia Layer.")
880 (home-page "https://wiki.libsdl.org/SDL3/FrontPage")
881 (license license:zlib)))
882
883(define-public guile-sdl2
884 (package
885 (name "guile-sdl2")
886 (version "0.8.0")
887 (source (origin
888 (method url-fetch)
889 (uri (string-append "https://files.dthompson.us/guile-sdl2/"
890 "guile-sdl2-" version ".tar.gz"))
891 (sha256
892 (base32
893 "1v57ghgqp9m32b2x47dya9zb0xvvfs5v8q8ak2wi8fzabajfpxap"))))
894 (build-system gnu-build-system)
895 (arguments
896 '(#:make-flags '("GUILE_AUTO_COMPILE=0")))
897 (native-inputs
898 (list guile-3.0 pkg-config))
899 (inputs
900 (list sdl2 sdl2-image sdl2-mixer sdl2-ttf))
901 (synopsis "Guile bindings for SDL2")
902 (home-page "https://dthompson.us/projects/guile-sdl2.html")
903 (description
904 "Guile-SDL2 provides Guile Scheme bindings for the SDL2 C shared library.
905The bindings are written in pure Scheme using Guile's foreign function
906interface.")
907 (license license:lgpl3+)))
908
909(define-public guile2.2-sdl2
910 (package/inherit guile-sdl2
911 (name "guile2.2-sdl2")
912 (native-inputs
913 `(("guile" ,guile-2.2)
914 ("pkg-config" ,pkg-config)))))