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