Upgrade SDL build script for SDL3

This commit is contained in:
Romain Vimont 2025-07-11 09:42:20 +02:00
commit 9cf66950c5

View file

@ -5,10 +5,10 @@ cd "$DEPS_DIR"
. common . common
process_args "$@" process_args "$@"
VERSION=2.32.8 VERSION=3.2.18
FILENAME=SDL-$VERSION.tar.gz FILENAME=SDL-$VERSION.tar.gz
PROJECT_DIR=SDL-release-$VERSION PROJECT_DIR=SDL-release-$VERSION
SHA256SUM=dd35e05644ae527848d02433bec24dd0ea65db59faecf1a0e5d1880c533dac2c SHA256SUM=51539fa13e546bc50c632beed3f34257de2baa38a4c642048de56377903b4265
cd "$SOURCES_DIR" cd "$SOURCES_DIR"
@ -35,45 +35,48 @@ else
cd "$DIRNAME" cd "$DIRNAME"
conf=( conf=(
--prefix="$INSTALL_DIR/$DIRNAME" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR/$DIRNAME"
) )
if [[ "$HOST" == linux ]] if [[ "$HOST" == linux ]]
then then
conf+=( conf+=(
--enable-video-wayland -DSDL_WAYLAND=ON
--enable-video-x11 -DSDL_X11=ON
) )
fi fi
if [[ "$LINK_TYPE" == static ]] if [[ "$LINK_TYPE" == static ]]
then then
conf+=( conf+=(
--enable-static -DBUILD_SHARED_LIBS=OFF
--disable-shared
) )
else else
conf+=( conf+=(
--disable-static -DBUILD_SHARED_LIBS=ON
--enable-shared
) )
fi fi
if [[ "$BUILD_TYPE" == cross ]] if [[ "$BUILD_TYPE" == cross ]]
then then
if [[ "$HOST" = win32 ]]
then
TOOLCHAIN_FILENAME="cmake-toolchain-mingw64-i686.cmake"
elif [[ "$HOST" = win64 ]]
then
TOOLCHAIN_FILENAME="cmake-toolchain-mingw64-x86_64.cmake"
else
echo "Unsupported cross-build to host: $HOST" >&2
exit 1
fi
conf+=( conf+=(
--host="$HOST_TRIPLET" -DCMAKE_TOOLCHAIN_FILE="$SOURCES_DIR/$PROJECT_DIR/build-scripts/$TOOLCHAIN_FILENAME"
) )
fi fi
"$SOURCES_DIR/$PROJECT_DIR"/configure "${conf[@]}" cmake "$SOURCES_DIR/$PROJECT_DIR" "${conf[@]}"
fi fi
make -j cmake --build .
# There is no "make install-strip" cmake --install .
make install
# Strip manually
if [[ "$LINK_TYPE" == shared && "$HOST" == win* ]]
then
${HOST_TRIPLET}-strip "$INSTALL_DIR/$DIRNAME/bin/SDL2.dll"
fi