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