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