Skip to content

Commit

Permalink
github: configure build for iOS-Remote
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed Oct 29, 2023
1 parent 3acbf2e commit e068e65
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 64 deletions.
46 changes: 25 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
strategy:
matrix:
arch: [arm64]
platform: [ios, ios_simulator, ios-tci, macos, visionos, visionos_simulator, visionos-tci]
platform: [ios, ios_simulator, ios-tci, ios_simulator-tci, macos, visionos, visionos_simulator, visionos-tci, visionos_simulator-tci]
include:
# x86_64 supported only for macOS and simulators
- arch: x86_64
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true'
run: ./scripts/build_dependencies.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }}
env:
NCPU: ${{ matrix.platform == 'ios-tci' && '2' || '0' }} # limit 2 CPU for TCI build due to memory issues, 0 = unlimited for other builds
NCPU: ${{ (matrix.platform == 'ios-tci' || matrix.platform == 'visionos-tci') && '2' || '0' }} # limit 2 CPU for TCI build due to memory issues, 0 = unlimited for other builds
- name: Compress Sysroot
if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
run: tar -acf sysroot.tgz sysroot*
Expand Down Expand Up @@ -152,14 +152,16 @@ jobs:
needs: [configuration, build-sysroot]
strategy:
matrix:
arch: [arm64]
platform: [ios, ios_simulator, ios-tci, macos, visionos, visionos_simulator, visionos-tci]
include:
# x86_64 supported only for macOS and simulators
- arch: x86_64
platform: macos
- arch: x86_64
platform: ios_simulator
configuration: [
{arch: "arm64", sdk: "iphoneos", platform: "ios", scheme: "iOS"},
{arch: "arm64", sdk: "iphoneos", platform: "ios-tci", scheme: "iOS-TCI"},
{arch: "arm64", sdk: "iphoneos", platform: "ios-tci", scheme: "iOS-Remote"},
{arch: "arm64", sdk: "xros", platform: "visionos", scheme: "iOS"},
{arch: "arm64", sdk: "xros", platform: "visionos-tci", scheme: "iOS-TCI"},
{arch: "arm64", sdk: "xros", platform: "visionos-tci", scheme: "iOS-Remote"},
{arch: "arm64", sdk: "macos", platform: "macos", scheme: "macOS"},
{arch: "x86_64", sdk: "macos", platform: "macos", scheme: "macOS"},
]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -169,8 +171,8 @@ jobs:
id: cache-sysroot
uses: osy/actions-cache@v3
with:
path: sysroot-${{ matrix.platform }}-${{ matrix.arch }}
key: ${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
path: sysroot-${{ matrix.configuration.platform }}-${{ matrix.configuration.arch }}
key: ${{ matrix.configuration.platform }}-${{ matrix.configuration.arch }}-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
- name: Check Cache
if: steps.cache-sysroot.outputs.cache-hit != 'true'
uses: actions/github-script@v6
Expand All @@ -182,12 +184,12 @@ jobs:
[[ "$(xcode-select -p)" == "${{ env.BUILD_XCODE_PATH }}"* ]] || sudo xcode-select -s "${{ env.BUILD_XCODE_PATH }}"
- name: Build UTM
run: |
./scripts/build_utm.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }} -o UTM
./scripts/build_utm.sh -k ${{ matrix.configuration.sdk }} -s ${{ matrix.configuration.scheme }} -a ${{ matrix.configuration.arch }} -o UTM
tar -acf UTM.xcarchive.tgz UTM.xcarchive
- name: Upload UTM
uses: actions/upload-artifact@v3
with:
name: UTM-${{ matrix.platform }}-${{ matrix.arch }}
name: UTM-${{ matrix.configuration.scheme }}-${{ matrix.configuration.platform }}-${{ matrix.configuration.arch }}
path: UTM.xcarchive.tgz
build-universal:
name: Build UTM (Universal Mac)
Expand Down Expand Up @@ -231,12 +233,14 @@ jobs:
strategy:
matrix:
configuration: [
{platform: "ios", mode: "ipa", name: "UTM.ipa", path: "UTM.ipa"},
{platform: "ios-tci", mode: "ipa-se", name: "UTM-SE.ipa", path: "UTM SE.ipa"},
{platform: "ios", mode: "ipa-hv", name: "UTM-HV.ipa", path: "UTM.ipa"},
{platform: "ios", mode: "deb", name: "UTM.deb", path: "UTM.deb"},
{platform: "visionos", mode: "ipa", name: "UTM-visionOS.ipa", path: "UTM.ipa"},
{platform: "visionos-tci", mode: "ipa-se", name: "UTM-SE-visionOS.ipa", path: "UTM SE.ipa"}
{platform: "ios", scheme: "iOS", mode: "ipa", name: "UTM.ipa", path: "UTM.ipa"},
{platform: "ios-tci", scheme: "iOS-SE", mode: "ipa-se", name: "UTM-SE.ipa", path: "UTM SE.ipa"},
{platform: "ios", scheme: "iOS", mode: "ipa-hv", name: "UTM-HV.ipa", path: "UTM.ipa"},
{platform: "ios", scheme: "iOS", mode: "deb", name: "UTM.deb", path: "UTM.deb"},
{platform: "visionos", scheme: "iOS", mode: "ipa", name: "UTM-visionOS.ipa", path: "UTM.ipa"},
{platform: "visionos-tci", scheme: "iOS-SE", mode: "ipa-se", name: "UTM-SE-visionOS.ipa", path: "UTM SE.ipa"}
{platform: "ios-tci", scheme: "iOS-Remote", mode: "ipa-remote", name: "UTM-Remote.ipa", path: "UTM Remote.ipa"},
{platform: "visionos-tci", scheme: "iOS-Remote", mode: "ipa-remote", name: "UTM-Remote-visionOS.ipa", path: "UTM Remote.ipa"},
]
if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
steps:
Expand All @@ -245,7 +249,7 @@ jobs:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: UTM-${{ matrix.configuration.platform }}-arm64
name: UTM-${{ matrix.configuration.scheme }}-${{ matrix.configuration.platform }}-arm64
- name: Install ldid + dpkg
run: brew install ldid dpkg
- name: Fakesign IPA
Expand Down
59 changes: 18 additions & 41 deletions scripts/build_utm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ command -v realpath >/dev/null 2>&1 || realpath() {
BASEDIR="$(dirname "$(realpath $0)")"

usage () {
echo "Usage: $(basename $0) [-t teamid] [-p platform] [-a architecture] [-t targetversion] [-o output]"
echo "Usage: $(basename $0) [-t teamid] [-p platform] [-s scheme] [-a architecture] [-t targetversion] [-o output]"
echo ""
echo " -t teamid Team Identifier for app groups. Optional for iOS. Required for macOS."
echo " -p platform Target platform. Default ios. [ios|ios_simulator|ios-tci|ios_simulator-tci|macos|visionos|visionos_simulator]"
echo " -a architecture Target architecture. Default arm64. [armv7|armv7s|arm64|i386|x86_64]"
echo " -k sdk Target SDK. Default iphoneos. [iphoneos|iphonesimulator|xros|xrsimulator|macos]"
echo " -s scheme Target scheme. Default iOS/macOS depending on platform. [iOS|iOS-TCI|iOS-Remote|macOS]"
echo " -a architecture Target architecture. Default arm64. [arm64|x86_64]"
echo " -o output Output archive path. Default is current directory."
echo ""
exit 1
Expand All @@ -20,9 +21,8 @@ usage () {
PRODUCT_BUNDLE_PREFIX="com.utmapp"
TEAM_IDENTIFIER=
ARCH=arm64
PLATFORM=ios
OUTPUT=$PWD
SDK=
SDK=iphoneos
SCHEME=

while [ "x$1" != "x" ]; do
Expand All @@ -35,8 +35,12 @@ while [ "x$1" != "x" ]; do
ARCH=$2
shift
;;
-p )
PLATFORM=$2
-k )
SDK=$2
shift
;;
-s )
SCHEME=$2
shift
;;
-o )
Expand All @@ -50,39 +54,14 @@ while [ "x$1" != "x" ]; do
shift
done

