fix(ios): build releases with LÖVE 12

This commit is contained in:
Adrian Castro
2026-08-01 21:45:23 +02:00
parent be60c7c1d5
commit ea78792c03
5 changed files with 46 additions and 88 deletions
+1 -1
View File
@@ -1 +1 @@
11.5 12.0
+17 -38
View File
@@ -1,4 +1,4 @@
# iOS build (LÖVE 11.5) # iOS build (LÖVE 12.0)
> **Native ROM/mod/save import.** The iOS build ships a Swift > **Native ROM/mod/save import.** The iOS build ships a Swift
> document-picker bridge (`native/GRPickerBridge.swift` + `GRBootstrap.m`) > document-picker bridge (`native/GRPickerBridge.swift` + `GRBootstrap.m`)
@@ -20,20 +20,17 @@
> The note below about a missing "UIDocumentPicker handoff" is > The note below about a missing "UIDocumentPicker handoff" is
> resolved by this bridge. > resolved by this bridge.
macOS + Xcode only. Pins the official **LÖVE 11.5** iOS Xcode tree macOS + Xcode only. Fetches the **LÖVE 12.0** source tree and matching Apple
(`love-11.5-ios-source.zip` from [love2d/love releases](https://github.com/love2d/love/releases/tag/11.5)), dependencies from the official [LÖVE source](https://github.com/love2d/love)
matching `conf.lua`'s `t.version = "11.5"`. and [Apple dependencies](https://github.com/love2d/love-apple-dependencies)
repositories. `conf.lua` declares LÖVE 12.0 on iOS and 11.5 elsewhere.
There is no separate `love2d/love-ios` GitHub repo for 11.5; the release zip Pin file: [`LOVE_VERSION`](./LOVE_VERSION) → `12.0`.
**is** the vendored iOS project (Xcode project under
`love-src/platform/xcode/love.xcodeproj`, target `love-ios`).
Pin file: [`LOVE_VERSION`](./LOVE_VERSION) → `11.5`.
## Quick start (simulator) ## Quick start (simulator)
```bash ```bash
# Fetch LÖVE 11.5 iOS sources (once) + build for Simulator # Fetch LÖVE 12.0 iOS sources and dependencies (once) + build for Simulator
scripts/build_ios.sh --fetch scripts/build_ios.sh --fetch
``` ```
@@ -80,10 +77,10 @@ Manual out-of-band steps:
| Path | Role | | Path | Role |
|------|------| |------|------|
| `LOVE_VERSION` | Engine pin (`11.5`) | | `LOVE_VERSION` | Engine pin (`12.0`) |
| `overlays/love-ios.plist` | Portrait-only Info.plist + display name **Pokemon Red** (copied over the upstream plist every build) | | `overlays/love-ios.plist` | Portrait-only Info.plist + display name **Pokemon Red** (copied over the upstream plist every build) |
| `love-src/` | Downloaded `love-11.5-ios-source` tree (**gitignored**, do not commit) | | `love-src/` | Downloaded LÖVE 12.0 source tree (**gitignored**, do not commit) |
| `cache/` | Downloaded zips (**gitignored**) | | `cache/` | Temporary source and dependency checkout data (**gitignored**) |
| `build/` | `xcodebuild` derived data (**gitignored**) | | `build/` | `xcodebuild` derived data (**gitignored**) |
Game payload lands at: Game payload lands at:
@@ -94,28 +91,10 @@ and is fused into the built `.app` (LÖVE auto-runs any bundled `*.love`).
## Apple libraries dependency ## Apple libraries dependency
The official `love-11.5-ios-source.zip` already ships prebuilt iOS `scripts/build_ios.sh --fetch` retrieves the matching iOS libraries and the
xcframeworks under `platform/xcode/ios/libraries/` (SDL2, LuaJIT, freetype, SDL3 framework from
ogg, vorbis, theora, modplug). [love-apple-dependencies](https://github.com/love2d/love-apple-dependencies).
Re-run it if either dependency directory is absent.
If that folder is missing or incomplete (e.g. you cloned sources without
libs), download the matching prebuilts and install them:
```bash
curl -fL -o mobile/ios/cache/love-11.5-apple-libraries.zip \
https://github.com/love2d/love/releases/download/11.5/love-11.5-apple-libraries.zip
unzip -q mobile/ios/cache/love-11.5-apple-libraries.zip -d mobile/ios/cache
rm -rf mobile/ios/love-src/platform/xcode/ios/libraries
cp -R mobile/ios/cache/love-apple-dependencies/iOS/libraries \
mobile/ios/love-src/platform/xcode/ios/libraries
```
`scripts/build_ios.sh` checks for `libraries/SDL2.xcframework` and fails with
these instructions if it is absent.
Upstream also documents
[love-apple-dependencies](https://github.com/love2d/love-apple-dependencies)
as an alternate source of the same libraries.
## App identity ## App identity
@@ -134,7 +113,7 @@ so refreshing `love-src/` does not lose branding.
| Flag | Meaning | | Flag | Meaning |
|------|---------| |------|---------|
| *(default)* | Simulator, Debug, no signing | | *(default)* | Simulator, Debug, no signing |
| `--fetch` | Download/extract `love-11.5-ios-source.zip` if `love-src/` is missing | | `--fetch` | Fetch the LÖVE 12.0 source tree and Apple dependencies if `love-src/` is missing |
| `--device` | Build against `iphoneos` instead of `iphonesimulator` | | `--device` | Build against `iphoneos` instead of `iphonesimulator` |
| `--release` | `Release` configuration instead of `Debug` | | `--release` | `Release` configuration instead of `Debug` |
| `--package-only` | Zip `game.love` + apply plist overlay; skip `xcodebuild` | | `--package-only` | Zip `game.love` + apply plist overlay; skip `xcodebuild` |
@@ -147,5 +126,5 @@ Also: `scripts/build.sh ios` delegates here (`--release` is forwarded).
- iOS platform installed in Xcode (Settings → Platforms). `xcodebuild -showsdks` - iOS platform installed in Xcode (Settings → Platforms). `xcodebuild -showsdks`
should list `iphonesimulator` / `iphoneos`. A partial install can fail IB/xib should list `iphonesimulator` / `iphoneos`. A partial install can fail IB/xib
compiles with `iOS … Platform Not Installed` even when the SDK name appears. compiles with `iOS … Platform Not Installed` even when the SDK name appears.
- `love-src/` present (`--fetch` or manual unzip of `love-11.5-ios-source.zip`) - `love-src/` present (`--fetch`)
- iOS libraries under `love-src/platform/xcode/ios/libraries/` (see above) - iOS libraries under `love-src/platform/xcode/ios/libraries/` and SDL3 under `love-src/platform/xcode/shared/Frameworks/`
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Applies gen1recomp's iOS native-bridge patches to the fetched LÖVE 11.5 """Applies gen1recomp's iOS native-bridge patches to the fetched LÖVE 12.0
source tree (mobile/ios/love-src/). Idempotent AND re-appliable: the first source tree (mobile/ios/love-src/). Idempotent AND re-appliable: the first
run stashes a pristine `.orig` copy of every file it rewrites, and later run stashes a pristine `.orig` copy of every file it rewrites, and later
runs always start over from that copy — so editing the patch content here runs always start over from that copy — so editing the patch content here
+25 -47
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Packages the LÖVE2D Pokémon Red port into an iOS app via LÖVE 11.5's # Packages the LÖVE2D Pokémon Red port into an iOS app via LÖVE 12.0's
# official iOS Xcode project (love-11.5-ios-source.zip). # iOS Xcode project.
# #
# Usage: scripts/build_ios.sh [--fetch] [--device] [--release] [--install] # Usage: scripts/build_ios.sh [--fetch] [--device] [--release] [--install]
# [--version X.Y.Z] [--package-only] # [--version X.Y.Z] [--package-only]
@@ -12,13 +12,12 @@
# first connected iPhone/iPad (unlock it first) # first connected iPhone/iPad (unlock it first)
# --release Release configuration # --release Release configuration
# --version X.Y.Z stamp MARKETING_VERSION / CURRENT_PROJECT_VERSION # --version X.Y.Z stamp MARKETING_VERSION / CURRENT_PROJECT_VERSION
# --fetch Download love-11.5-ios-source.zip into mobile/ios/love-src/ # --fetch Fetch LÖVE 12.0 sources and Apple dependencies into mobile/ios/love-src/
# --package-only Zip game.love + apply plist overlay; skip xcodebuild # --package-only Zip game.love + apply plist overlay; skip xcodebuild
# #
# Prerequisites: # Prerequisites:
# - macOS + Xcode (xcodebuild) # - macOS + Xcode (xcodebuild)
# - mobile/ios/love-src/ (see --fetch / mobile/ios/README.md) # - mobile/ios/love-src/ (see --fetch / mobile/ios/README.md)
# - prebuilt iOS libraries under love-src/platform/xcode/ios/libraries/
# #
# Output: dist/ios/<Config>-<sdk>/gen1recomp.app (convenience copy) # Output: dist/ios/<Config>-<sdk>/gen1recomp.app (convenience copy)
# dist/ios/gen1recomp.ipa (device builds only) # dist/ios/gen1recomp.ipa (device builds only)
@@ -54,11 +53,11 @@ BUNDLE_ID="${GEN1_BUNDLE_ID:-com.theboisclub.gen1recomp}"
if [ -z "$BUNDLE_ID" ] && [ -f "$IOS_DIR/bundle_id.local" ]; then if [ -z "$BUNDLE_ID" ] && [ -f "$IOS_DIR/bundle_id.local" ]; then
BUNDLE_ID="$(tr -d '[:space:]' < "$IOS_DIR/bundle_id.local")" BUNDLE_ID="$(tr -d '[:space:]' < "$IOS_DIR/bundle_id.local")"
fi fi
LOVE_VERSION="$(tr -d '[:space:]' < "$IOS_DIR/LOVE_VERSION" 2>/dev/null || echo 11.5)" LOVE_VERSION="$(tr -d '[:space:]' < "$IOS_DIR/LOVE_VERSION" 2>/dev/null || echo 12.0)"
IOS_SOURCE_ZIP="love-${LOVE_VERSION}-ios-source.zip" LOVE_SOURCE_REF="${LOVE_SOURCE_REF:-main}"
APPLE_LIBS_ZIP="love-${LOVE_VERSION}-apple-libraries.zip" APPLE_DEPENDENCIES_REF="${APPLE_DEPENDENCIES_REF:-main}"
IOS_SOURCE_URL="https://github.com/love2d/love/releases/download/${LOVE_VERSION}/${IOS_SOURCE_ZIP}" LOVE_SOURCE_REPO="https://github.com/love2d/love.git"
APPLE_LIBS_URL="https://github.com/love2d/love/releases/download/${LOVE_VERSION}/${APPLE_LIBS_ZIP}" APPLE_DEPENDENCIES_REPO="https://github.com/love2d/love-apple-dependencies.git"
FETCH=false FETCH=false
DEVICE=false DEVICE=false
@@ -160,25 +159,19 @@ fi
# --------------------------------------------------------------- fetch love-src # --------------------------------------------------------------- fetch love-src
fetch_love_ios() { fetch_love_ios() {
mkdir -p "$CACHE" mkdir -p "$CACHE"
local zip_path="$CACHE/$IOS_SOURCE_ZIP"
if [ ! -f "$zip_path" ]; then
say "downloading $IOS_SOURCE_ZIP (LÖVE $LOVE_VERSION iOS sources)"
curl -fL --progress-bar "$IOS_SOURCE_URL" -o "$zip_path" \
|| fail "download failed: $IOS_SOURCE_URL"
else
say "using cached $zip_path"
fi
say "extracting into $LOVE_SRC"
rm -rf "$LOVE_SRC"
local tmp local tmp
tmp="$(mktemp -d "$CACHE/extract.XXXXXX")" tmp="$(mktemp -d "$CACHE/extract.XXXXXX")"
unzip -q "$zip_path" -d "$tmp" say "fetching LÖVE $LOVE_VERSION sources ($LOVE_SOURCE_REF)"
# Zip root is love-<version>-ios-source/ git clone --depth 1 --branch "$LOVE_SOURCE_REF" "$LOVE_SOURCE_REPO" "$tmp/love" \
local extracted || fail "failed to fetch LÖVE sources from $LOVE_SOURCE_REPO"
extracted="$(find "$tmp" -maxdepth 1 -mindepth 1 -type d ! -name '__MACOSX' | head -1)" say "fetching Apple dependencies ($APPLE_DEPENDENCIES_REF)"
[ -n "$extracted" ] || fail "unexpected layout inside $IOS_SOURCE_ZIP" git clone --depth 1 --branch "$APPLE_DEPENDENCIES_REF" "$APPLE_DEPENDENCIES_REPO" "$tmp/dependencies" \
mv "$extracted" "$LOVE_SRC" || fail "failed to fetch Apple dependencies from $APPLE_DEPENDENCIES_REPO"
rm -rf "$LOVE_SRC"
mv "$tmp/love" "$LOVE_SRC"
mkdir -p "$LIBS_DIR" "$XCODE_DIR/shared"
cp -R "$tmp/dependencies/iOS/libraries/." "$LIBS_DIR"
cp -R "$tmp/dependencies/shared/." "$XCODE_DIR/shared"
rm -rf "$tmp" rm -rf "$tmp"
say "love-src ready (LÖVE $LOVE_VERSION)" say "love-src ready (LÖVE $LOVE_VERSION)"
} }
@@ -188,18 +181,12 @@ if [ ! -d "$XCODE_DIR/love.xcodeproj" ]; then
fetch_love_ios fetch_love_ios
else else
fail "LÖVE $LOVE_VERSION iOS sources not found at mobile/ios/love-src/. fail "LÖVE $LOVE_VERSION iOS sources not found at mobile/ios/love-src/.
Fetch them (documented download of love-${LOVE_VERSION}-ios-source.zip): Fetch them:
scripts/build_ios.sh --fetch scripts/build_ios.sh --fetch
Or manually:
mkdir -p mobile/ios/cache
curl -fL -o mobile/ios/cache/$IOS_SOURCE_ZIP \\
$IOS_SOURCE_URL
unzip -q mobile/ios/cache/$IOS_SOURCE_ZIP -d mobile/ios/cache
mv mobile/ios/cache/love-${LOVE_VERSION}-ios-source mobile/ios/love-src
See mobile/ios/README.md." See mobile/ios/README.md."
fi fi
elif $FETCH; then elif $FETCH; then
say "love-src already present; skipping download (delete mobile/ios/love-src to refresh)" say "love-src already present; skipping fetch (delete mobile/ios/love-src to refresh)"
fi fi
[ -d "$XCODE_DIR/love.xcodeproj" ] \ [ -d "$XCODE_DIR/love.xcodeproj" ] \
@@ -207,25 +194,16 @@ fi
# --------------------------------------------------------------- apple libraries # --------------------------------------------------------------- apple libraries
require_ios_libraries() { require_ios_libraries() {
if [ -d "$LIBS_DIR/SDL2.xcframework" ]; then if [ -d "$LIBS_DIR/SDL2.xcframework" ] && [ -d "$XCODE_DIR/shared/Frameworks/SDL3.xcframework" ]; then
return 0 return 0
fi fi
fail "prebuilt iOS libraries missing at: fail "prebuilt iOS libraries missing at:
$LIBS_DIR $LIBS_DIR
love-ios expects SDL2.xcframework (and friends) there. and shared/Frameworks.
The official love-${LOVE_VERSION}-ios-source.zip normally includes them. Re-fetch the LÖVE $LOVE_VERSION source tree and its Apple dependencies:
If they are absent, install love-${LOVE_VERSION}-apple-libraries.zip:
mkdir -p mobile/ios/cache scripts/build_ios.sh --fetch"
curl -fL -o mobile/ios/cache/$APPLE_LIBS_ZIP \\
$APPLE_LIBS_URL
unzip -q mobile/ios/cache/$APPLE_LIBS_ZIP -d mobile/ios/cache
rm -rf mobile/ios/love-src/platform/xcode/ios/libraries
cp -R mobile/ios/cache/love-apple-dependencies/iOS/libraries \\
mobile/ios/love-src/platform/xcode/ios/libraries
See mobile/ios/README.md (Apple libraries dependency)."
} }
require_ios_libraries require_ios_libraries
+2 -1
View File
@@ -602,7 +602,8 @@ function Renderer:endFrame(zones, worldZones)
-- runs, so dialogs, menus and the HUD sit on top as usual. -- runs, so dialogs, menus and the HUD sit on top as usual.
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.setScissor(0, 0, ww, wh) love.graphics.setScissor(0, 0, ww, wh)
if love.system and love.system.getOS and love.system.getOS() == "iOS" then local loveMajor = love.getVersion()
if love.system and love.system.getOS and love.system.getOS() == "iOS" and loveMajor >= 12 then
love.graphics.draw(self.worldOverride, 0, wh, 0, 1 / dpiX, -1 / dpiY) love.graphics.draw(self.worldOverride, 0, wh, 0, 1 / dpiX, -1 / dpiY)
else else
love.graphics.draw(self.worldOverride, 0, 0, 0, 1 / dpiX, 1 / dpiY) love.graphics.draw(self.worldOverride, 0, 0, 0, 1 / dpiX, 1 / dpiY)