Yokan / rebuild
Course 1 8624561

build-ios-unsigned-ipa.sh

scripts/build-ios-unsigned-ipa.sh

configuration / resource79 lines
1#!/bin/sh2# Build an unsigned iOS .ipa for sideloading (AltStore/SideStore re-sign on install).3# Used by the GitHub and Forgejo release workflows and by Codemagic.4#5# Usage:6#   scripts/build-ios-unsigned-ipa.sh7#8# Environment:9#   YOKAN_SIDELOAD_RUNTIME  YES (default) embeds the signed Java 21 runtime and10#                           M-Extension-Server via iosApp/PrepareExtensionRuntime.sh;11#                           NO builds without the embedded extension runtime.12#   CONFIGURATION           Xcode configuration, default Release.13#   YOKAN_VERSION           Release version/tag; defaults to version.xcconfig.14#   YOKAN_VERSION_CODE      Optional positive platform build number override.15set -eu1617SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"18REPO_ROOT="$SCRIPT_DIR/.."19. "$SCRIPT_DIR/yokan-version.sh"20CONFIGURATION="${CONFIGURATION:-Release}"21SIDELOAD="${YOKAN_SIDELOAD_RUNTIME:-YES}"22case "$SIDELOAD" in23    YES) SIDELOAD_ENABLED=1 ;;24    NO) SIDELOAD_ENABLED=0 ;;25    *) echo "error: YOKAN_SIDELOAD_RUNTIME must be YES or NO" >&2; exit 2 ;;26esac27DERIVED_DATA="$REPO_ROOT/build/ios-ipa/DerivedData"28OUTPUT_DIR="$REPO_ROOT/build/ios-ipa/dist"29PRODUCTS_DIR="$DERIVED_DATA/Build/Products/$CONFIGURATION-iphoneos"3031echo "==> Building unsigned $CONFIGURATION iosApp (sideload runtime: $SIDELOAD)"32xcodebuild \33    -project "$REPO_ROOT/iosApp/iosApp.xcodeproj" \34    -scheme iosApp \35    -configuration "$CONFIGURATION" \36    -destination 'generic/platform=iOS' \37    -derivedDataPath "$DERIVED_DATA" \38    YOKAN_SIDELOAD_RUNTIME="$SIDELOAD" \39    YOKAN_SIDELOAD_RUNTIME_ENABLED="$SIDELOAD_ENABLED" \40    YOKAN_VERSION="$YOKAN_VERSION" \41    MARKETING_VERSION="$YOKAN_VERSION" \42    CURRENT_PROJECT_VERSION="$YOKAN_VERSION_CODE" \43    CODE_SIGNING_ALLOWED=NO \44    CODE_SIGNING_REQUIRED=NO \45    CODE_SIGN_IDENTITY="" \46    build4748APP_PATH="$(/bin/ls -d "$PRODUCTS_DIR"/*.app 2>/dev/null | head -n 1 || true)"49if [ -z "$APP_PATH" ]; then50    echo "error: no .app produced under $PRODUCTS_DIR" >&251    exit 152fi5354if [ "$SIDELOAD" = "YES" ]; then55    for required in \56        "$APP_PATH/Frameworks/OpenJDKRuntime.framework/OpenJDKRuntime" \57        "$APP_PATH/MExtensionServer.jar"58    do59        if [ ! -e "$required" ]; then60            echo "error: sideload runtime asset missing from app bundle: $required" >&261            exit 162        fi63    done64fi6566VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP_PATH/Info.plist" 2>/dev/null || echo dev)"67TAG="v$VERSION"68IPA_PATH="$OUTPUT_DIR/Yokan-$TAG-ios-unsigned.ipa"6970echo "==> Packaging $IPA_PATH"71STAGE_DIR="$REPO_ROOT/build/ios-ipa/stage"72rm -rf "$STAGE_DIR" "$IPA_PATH"73mkdir -p "$STAGE_DIR/Payload" "$OUTPUT_DIR"74/usr/bin/ditto "$APP_PATH" "$STAGE_DIR/Payload/$(basename "$APP_PATH")"75(cd "$STAGE_DIR" && /usr/bin/ditto -c -k --norsrc --keepParent Payload "$IPA_PATH")76rm -rf "$STAGE_DIR"7778/bin/ls -lh "$IPA_PATH"79echo "==> Done. Install with AltStore/SideStore (they re-sign the unsigned bundle)."80

Search chapters, reference and source filenames.