2020-09-03 17:52:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-12-08 23:48:19 +00:00
|
|
|
SDL_REPO="https://github.com/libsdl-org/SDL.git"
|
2021-12-31 20:48:23 +00:00
|
|
|
SDL_COMMIT="d0de4c625ad26ef5401665ca26b5f2c0fb76e91b"
|
2020-09-03 17:52:38 +00:00
|
|
|
|
|
|
|
ffbuild_enabled() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
ffbuild_dockerbuild() {
|
2021-12-08 23:48:19 +00:00
|
|
|
git-mini-clone "$SDL_REPO" "$SDL_COMMIT" sdl
|
2020-09-03 17:52:38 +00:00
|
|
|
cd sdl
|
|
|
|
|
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
|
2020-09-03 17:52:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ffbuild_configure() {
|
|
|
|
echo --enable-sdl2
|
|
|
|
}
|
|
|
|
|
|
|
|
ffbuild_unconfigure() {
|
|
|
|
echo --disable-sdl2
|
|
|
|
}
|