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