Update SDL #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: apple | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: {} | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
fail-fast: true | |
matrix: | |
platform: [iPhoneOS, iPhoneSimulator, AppleTVOS, AppleTVSimulator, MacOSX] | |
arch: [arm64, x86_64] | |
exclude: | |
- platform: iPhoneOS | |
arch: x86_64 | |
- platform: AppleTVOS | |
arch: x86_64 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
submodules: true | |
- name: Restore timestamps | |
run: | | |
cd src | |
for dir in * | |
do | |
cd $dir | |
timestamp=$(git log --date=local --pretty=format:"%cd" --date=format:'%Y%m%d%H%M.%S' . | head -1) | |
find . -exec touch -t $timestamp {} + | |
cd .. | |
done | |
- id: sysroot | |
uses: ASzc/change-string-case-action@v5 | |
with: | |
string: ${{ matrix.platform }} | |
- name: Configure shared build for MacOSX | |
if: ${{ matrix.platform == 'MacOSX' }} | |
run: | | |
echo "shared=ON" >> $GITHUB_ENV | |
echo "static=OFF" >> $GITHUB_ENV | |
- name: Configure static build for non-MacOSX | |
if: ${{ matrix.platform != 'MacOSX' }} | |
run: | | |
echo "shared=OFF" >> $GITHUB_ENV | |
echo "static=ON" >> $GITHUB_ENV | |
- name: Download cctools | |
run: | | |
cd /opt | |
wget https://github.com/supertuxkart/dependencies/releases/download/cctools/cctools-14.1.tar.xz | |
tar xf cctools-14.1.tar.xz | |
rm cctools-14.1.tar.xz | |
- name: Build zlib | |
run: | | |
cd src/zlib | |
# zlib cmake will change the public header, install it first | |
mkdir -p $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include | |
mkdir -p $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
cp -p zconf.h zlib.h $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} | |
../../../build_tools/fix_rpath.py $(pwd) | |
make -j5 | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a libz*dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
else | |
cp -a libz.a $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
- name: Build Mbed TLS | |
run: | | |
cd src/mbedtls | |
# Remove empty paragraph passed to '\retval' error | |
sed -i 's/set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")//g' CMakeLists.txt | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF \ | |
-DUSE_SHARED_MBEDTLS_LIBRARY=${{ env.shared }} -DUSE_STATIC_MBEDTLS_LIBRARY=${{ env.static }} | |
../../../build_tools/fix_rpath.py $(pwd)/library | |
make -j5 | |
make install | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
# New CMake no longer specify @rpath when install, copy manually | |
cp -a library/libmbed*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
# Fix dylib permission | |
chmod 755 $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/libmbed*dylib || true | |
fi | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/cmake | |
- name: Build cURL | |
run: | | |
# Disable bundled zlib | |
cd src/curl | |
mkdir build | |
cd build | |
# Fix old Mac without HAVE_CLOCK_GETTIME_MONOTONIC | |
if [ ${{ matrix.platform }} = "MacOSX" ] && [ ${{ matrix.arch }} = "x86_64" ]; then | |
wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.9.sdk.tar.xz | |
tar xf MacOSX10.9.sdk.tar.xz | |
extra_flags="-isysroot $(pwd)/MacOSX10.9.sdk" | |
fi | |
# -DCURL_CA_BUNDLE=none -DCURL_CA_PATH=none because STK includes its own | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DBUILD_TESTING=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=${{ env.shared }} \ | |
-DCURL_USE_MBEDTLS=ON -DUSE_ZLIB=ON \ | |
-DCURL_USE_OPENSSL=OFF -DCURL_USE_LIBSSH=OFF -DCURL_USE_LIBSSH2=OFF \ | |
-DCURL_USE_GSSAPI=OFF -DUSE_NGHTTP2=OFF -DUSE_QUICHE=OFF \ | |
-DHTTP_ONLY=ON -DCURL_CA_BUNDLE=none -DCURL_CA_PATH=none \ | |
-DCMAKE_C_FLAGS="$extra_flags" -DCMAKE_CXX_FLAGS="$extra_flags" | |
../../../build_tools/fix_rpath.py $(pwd)/lib | |
make -j5 | |
make install | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a lib/libcurl.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/bin | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/cmake | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig | |
- name: Build libpng | |
run: | | |
cd src/libpng | |
mkdir build | |
cd build | |
# -DPNG_ARM_NEON=off is required for successful compilation of aarch64 | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DPNG_SHARED=${{ env.shared }} -DPNG_STATIC=${{ env.static }} -DPNG_TESTS=OFF -DPNG_ARM_NEON=off | |
../../../build_tools/fix_rpath.py $(pwd) | |
make -j5 | |
make install | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a libpng*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/bin | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/libpng | |
rm -f $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/libpng.a | |
touch -r ../README $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/png* | |
touch -r ../README $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/libpng16/* | |
- name: Build FreeType bootstrap | |
run: | | |
cd src/freetype | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DFT_WITH_ZLIB=ON -DFT_WITH_BZIP2=OFF -DFT_WITH_BROTLI=OFF \ | |
-DFT_WITH_PNG=ON -DFT_WITH_HARFBUZZ=OFF -DBUILD_SHARED_LIBS=${{ env.shared }} \ | |
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE | |
../../../build_tools/fix_rpath.py $(pwd) | |
make -j5 | |
make install | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a libfreetype.*dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/cmake | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig | |
touch -r ../README $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/freetype2/freetype/config/* | |
- name: Build HarfBuzz | |
run: | | |
cd src/harfbuzz | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DHB_HAVE_CORETEXT=OFF -DHB_HAVE_FREETYPE=ON -DBUILD_SHARED_LIBS=${{ env.shared }} \ | |
-DHB_BUILD_SUBSET=OFF | |
../../../build_tools/fix_rpath.py $(pwd) | |
make -j5 | |
make install | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a libharfbuzz*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/cmake | |
- name: Build FreeType | |
run: | | |
# Circular dependency of freetype crashes gatekeeper on MacOSX (stack overflowed) | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
exit 0 | |
fi | |
cd src/freetype | |
git reset --hard | |
rm -rf build | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DFT_WITH_ZLIB=ON -DFT_WITH_BZIP2=OFF -DFT_WITH_BROTLI=OFF \ | |
-DFT_WITH_PNG=ON -DFT_WITH_HARFBUZZ=ON -DBUILD_SHARED_LIBS=${{ env.shared }} \ | |
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE | |
../../../build_tools/fix_rpath.py $(pwd) | |
make -j5 | |
# Don't make install again as the timestamp will be overwritten after git reset --hard | |
cp -a libfreetype.*dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib || true | |
cp libfreetype.a $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib || true | |
- name: Build Ogg | |
run: | | |
cd src/libogg | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DBUILD_SHARED_LIBS=${{ env.shared }} -DBUILD_TESTING=OFF -DINSTALL_DOCS=OFF \ | |
-DINSTALL_PKG_CONFIG_MODULE=OFF -DINSTALL_CMAKE_PACKAGE_MODULE=OFF | |
../../../build_tools/fix_rpath.py $(pwd) | |
make -j5 | |
make install | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a libogg*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
touch -r ../README.md $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/ogg/* | |
- name: Build Vorbis | |
run: | | |
cd src/libvorbis | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DBUILD_SHARED_LIBS=${{ env.shared }} -DINSTALL_CMAKE_PACKAGE_MODULE=OFF | |
../../../build_tools/fix_rpath.py $(pwd)/lib | |
make -j5 | |
make install | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a lib/libvorbis*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig | |
- name: Build libjpeg-turbo | |
run: | | |
# As jpeg is not performance crticial enough for STK so it's built with asm disabled for non-MacOSX | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
sudo apt install -y yasm | |
fi | |
cd src/libjpeg | |
mkdir build | |
cd build | |
# libjpeg install library to lib64 folder, override it | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DENABLE_SHARED=${{ env.shared }} -DENABLE_STATIC=${{ env.static }} -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib \ | |
-DCMAKE_SKIP_INSTALL_RPATH=ON | |
make -j5 | |
make install | |
touch -r ../jerror.h $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/jconfig.h | |
rm -r $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/bin | |
- name: Build libsamplerate | |
run: | | |
cd src/libsamplerate | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DLIBSAMPLERATE_EXAMPLES=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=${{ env.shared }} | |
../../../build_tools/fix_rpath.py $(pwd)/src | |
make -j5 | |
make install | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a src/libsamplerate*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig | |
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/cmake | |
- name: Build astc-encoder | |
run: | | |
cd src/astc-encoder | |
sed -i '/-Werror/d' Source/cmake_core.cmake | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
sed -i 's|${ASTCENC_TARGET}-shared|astcenc|g' Source/cmake_core.cmake | |
else | |
sed -i 's|${ASTCENC_TARGET}-static|astcenc|g' Source/cmake_core.cmake | |
fi | |
mkdir build | |
cd build | |
# We require SSE4.1 (x86_64) or NEON (arm*) for astc-encoder | |
if [ ${{ matrix.arch }} = "x86_64" ]; then | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} \ | |
-DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DASTCENC_ISA_SSE41=ON -DASTCENC_INVARIANCE=OFF -DASTCENC_CLI=OFF \ | |
-DASTCENC_UNIVERSAL_BUILD=OFF -DASTCENC_SHAREDLIB=ON \ | |
-DCMAKE_C_FLAGS='-O3' -DCMAKE_CXX_FLAGS='-O3' | |
else | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} \ | |
-DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DASTCENC_ISA_NEON=ON -DASTCENC_INVARIANCE=OFF -DASTCENC_CLI=OFF \ | |
-DASTCENC_UNIVERSAL_BUILD=OFF -DASTCENC_SHAREDLIB=ON \ | |
-DCMAKE_C_FLAGS='-O3' -DCMAKE_CXX_FLAGS='-O3' | |
fi | |
make -j5 | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
/opt/cctools/bin/x86_64-apple-darwin11-install_name_tool -id @rpath/libastcenc.dylib Source/libastcenc.dylib | |
cp -a Source/libastcenc.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
else | |
cp -a Source/libastcenc.a $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
cp -p ../Source/astcenc.h $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include | |
- name: Build shaderc | |
run: | | |
cd src/shaderc | |
utils/git-sync-deps | |
curl https://github.com/supertuxkart/stk-code/commit/9ea2f3ff8cd8dea1c1a6d07a9a4a842848b901e6.diff | patch -p3 | |
mkdir build | |
cd build | |
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \ | |
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \ | |
-DCMAKE_BUILD_TYPE=Release -DSHADERC_SKIP_INSTALL=1 \ | |
-DSHADERC_SKIP_TESTS=1 -DSHADERC_SKIP_EXAMPLES=1 \ | |
-DSPIRV_HEADERS_SKIP_INSTALL=1 -DSPIRV_HEADERS_SKIP_EXAMPLES=1 \ | |
-DSKIP_SPIRV_TOOLS_INSTALL=1 -DSPIRV_SKIP_TESTS=1 \ | |
-DSPIRV_SKIP_EXECUTABLES=1 -DENABLE_GLSLANG_BINARIES=0 \ | |
-DENABLE_CTEST=0 | |
sed -i "s#install_name $(pwd)/libshaderc#install_name @rpath#g" libshaderc/CMakeFiles/shaderc_shared.dir/link.txt | |
make -j4 | |
../../../build_tools/fix_rpath.py $(pwd)/libshaderc | |
if [ ${{ matrix.platform }} = "MacOSX" ]; then | |
cp -a libshaderc/libshaderc*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
else | |
cp -a libshaderc/libshaderc_combined.a $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib | |
fi | |
cp -ra ../libshaderc/include/shaderc $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include | |
- name: Prepare upload | |
run: | | |
mv $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} . | |
rm -rf dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/share | |
mkdir build | |
tar -cJf build/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}.tar.xz dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} | |
- name: Copy SDL2 | |
if: ${{ matrix.platform == 'iPhoneSimulator' && matrix.arch == 'arm64' }} | |
run: | | |
tar -cJf build/sdl.tar.xz src/sdl2 | |
- name: Upload dependencies | |
uses: actions/[email protected] | |
with: | |
name: build | |
path: build/* | |
packaging: | |
name: Packaging dependencies | |
needs: build | |
runs-on: macos-12 | |
steps: | |
- uses: maxim-lobanov/[email protected] | |
with: | |
xcode-version: latest-stable | |
- name: Configure packaging name for git master branch | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: | | |
echo "release_name=preview" >> $GITHUB_ENV | |
- name: Configure packaging name for tag | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV | |
- name: Exit otherwise | |
if: ${{ !(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) || | |
github.repository_owner != 'supertuxkart' }} | |
run: exit 1 | |
- name: Check for prerelease | |
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }} | |
run: | | |
echo "release_pre=true" >> $GITHUB_ENV | |
- name: Check for non-prerelease | |
if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }} | |
run: | | |
echo "release_pre=false" >> $GITHUB_ENV | |
- name: Download dependencies | |
uses: actions/download-artifact@v2 | |
- name: lipo -create libraries | |
run: | | |
tar xf build/dependencies-iphoneos-arm64.tar.xz | |
tar xf build/dependencies-iphonesimulator-x86_64.tar.xz | |
tar xf build/dependencies-iphonesimulator-arm64.tar.xz | |
tar xf build/dependencies-appletvos-arm64.tar.xz | |
tar xf build/dependencies-appletvsimulator-x86_64.tar.xz | |
tar xf build/dependencies-appletvsimulator-arm64.tar.xz | |
tar xf build/dependencies-macosx-x86_64.tar.xz | |
tar xf build/dependencies-macosx-arm64.tar.xz | |
mkdir -p dependencies-macosx/lib | |
mv dependencies-macosx-x86_64/include dependencies-macosx | |
cd dependencies-macosx/lib | |
for f in ../../dependencies-macosx-x86_64/lib/*.dylib; do | |
file=$(basename $f) | |
if [ -L $f ]; then | |
cp -a ../../dependencies-macosx-x86_64/lib/$file . | |
continue | |
fi | |
lipo -create ../../dependencies-macosx-x86_64/lib/$file ../../dependencies-macosx-arm64/lib/$file -output $file | |
done | |
cd ../.. | |
for simulator in iphonesimulator appletvsimulator; do | |
mkdir -p dependencies-$simulator/lib | |
mv dependencies-$simulator-x86_64/include dependencies-$simulator | |
cd dependencies-$simulator/lib | |
for f in ../../dependencies-$simulator-x86_64/lib/*.a; do | |
file=$(basename $f) | |
lipo -create ../../dependencies-$simulator-x86_64/lib/$file ../../dependencies-$simulator-arm64/lib/$file -output $file | |
done | |
cd ../.. | |
done | |
# Only single arch for iphoneos and appletvos | |
mv dependencies-iphoneos-arm64 dependencies-iphoneos | |
mv dependencies-appletvos-arm64 dependencies-appletvos | |
- name: Build SDL2 | |
run: | | |
tar xf build/sdl.tar.xz | |
cd src/sdl2/Xcode/SDL | |
xcodebuild -project SDL.xcodeproj -target "Shared Library" -configuration Release -sdk macosx CONFIGURATION_BUILD_DIR=./build-macosx | |
cp -a build-macosx/libSDL2.dylib ../../../../dependencies-macosx/lib | |
cp -rp ../../include ../../../../dependencies-macosx/include/SDL2 | |
xcodebuild -project SDL.xcodeproj -target "Static Library-iOS" -configuration Release -sdk iphoneos CONFIGURATION_BUILD_DIR=./build-iphoneos OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs -Wno-unused-command-line-argument" | |
cp build-iphoneos/libSDL2.a ../../../../dependencies-iphoneos/lib | |
cp -rp ../../include ../../../../dependencies-iphoneos/include/SDL2 | |
xcodebuild -project SDL.xcodeproj -target "Static Library-iOS" -configuration Release -sdk iphonesimulator CONFIGURATION_BUILD_DIR=./build-iphonesimulator OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs -Wno-unused-command-line-argument" | |
cp build-iphonesimulator/libSDL2.a ../../../../dependencies-iphonesimulator/lib | |
cp -rp ../../include ../../../../dependencies-iphonesimulator/include/SDL2 | |
xcodebuild -project SDL.xcodeproj -target "Static Library-tvOS" -configuration Release -sdk appletvos CONFIGURATION_BUILD_DIR=./build-appletvos OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs -Wno-unused-command-line-argument" | |
cp build-appletvos/libSDL2.a ../../../../dependencies-appletvos/lib | |
cp -rp ../../include ../../../../dependencies-appletvos/include/SDL2 | |
xcodebuild -project SDL.xcodeproj -target "Static Library-tvOS" -configuration Release -sdk appletvsimulator CONFIGURATION_BUILD_DIR=./build-appletvsimulator OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs -Wno-unused-command-line-argument" | |
cp build-appletvsimulator/libSDL2.a ../../../../dependencies-appletvsimulator/lib | |
cp -rp ../../include ../../../../dependencies-appletvsimulator/include/SDL2 | |
- name: Add MoltenVK | |
run: | | |
wget https://github.com/supertuxkart/dependencies/releases/download/moltenvk/moltenvk-1.2.4.tar.xz | |
mkdir moltenvk | |
tar xf moltenvk-1.2.4.tar.xz -C moltenvk | |
for platform in macosx iphoneos iphonesimulator appletvos appletvsimulator; do | |
cp -rp moltenvk/include/MoltenVK dependencies-$platform/include | |
cp -rp moltenvk/include/vk_video dependencies-$platform/include | |
cp -rp moltenvk/include/vulkan dependencies-$platform/include | |
done | |
cp moltenvk/dylib/macOS/libMoltenVK.dylib dependencies-macosx/lib | |
cp moltenvk/MoltenVK.xcframework/ios-arm64/libMoltenVK.a dependencies-iphoneos/lib | |
cp moltenvk/MoltenVK.xcframework/ios-arm64_x86_64-simulator/libMoltenVK.a dependencies-iphonesimulator/lib | |
cp moltenvk/MoltenVK.xcframework/tvos-arm64_arm64e/libMoltenVK.a dependencies-appletvos/lib | |
cp moltenvk/MoltenVK.xcframework/tvos-arm64_x86_64-simulator/libMoltenVK.a dependencies-appletvsimulator/lib | |
- name: Archive | |
run: | | |
tar -cJf dependencies-macosx.tar.xz dependencies-macosx | |
tar -cJf dependencies-iphoneos.tar.xz dependencies-iphoneos | |
tar -cJf dependencies-iphonesimulator.tar.xz dependencies-iphonesimulator | |
tar -cJf dependencies-appletvos.tar.xz dependencies-appletvos | |
tar -cJf dependencies-appletvsimulator.tar.xz dependencies-appletvsimulator | |
- name: Upload Apple dependencies | |
uses: ncipollo/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: "dependencies*.xz" | |
tag: ${{ env.release_name }} | |
omitBodyDuringUpdate: true | |
omitNameDuringUpdate: true | |
allowUpdates: true | |
prerelease: ${{ env.release_pre }} |