Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/sdl/update-sdl.sh
9902 views
1
#!/bin/bash -e
2
3
VERSION=3.2.16
4
5
target=$(dirname "$(realpath $0)")
6
pushd $target
7
8
rm -rf atomic core events haptic hidapi include io joystick libm loadso \
9
sensor stdlib thread timer *.c *.h CREDITS.md LICENSE.txt
10
rm -rf *.tar.gz tmp
11
12
mkdir tmp && pushd tmp
13
14
echo "Updating SDL3 to version:" $VERSION
15
curl -L -O https://github.com/libsdl-org/SDL/archive/release-$VERSION.tar.gz
16
17
tar --strip-components=1 -xvf release-$VERSION.tar.gz
18
rm release-$VERSION.tar.gz
19
20
# We aim to copy only the minimum amount of files needed, so we don't need to
21
# vendor and compile more source code than necessary.
22
23
cp -v CREDITS.md LICENSE.txt $target
24
25
# Includes.
26
# For build config, we use a single private one in the driver.
27
# We might reconsider as we make more platforms use SDL.
28
cp -rv include $target
29
rm -f $target/include/build_config/{*.cmake,SDL_build_config_*.h} $target
30
rm -f $target/include/SDL3/SDL_{egl,gpu,oldnames,opengl*,test*,vulkan}.h $target
31
32
pushd src
33
34
# Shared dependencies
35
36
cp -rv *.{c,h} atomic libm stdlib $target
37
rm -f $target/stdlib/*.masm
38
39
# Only some files needed
40
41
mkdir $target/events
42
cp -v events/SDL_{event*.{c,h},mouse_c.h} $target/events
43
44
mkdir $target/io
45
cp -v io/SDL_iostream*.{c,h} $target/io
46
47
# Platform specific
48
49
mkdir $target/core
50
cp -rv core/{linux,unix,windows} $target/core
51
rm -f $target/core/windows/version.rc
52
53
mkdir $target/haptic
54
cp -rv haptic/{*.{c,h},darwin,linux,windows} $target/haptic
55
56
mkdir $target/joystick
57
cp -rv joystick/{*.{c,h},apple,darwin,hidapi,linux,windows} $target/joystick
58
59
mkdir $target/loadso
60
cp -rv loadso/dlopen $target/loadso
61
62
mkdir $target/sensor
63
cp -rv sensor/{*.{c,h},dummy} $target/sensor
64
65
mkdir $target/thread
66
cp -rv thread/{*.{c,h},pthread,windows} $target/thread
67
# Despite being 'generic', syssem.c is included in the Unix driver for macOS,
68
# and syscond/sysrwlock are used by the Windows driver.
69
# systhread_c.h is included by all these, but we should NOT compile the matching .c file.
70
mkdir $target/thread/generic
71
cp -v thread/generic/SDL_{syssem.c,{syscond,sysrwlock}*.{c,h},systhread_c.h} $target/thread/generic
72
73
mkdir $target/timer
74
cp -rv timer/{*.{c,h},unix,windows} $target/timer
75
76
# HIDAPI
77
78
mkdir -p $target/hidapi
79
cp -v hidapi/{*.{c,h},AUTHORS.txt,LICENSE.txt,LICENSE-bsd.txt,VERSION} $target/hidapi
80
for dir in hidapi linux mac windows; do
81
mkdir $target/hidapi/$dir
82
cp -v hidapi/$dir/*.{c,h} $target/hidapi/$dir
83
done
84
85
popd
86
popd
87
rm -rf tmp
88
popd
89
90
echo "SDL3 source code copied successfully. Review 'git status' for potential new files to compile or remove."
91
echo "Make sure to re-apply patches from the 'patches' folder if any are provided."
92
93