Skip to content

config: don't pointlessly copy the palette string #1

config: don't pointlessly copy the palette string

config: don't pointlessly copy the palette string #1

Workflow file for this run

name: OS X (powerpc/x86_64/arm64)
on:
push:
pull_request:
workflow_dispatch:
# The configure prefix for any given
# architecture is
# $HOME/{architecture}prefix
# while any specific files/binaries
# needed for that architecture, not
# necessarily related to autotools,
# should be stored in
# $HOME/{architecture}
# This is so that we don't screw
# up the global directories with
# files for many different
# architectures.
jobs:
osx:
runs-on: macos-12
env:
SDL_VERSION: 2.30.7
SDL_PPC_VERSION: 2.0.3
FLAC_VERSION: 1.4.3
LIBOGG_VERSION: 1.3.5
UTF8PROC_VERSION: 2.9.0
steps:
- name: 'Install dependencies'
run: |
brew install automake zip cmake wget
- name: 'Cache x86_64 files'
id: cache-x86_64-files
uses: actions/cache@v4
with:
path: '/Users/runner/x86_64'
key: mac-x86_64-files
- name: 'Cache arm64 files'
id: cache-arm64-files
uses: actions/cache@v4
with:
path: '/Users/runner/arm64'
key: mac-arm64-files
- name: 'Restore cached PowerPC files'
id: cache-powerpc-restore
uses: actions/cache/restore@v4
with:
path: 'schism-macppc-bins'
key: mac-powerpc-bins
- name: 'Download 10.9 SDK for x86_64'
if: steps.cache-x86_64-files.outputs.cache-hit != 'true'
run: |
mkdir -p "$HOME/x86_64"
pushd "$HOME/x86_64"
mkdir SDKs
cd SDKs
curl -L "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.9.sdk.tar.xz" | tar -xvf -
popd
- name: 'Download 11.0 SDK for arm64'
if: steps.cache-arm64-files.outputs.cache-hit != 'true'
run: |
mkdir -p "$HOME/arm64"
pushd "$HOME/arm64"
mkdir SDKs
cd SDKs
curl -L "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz" | tar -xvf -
popd
- name: 'Grab PowerPC cross compile binaries'
if: steps.cache-powerpc-restore.outputs.cache-hit != 'true'
run: |
wget -O schism-macppc-bins.zip "https://www.dropbox.com/scl/fi/trq99fq51p13nh8tajpwa/schism-macppc-bins.zip?rlkey=xemvhpmm1ci0dnseawmanr749&st=g4qteuny&dl=1"
unzip schism-macppc-bins.zip -d "schism-macppc-bins"
rm schism-macppc-bins.zip
- name: 'Save PowerPC files in cache'
id: cache-powerpc-save
uses: actions/cache/save@v4
with:
path: 'schism-macppc-bins'
key: ${{ steps.cache-powerpc-restore.outputs.cache-primary-key }}
- name: 'Install PowerPC cross compile binaries'
run: |
pushd schism-macppc-bins
mkdir "$HOME/ppc"
tar -xvf "Xcode3as.tar.gz" -C "$HOME/ppc"
tar -xvf "Xcode3gcc42.tar.gz" -C "$HOME/ppc"
tar -xvf "Xcode3ld.tar.gz" -C "$HOME/ppc"
tar -xvf "Xcode105SDK.tar.gz" -C "$HOME/ppc"
tar -xvf "OSX108INT.tar.gz" -C "$HOME/ppc"
mkdir "/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc"
cp "$HOME/ppc/usr/libexec/gcc/darwin/ppc/as" "/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc/as"
popd
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Get date of latest commit'
id: date
run: echo "date=$(git log -n 1 --date=short --format=format:%cd | sed 's/\(....\)-\(..\)-\(..\).*/\1\2\3/')" >> $GITHUB_OUTPUT
# Since Homebrew doesn't provide binaries for old versions, we have to compile our own:
- name: 'Download SDL2 sources'
run: |
(curl https://www.libsdl.org/release/SDL2-$SDL_VERSION.tar.gz || curl -L https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL2-$SDL_VERSION.tar.gz) | tar xvf -
(curl https://www.libsdl.org/release/SDL2-$SDL_PPC_VERSION.tar.gz || curl -L https://master.dl.sourceforge.net/project/libsdl/SDL/$SDL_PPC_VERSION/SDL2-$SDL_PPC_VERSION.tar.gz) | tar xvf -
- name: 'Patch SDL 2.0.3 for PowerPC building'
run: |
wget -O SDL2-2.0.3_OSX_105.patch "https://gist.github.com/miniupnp/a8f474c504eaa3ad9135/raw/7481973a1cd11b98ec01806e3729c9b96b5310a4/SDL2-2.0.3_OSX_105.patch"
patch -p0 < SDL2-2.0.3_OSX_105.patch
- name: 'Build SDL2'
run: |
(export PATH="$PATH:$HOME/ppc/usr/bin" && cd SDL2-$SDL_PPC_VERSION && mkdir build_powerpc && cd build_powerpc && ../configure CC=powerpc-apple-darwin10-gcc-4.2.1 CPP=powerpc-apple-darwin10-cpp-4.2.1 OBJC=powerpc-apple-darwin10-gcc-4.2.1 CXX=powerpc-apple-darwin10-g++-4.2.1 CFLAGS="-mcpu=G4" CPPFLAGS="-isysroot $HOME/ppc/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-F$HOME/ppc/SDKs/MacOSX10.5.sdk/System/Library/Frameworks -L/usr/lib -L/usr/lib/system -Wl,-syslibroot,$HOME/ppc/SDKs/MacOSX10.5.sdk" --host=powerpc-apple-darwin10 --prefix="$HOME/ppcprefix" --disable-rpath --disable-alsa-shared --disable-pulseaudio-shared --disable-x11-shared --disable-esd --disable-video-wayland --disable-alsa --disable-dbus --disable-nas --disable-pulseaudio --disable-video-x11 --disable-haptic --disable-rpath && make && make install) &
(export MACOSX_DEPLOYMENT_TARGET="10.9" && cd SDL2-$SDL_VERSION && mkdir build_x86_64 && cd build_x86_64 && ../configure CPPFLAGS="-mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.9.sdk" --prefix="$HOME/x86_64prefix" && make && make install) &
(export MACOSX_DEPLOYMENT_TARGET="11.0" && cd SDL2-$SDL_VERSION && mkdir build_arm64 && cd build_arm64 && ../configure CPPFLAGS="-mmacosx-version-min=11.0 -isysroot $HOME/arm64/SDKs/MacOSX11.0.sdk" CFLAGS="-arch arm64" LDFLAGS="-arch arm64" --host=aarch64-apple-darwin20 --prefix="$HOME/arm64prefix" && make && make install) &
wait
- name: 'Download libflac and libogg sources'
run: |
(curl https://ftp.osuosl.org/pub/xiph/releases/flac/flac-$FLAC_VERSION.tar.xz || curl -L https://github.com/xiph/flac/releases/download/$FLAC_VERSION/flac-$FLAC_VERSION.tar.xz) | tar xvf -
(curl https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-$LIBOGG_VERSION.tar.gz || curl -L https://github.com/xiph/ogg/releases/download/v$LIBOGG_VERSION/libogg-$LIBOGG_VERSION.tar.gz) | tar xvf -
- name: 'Build libogg'
run: |
pushd libogg-$LIBOGG_VERSION
# libogg's configure is too old
autoreconf -I"$HOME/x86_64prefix/share/aclocal" -i
(export PATH="$PATH:$HOME/ppc/usr/bin" && mkdir build_powerpc && cd build_powerpc && ../configure CC=powerpc-apple-darwin10-gcc-4.2.1 CPP=powerpc-apple-darwin10-cpp-4.2.1 OBJC=powerpc-apple-darwin10-gcc-4.2.1 CXX=powerpc-apple-darwin10-g++-4.2.1 CFLAGS="-mcpu=G4" CPPFLAGS="-isysroot $HOME/ppc/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-F$HOME/ppc/SDKs/MacOSX10.5.sdk/System/Library/Frameworks -L/usr/lib -L/usr/lib/system -Wl,-syslibroot,$HOME/ppc/SDKs/MacOSX10.5.sdk" --host=powerpc-apple-darwin10 --prefix="$HOME/ppcprefix" && make && make install) &
(export MACOSX_DEPLOYMENT_TARGET="10.9" && mkdir build_x86_64 && cd build_x86_64 && ../configure CPPFLAGS="-mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.9.sdk" --prefix="$HOME/x86_64prefix" && make && make install) &
(export MACOSX_DEPLOYMENT_TARGET="11.0" && mkdir build_arm64 && cd build_arm64 && ../configure CPPFLAGS="-mmacosx-version-min=11.0 -isysroot $HOME/arm64/SDKs/MacOSX11.0.sdk" CFLAGS="-arch arm64" LDFLAGS="-arch arm64" --host=aarch64-apple-darwin20 --prefix="$HOME/arm64prefix" && make && make install) &
wait
popd
- name: 'Build libflac'
run: |
pushd flac-$FLAC_VERSION
autoreconf -I"$HOME/x86_64prefix/share/aclocal" -i
(export PATH="$PATH:$HOME/ppc/usr/bin" && mkdir build_powerpc && cd build_powerpc && ../configure CC=powerpc-apple-darwin10-gcc-4.2.1 CPP=powerpc-apple-darwin10-cpp-4.2.1 OBJC=powerpc-apple-darwin10-gcc-4.2.1 CXX=powerpc-apple-darwin10-g++-4.2.1 CFLAGS="-mcpu=G4" CPPFLAGS="-isysroot $HOME/ppc/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-F$HOME/ppc/SDKs/MacOSX10.5.sdk/System/Library/Frameworks -L/usr/lib -L/usr/lib/system -Wl,-syslibroot,$HOME/ppc/SDKs/MacOSX10.5.sdk" --host=powerpc-apple-darwin10 --prefix="$HOME/ppcprefix" --disable-cpplibs --disable-programs --disable-examples && make && make install) &
(export MACOSX_DEPLOYMENT_TARGET="10.9" && mkdir build_x86_64 && cd build_x86_64 && ../configure CPPFLAGS="-mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.9.sdk" --prefix="$HOME/x86_64prefix" --disable-cpplibs --disable-programs --disable-examples && make && make install) &
(export MACOSX_DEPLOYMENT_TARGET="11.0" && mkdir build_arm64 && cd build_arm64 && ../configure CPPFLAGS="-mmacosx-version-min=11.0 -isysroot $HOME/arm64/SDKs/MacOSX11.0.sdk" CFLAGS="-arch arm64" LDFLAGS="-arch arm64" --host=aarch64-apple-darwin20 --prefix="$HOME/arm64prefix" --disable-cpplibs --disable-programs --disable-examples && make && make install) &
wait
popd
- name: 'Download utf8proc'
run: |
(curl -L https://github.com/JuliaStrings/utf8proc/releases/download/v$UTF8PROC_VERSION/utf8proc-$UTF8PROC_VERSION.tar.gz) | tar -xzvf -
- name: 'Build utf8proc'
run: |
export PATH="$HOME/llvm-mingw/bin:$PATH"
cd utf8proc-$UTF8PROC_VERSION
(export PATH="$PATH:$HOME/ppc/usr/bin" && mkdir build_powerpc && cd build_powerpc && CFLAGS="-mcpu=G4" LDFLAGS="-F$HOME/ppc/SDKs/MacOSX10.5.sdk/System/Library/Frameworks -L/usr/lib -L/usr/lib/system -Wl,-syslibroot,$HOME/ppc/SDKs/MacOSX10.5.sdk" cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="$HOME/ppcprefix" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.5" -DCMAKE_OSX_SYSROOT="$HOME/ppc/SDKs/MacOSX10.5.sdk" -DCMAKE_C_COMPILER="powerpc-apple-darwin10-gcc-4.2.1" -DCMAKE_SYSTEM_NAME="Darwin" -DBUILD_SHARED_LIBS=1 && make && make install) &
(export MACOSX_DEPLOYMENT_TARGET="10.9" && mkdir build_x86_64 && cd build_x86_64 && cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="$HOME/x86_64prefix" -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET="10.7" -DCMAKE_OSX_SYSROOT="$HOME/x86_64/SDKs/MacOSX10.9.sdk" -DBUILD_SHARED_LIBS=1 && make && make install) &
(export MACOSX_DEPLOYMENT_TARGET="11.0" && mkdir build_arm64 && cd build_arm64 && cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="$HOME/arm64prefix" -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" -DCMAKE_OSX_SYSROOT="$HOME/arm64/SDKs/MacOSX11.0.sdk" -DBUILD_SHARED_LIBS=1 && make && make install) &
wait
cd ../..
- name: 'Build Schism'
run: |
autoreconf -I"$HOME/x86_64prefix/share/aclocal" -i
rm "$HOME/ppc/SDKs/MacOSX10.5.sdk/usr/local/lib/libutf8proc.dylib" # hack
(export PATH="$PATH:$HOME/ppc/usr/bin" && export PKG_CONFIG_PATH="$HOME/ppcprefix/lib/pkgconfig" && mkdir build_powerpc && cd build_powerpc && ../configure CC=powerpc-apple-darwin10-gcc-4.2.1 CPP=powerpc-apple-darwin10-cpp-4.2.1 OBJC=powerpc-apple-darwin10-gcc-4.2.1 CXX=powerpc-apple-darwin10-g++-4.2.1 CFLAGS="-mcpu=G4" CPPFLAGS="-isysroot $HOME/ppc/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" LDFLAGS="-F$HOME/ppc/SDKs/MacOSX10.5.sdk/System/Library/Frameworks -L/usr/lib -L/usr/lib/system -Wl,-syslibroot,$HOME/ppc/SDKs/MacOSX10.5.sdk" --host=powerpc-apple-darwin10 --prefix="$HOME/ppcprefix" --with-sdl-prefix="$HOME/ppcprefix" --with-flac && make) &
(export MACOSX_DEPLOYMENT_TARGET="10.9" && export PKG_CONFIG_PATH="$HOME/x86_64prefix/lib/pkgconfig" && mkdir build_x86_64 && cd build_x86_64 && ../configure CPPFLAGS="-mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -isysroot $HOME/x86_64/SDKs/MacOSX10.9.sdk" --prefix="$HOME/x86_64prefix" --with-sdl-prefix="$HOME/x86_64prefix" --with-flac && make && strip -S schismtracker) &
(export MACOSX_DEPLOYMENT_TARGET="11.0" && export PKG_CONFIG_PATH="$HOME/arm64prefix/lib/pkgconfig" && mkdir build_arm64 && cd build_arm64 && ../configure CPPFLAGS="-mmacosx-version-min=11.0 -isysroot $HOME/arm64/SDKs/MacOSX11.0.sdk" OBJCFLAGS="-arch arm64" CFLAGS="-arch arm64" LDFLAGS="-arch arm64" --host=aarch64-apple-darwin20 --prefix="$HOME/arm64prefix" --with-sdl-prefix="$HOME/arm64prefix" && make && make install) &
wait
cd ../..
- name: 'Package Schism'
run: |
for i in SDL2-2.0.0 FLAC.12 ogg.0; do
"$HOME/ppc/usr/bin/install_name_tool" -change "$HOME/ppcprefix/lib/lib${i}.dylib" @executable_path/../Resources/lib${i}.dylib build_powerpc/schismtracker
install_name_tool -change "$HOME/x86_64prefix/lib/lib${i}.dylib" @executable_path/../Resources/lib${i}.dylib build_x86_64/schismtracker
install_name_tool -change "$HOME/arm64prefix/lib/lib${i}.dylib" @executable_path/../Resources/lib${i}.dylib build_arm64/schismtracker
done
"$HOME/ppc/usr/bin/install_name_tool" -change "@rpath/libutf8proc.3.dylib" @executable_path/../Resources/libutf8proc.3.dylib build_powerpc/schismtracker
install_name_tool -change "@rpath/libutf8proc.3.dylib" @executable_path/../Resources/libutf8proc.3.dylib build_x86_64/schismtracker
install_name_tool -change "@rpath/libutf8proc.3.dylib" @executable_path/../Resources/libutf8proc.3.dylib build_arm64/schismtracker
"$HOME/ppc/usr/bin/install_name_tool" -change "$HOME/ppcprefix/lib/libogg.0.dylib" @loader_path/../Resources/libogg.0.dylib "$HOME/ppcprefix/lib/libFLAC.12.dylib"
install_name_tool -change "$HOME/x86_64prefix/lib/libogg.0.dylib" @loader_path/../Resources/libogg.0.dylib "$HOME/x86_64prefix/lib/libFLAC.12.dylib"
install_name_tool -change "$HOME/arm64prefix/lib/libogg.0.dylib" @loader_path/../Resources/libogg.0.dylib "$HOME/arm64prefix/lib/libFLAC.12.dylib"
lipo -create -o schismtracker build_powerpc/schismtracker build_x86_64/schismtracker build_arm64/schismtracker
cd sys/macosx/Schism_Tracker.app/Contents/
sed -i .bak "s;<string>CFBundle.*Version.*</string>;<string>$(date +%Y%m%d)</string>;" Info.plist
rm Info.plist.bak
mkdir MacOS
cp ../../../../schismtracker MacOS
for i in SDL2-2.0.0 FLAC.12 ogg.0 utf8proc.3; do
lipo -create -o "Resources/lib${i}.dylib" "$HOME/x86_64prefix/lib/lib${i}.dylib" "$HOME/ppcprefix/lib/lib${i}.dylib" "$HOME/arm64prefix/lib/lib${i}.dylib"
done
cd MacOS
cd ../../../../..
cp -r sys/macosx/Schism_Tracker.app Schism\ Tracker.app
cp docs/configuration.md .
wget https://raw.githubusercontent.com/xiph/flac/master/COPYING.Xiph
zip -r schismtracker.zip configuration.md COPYING COPYING.Xiph README.md Schism\ Tracker.app
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: schismtracker-${{ steps.date.outputs.date }}-macos
path: schismtracker.zip