Add SDL 2.24.0 libs for Linux

Add the Linux SDL libs to the repo like Windows and macOS instead of
downloading them when running make-linux-portable.sh.
This commit is contained in:
Zack Middleton 2023-03-02 23:08:03 -06:00
parent 22a0949a26
commit 595b89dbe5
4 changed files with 7 additions and 78 deletions

Binary file not shown.

Binary file not shown.

View file

@ -1 +0,0 @@
DIR=build/spearmint-sdl2-downloads

View file

@ -2,34 +2,6 @@
ARCH=$1
ERROR=0
# Install directory for Spearmint SDL2 builds (i.e., /home/zack/Local/SDL-2.0.X).
DIR=/home/zack/Local
# SDL version to install and compile against.
# See available versions at http://clover.moe/downloads/spearmint-make-linux-portable-deps/
SDLVERSION=2.0.8
#
# Use make-linux-portable.local file to set DIR and (optionally) SDLVERSION
#
SETTINGS="$(dirname $0)/make-linux-portable.local"
if [ -f "$SETTINGS" ] ; then
. "$SETTINGS" # source "$SETTINGS"
if [ -z "$DIR" ] || [ ! -d "$DIR" ]; then
echo "Error: DIR specified in '$SETTINGS' not found."
echo
ERROR=1
fi
else
# Require settings file to exist but only error if specified arch
if [ -n "$ARCH" ]; then
echo "Error: You need to create '$SETTINGS', see usage."
echo
ERROR=1
fi
fi
if [ -z "$ARCH" ] || [ $ERROR -ne 0 ]; then
echo "Usage: make-linux-portable.sh <arch> [make options]"
echo " arch can be x86 or x86_64"
@ -45,13 +17,7 @@ if [ -z "$ARCH" ] || [ $ERROR -ne 0 ]; then
echo
echo "DIRECTIONS"
echo
echo "1. Create a directory to store Spearmint SDL2 builds and create a file named"
echo "'$SETTINGS' containing:"
echo
echo " # Example comment line"
echo " DIR=/path/to/spearmint-make-linux-portable-deps"
echo
echo "2. To build the game clients (and download Spearmint SDL2 builds if needed) run"
echo "1. To build the game clients (and download Spearmint SDL2 builds if needed) run"
echo "the following commands:"
echo
echo " make clean-release ARCH=x86"
@ -62,7 +28,7 @@ if [ -z "$ARCH" ] || [ $ERROR -ne 0 ]; then
echo "Note: make clean-release ARCH=... is only needed if you previously compiled as"
echo "non-portable."
echo
echo "3. Make the following files are included relative to the game client in the"
echo "2. Make the following files are included relative to the game client in the"
echo "downloads:"
echo
echo " ./lib/x86/libSDL2-2.0.so.0"
@ -85,46 +51,10 @@ if [ -z "$ARCH" ] || [ $ERROR -ne 0 ]; then
exit $ERROR
fi
if [ ! -d "$DIR/SDL-$SDLVERSION" ] ; then
echo "Downloading Spearmint SDL-$SDLVERSION builds into '$DIR'..."
SDL_LIBDIR="code/libs/linux-$ARCH"
# Download SDL2 libs and headers into $DIR.
if [ ! -f "$DIR/SDL-$SDLVERSION.tar.xz" ] ; then
# Yes, wget and curl use -o with different capitalization to set output filename.
if command -v wget >/dev/null 2>&1 ; then
wget -O "$DIR/SDL-$SDLVERSION.tar.xz" "http://clover.moe/downloads/spearmint-make-linux-portable-deps/SDL-$SDLVERSION.tar.xz"
ERROR=$?
elif command -v curl >/dev/null 2>&1 ; then
curl -o "$DIR/SDL-$SDLVERSION.tar.xz" "http://clover.moe/downloads/spearmint-make-linux-portable-deps/SDL-$SDLVERSION.tar.xz"
ERROR=$?
else
echo "Error: Need to install wget or curl to download Spearmint SDL2 builds."
exit 1
fi
if [ $ERROR -ne 0 ] ; then
echo "Error: Failed to download SDL-$SDLVERSION!"
exit 1
fi
fi
# Extract into $DIR/SDL-$SDLVERSION/.
tar xJf "$DIR/SDL-$SDLVERSION.tar.xz" -C "$DIR"
# Edit prefix in sdl2-config to point to the install directory.
sed -i -e "s|/home/zack/Local|$DIR|" "$DIR/SDL-$SDLVERSION/build-x86/bin/sdl2-config"
sed -i -e "s|/home/zack/Local|$DIR|" "$DIR/SDL-$SDLVERSION/build-x86_64/bin/sdl2-config"
fi
SDL_PREFIX="$DIR/SDL-$SDLVERSION/build-$ARCH"
if [ ! -d "$SDL_PREFIX" ] ; then
echo "Arch '$ARCH' not found in '$DIR/SDL-$SDLVERSION'"
exit 1
fi
SDL_CFLAGS=$("$SDL_PREFIX/bin/sdl2-config" --cflags)
SDL_LIBS=$("$SDL_PREFIX/bin/sdl2-config" --libs)
SDL_CFLAGS="-Icode/SDL2/include -D_REENTRANT"
SDL_LIBS="-L$SDL_LIBDIR -lSDL2"
# Don't pass arch ($1) to make in $*
shift 1
@ -140,8 +70,8 @@ fi
if [ ! -d build/release-linux-$ARCH/lib/$ARCH/ ] ; then
mkdir -p build/release-linux-$ARCH/lib/$ARCH/
fi
if [ ! -f build/release-linux-$ARCH/lib/$ARCH/libSDL2-2.0.so.0 ] || [ $(stat -c %Y build/release-linux-$ARCH/lib/$ARCH/libSDL2-2.0.so.0) != $(stat -c %Y "$SDL_PREFIX/lib/libSDL2-2.0.so.0") ] ; then
cp --preserve=timestamps "$SDL_PREFIX/lib/libSDL2-2.0.so.0" build/release-linux-$ARCH/lib/$ARCH/libSDL2-2.0.so.0
if [ ! -f build/release-linux-$ARCH/lib/$ARCH/libSDL2-2.0.so.0 ] || [ $(stat -c %Y build/release-linux-$ARCH/lib/$ARCH/libSDL2-2.0.so.0) != $(stat -c %Y "$SDL_LIBDIR/libSDL2-2.0.so.0") ] ; then
cp --preserve=timestamps "$SDL_LIBDIR/libSDL2-2.0.so.0" build/release-linux-$ARCH/lib/$ARCH/libSDL2-2.0.so.0
fi
# It's interesting to see why a glibc version is required.