Commit | Line | Data |
---|---|---|
c3c516ea DT |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2013 David Thompson <dthompson2@worcester.edu> | |
9cb3036f | 3 | ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> |
666aa995 | 4 | ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com> |
c3c516ea DT |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
9 | ;;; under the terms of the GNU General Public License as published by | |
10 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
11 | ;;; your option) any later version. | |
12 | ;;; | |
13 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ;;; GNU General Public License for more details. | |
17 | ;;; | |
18 | ;;; You should have received a copy of the GNU General Public License | |
19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
21 | (define-module (gnu packages sdl) | |
22 | #:use-module (gnu packages) | |
23 | #:use-module (guix licenses) | |
24 | #:use-module (guix packages) | |
25 | #:use-module (guix download) | |
26 | #:use-module (guix build-system gnu) | |
d6f74baf | 27 | #:use-module (guix build-system trivial) |
5cf3bcd4 | 28 | #:use-module ((gnu packages fontutils) #:prefix font:) |
bcc046fc | 29 | #:use-module (gnu packages guile) |
e55354b8 | 30 | #:use-module (gnu packages image) |
c3c516ea | 31 | #:use-module (gnu packages linux) |
5cf3bcd4 | 32 | #:use-module (gnu packages mp3) |
8bf8d7c7 DT |
33 | #:use-module (gnu packages pkg-config) |
34 | #:use-module (gnu packages pulseaudio) | |
200726ed | 35 | #:use-module (gnu packages gl) |
54ff0b7d | 36 | #:use-module (gnu packages xiph) |
c3c516ea | 37 | #:use-module (gnu packages xorg) |
8bf8d7c7 DT |
38 | #:export (sdl |
39 | sdl2 | |
5cf3bcd4 DT |
40 | libmikmod |
41 | sdl-gfx | |
42 | sdl-image | |
43 | sdl-mixer | |
44 | sdl-net | |
45 | sdl-ttf)) | |
8bf8d7c7 DT |
46 | |
47 | (define sdl | |
48 | (package | |
49 | (name "sdl") | |
50 | (version "1.2.15") | |
51 | (source (origin | |
52 | (method url-fetch) | |
53 | (uri | |
54 | (string-append "http://libsdl.org/release/SDL-" | |
55 | version ".tar.gz")) | |
56 | (sha256 | |
57 | (base32 | |
9cb3036f MW |
58 | "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn")) |
59 | (patches (list (search-patch "sdl-libx11-1.6.patch"))))) | |
8bf8d7c7 | 60 | (build-system gnu-build-system) |
22f33e61 | 61 | (arguments |
666aa995 | 62 | '(;; Explicitly link against shared libraries instead of dlopening them. |
83bb3a3e SB |
63 | ;; For X11, ALSA, and PulseAudio. |
64 | ;; OpenGL library is still dlopened at runtime. | |
65 | #:configure-flags '("--disable-alsa-shared" | |
66 | "--disable-pulseaudio-shared" | |
07780c71 SB |
67 | "--disable-x11-shared" |
68 | ;; Explicitly link with mesa. | |
69 | ;; This add mesa to libsdl's RUNPATH, to make dlopen | |
70 | ;; finding the libGL from mesa at runtime. | |
71 | "LDFLAGS=-lGL") | |
22f33e61 LC |
72 | |
73 | #:tests? #f)) ; no check target | |
558a5122 LC |
74 | (propagated-inputs |
75 | ;; SDL headers include X11 headers. | |
666aa995 SB |
76 | `(("libx11" ,libx11) |
77 | ("libcap" ,libcap))) ; 'libSDL.la' contain `-lcap'. | |
22f33e61 | 78 | (native-inputs `(("pkg-config" ,pkg-config))) |
558a5122 | 79 | (inputs `(("libxrandr" ,libxrandr) |
8bf8d7c7 | 80 | ("mesa" ,mesa) |
83bb3a3e | 81 | ("glu" ,glu) |
8bf8d7c7 | 82 | ("alsa-lib" ,alsa-lib) |
8bf8d7c7 DT |
83 | ("pulseaudio" ,pulseaudio))) |
84 | (synopsis "Cross platform game development library") | |
85 | (description "Simple DirectMedia Layer is a cross-platform development | |
86 | library designed to provide low level access to audio, keyboard, mouse, | |
87 | joystick, and graphics hardware.") | |
88 | (home-page "http://libsdl.org/") | |
89 | (license lgpl2.1))) | |
90 | ||
91 | (define sdl2 | |
92 | (package (inherit sdl) | |
93 | (name "sdl2") | |
b907324d | 94 | (version "2.0.3") |
8bf8d7c7 DT |
95 | (source (origin |
96 | (method url-fetch) | |
97 | (uri | |
98 | (string-append "http://libsdl.org/release/SDL2-" | |
99 | version ".tar.gz")) | |
100 | (sha256 | |
101 | (base32 | |
b907324d | 102 | "0369ngvb46x6c26h8zva4x22ywgy6mvn0wx87xqwxg40pxm9m9m5")))) |
8bf8d7c7 | 103 | (license bsd-3))) |
c3c516ea DT |
104 | |
105 | (define libmikmod | |
106 | (package | |
107 | (name "libmikmod") | |
1effda8d | 108 | (version "3.3.7") |
c3c516ea DT |
109 | (source (origin |
110 | (method url-fetch) | |
111 | (uri (string-append "mirror://sourceforge/mikmod/libmikmod/" | |
112 | version "/libmikmod-" version ".tar.gz")) | |
113 | (sha256 | |
114 | (base32 | |
1effda8d | 115 | "18nrkf5l50hfg0y50yxr7bvik9f002lhn8c00nbcp6dgm5011x2c")))) |
c3c516ea | 116 | (build-system gnu-build-system) |
03920078 LC |
117 | (arguments |
118 | ;; By default, libmikmod tries to dlopen libasound etc., which won't work | |
119 | ;; unless the right libalsa happens to be in $LD_LIBRARY_PATH. Pass | |
120 | ;; '--disable-dl' to avoid that. | |
121 | '(#:configure-flags '("--disable-dl"))) | |
9e771e3b | 122 | (synopsis "Library for module sound formats") |
c3c516ea DT |
123 | (description |
124 | "MikMod is able to play a wide range of module formats, as well as | |
35b9e423 | 125 | digital sound files. It can take advantage of particular features of your |
c3c516ea DT |
126 | system, such as sound redirection over the network.") |
127 | (license lgpl2.1) | |
128 | (home-page "http://mikmod.sourceforge.net/"))) | |
5cf3bcd4 DT |
129 | |
130 | (define sdl-gfx | |
131 | (package | |
132 | (name "sdl-gfx") | |
133 | (version "2.0.24") | |
134 | (source (origin | |
135 | (method url-fetch) | |
136 | (uri | |
137 | (string-append "http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-" | |
138 | version ".tar.gz")) | |
139 | (sha256 | |
140 | (base32 | |
141 | "064islldm4r42lgj9fr4kbk66r7jmmakk9745hhyb1kmw71kib9h")))) | |
142 | (build-system gnu-build-system) | |
143 | (propagated-inputs `(("sdl" ,sdl))) | |
5cf3bcd4 DT |
144 | (synopsis "SDL graphics primitives library") |
145 | (description "SDL_gfx provides graphics drawing primitives, rotozoom and | |
146 | other supporting functions for SDL.") | |
147 | (home-page "http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx") | |
1d830bc0 LC |
148 | (license zlib) |
149 | ||
150 | ;; The code apparently includes Intel assembly, which fails to build on | |
151 | ;; MIPS, at least. | |
152 | (supported-systems '("i686-linux" "x86_64-linux")))) | |
5cf3bcd4 DT |
153 | |
154 | (define sdl-image | |
155 | (package | |
156 | (name "sdl-image") | |
157 | (version "1.2.12") | |
158 | (source (origin | |
159 | (method url-fetch) | |
160 | (uri | |
161 | (string-append "http://www.libsdl.org/projects/SDL_image/release/SDL_image-" | |
162 | version ".tar.gz")) | |
163 | (sha256 | |
164 | (base32 | |
165 | "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b")))) | |
166 | (build-system gnu-build-system) | |
7c3e60fb SB |
167 | (arguments |
168 | ;; Explicitly link against shared libraries instead of dlopening them. | |
169 | '(#:configure-flags '("--disable-jpg-shared" | |
170 | "--disable-png-shared" | |
171 | "--disable-tif-shared" | |
172 | "--disable-webp-shared"))) | |
586b6d4d | 173 | (native-inputs `(("pkg-config" ,pkg-config))) |
5cf3bcd4 | 174 | ;; FIXME: Add webp |
586b6d4d DT |
175 | ;; |
176 | ;; libjpeg, libpng, and libtiff are propagated inputs because the | |
177 | ;; SDL_image headers include the headers of these libraries. SDL is a | |
178 | ;; propagated input because the pkg-config file refers to SDL's pkg-config | |
179 | ;; file. | |
180 | (propagated-inputs `(("sdl" ,sdl) | |
181 | ("libjpeg" ,libjpeg) | |
182 | ("libpng" ,libpng) | |
183 | ("libtiff" ,libtiff))) | |
5cf3bcd4 DT |
184 | (synopsis "SDL image loading library") |
185 | (description "SDL_image is an image file loading library for SDL that | |
186 | supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, | |
187 | WEBP, XCF, XPM, and XV.") | |
6b464e6e | 188 | (home-page "http://www.libsdl.org/projects/SDL_image/") |
5cf3bcd4 DT |
189 | (license zlib))) |
190 | ||
191 | (define sdl-mixer | |
192 | (package | |
193 | (name "sdl-mixer") | |
194 | (version "1.2.12") | |
195 | (source (origin | |
196 | (method url-fetch) | |
197 | (uri | |
198 | (string-append "http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-" | |
199 | version ".tar.gz")) | |
200 | (sha256 | |
201 | (base32 | |
202 | "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n")))) | |
203 | (build-system gnu-build-system) | |
204 | ;; no check target | |
205 | ;; use libmad instead of smpeg | |
3ff73390 | 206 | ;; explicitly link against shared libraries instead of dlopening them |
5cf3bcd4 | 207 | (arguments `(#:tests? #f |
3ff73390 SB |
208 | #:configure-flags '("--enable-music-mp3-mad-gpl" |
209 | "--disable-music-mod-shared" | |
210 | "--disable-music-fluidsynth-shared" | |
211 | "--disable-music-ogg-shared" | |
212 | "--disable-music-flac-shared" | |
213 | "--disable-music-mp3-shared"))) | |
5cf3bcd4 DT |
214 | (inputs `(("libvorbis" ,libvorbis) |
215 | ("libflac" ,flac) | |
216 | ("libmad" ,libmad) | |
217 | ("libmikmod" ,libmikmod))) | |
218 | ;; FIXME: Add libfluidsynth | |
219 | (propagated-inputs `(("sdl" ,sdl))) | |
220 | (synopsis "SDL multi-channel audio mixer library") | |
221 | (description "SDL_mixer is a multi-channel audio mixer library for SDL. | |
222 | It supports any number of simultaneously playing channels of 16 bit stereo | |
223 | audio, plus a single channel of music. Supported format include FLAC, MOD, | |
224 | MIDI, Ogg Vorbis, and MP3.") | |
6b464e6e | 225 | (home-page "http://www.libsdl.org/projects/SDL_mixer/") |
5cf3bcd4 DT |
226 | (license zlib))) |
227 | ||
228 | (define sdl-net | |
229 | (package | |
230 | (name "sdl-net") | |
231 | (version "1.2.8") | |
232 | (source (origin | |
233 | (method url-fetch) | |
234 | (uri | |
235 | (string-append "http://www.libsdl.org/projects/SDL_net/release/SDL_net-" | |
236 | version ".tar.gz")) | |
237 | (sha256 | |
238 | (base32 | |
239 | "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz")))) | |
240 | (build-system gnu-build-system) | |
241 | (propagated-inputs `(("sdl" ,sdl))) | |
41eb1198 | 242 | (native-inputs `(("pkg-config" ,pkg-config))) |
5cf3bcd4 DT |
243 | (synopsis "SDL networking library") |
244 | (description "SDL_net is a small, cross-platform networking library for | |
245 | SDL.") | |
6b464e6e | 246 | (home-page "http://www.libsdl.org/projects/SDL_net/") |
5cf3bcd4 DT |
247 | (license zlib))) |
248 | ||
249 | (define sdl-ttf | |
250 | (package | |
251 | (name "sdl-ttf") | |
252 | (version "2.0.11") | |
253 | (source (origin | |
254 | (method url-fetch) | |
255 | (uri | |
256 | (string-append "http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-" | |
257 | version ".tar.gz")) | |
258 | (sha256 | |
259 | (base32 | |
260 | "1dydxd4f5kb1288i5n5568kdk2q7f8mqjr7i7sd33nplxjaxhk3j")))) | |
261 | (build-system gnu-build-system) | |
262 | (propagated-inputs `(("sdl" ,sdl))) | |
263 | (inputs `(("freetype" ,font:freetype) | |
41eb1198 LC |
264 | ("mesa" ,mesa))) |
265 | (native-inputs `(("pkg-config" ,pkg-config))) | |
5cf3bcd4 DT |
266 | (synopsis "SDL TrueType font library") |
267 | (description "SDL_ttf is a TrueType font rendering library for SDL.") | |
6b464e6e | 268 | (home-page "http://www.libsdl.org/projects/SDL_ttf/") |
5cf3bcd4 | 269 | (license zlib))) |
d6f74baf DT |
270 | |
271 | (define sdl-union | |
272 | (package | |
273 | (name "sdl-union") | |
274 | (version (package-version sdl)) | |
275 | (source #f) | |
276 | (build-system trivial-build-system) | |
277 | (arguments | |
278 | '(#:modules ((guix build union)) | |
279 | #:builder (begin | |
280 | (use-modules (ice-9 match) | |
281 | (guix build union)) | |
282 | (match %build-inputs | |
283 | (((names . directories) ...) | |
284 | (union-build (assoc-ref %outputs "out") | |
285 | directories)))))) | |
286 | (inputs `(("sdl" ,sdl) | |
287 | ("sdl-gfx" ,sdl-gfx) | |
288 | ("sdl-image" ,sdl-image) | |
289 | ("sdl-mixer" ,sdl-mixer) | |
290 | ("sdl-ttf" ,sdl-ttf))) | |
291 | (synopsis "Union of all SDL libraries") | |
292 | (description | |
293 | "A union of SDL and its extension libraries. A union is required because | |
294 | sdl-config assumes that all of the headers and libraries are in the same | |
295 | directory.") | |
296 | (home-page (package-home-page sdl)) | |
297 | (license (package-license sdl)))) | |
bcc046fc DT |
298 | |
299 | (define-public guile-sdl | |
300 | (package | |
301 | (name "guile-sdl") | |
302 | (version "0.5.1") | |
303 | (source (origin | |
304 | (method url-fetch) | |
305 | (uri | |
306 | (string-append "mirror://gnu/guile-sdl/guile-sdl-" | |
307 | version ".tar.xz")) | |
308 | (sha256 | |
309 | (base32 | |
310 | "126n4rd0ydh6i2s11ari5k85iivradlf12zq13b34shf9k1wn5am")))) | |
311 | (build-system gnu-build-system) | |
312 | (native-inputs | |
313 | `(("pkg-config" ,pkg-config) | |
314 | ;; Required by test suite. | |
315 | ("xorg-server" ,xorg-server) | |
316 | ("libjpeg" ,libjpeg))) | |
317 | (inputs | |
318 | `(("guile" ,guile-2.0) | |
319 | ("sdl-union" ,sdl-union))) | |
320 | (arguments | |
321 | '(#:configure-flags | |
322 | (list (string-append "--with-sdl-prefix=" | |
323 | (assoc-ref %build-inputs "sdl-union"))) | |
324 | #:parallel-build? #f ; parallel build fails | |
325 | #:phases | |
326 | (alist-cons-before | |
327 | 'configure 'fix-env-and-patch | |
328 | (lambda* (#:key inputs #:allow-other-keys) | |
329 | (setenv "GUILE_AUTO_COMPILE" "0") | |
330 | ;; SDL_image needs to dlopen libjpeg in the test suite. | |
331 | (setenv "LD_LIBRARY_PATH" | |
332 | (string-append (assoc-ref inputs "libjpeg") "/lib")) | |
333 | ;; Change the site directory /site/2.0 like Guile expects. | |
334 | (substitute* "build-aux/guile-baux/re-prefixed-site-dirs" | |
335 | (("\"/site\"") "\"/site/2.0\""))) | |
336 | (alist-cons-before | |
337 | 'check 'start-xorg-server | |
338 | (lambda* (#:key inputs #:allow-other-keys) | |
339 | ;; The test suite requires a running X server. | |
340 | (system (format #f "~a/bin/Xvfb :1 &" | |
341 | (assoc-ref inputs "xorg-server"))) | |
342 | (setenv "DISPLAY" ":1")) | |
343 | %standard-phases)))) | |
344 | (synopsis "Guile interface for SDL (Simple DirectMedia Layer)") | |
345 | (description "Guile-SDL is a set of bindings to the Simple DirectMedia | |
346 | Layer (SDL). With them, Guile programmers can have easy access to graphics, | |
347 | sound and device input (keyboards, joysticks, mice, etc.).") | |
348 | (home-page "http://gnu.org/s/guile-sdl") | |
349 | (license gpl3+))) |