FFmpeg-Builds/scripts.d/50-sdl.sh

67 lines
1.7 KiB
Bash
Raw Permalink Normal View History

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-06-21 11:43:28 +00:00
SCRIPT_COMMIT="ceece918e4ebe7adfe80ee35a0a4a928c0018252"
2022-12-02 17:11:12 +00:00
SCRIPT_BRANCH="SDL2"
2020-09-03 17:52:38 +00:00
ffbuild_enabled() {
return 0
}
ffbuild_dockerbuild() {
cd "$FFBUILD_DLDIR/$SELF"
2020-09-03 17:52:38 +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-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
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' \
"$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
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
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
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
}