Mercurial > vanilla
comparison lib/sdl2/sdl2.sh @ 760:59f3318533db
lib/sdl2: initial import, closes #1001
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 08 Aug 2019 20:30:00 +0200 |
parents | |
children | 0e6c54d47dfb |
comparison
equal
deleted
inserted
replaced
759:6fc101f8b060 | 760:59f3318533db |
---|---|
1 #!/bin/sh | |
2 # | |
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr> | |
4 # | |
5 # Permission to use, copy, modify, and/or distribute this software for any | |
6 # purpose with or without fee is hereby granted, provided that the above | |
7 # copyright notice and this permission notice appear in all copies. | |
8 # | |
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
16 # | |
17 | |
18 PKGNAME=sdl2 | |
19 PKGVERSION=2.0.10 | |
20 PKGREVISION=1 | |
21 PKGLICENSE="ZLIB" | |
22 PKGSUMMARY="Simple Directmedia Layer" | |
23 PKGDOWNLOAD="https://www.libsdl.org/release/SDL2-$PKGVERSION.tar.gz" | |
24 PKGOPTIONS="ALSA | |
25 ATOMIC | |
26 AUDIO | |
27 DBUS | |
28 DSO | |
29 EVENTS | |
30 FILE | |
31 FILESYSTEM | |
32 GLES1 | |
33 GLES2 | |
34 GLES3 | |
35 HAPTIC | |
36 JACK | |
37 JOYSTICK | |
38 KMS | |
39 OPENGL | |
40 OSS | |
41 POWER | |
42 PULSEAUDIO | |
43 RENDER | |
44 SENSOR | |
45 THREADS | |
46 TIMER | |
47 UDEV | |
48 VIDEO | |
49 VULKAN | |
50 WAYLAND | |
51 X" | |
52 | |
53 # NAS, SAMPLERATE, IBUS | |
54 | |
55 : ${CHOST:=$(uname -m)-linux-musl} | |
56 : ${CBUILD:=$(uname -m)-linux-musl} | |
57 : ${CC:=clang} | |
58 : ${CFLAGS:=-O2} | |
59 : ${CXX:=clang++} | |
60 : ${CXXFLAGS:=-O2} | |
61 : ${LDFLAGS:=} | |
62 : ${LIBS:=} | |
63 : ${ALSA:=yes} | |
64 : ${ATOMIC:=yes} | |
65 : ${AUDIO:=yes} | |
66 : ${DBUS:=yes} | |
67 : ${DSO:=yes} | |
68 : ${EVENTS:=yes} | |
69 : ${FILE:=yes} | |
70 : ${FILESYSTEM:=yes} | |
71 : ${GLES1:=yes} | |
72 : ${GLES2:=yes} | |
73 : ${GLES3:=yes} | |
74 : ${HAPTIC:=yes} | |
75 : ${JACK:=yes} | |
76 : ${JOYSTICK:=yes} | |
77 : ${KMS:=yes} | |
78 : ${OPENGL:=yes} | |
79 : ${OSS:=yes} | |
80 : ${POWER:=yes} | |
81 : ${PULSEAUDIO:=yes} | |
82 : ${RENDER:=yes} | |
83 : ${SENSOR:=yes} | |
84 : ${THREADS:=yes} | |
85 : ${TIMER:=yes} | |
86 : ${UDEV:=yes} | |
87 : ${VIDEO:=yes} | |
88 : ${VULKAN:=yes} | |
89 : ${WAYLAND:=yes} | |
90 : ${X:=yes} | |
91 | |
92 if [ "$ALSA" = "yes" ]; then | |
93 PKGDEPENDS="alsa-lib $PKGDEPENDS" | |
94 with_alsa="--enable-alsa" | |
95 else | |
96 with_alsa="--disable-alsa" | |
97 fi | |
98 | |
99 if [ "$ATOMIC" = "yes" ]; then | |
100 with_atomic="--enable-atomic" | |
101 else | |
102 with_atomic="--disable-atomic" | |
103 fi | |
104 | |
105 if [ "$AUDIO" = "yes" ]; then | |
106 with_audio="--enable-audio" | |
107 else | |
108 with_audio="--disable-audio" | |
109 fi | |
110 | |
111 if [ "$DBUS" = "yes" ]; then | |
112 PKGDEPENDS="network/dbus $PKGDEPENDS" | |
113 with_dbus="--enable-dbus" | |
114 else | |
115 with_dbus="--disable-dbus" | |
116 fi | |
117 | |
118 if [ "$DSO" = "yes" ]; then | |
119 with_dso="--enable-loadso" | |
120 else | |
121 with_dso="--disable-loadso" | |
122 fi | |
123 | |
124 if [ "$EVENTS" = "yes" ]; then | |
125 with_events="--enable-events" | |
126 else | |
127 with_events="--disable-events" | |
128 fi | |
129 | |
130 if [ "$FILE" = "yes" ]; then | |
131 with_file="--enable-file" | |
132 else | |
133 with_file="--disable-file" | |
134 fi | |
135 | |
136 if [ "$FILESYSTEM" = "yes" ]; then | |
137 with_filesystem="--enable-filesystem" | |
138 else | |
139 with_filesystem="--disable-filesystem" | |
140 fi | |
141 | |
142 if [ "$GLES1" = "yes" ]; then | |
143 with_gles1="--enable-video-opengles1" | |
144 else | |
145 with_gles1="--disable-video-opengles1" | |
146 fi | |
147 | |
148 if [ "$GLES2" = "yes" ]; then | |
149 with_gles2="--enable-video-opengles2" | |
150 else | |
151 with_gles2="--disable-video-opengles2" | |
152 fi | |
153 | |
154 if [ "$GLES3" = "yes" ]; then | |
155 with_gles3="--enable-video-opengles" | |
156 else | |
157 with_gles3="--disable-video-opengles" | |
158 fi | |
159 | |
160 if [ "$HAPTIC" = "yes" ]; then | |
161 with_haptic="--enable-haptic" | |
162 else | |
163 with_haptic="--disable-haptic" | |
164 fi | |
165 | |
166 if [ "$JACK" = "yes" ]; then | |
167 PKGDEPENDS="audio/jack $PKGDEPENDS" | |
168 with_jack="--enable-jack" | |
169 else | |
170 with_jack="--disable-jack" | |
171 fi | |
172 | |
173 if [ "$JOYSTICK" = "yes" ]; then | |
174 with_joystick="--enable-joystick" | |
175 else | |
176 with_joystick="--disable-joystick" | |
177 fi | |
178 | |
179 if [ "$KMS" = "yes" ]; then | |
180 PKGDEPENDS="graphics/libdrm $PKGDEPENDS" | |
181 with_kms="--enable-video-kmsdrm" | |
182 else | |
183 with_kms="--disable-video-kmsdrm" | |
184 fi | |
185 | |
186 if [ "$OPENGL" = "yes" ]; then | |
187 PKGDEPENDS="graphics/mesa $PKGDEPENDS" | |
188 with_opengl="--enable-video-opengl" | |
189 else | |
190 with_opengl="--disable-video-opengl" | |
191 fi | |
192 | |
193 if [ "$OSS" = "yes" ]; then | |
194 with_oss="--enable-oss" | |
195 else | |
196 with_oss="--disable-oss" | |
197 fi | |
198 | |
199 if [ "$POWER" = "yes" ]; then | |
200 with_power="--enable-power" | |
201 else | |
202 with_power="--disable-power" | |
203 fi | |
204 | |
205 if [ "$PULSEAUDIO" = "yes" ]; then | |
206 PKGDEPENDS="audio/pulseaudio $PKGDEPENDS" | |
207 with_pulseaudio="--enable-pulseaudio" | |
208 else | |
209 with_pulseaudio="--disable-pulseaudio" | |
210 fi | |
211 | |
212 if [ "$RENDER" = "yes" ]; then | |
213 with_render="--enable-render" | |
214 else | |
215 with_render="--disable-render" | |
216 fi | |
217 | |
218 if [ "$SENSOR" = "yes" ]; then | |
219 with_sensor="--enable-sensor" | |
220 else | |
221 with_sensor="--disable-sensor" | |
222 fi | |
223 | |
224 if [ "$THREADS" = "yes" ]; then | |
225 with_threads="--enable-threads" | |
226 else | |
227 with_threads="--disable-threads" | |
228 fi | |
229 | |
230 if [ "$UDEV" = "yes" ]; then | |
231 with_udev="--enable-libudev" | |
232 else | |
233 with_udev="--disable-libudev" | |
234 fi | |
235 | |
236 if [ "$VIDEO" = "yes" ]; then | |
237 with_video="--enable-video" | |
238 else | |
239 with_video="--disable-video" | |
240 fi | |
241 | |
242 if [ "$VULKAN" = "yes" ]; then | |
243 with_vulkan="--enable-video-vulkan" | |
244 else | |
245 with_vulkan="--disable-video-vulkan" | |
246 fi | |
247 | |
248 if [ "$X" = "yes" ]; then | |
249 PKGDEPENDS="x11/libxext | |
250 x11/libxcursor | |
251 x11/libxinerama | |
252 x11/libxrandr | |
253 x11/libxscrnsaver | |
254 x1/libxi $PKGDEPENDS" | |
255 with_x="--enable-video-x11" | |
256 with_x="--enable-video-x11-scrnsaver $with_x" | |
257 with_x="--enable-video-x11-xcursor $with_x" | |
258 with_x="--enable-video-x11-xinerama $with_x" | |
259 with_x="--enable-video-x11-xinput $with_x" | |
260 with_x="--enable-video-x11-xrandr $with_x" | |
261 with_x="--enable-video-x11-xshape $with_x" | |
262 else | |
263 with_x="--disable-video-x11" | |
264 with_x="--disable-video-x11-scrnsaver $with_x" | |
265 with_x="--disable-video-x11-xcursor $with_x" | |
266 with_x="--disable-video-x11-xdbe $with_x" | |
267 with_x="--disable-video-x11-xinerama $with_x" | |
268 with_x="--disable-video-x11-xinput $with_x" | |
269 with_x="--disable-video-x11-xrandr $with_x" | |
270 with_x="--disable-video-x11-xshape $with_x" | |
271 fi | |
272 | |
273 build() | |
274 { | |
275 rm -rf SDL2-$PKGVERSION | |
276 tar xvf SDL2-$PKGVERSION.tar.gz | |
277 cd SDL2-$PKGVERSION | |
278 | |
279 CC="$CC" \ | |
280 CFLAGS="$CFLAGS" \ | |
281 CXX="$CXX" \ | |
282 CXXFLAGS="$CXXFLAGS" \ | |
283 LDFLAGS="$LDFLAGS" \ | |
284 LIBS="$LIBS" \ | |
285 ./configure \ | |
286 --build=$CBUILD \ | |
287 --host=$CHOST \ | |
288 --prefix= \ | |
289 $with_alsa \ | |
290 $with_atomic \ | |
291 $with_audio \ | |
292 $with_dbus \ | |
293 $with_dso \ | |
294 $with_events \ | |
295 $with_file \ | |
296 $with_filesystem \ | |
297 $with_gles1 \ | |
298 $with_gles2 \ | |
299 $with_gles3 \ | |
300 $with_haptic \ | |
301 $with_jack \ | |
302 $with_joystick \ | |
303 $with_kms \ | |
304 $with_opengl \ | |
305 $with_oss \ | |
306 $with_power \ | |
307 $with_pulseaudio \ | |
308 $with_render \ | |
309 $with_sensor \ | |
310 $with_threads \ | |
311 $with_timer \ | |
312 $with_udev \ | |
313 $with_video \ | |
314 $with_vulkan \ | |
315 $with_wayland \ | |
316 $with_x | |
317 make | |
318 make install DESTDIR=$DESTDIR | |
319 rm -f $DESTDIR/lib/libSDL2*.la | |
320 | |
321 cd .. | |
322 rm -rf SDL2-$PKGVERSION | |
323 } |