1
0

42 lines
1.3 KiB
Bash
Raw Normal View History

2022-09-01 23:26:24 +02:00
#!/bin/bash -e
2023-06-27 01:48:52 +03:00
SDL2_VERSION=2.28.0
. scripts/sdk.sh
mkdir -p deps; cd deps
2022-09-01 23:26:24 +02:00
if [ ! -d SDL2-src ]; then
wget https://github.com/libsdl-org/SDL/archive/release-$SDL2_VERSION.tar.gz
tar -xzvf release-$SDL2_VERSION.tar.gz
mv SDL-release-$SDL2_VERSION SDL2-src
rm release-$SDL2_VERSION.tar.gz
# 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
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"