2020-09-03 17:52:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-07-12 15:54:12 +00:00
|
|
|
SCRIPT_REPO="https://github.com/libsdl-org/SDL.git"
|
2023-05-29 12:10:36 +00:00
|
|
|
SCRIPT_COMMIT="5007b963639bff2fa3359abbfe20d53ea9111fd9"
|
2022-12-02 17:11:12 +00:00
|
|
|
SCRIPT_BRANCH="SDL2"
|
2020-09-03 17:52:38 +00:00
|
|
|
|
|
|
|
ffbuild_enabled() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2023-06-18 14:44:57 +00:00
|
|
|
ffbuild_dockerdl() {
|
2022-07-12 15:54:12 +00:00
|
|
|
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" sdl
|
2023-06-18 14:44:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ffbuild_dockerbuild() {
|
|
|
|
cd "$FFBUILD_DLDIR"/sdl
|
2020-09-03 17:52:38 +00:00
|
|
|
|
2021-12-08 23:48:19 +00:00
|
|
|
mkdir build && cd build
|
|
|
|
|
2021-12-09 00:11:24 +00:00
|
|
|
local mycmake=(
|
|
|
|
-DSDL_SHARED=OFF
|
|
|
|
-DSDL_STATIC=ON
|
|
|
|
-DSDL_STATIC_PIC=ON
|
2021-12-11 00:57:56 +00:00
|
|
|
-DSDL_TEST=OFF
|
2021-12-09 00:11:24 +00:00
|
|
|
)
|
2021-12-08 23:48:19 +00:00
|
|
|
|
2021-12-09 00:11:24 +00:00
|
|
|
if [[ $TARGET == linux* ]]; then
|
|
|
|
mycmake+=(
|
2021-12-11 00:57:56 +00:00
|
|
|
-DSDL_X11=ON
|
2021-12-09 00:11:24 +00:00
|
|
|
-DSDL_X11_SHARED=OFF
|
|
|
|
-DHAVE_XGENERICEVENT=TRUE
|
|
|
|
-DSDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM=1
|
2021-12-17 23:21:43 +00:00
|
|
|
|
|
|
|
-DSDL_PULSEAUDIO=ON
|
|
|
|
-DSDL_PULSEAUDIO_SHARED=OFF
|
2021-12-09 00:11:24 +00:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" "${mycmake[@]}" ..
|
2020-09-03 17:52:38 +00:00
|
|
|
|
2021-12-08 23:48:19 +00:00
|
|
|
ninja -j$(nproc)
|
|
|
|
ninja install
|
|
|
|
|
|
|
|
if [[ $TARGET == linux* ]]; then
|
2021-12-11 00:57:56 +00:00
|
|
|
sed -ri -e 's/\-Wl,\-\-no\-undefined.*//' \
|
|
|
|
-e 's/ \-l\/.+?\.a//g' \
|
2021-12-08 23:48:19 +00:00
|
|
|
"$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc
|
2021-12-17 23:21:43 +00:00
|
|
|
echo 'Requires: libpulse-simple xxf86vm xscrnsaver xrandr xfixes xi xinerama xcursor' >> "$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc
|
2021-12-09 00:45:15 +00:00
|
|
|
elif [[ $TARGET == win* ]]; then
|
|
|
|
sed -ri -e 's/\-Wl,\-\-no\-undefined.*//' \
|
|
|
|
-e 's/ \-mwindows//g' \
|
|
|
|
-e 's/ \-lSDL2main//g' \
|
|
|
|
-e 's/ \-Dmain=SDL_main//g' \
|
|
|
|
"$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc
|
2021-12-08 23:48:19 +00:00
|
|
|
fi
|
2022-06-09 23:00:16 +00:00
|
|
|
|
|
|
|
sed -ri -e 's/ -lSDL2//g' \
|
|
|
|
-e 's/Libs: /Libs: -lSDL2 /'\
|
|
|
|
"$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc
|
2022-07-13 22:16:48 +00:00
|
|
|
|
|
|
|
echo 'Requires: samplerate' >> "$FFBUILD_PREFIX"/lib/pkgconfig/sdl2.pc
|
2020-09-03 17:52:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ffbuild_configure() {
|
|
|
|
echo --enable-sdl2
|
|
|
|
}
|
|
|
|
|
|
|
|
ffbuild_unconfigure() {
|
|
|
|
echo --disable-sdl2
|
|
|
|
}
|