case $PLATFORM in
*-tci )
SCHEME="iOS-TCI"
;;
ios* | visionos* )
SCHEME="iOS"
;;
case $SDK in
macos )
SCHEME="macOS"
;;
* )
usage
;;
esac

case $PLATFORM in
visionos_simulator* )
SDK=xrsimulator
;;
visionos* )
SDK=xros
;;
ios_simulator* )
SDK=iphonesimulator
;;
ios* )
SDK=iphoneos
;;
macos )
SDK=macosx
;;
* )
usage
if [ -z "$SCHEME" ]; then
SCHEME="iOS"
fi
;;
esac

Expand All @@ -94,8 +73,7 @@ fi
xcodebuild archive -archivePath "$OUTPUT" -scheme "$SCHEME" -sdk "$SDK" $ARCH_ARGS -configuration Release CODE_SIGNING_ALLOWED=NO $TEAM_IDENTIFIER_PREFIX
BUILT_PATH=$(find $OUTPUT.xcarchive -name '*.app' -type d | head -1)
# Only retain the target architecture to address < iOS 15 crash & save disk space
case $PLATFORM in
ios | ios-tci )
if [ "$SDK" == "iphoneos" ]; then
find "$BUILT_PATH" -type f -path '*/Frameworks/*.dylib' | while read FILE; do
if [[ $(lipo -info "$FILE") =~ "Architectures in the fat file" ]]; then
lipo -thin $ARCH "$FILE" -output "$FILE"
Expand All @@ -107,10 +85,9 @@ ios | ios-tci )
lipo -thin $ARCH "$FILE" -output "$FILE"
fi
done
;;
esac
fi
find "$BUILT_PATH" -type d -path '*/Frameworks/*.framework' -exec codesign --force --sign - --timestamp=none \{\} \;
if [ "$PLATFORM" == "macos" ]; then
if [ "$SDK" == "macos" ]; then
# always build with vm entitlements, package_mac.sh can strip it later
# this way we can import into Xcode and re-sign from there
UTM_ENTITLEMENTS="/tmp/utm.$$.entitlements"
Expand Down
10 changes: 8 additions & 2 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ usage() {
echo " MODE is one of:"
echo " deb (Cydia DEB)"
echo " ipa (unsigned IPA of full build with all entitlements)"
echo " ipa-se (unsigned IPA of TCI build)"
echo " ipa-se (unsigned IPA of SE build)"
echo " ipa-remote (unsigned IPA of Remote build)"
echo " ipa-hv (unsigned IPA of full build without JIT entitlement)"
echo " ipa-signed (developer signed IPA with valid PROFILE_NAME and TEAM_ID)"
echo " inputXcarchive is path to UTM.xcarchive"
Expand Down Expand Up @@ -42,6 +43,11 @@ ipa-se )
BUNDLE_ID="com.utmapp.UTM-SE"
INPUT_APP="$INPUT/Products/Applications/UTM SE.app"
;;
ipa-remote )
NAME="UTM Remote"
BUNDLE_ID="com.utmapp.UTM-Remote"
INPUT_APP="$INPUT/Products/Applications/UTM Remote.app"
;;
* )
usage
;;
Expand Down Expand Up @@ -298,7 +304,7 @@ EOL
create_fake_ipa "$NAME" "$BUNDLE_ID" "$INPUT" "$OUTPUT" "$FAKEENT"
rm "$FAKEENT"
;;
ipa-se )
ipa-se | ipa-remote )
FAKEENT="/tmp/fakeent.$$.plist"
cat >"$FAKEENT" <<EOL
<?xml version="1.0" encoding="UTF-8"?>
Expand Down

0 comments on commit e068e65

Please sign in to comment.