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 ARCH=$1
ERROR=0 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 if [ -z "$ARCH" ] || [ $ERROR -ne 0 ]; then
echo "Usage: make-linux-portable.sh <arch> [make options]" echo "Usage: make-linux-portable.sh <arch> [make options]"
echo " arch can be x86 or x86_64" echo " arch can be x86 or x86_64"
@ -45,13 +17,7 @@ if [ -z "$ARCH" ] || [ $ERROR -ne 0 ]; then
echo echo
echo "DIRECTIONS" echo "DIRECTIONS"
echo echo
echo "1. Create a directory to store Spearmint SDL2 builds and create a file named" echo "1. To build the game clients (and download Spearmint SDL2 builds if needed) run"
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 "the following commands:" echo "the following commands:"
echo echo
echo " make clean-release ARCH=x86" 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 "Note: make clean-release ARCH=... is only needed if you previously compiled as"
echo "non-portable." echo "non-portable."
echo 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 "downloads:"
echo echo
echo " ./lib/x86/libSDL2-2.0.so.0" echo " ./lib/x86/libSDL2-2.0.so.0"
@ -85,46 +51,10 @@ if [ -z "$ARCH" ] || [ $ERROR -ne 0 ]; then
exit $ERROR exit $ERROR
fi fi
if [ ! -d "$DIR/SDL-$SDLVERSION" ] ; then SDL_LIBDIR="code/libs/linux-$ARCH"
echo "Downloading Spearmint SDL-$SDLVERSION builds into '$DIR'..."
# Download SDL2 libs and headers into $DIR. SDL_CFLAGS="-Icode/SDL2/include -D_REENTRANT"
if [ ! -f "$DIR/SDL-$SDLVERSION.tar.xz" ] ; then SDL_LIBS="-L$SDL_LIBDIR -lSDL2"
# 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)
# Don't pass arch ($1) to make in $* # Don't pass arch ($1) to make in $*
shift 1 shift 1
@ -140,8 +70,8 @@ fi
if [ ! -d build/release-linux-$ARCH/lib/$ARCH/ ] ; then if [ ! -d build/release-linux-$ARCH/lib/$ARCH/ ] ; then
mkdir -p build/release-linux-$ARCH/lib/$ARCH/ mkdir -p build/release-linux-$ARCH/lib/$ARCH/
fi 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 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_PREFIX/lib/libSDL2-2.0.so.0" build/release-linux-$ARCH/lib/$ARCH/libSDL2-2.0.so.0 cp --preserve=timestamps "$SDL_LIBDIR/libSDL2-2.0.so.0" build/release-linux-$ARCH/lib/$ARCH/libSDL2-2.0.so.0
fi fi
# It's interesting to see why a glibc version is required. # It's interesting to see why a glibc version is required.