2022-09-01 23:26:24 +02:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2023-09-21 01:50:55 +03:00
|
|
|
SDL2_VERSION=release-2.28.3
|
2022-12-02 11:40:55 +01:00
|
|
|
|
|
|
|
. scripts/sdk.sh
|
|
|
|
mkdir -p deps; cd deps
|
2022-09-01 23:26:24 +02:00
|
|
|
|
|
|
|
if [ ! -d SDL2-src ]; then
|
2023-08-11 13:35:54 +03:00
|
|
|
wget https://github.com/libsdl-org/SDL/archive/$SDL2_VERSION.tar.gz
|
|
|
|
tar -xzf $SDL2_VERSION.tar.gz
|
|
|
|
mv SDL-$SDL2_VERSION SDL2-src
|
|
|
|
rm $SDL2_VERSION.tar.gz
|
2022-09-25 12:10:27 +02:00
|
|
|
# Disable some features that are not needed
|
|
|
|
sed -i '' 's/#define SDL_AUDIO_DRIVER_COREAUDIO 1/#define SDL_AUDIO_DRIVER_COREAUDIO 0/g' SDL2-src/include/SDL_config_macosx.h
|
|
|
|
sed -i '' 's/#define SDL_AUDIO_DRIVER_DISK 1/#define SDL_AUDIO_DRIVER_DISK 0/g' SDL2-src/include/SDL_config_macosx.h
|
|
|
|
sed -i '' 's/#define SDL_AUDIO_DRIVER_DUMMY 1/#define SDL_AUDIO_DRIVER_DUMMY 0/g' SDL2-src/include/SDL_config_macosx.h
|
|
|
|
sed -i '' 's/#define SDL_PLATFORM_SUPPORTS_METAL 1/#define SDL_PLATFORM_SUPPORTS_METAL 0/g' SDL2-src/include/SDL_config_macosx.h
|
2022-09-01 23:26:24 +02:00
|
|
|
fi
|
|
|
|
|
2022-09-25 12:10:27 +02:00
|
|
|
rm -rf SDL2
|
|
|
|
|
2022-09-01 23:26:24 +02:00
|
|
|
cd SDL2-src
|
|
|
|
|
|
|
|
xcodebuild build \
|
|
|
|
ARCHS="$OSX_ARCHES" \
|
|
|
|
-project Xcode/SDL/SDL.xcodeproj \
|
|
|
|
-configuration Release \
|
|
|
|
-scheme "Static Library"
|
|
|
|
|
|
|
|
BUILD_FOLDER=$(xcodebuild \
|
|
|
|
-project Xcode/SDL/SDL.xcodeproj \
|
|
|
|
-configuration Release \
|
|
|
|
-scheme "Static Library" \
|
|
|
|
-showBuildSettings | \
|
|
|
|
grep TARGET_BUILD_DIR | sed -n -e 's/^.*TARGET_BUILD_DIR = //p')
|
|
|
|
|
|
|
|
mkdir -p ../SDL2
|
2022-11-13 17:35:33 +01:00
|
|
|
cp -v "${BUILD_FOLDER}/libSDL2.a" ../SDL2
|
|
|
|
cp -rv include ../SDL2
|
2022-09-01 23:26:24 +02:00
|
|
|
|
|
|
|
echo "SDL2 build successful"
|