diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4ee0ba18..9dd3ad167 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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* @@ -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 @@ -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 @@ -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) @@ -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: @@ -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 diff --git a/scripts/build_utm.sh b/scripts/build_utm.sh index 191e77a72..95f240172 100755 --- a/scripts/build_utm.sh +++ b/scripts/build_utm.sh @@ -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 @@ -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 @@ -35,8 +35,12 @@ while [ "x$1" != "x" ]; do ARCH=$2 shift ;; - -p ) - PLATFORM=$2 + -k ) + SDK=$2 + shift + ;; + -s ) + SCHEME=$2 shift ;; -o ) @@ -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 @@ -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" @@ -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" diff --git a/scripts/package.sh b/scripts/package.sh index 9c48bbe46..73b24931a 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -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" @@ -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 ;; @@ -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" <