Repository navigation
130 lines (119 loc) · 6.48 KB
/
Copy pathios.yml
File metadata and controls
130 lines (119 loc) · 6.48 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
name: iOS builds
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build for iOS arm64
runs-on: macos-26
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- uses: actions/checkout@v7
with:
submodules: true
# FFmpeg's libraries are cross-compiled with Kazarov's pinned LGPL configuration.
- name: Install the toolchain and libraries
run: |
brew install cmake ninja glslang
rustup toolchain install stable --profile minimal
rustup target add aarch64-apple-ios
tools/ci/prebuilt-deps.sh ios-arm64
# SDL3 is required by kazarov and is not shipped as an iOS framework by Homebrew,
# so cross-compile it for iOS arm64 into a local prefix the CMake configure can find.
- name: Build SDL3 for iOS arm64
run: |
curl -L https://github.com/libsdl-org/SDL/archive/refs/tags/release-3.4.0.tar.gz \
| tar xz -C "$RUNNER_TEMP"
cmake -S "$RUNNER_TEMP/SDL-release-3.4.0" -B "$RUNNER_TEMP/sdl-ios-build" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_SYSROOT=iphoneos \
-DCMAKE_OSX_DEPLOYMENT_TARGET=16.3 \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/sdl-ios" \
-DSDL_STATIC=ON \
-DSDL_SHARED=OFF \
-DSDL_TESTS=OFF \
-DSDL_EXAMPLES=OFF
cmake --build "$RUNNER_TEMP/sdl-ios-build" --config Release -j"$(sysctl -n hw.ncpu)"
cmake --install "$RUNNER_TEMP/sdl-ios-build" --config Release
echo "SDL3_PREFIX=$RUNNER_TEMP/sdl-ios" >> "$GITHUB_ENV"
# Homebrew's molten-vk is a macOS dylib; the iOS static library and its Vulkan headers come from the
# MoltenVK release.
- name: Fetch MoltenVK for iOS
run: |
curl -L https://github.com/KhronosGroup/MoltenVK/releases/download/v1.4.2/MoltenVK-ios.tar \
| tar x -C "$RUNNER_TEMP"
lib=$(find "$RUNNER_TEMP/MoltenVK" -path '*/static/MoltenVK.xcframework/ios-arm64/libMoltenVK.a' | head -n1)
header=$(find "$RUNNER_TEMP/MoltenVK" -path '*/include/vulkan/vulkan.h' | head -n1)
test -n "$lib" && test -n "$header"
echo "MOLTENVK_LIBRARY=$lib" >> "$GITHUB_ENV"
echo "VULKAN_INCLUDE_DIR=$(dirname "$(dirname "$header")")" >> "$GITHUB_ENV"
- name: Configure for iOS
run: |
cmake --preset ios-arm64-release \
-DSDL3_DIR="$SDL3_PREFIX/lib/cmake/SDL3" \
-DVulkan_INCLUDE_DIR="$VULKAN_INCLUDE_DIR" \
-DVulkan_LIBRARY="$MOLTENVK_LIBRARY" \
-DRust_CARGO_TARGET=aarch64-apple-ios \
-DCT_BUILD_TESTS=OFF
- name: Build for iOS
# Cargo's C builds (zstd, cxx, the movie muxer) otherwise target the SDK's own iOS version, not the app's.
# Only here: FFmpeg's configure would build its host tools for iOS too and could not run them.
env:
IPHONEOS_DEPLOYMENT_TARGET: "16.3"
# -k 0 reports every unit that fails, not only the first.
run: cmake --build port/build/ios-arm64-release --target darkchronicle -j"$(sysctl -n hw.ncpu)" -- -k 0
# The .ipa is unsigned: a sideloading tool (Sideloadly, AltStore) signs it with the installer's Apple ID.
# The button symbols and the gameplay seed (assets/data.zip) go inside the bundle, which is where the game
# looks beside its executable.
- name: Package the .ipa
run: |
build=port/build/ios-arm64-release
mkdir -p "$RUNNER_TEMP/ipa/Payload"
cp -R "$build/darkchronicle.app" "$RUNNER_TEMP/ipa/Payload/"
# The split debug symbols would double the download; they are no part of the app.
rm -rf "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/darkchronicle.dSYM"
cp -R "$build/glyphs" "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/"
# The Luau scripts the events run, which the game finds in scripts/ beside its executable.
cp -R "$build/scripts" "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/"
test -n "$(find "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/scripts" -name '*.luau' | head -n1)"
# Each one with its bytecode, so the device does not compile them (CT_LUAU_PRECOMPILE).
test -n "$(find "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/scripts" -name '*.luauc' | head -n1)"
mkdir -p "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/assets"
cp "$build/assets/data.zip" "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/assets/"
# The home screen icon, which SideStore and LiveContainer also show.
sips -z 120 120 port/assets/icon/chronicletwo-512.png --out "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/AppIcon60x60@2x.png"
sips -z 180 180 port/assets/icon/chronicletwo-512.png --out "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/AppIcon60x60@3x.png"
# A quick check of what sideloading and LiveContainer need: an arm64, position-independent executable.
file "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/darkchronicle"
otool -hv "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/darkchronicle" | grep -q PIE
otool -l "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/darkchronicle" | grep -A4 LC_BUILD_VERSION
# libc++ symbols newer than the minimum iOS kill the app in dyld before main. std::pmr (iOS 17) slipped in
# once, and iOS 16.3.1 has no floating-point std::to_chars although the headers say 16.3.
if nm -u "$RUNNER_TEMP/ipa/Payload/darkchronicle.app/darkchronicle" | grep -E '__ZNSt3__1(3pmr|8to_chars)'; then
echo "the executable imports libc++ symbols that iOS 16 lacks" >&2
exit 1
fi
(cd "$RUNNER_TEMP/ipa" && zip -qry "$GITHUB_WORKSPACE/DarkChronicle.ipa" Payload)
- name: Upload the .ipa
uses: actions/upload-artifact@v7
with:
name: DarkChronicle-ios-arm64
path: DarkChronicle.ipa
if-no-files-found: error
# The symbols stay out of the .ipa but are kept to read the addresses in a device's stack reports.
- name: Upload the debug symbols
uses: actions/upload-artifact@v7
with:
name: DarkChronicle-ios-arm64-dSYM
path: port/build/ios-arm64-release/darkchronicle.app/darkchronicle.dSYM
if-no-files-found: warn