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