gnu: Add PadWalker.
[jackhill/guix/guix.git] / gnu / packages / sdl.scm
CommitLineData
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
SB
62 '(;; Explicitly link against shared libraries instead of dlopening them.
63 ;; For X11, ALSA, PulseAudio, etc.
64 #:configure-flags '("--disable-sdl-dlopen")
22f33e61
LC
65
66 #:tests? #f)) ; no check target
558a5122
LC
67 (propagated-inputs
68 ;; SDL headers include X11 headers.
666aa995
SB
69 `(("libx11" ,libx11)
70 ("libcap" ,libcap))) ; 'libSDL.la' contain `-lcap'.
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
78library designed to provide low level access to audio, keyboard, mouse,
79joystick, and graphics hardware.")
80 (home-page "http://libsdl.org/")
81 (license lgpl2.1)))
82
83(define sdl2
84 (package (inherit sdl)
85 (name "sdl2")
b907324d 86 (version "2.0.3")
8bf8d7c7
DT
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
b907324d 94 "0369ngvb46x6c26h8zva4x22ywgy6mvn0wx87xqwxg40pxm9m9m5"))))
8bf8d7c7 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 119digital sound files. It can take advantage of particular features of your
c3c516ea
DT
120system, 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
140other 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)
7c3e60fb
SB
161 (arguments
162 ;; Explicitly link against shared libraries instead of dlopening them.
163 '(#:configure-flags '("--disable-jpg-shared"
164 "--disable-png-shared"
165 "--disable-tif-shared"
166 "--disable-webp-shared")))
586b6d4d 167 (native-inputs `(("pkg-config" ,pkg-config)))
5cf3bcd4 168 ;; FIXME: Add webp
586b6d4d
DT
169 ;;
170 ;; libjpeg, libpng, and libtiff are propagated inputs because the
171 ;; SDL_image headers include the headers of these libraries. SDL is a
172 ;; propagated input because the pkg-config file refers to SDL's pkg-config
173 ;; file.
174 (propagated-inputs `(("sdl" ,sdl)
175 ("libjpeg" ,libjpeg)
176 ("libpng" ,libpng)
177 ("libtiff" ,libtiff)))
5cf3bcd4
DT
178 (synopsis "SDL image loading library")
179 (description "SDL_image is an image file loading library for SDL that
180supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF,
181WEBP, XCF, XPM, and XV.")
6b464e6e 182 (home-page "http://www.libsdl.org/projects/SDL_image/")
5cf3bcd4
DT
183 (license zlib)))
184
185(define sdl-mixer
186 (package
187 (name "sdl-mixer")
188 (version "1.2.12")
189 (source (origin
190 (method url-fetch)
191 (uri
192 (string-append "http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-"
193 version ".tar.gz"))
194 (sha256
195 (base32
196 "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"))))
197 (build-system gnu-build-system)
198 ;; no check target
199 ;; use libmad instead of smpeg
3ff73390 200 ;; explicitly link against shared libraries instead of dlopening them
5cf3bcd4 201 (arguments `(#:tests? #f
3ff73390
SB
202 #:configure-flags '("--enable-music-mp3-mad-gpl"
203 "--disable-music-mod-shared"
204 "--disable-music-fluidsynth-shared"
205 "--disable-music-ogg-shared"
206 "--disable-music-flac-shared"
207 "--disable-music-mp3-shared")))
5cf3bcd4
DT
208 (inputs `(("libvorbis" ,libvorbis)
209 ("libflac" ,flac)
210 ("libmad" ,libmad)
211 ("libmikmod" ,libmikmod)))
212 ;; FIXME: Add libfluidsynth
213 (propagated-inputs `(("sdl" ,sdl)))
214 (synopsis "SDL multi-channel audio mixer library")
215 (description "SDL_mixer is a multi-channel audio mixer library for SDL.
216It supports any number of simultaneously playing channels of 16 bit stereo
217audio, plus a single channel of music. Supported format include FLAC, MOD,
218MIDI, Ogg Vorbis, and MP3.")
6b464e6e 219 (home-page "http://www.libsdl.org/projects/SDL_mixer/")
5cf3bcd4
DT
220 (license zlib)))
221
222(define sdl-net
223 (package
224 (name "sdl-net")
225 (version "1.2.8")
226 (source (origin
227 (method url-fetch)
228 (uri
229 (string-append "http://www.libsdl.org/projects/SDL_net/release/SDL_net-"
230 version ".tar.gz"))
231 (sha256
232 (base32
233 "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz"))))
234 (build-system gnu-build-system)
235 (propagated-inputs `(("sdl" ,sdl)))
41eb1198 236 (native-inputs `(("pkg-config" ,pkg-config)))
5cf3bcd4
DT
237 (synopsis "SDL networking library")
238 (description "SDL_net is a small, cross-platform networking library for
239SDL.")
6b464e6e 240 (home-page "http://www.libsdl.org/projects/SDL_net/")
5cf3bcd4
DT
241 (license zlib)))
242
243(define sdl-ttf
244 (package
245 (name "sdl-ttf")
246 (version "2.0.11")
247 (source (origin
248 (method url-fetch)
249 (uri
250 (string-append "http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-"
251 version ".tar.gz"))
252 (sha256
253 (base32
254 "1dydxd4f5kb1288i5n5568kdk2q7f8mqjr7i7sd33nplxjaxhk3j"))))
255 (build-system gnu-build-system)
256 (propagated-inputs `(("sdl" ,sdl)))
257 (inputs `(("freetype" ,font:freetype)
41eb1198
LC
258 ("mesa" ,mesa)))
259 (native-inputs `(("pkg-config" ,pkg-config)))
5cf3bcd4
DT
260 (synopsis "SDL TrueType font library")
261 (description "SDL_ttf is a TrueType font rendering library for SDL.")
6b464e6e 262 (home-page "http://www.libsdl.org/projects/SDL_ttf/")
5cf3bcd4 263 (license zlib)))
d6f74baf
DT
264
265(define sdl-union
266 (package
267 (name "sdl-union")
268 (version (package-version sdl))
269 (source #f)
270 (build-system trivial-build-system)
271 (arguments
272 '(#:modules ((guix build union))
273 #:builder (begin
274 (use-modules (ice-9 match)
275 (guix build union))
276 (match %build-inputs
277 (((names . directories) ...)
278 (union-build (assoc-ref %outputs "out")
279 directories))))))
280 (inputs `(("sdl" ,sdl)
281 ("sdl-gfx" ,sdl-gfx)
282 ("sdl-image" ,sdl-image)
283 ("sdl-mixer" ,sdl-mixer)
284 ("sdl-ttf" ,sdl-ttf)))
285 (synopsis "Union of all SDL libraries")
286 (description
287 "A union of SDL and its extension libraries. A union is required because
288sdl-config assumes that all of the headers and libraries are in the same
289directory.")
290 (home-page (package-home-page sdl))
291 (license (package-license sdl))))
bcc046fc
DT
292
293(define-public guile-sdl
294 (package
295 (name "guile-sdl")
296 (version "0.5.1")
297 (source (origin
298 (method url-fetch)
299 (uri
300 (string-append "mirror://gnu/guile-sdl/guile-sdl-"
301 version ".tar.xz"))
302 (sha256
303 (base32
304 "126n4rd0ydh6i2s11ari5k85iivradlf12zq13b34shf9k1wn5am"))))
305 (build-system gnu-build-system)
306 (native-inputs
307 `(("pkg-config" ,pkg-config)
308 ;; Required by test suite.
309 ("xorg-server" ,xorg-server)
310 ("libjpeg" ,libjpeg)))
311 (inputs
312 `(("guile" ,guile-2.0)
313 ("sdl-union" ,sdl-union)))
314 (arguments
315 '(#:configure-flags
316 (list (string-append "--with-sdl-prefix="
317 (assoc-ref %build-inputs "sdl-union")))
318 #:parallel-build? #f ; parallel build fails
319 #:phases
320 (alist-cons-before
321 'configure 'fix-env-and-patch
322 (lambda* (#:key inputs #:allow-other-keys)
323 (setenv "GUILE_AUTO_COMPILE" "0")
324 ;; SDL_image needs to dlopen libjpeg in the test suite.
325 (setenv "LD_LIBRARY_PATH"
326 (string-append (assoc-ref inputs "libjpeg") "/lib"))
327 ;; Change the site directory /site/2.0 like Guile expects.
328 (substitute* "build-aux/guile-baux/re-prefixed-site-dirs"
329 (("\"/site\"") "\"/site/2.0\"")))
330 (alist-cons-before
331 'check 'start-xorg-server
332 (lambda* (#:key inputs #:allow-other-keys)
333 ;; The test suite requires a running X server.
334 (system (format #f "~a/bin/Xvfb :1 &"
335 (assoc-ref inputs "xorg-server")))
336 (setenv "DISPLAY" ":1"))
337 %standard-phases))))
338 (synopsis "Guile interface for SDL (Simple DirectMedia Layer)")
339 (description "Guile-SDL is a set of bindings to the Simple DirectMedia
340Layer (SDL). With them, Guile programmers can have easy access to graphics,
341sound and device input (keyboards, joysticks, mice, etc.).")
342 (home-page "http://gnu.org/s/guile-sdl")
343 (license gpl3+)))