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