-
Notifications
You must be signed in to change notification settings - Fork 1
/
sdl2_2.0.8
119 lines (109 loc) · 3.44 KB
/
sdl2_2.0.8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
check_commands make gcc
# Options in the array below will be disabled unless they are
# explicitly enabled.
availables=( \
video video-opengl loadso render audio joystick haptic power \
filesystem threads timers file cpuinfo)
# Notes about the activation of loadso
#
# When loadso is not activated, when compiling
# using "sdl2-config" --libs to link we get the error:
# libSDL2.a(SDL_dynapi.o): undefined reference to symbol 'dlopen@@GLIBC_2.1'
# The problem is the option -ldl is required but not included by sdl2-config.
#
# In addition, when using an OPENGL window, if the loadso is not available
# the following error is given at runtime:
#
# Could not create window: Failed loading libGL.so.1: SDL_LoadObject() not implemented
#
# We activate therefore the loadso module when opengl is enabled.
#
# The module timers is very important and should be enabled whenever the
# events subsystem is used.
# If timers is disabled and SDL_PollEvent is used the application will use
# 100% of the CPU. In addition the SDL_Delay function will do nothing.
# It could be disabled if events are also disabled but this configuration
# is not currently supported.
# By default we build video, timers and events modules
enables=(video events timers)
needs_loadso=no
disables=(atomic dbus ibus ime fcitx input-tslib render-metal)
audio_disables=(jack arts nas sndio fusionsound diskaudio dummyaudio libsamplerate)
video_disables=(video-{mir,vulkan,directfb,dummy,opengles,opengles1,opengles2,vivante})
if [[ "$OSTYPE" == "linux"* ]]; then
os_audio_enables=(pulseaudio)
os_audio_disables=(oss esd "${audio_disables[@]}")
enables+=(video-x11 video-x11-{xcursor,xrandr})
disables+=(
"${video_disables[@]}" video-wayland \
video-x11-{xdbe,xinerama,scrnsaver,xshape,vm})
elif [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "mingw"* ]]; then
os_audio_enables=()
os_audio_disables=("${audio_disables[@]}")
# On windows the default video driver is directx but windib will
# be used if directx is disabled. Windib is based on GDI32 and doesn't
# need to be explicitly enabled with configure.
disables+=(directx render-d3d "${video_disables[@]}")
elif [[ "$OSTYPE" == "darwin"* ]]; then
enables+=(cocoa)
disables+=("${video_disables[@]}")
fi
options=()
while [ ! -z ${1+x} ]; do
case $1 in
-audio)
enables+=(audio "${os_audio_enables[@]}")
disables+=("${os_audio_disables[@]}")
;;
-opengl)
enables+=(video-opengl)
needs_loadso=yes
;;
-threads)
enables+=(threads)
;;
-joystick)
enables+=(joystick)
;;
-loadso)
needs_loadso=yes
;;
-filesystem)
enables+=(filesystem)
;;
-file)
enables+=(file)
;;
-threads)
enables+=(threads)
;;
-cpuinfo)
enables+=(cpuinfo)
;;
-render)
enables+=(render)
;;
*)
options+=("$1")
;;
esac
shift
done
if [[ $needs_loadso == yes ]]; then
enables+=(loadso)
fi
all_enables="${enables[*]}"
for opt in "${availables[@]}"; do
if [[ " $all_enables " != *" $opt "* ]]; then
disables+=("$opt")
fi
done
for name in "${enables[@]}"; do
options+=("--enable-$name")
done
for name in "${disables[@]}"; do
options+=("--disable-$name")
done
SDL_ARCHIVE_NAME="SDL2-$version"
enter_archive "http://libsdl.org/release/${SDL_ARCHIVE_NAME}.tar.gz"
build_and_install configure "${options[@]}"