forked from schismtracker/schismtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
253 lines (225 loc) · 11.4 KB
/
Copy pathmacos.yml
File metadata and controls
253 lines (225 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: Classic Mac OS (powerpc)
on:
push:
pull_request:
workflow_dispatch:
# This file uses the Retro68 toolchain to build
# a binary of Schism Tracker for the Classic Mac
# OS. I only care enough to build for powerpc,
# since 68k machines are way too slow for it to
# be even remotely usable. Regardless, I'm still
# putting powerpc files in their own folder in
# case someone really wants to build a 68k version
# of schism.
#
# There are quite a few hacks in here; for example
# xz isn't included in the docker image, so we have
# to make it ourselves, which is annoying. However,
# liblzma is. Unfortunately this means symbols are
# screwed up and we need to preload a newer liblzma.
jobs:
macos:
runs-on: ubuntu-latest
container:
image: ghcr.io/autc04/retro68
env:
SDL_VERSION: 1.2.15
SDL_SHA256: d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00
XZ_VERSION: 5.6.3
XZ_SHA256: b1d45295d3f71f25a4c9101bd7c8d16cb56348bbef3bbc738da0351e17c73317
FLAC_VERSION: 1.5.0
FLAC_SHA256: f2c1c76592a82ffff8413ba3c4a1299b6c7ab06c734dee03fd88630485c2b920
LIBOGG_VERSION: 1.3.6
LIBOGG_SHA256: 5c8253428e181840cd20d41f3ca16557a9cc04bad4a3d04cce84808677fa1061
UTF8PROC_VERSION: 2.10.0
UTF8PROC_SHA256: 276a37dc4d1dd24d7896826a579f4439d1e5fe33603add786bb083cab802e23e
steps:
- name: 'Retrieve runner temp directory'
id: temp
run: |
echo "temp=$RUNNER_TEMP" >> $GITHUB_OUTPUT
- name: 'Cache Universal Interfaces'
id: cache-universal-interfaces
uses: actions/cache@v4
with:
path: '${{ steps.temp.outputs.temp }}/InterfacesAndLibraries'
key: macos-cache-universal-interfaces
- name: 'Prepare Universal Interfaces'
if: steps.cache-universal-interfaces.outputs.cache-hit != 'true'
run: |
# make sure we have plenty of mirrors so we don't get bogus build fails
curl "https://staticky.com/mirrors/ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM_Images/MPW-GM.img.bin" > "$RUNNER_TEMP/MPW-GM.img.bin" \
|| curl "https://web.archive.org/web/20131006071819if_/https://staticky.com/mirrors/ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM_Images/MPW-GM.img.bin" > "$RUNNER_TEMP/MPW-GM.img.bin" \
|| curl "http://old.mac.gdn/apps/mpw-gm.img__0.bin" > "$RUNNER_TEMP/MPW-GM.img.bin" \
|| curl "ftp://mirror:mirror@ftp.macintosh.garden/apps/mpw-gm.img__0.bin" > "$RUNNER_TEMP/MPW-GM.img.bin"
/Retro68-build/bin/install-universal-interfaces.sh "$RUNNER_TEMP" "MPW-GM.img.bin"
- name: 'Link Universal Interfaces'
run: |
echo "Linking Universal interfaces..."
/Retro68-build/bin/interfaces-and-libraries.sh /Retro68-build/toolchain "$RUNNER_TEMP/InterfacesAndLibraries"
echo "done"
- name: 'Checkout'
uses: actions/checkout@v4
with:
path: schism
# FIXME store this in RUNNER_TEMP instead
- name: 'Cache XZ utils sources and binaries'
id: cache-xz
uses: actions/cache@v4
with:
path: xz-${{ env.XZ_VERSION }}
key: macos-cache-xz
- name: 'Downloads XZ utils sources'
if: steps.cache-xz.outputs.cache-hit != 'true'
run: |
curl -L -o "xz-$XZ_VERSION.tar.gz" "https://github.com/tukaani-project/xz/releases/download/v$XZ_VERSION/xz-$XZ_VERSION.tar.gz"
echo "$XZ_SHA256 xz-$XZ_VERSION.tar.gz" | shasum -a 256 -c -
tar xvf "xz-$XZ_VERSION.tar.gz"
- name: 'Build XZ utils'
if: steps.cache-xz.outputs.cache-hit != 'true'
run: |
cd "xz-$XZ_VERSION"
mkdir build
cd build
../configure
make
cd .. # build
cd .. # xz-$XZ_VERSION
- name: 'Install XZ utils'
run: |
cd "xz-$XZ_VERSION/build"
make install
cd ../.. # xz-$XZ_VERSION/build
- name: 'Install unar'
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
apt-get install -y unar
- name: 'Cache dependencies'
id: cache-ppc-dependencies
uses: actions/cache@v4
with:
path: '${{ steps.temp.outputs.temp }}/ppcprefix'
key: macos-cache-powerpc-flac_${{ env.FLAC_VERSION }}-libogg_${{ env.LIBOGG_VERSION }}-SDL_${{ env.SDL_VERSION }}-UTF8PROC_${{ env.UTF8PROC_VERSION }}
- name: 'Download SDL 1.2 sources (powerpc)'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
curl -L -o "SDL-$SDL_VERSION.tar.gz" "https://www.libsdl.org/release/SDL-$SDL_VERSION.tar.gz"
echo "$SDL_SHA256 SDL-$SDL_VERSION.tar.gz" | shasum -a 256 -c -
tar xvf "SDL-$SDL_VERSION.tar.gz"
cd "SDL-$SDL_VERSION"
patch -p1 < ../schism/.github/patches/SDL/2-configure-retro68.patch
patch -p1 < ../schism/.github/patches/SDL/3-fixup-main.patch
./autogen.sh
cd ..
- name: 'Download OpenGL SDK'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
curl -f "https://old.mac.gdn/apps/OpenGL_SDK_1.2.sit" > "OpenGL_SDK_1.2.sit" \
|| curl -f "ftp://macosix.retro-os.live/OS9%20Files/Deveopment%20Tools/OpenGL_SDK_1.2.sit" > "OpenGL_SDK_1.2.sit"
echo "5327d9253ca60f48d8f6e5d826f861ef463ba22c721539e17c8d4e89a7543216 OpenGL_SDK_1.2.sit" | shasum -a 256 -c -
unar -k hidden "OpenGL_SDK_1.2.sit"
mv "OpenGL SDK 1.2" "OpenGL_SDK_1.2"
mkdir GLLibs
cd OpenGL_SDK_1.2/Libraries
mkdir -p "$RUNNER_TEMP/ppcprefix/lib"
for i in OpenGL*Stub; do
MakeImport "$i" $RUNNER_TEMP/ppcprefix/lib/lib"${i%%Stub}".a
done
cd ../..
- name: 'Build SDL 1.2.15 (powerpc)'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
cd SDL-1.2.15
mkdir build_powerpc
cd build_powerpc
# XXX we could probably do --disable-file without too much trouble
../configure --host=powerpc-apple-macos --prefix="$RUNNER_TEMP/ppcprefix" --disable-joystick --disable-cdrom CPPFLAGS="-I$(pwd)/../../OpenGL_SDK_1.2/Headers"
make
make install
cd .. # build_powerpc
cd .. # SDL-1.2.15
- name: 'Download and prepare libogg sources'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
curl -L -o libogg-$LIBOGG_VERSION.tar.xz "https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-$LIBOGG_VERSION.tar.xz" || curl -L -o libogg-$LIBOGG_VERSION.tar.xz "https://github.com/xiph/ogg/releases/download/v$LIBOGG_VERSION/libogg-$LIBOGG_VERSION.tar.xz"
echo "$LIBOGG_SHA256 libogg-$LIBOGG_VERSION.tar.xz" | shasum -a 256 -c -
LD_PRELOAD=/usr/local/lib/liblzma.so.5 tar xvf "libogg-$LIBOGG_VERSION.tar.xz"
- name: 'Build libogg (powerpc)'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
cd libogg-$LIBOGG_VERSION
mkdir build_powerpc
cd build_powerpc
CPPFLAGS="-I$RUNNER_TEMP/ppcprefix/include" LDFLAGS="-L$RUNNER_TEMP/ppcprefix/lib" ../configure --host=powerpc-apple-macos --prefix="$RUNNER_TEMP/ppcprefix"
make
make install
cd .. # build_powerpc
cd .. # libogg-$LIBOGG_VERSION
- name: 'Download and prepare FLAC sources'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
curl -L -o flac-$FLAC_VERSION.tar.xz "https://ftp.osuosl.org/pub/xiph/releases/flac/flac-$FLAC_VERSION.tar.xz" || curl -L -o flac-$FLAC_VERSION.tar.xz "https://github.com/xiph/flac/releases/download/$FLAC_VERSION/flac-$FLAC_VERSION.tar.xz"
echo "$FLAC_SHA256 flac-$FLAC_VERSION.tar.xz" | shasum -a 256 -c -
LD_PRELOAD=/usr/local/lib/liblzma.so.5 tar xvf "flac-$FLAC_VERSION.tar.xz"
- name: 'Build FLAC (powerpc)'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
cd flac-$FLAC_VERSION
mkdir build_powerpc
cd build_powerpc
# hax: we need to patch out all calls to chmod, utimensat, and chown, because none of them
# exist under retro68, and additionally we don't use anything that's likely to need them
CPPFLAGS="-I$RUNNER_TEMP/ppcprefix/include" LDFLAGS="-L$RUNNER_TEMP/ppcprefix/lib" ../configure --host=powerpc-apple-macos --disable-programs --disable-examples --disable-cpplibs --prefix="$RUNNER_TEMP/ppcprefix"
make
make install
cd .. # build_powerpc
cd .. # flac-$FLAC_VERSION
- name: 'Download utf8proc'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
curl -L -o "utf8proc-$UTF8PROC_VERSION.tar.gz" "https://github.com/JuliaStrings/utf8proc/releases/download/v$UTF8PROC_VERSION/utf8proc-$UTF8PROC_VERSION.tar.gz"
echo "$UTF8PROC_SHA256 utf8proc-$UTF8PROC_VERSION.tar.gz" | shasum -a 256 -c -
tar xvf "utf8proc-$UTF8PROC_VERSION.tar.gz"
- name: 'Build utf8proc (powerpc)'
if: steps.cache-ppc-dependencies.outputs.cache-hit != 'true'
run: |
cd utf8proc-$UTF8PROC_VERSION
mkdir build_powerpc
cd build_powerpc
CMAKE_TOOLCHAIN_FILE=/Retro68-build/toolchain/powerpc-apple-macos/cmake/retroppc.toolchain.cmake cmake .. -DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/ppcprefix"
make
make install
cd .. # build_powerpc
cd .. # utf8proc-$UTF8PROC_VERSION
- name: 'Get date of latest commit'
id: date
run: |
cd schism
echo "date=$(git log -n 1 --date=short --format=format:%cd | sed 's/\(....\)-\(..\)-\(..\).*/\1\2\3/')" >> $GITHUB_OUTPUT
cd ..
- name: 'Build Schism (powerpc)'
run: |
cd schism
mkdir acinclude
curl -s "https://raw.githubusercontent.com/pkgconf/pkgconf/refs/tags/pkgconf-2.3.0/pkg.m4" -o "acinclude/pkg.m4"
autoreconf -Iacinclude -i
mkdir build_powerpc
cd build_powerpc
CPPFLAGS="-I$RUNNER_TEMP/ppcprefix/include" LDFLAGS="-L$RUNNER_TEMP/ppcprefix/lib" LIBS="-lOpenGLLibrary" UTF8PROC_CFLAGS="-I/Retro68-build/toolchain/powerpc-apple-macos/include" UTF8PROC_LIBS="-lutf8proc" FLAC_CFLAGS="-I$RUNNER_TEMP/ppcprefix/include" FLAC_LIBS="-L$RUNNER_TEMP/ppcprefix/lib -lFLAC -logg -lm" SDL12_CFLAGS="-I$RUNNER_TEMP/ppcprefix/include/SDL" SDL12_LIBS="-L$RUNNER_TEMP/ppcprefix/lib -lSDL" ../configure --with-sdl12 --enable-sdl12-linking --with-flac --enable-flac-linking --without-jack --without-sdl2 --disable-threads --host=powerpc-apple-macos --prefix="$RUNNER_TEMP/ppcprefix"
make schismtracker.bin RETRO68_ROOT="/Retro68-build/toolchain"
cd .. # build_powerpc
cd .. # schism
- name: 'Package Schism'
run: |
cp schism/build_powerpc/schismtracker.bin .
cp schism/docs/configuration.md .
cp schism/README.md schism/COPYING .
curl -s "https://raw.githubusercontent.com/xiph/flac/master/COPYING.Xiph" -o "COPYING.Xiph"
zip -r schismtracker.zip configuration.md COPYING COPYING.Xiph README.md schismtracker.bin
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: schismtracker-${{ steps.date.outputs.date }}-classic-macos
path: schismtracker.zip