Run a virtual iPhone on an Apple Silicon Mac.
Swift
Build vphoned-tvos against the AppleTVOS SDK, and release 2.13.7
Lakr233dcd65475b288
diff --git a/VPhoneDaemon/Daemon/Bootstrap/GuestBootstrapPlatform.swift b/VPhoneDaemon/Daemon/Bootstrap/GuestBootstrapPlatform.swiftindex e018bdaa..97aed9df 100644--- a/VPhoneDaemon/Daemon/Bootstrap/GuestBootstrapPlatform.swift+++ b/VPhoneDaemon/Daemon/Bootstrap/GuestBootstrapPlatform.swift@@ -8,10 +8,9 @@ import MachO/// Irisin publishes three: RootHide and rootless for iOS, and RootHide alone/// for Apple TV, whose daemon and helper are tvOS binaries that refuse any/// other bootstrap (Irisin's Documentation/AppleTV.md). A TV guest runs-/// `vphoned-tvos`, the iOS build marked tvOS so that dyld loads the system's-/// libraries into it. The same mark decides whether Irisin's tvOS binaries-/// load, so it is what this reads rather than the product type: the Apple TV-/// HD and the 4K take the same package.+/// `vphoned-tvos`, built against the AppleTVOS SDK. Its platform decides+/// whether Irisin's tvOS binaries load, so it is what this reads rather than+/// the product type: the Apple TV HD and the 4K take the same package.enum GuestBootstrapPlatform {/// The package for a layout, or nil when this system has none for it.static func packageArchitecture(layout: String, tvOS: Bool) -> String? {diff --git a/VPhoneDaemon/Daemon/Bootstrap/RootHide/GuestIrisinInstaller+RootHideBase.swift b/VPhoneDaemon/Daemon/Bootstrap/RootHide/GuestIrisinInstaller+RootHideBase.swiftindex 71f2f42a..5f88e8c1 100644--- a/VPhoneDaemon/Daemon/Bootstrap/RootHide/GuestIrisinInstaller+RootHideBase.swift+++ b/VPhoneDaemon/Daemon/Bootstrap/RootHide/GuestIrisinInstaller+RootHideBase.swift@@ -1,5 +1,6 @@import Darwinimport Foundation+import VphonedNative// MARK: - RootHide bootstrap base@@ -218,15 +219,15 @@ extension GuestIrisinInstaller {throw GuestAPIError.operationFailed("pipe: \(String(cString: strerror(errno)))")}var actions: posix_spawn_file_actions_t?- posix_spawn_file_actions_init(&actions)- posix_spawn_file_actions_addopen(&actions, STDIN_FILENO, "/dev/null", O_RDONLY, 0)- posix_spawn_file_actions_adddup2(&actions, outputPipe[1], STDOUT_FILENO)- posix_spawn_file_actions_adddup2(&actions, outputPipe[1], STDERR_FILENO)- posix_spawn_file_actions_addclose(&actions, outputPipe[0])- posix_spawn_file_actions_addclose(&actions, outputPipe[1])+ vp_spawn_file_actions_init(&actions)+ vp_spawn_file_actions_addopen(&actions, STDIN_FILENO, "/dev/null", O_RDONLY, 0)+ vp_spawn_file_actions_adddup2(&actions, outputPipe[1], STDOUT_FILENO)+ vp_spawn_file_actions_adddup2(&actions, outputPipe[1], STDERR_FILENO)+ vp_spawn_file_actions_addclose(&actions, outputPipe[0])+ vp_spawn_file_actions_addclose(&actions, outputPipe[1])var pid: pid_t = 0- let spawned = posix_spawn(&pid, path, &actions, nil, &argv, environ)- posix_spawn_file_actions_destroy(&actions)+ let spawned = vp_spawn(&pid, path, &actions, nil, &argv, environ)+ vp_spawn_file_actions_destroy(&actions)close(outputPipe[1])guard spawned == 0 else {close(outputPipe[0])diff --git a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift b/VPhoneDaemon/Daemon/GuestAPI+Environment.swiftindex 7ffff54f..6f6dcfc7 100644--- a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift+++ b/VPhoneDaemon/Daemon/GuestAPI+Environment.swift@@ -1,6 +1,7 @@import Darwinimport Foundationimport IcliSystem+import VphonedNative// MARK: - vphone Environment@@ -150,12 +151,12 @@ extension GuestAPI {throw GuestAPIError.operationFailed("pipe: \(String(cString: strerror(errno)))")}var actions: posix_spawn_file_actions_t?- posix_spawn_file_actions_init(&actions)- posix_spawn_file_actions_adddup2(&actions, errorPipe[1], STDERR_FILENO)- posix_spawn_file_actions_addclose(&actions, errorPipe[0])+ vp_spawn_file_actions_init(&actions)+ vp_spawn_file_actions_adddup2(&actions, errorPipe[1], STDERR_FILENO)+ vp_spawn_file_actions_addclose(&actions, errorPipe[0])var pid: pid_t = 0- let spawned = posix_spawn(&pid, arguments[0], &actions, nil, &argv, environ)- posix_spawn_file_actions_destroy(&actions)+ let spawned = vp_spawn(&pid, arguments[0], &actions, nil, &argv, environ)+ vp_spawn_file_actions_destroy(&actions)close(errorPipe[1])guard spawned == 0 else {close(errorPipe[0])diff --git a/VPhoneDaemon/Daemon/GuestAPI.swift b/VPhoneDaemon/Daemon/GuestAPI.swiftindex 1f3d84a8..0b63ceac 100644--- a/VPhoneDaemon/Daemon/GuestAPI.swift+++ b/VPhoneDaemon/Daemon/GuestAPI.swift@@ -420,11 +420,15 @@ enum GuestAPI {case "clipboard.set":return try setClipboard(string(params, "text"))case "clipboard.clear":+ #if os(tvOS)+ throw GuestAPIError.operationFailed("tvOS has no system clipboard")+ #elseguard let pasteboard = UIPasteboard(name: .general, create: false) else {throw GuestAPIError.operationFailed("The system clipboard is unavailable")}pasteboard.items = []return try clipboardInfo()+ #endifcase "files.list":return try fileList(string(params, "path"))case "files.mkdir":diff --git a/VPhoneDaemon/Native/Include/VphonedNative.h b/VPhoneDaemon/Native/Include/VphonedNative.hindex 350d9736..d15bfb54 100644--- a/VPhoneDaemon/Native/Include/VphonedNative.h+++ b/VPhoneDaemon/Native/Include/VphonedNative.h@@ -2,11 +2,37 @@#include <stdbool.h>#include <stddef.h>#include <stdint.h>+#include <spawn.h>#include <sys/types.h>#ifdef __OBJC__#import <Foundation/Foundation.h>#endif+// MARK: - Spawning++// tvOS has posix_spawn and execv, and libSystem exports them there as on iOS,+// but the AppleTVOS SDK declares them unavailable. vphoned is built for both+// from one source, so it calls the same libSystem symbols under these names.+int vp_spawn(pid_t * _Nullable pid, const char * _Nonnull path,+ const posix_spawn_file_actions_t _Nullable * _Nullable actions,+ const posix_spawnattr_t _Nullable * _Nullable attributes,+ char * _Nullable const argv[_Nonnull], char * _Nullable const envp[_Nullable]) __asm__("_posix_spawn");+int vp_spawn_file_actions_init(posix_spawn_file_actions_t _Nullable * _Nonnull actions)+ __asm__("_posix_spawn_file_actions_init");+int vp_spawn_file_actions_destroy(posix_spawn_file_actions_t _Nullable * _Nonnull actions)+ __asm__("_posix_spawn_file_actions_destroy");+int vp_spawn_file_actions_addclose(posix_spawn_file_actions_t _Nullable * _Nonnull actions, int descriptor)+ __asm__("_posix_spawn_file_actions_addclose");+int vp_spawn_file_actions_adddup2(posix_spawn_file_actions_t _Nullable * _Nonnull actions, int descriptor, int target)+ __asm__("_posix_spawn_file_actions_adddup2");+int vp_spawn_file_actions_addopen(posix_spawn_file_actions_t _Nullable * _Nonnull actions, int descriptor,+ const char * _Nonnull path, int flags, mode_t mode) __asm__("_posix_spawn_file_actions_addopen");+int vp_spawnattr_init(posix_spawnattr_t _Nullable * _Nonnull attributes) __asm__("_posix_spawnattr_init");+int vp_spawnattr_destroy(posix_spawnattr_t _Nullable * _Nonnull attributes) __asm__("_posix_spawnattr_destroy");+int vp_spawnattr_setflags(posix_spawnattr_t _Nullable * _Nonnull attributes, short flags)+ __asm__("_posix_spawnattr_setflags");+int vp_execv(const char * _Nonnull path, char * _Nullable const argv[_Nonnull]) __asm__("_execv");+// Keep legacy bridge pointers explicitly unspecified: their Swift import stays// unchanged while sharing this header with APIs that declare nonnull pointers.// Do not assume nonnull for error strings or optional output parameters.diff --git a/VPhoneDaemon/Native/vphoned_native.m b/VPhoneDaemon/Native/vphoned_native.mindex 6f46a801..f58cb4e3 100644--- a/VPhoneDaemon/Native/vphoned_native.m+++ b/VPhoneDaemon/Native/vphoned_native.m@@ -98,7 +98,7 @@ void vp_native_bootstrap_cached_binary(void) {return;}char *const arguments[] = {(char *)cache, NULL};- execv(cache, arguments);+ vp_execv(cache, arguments);fprintf(stderr, "vphoned proxy: cached binary exec failed: %s\n", strerror(errno));_exit(1);}diff --git a/VPhoneDaemon/Native/vphoned_proxy.c b/VPhoneDaemon/Native/vphoned_proxy.cindex ba95161d..2d3ef374 100644--- a/VPhoneDaemon/Native/vphoned_proxy.c+++ b/VPhoneDaemon/Native/vphoned_proxy.c@@ -97,15 +97,15 @@ int vp_native_run_proxy(void) {int pipe_fds[2];if (pipe(pipe_fds) != 0) return 1;posix_spawn_file_actions_t file_actions;- int error = posix_spawn_file_actions_init(&file_actions);+ int error = vp_spawn_file_actions_init(&file_actions);if (error != 0) {close(pipe_fds[0]);close(pipe_fds[1]);return 1;}- error = posix_spawn_file_actions_addclose(&file_actions, pipe_fds[1]);+ error = vp_spawn_file_actions_addclose(&file_actions, pipe_fds[1]);if (error != 0) {- posix_spawn_file_actions_destroy(&file_actions);+ vp_spawn_file_actions_destroy(&file_actions);close(pipe_fds[0]);close(pipe_fds[1]);return 1;@@ -115,8 +115,8 @@ int vp_native_run_proxy(void) {snprintf(fd_argument, sizeof(fd_argument), "%d", pipe_fds[0]);char *arguments[] = {executable, "--io", fd_argument, NULL};pid_t child = -1;- error = posix_spawn(&child, executable, &file_actions, NULL, arguments, environ);- posix_spawn_file_actions_destroy(&file_actions);+ error = vp_spawn(&child, executable, &file_actions, NULL, arguments, environ);+ vp_spawn_file_actions_destroy(&file_actions);close(pipe_fds[0]);if (error != 0) {fprintf(stderr, "vphoned proxy: posix_spawn failed: %s\n", strerror(error));diff --git a/VPhoneDaemon/Native/vphoned_pty.c b/VPhoneDaemon/Native/vphoned_pty.cindex 8eb3d529..28f21999 100644--- a/VPhoneDaemon/Native/vphoned_pty.c+++ b/VPhoneDaemon/Native/vphoned_pty.c@@ -233,20 +233,20 @@ int vp_spawn_collect(const char *path, const char *const *argv, const char *inpu}posix_spawn_file_actions_t actions;- posix_spawn_file_actions_init(&actions);- posix_spawn_file_actions_adddup2(&actions, in[0], STDIN_FILENO);- posix_spawn_file_actions_adddup2(&actions, out[1], STDOUT_FILENO);- posix_spawn_file_actions_adddup2(&actions, err[1], STDERR_FILENO);+ vp_spawn_file_actions_init(&actions);+ vp_spawn_file_actions_adddup2(&actions, in[0], STDIN_FILENO);+ vp_spawn_file_actions_adddup2(&actions, out[1], STDOUT_FILENO);+ vp_spawn_file_actions_adddup2(&actions, err[1], STDERR_FILENO);posix_spawnattr_t attributes;- posix_spawnattr_init(&attributes);+ vp_spawnattr_init(&attributes);// Only the three descriptors above reach the child: vphoned holds the// VSOCK listener and every client connection.- posix_spawnattr_setflags(&attributes, POSIX_SPAWN_CLOEXEC_DEFAULT);+ vp_spawnattr_setflags(&attributes, POSIX_SPAWN_CLOEXEC_DEFAULT);pid_t child = -1;- int failure = posix_spawn(&child, path, &actions, &attributes, (char *const *)argv, environ);- posix_spawn_file_actions_destroy(&actions);- posix_spawnattr_destroy(&attributes);+ int failure = vp_spawn(&child, path, &actions, &attributes, (char *const *)argv, environ);+ vp_spawn_file_actions_destroy(&actions);+ vp_spawnattr_destroy(&attributes);close(in[0]);close(out[1]);close(err[1]);@@ -295,13 +295,13 @@ int vp_session_open(const char *program, int columns, int rows, pid_t *pid) {vp_keep_from_children(slave);posix_spawn_file_actions_t actions;- posix_spawn_file_actions_init(&actions);- posix_spawn_file_actions_adddup2(&actions, slave, STDIN_FILENO);- posix_spawn_file_actions_adddup2(&actions, slave, STDOUT_FILENO);- posix_spawn_file_actions_adddup2(&actions, slave, STDERR_FILENO);+ vp_spawn_file_actions_init(&actions);+ vp_spawn_file_actions_adddup2(&actions, slave, STDIN_FILENO);+ vp_spawn_file_actions_adddup2(&actions, slave, STDOUT_FILENO);+ vp_spawn_file_actions_adddup2(&actions, slave, STDERR_FILENO);posix_spawnattr_t attributes;- posix_spawnattr_init(&attributes);- posix_spawnattr_setflags(&attributes, POSIX_SPAWN_CLOEXEC_DEFAULT);+ vp_spawnattr_init(&attributes);+ vp_spawnattr_setflags(&attributes, POSIX_SPAWN_CLOEXEC_DEFAULT);char *arguments[5];int count = 0;@@ -316,9 +316,9 @@ int vp_session_open(const char *program, int columns, int rows, pid_t *pid) {arguments[count] = NULL;pid_t child = -1;- int failure = posix_spawn(&child, executable, &actions, &attributes, arguments, environ);- posix_spawn_file_actions_destroy(&actions);- posix_spawnattr_destroy(&attributes);+ int failure = vp_spawn(&child, executable, &actions, &attributes, arguments, environ);+ vp_spawn_file_actions_destroy(&actions);+ vp_spawnattr_destroy(&attributes);close(slave);if (failure != 0) {close(master);@@ -392,21 +392,21 @@ char *vp_session_evaluate(const char *source, double timeout, int *status) {}posix_spawn_file_actions_t actions;- posix_spawn_file_actions_init(&actions);- posix_spawn_file_actions_adddup2(&actions, in[0], STDIN_FILENO);- posix_spawn_file_actions_adddup2(&actions, out[1], STDOUT_FILENO);+ vp_spawn_file_actions_init(&actions);+ vp_spawn_file_actions_adddup2(&actions, in[0], STDIN_FILENO);+ vp_spawn_file_actions_adddup2(&actions, out[1], STDOUT_FILENO);// The session keeps vphoned's stderr: a crash report from a script belongs// in the guest log, and its stdout carries nothing but the reply.- posix_spawn_file_actions_adddup2(&actions, STDERR_FILENO, STDERR_FILENO);+ vp_spawn_file_actions_adddup2(&actions, STDERR_FILENO, STDERR_FILENO);posix_spawnattr_t attributes;- posix_spawnattr_init(&attributes);- posix_spawnattr_setflags(&attributes, POSIX_SPAWN_CLOEXEC_DEFAULT);+ vp_spawnattr_init(&attributes);+ vp_spawnattr_setflags(&attributes, POSIX_SPAWN_CLOEXEC_DEFAULT);char *arguments[] = {executable, "--session", "eval", NULL};pid_t child = -1;- int failure = posix_spawn(&child, executable, &actions, &attributes, arguments, environ);- posix_spawn_file_actions_destroy(&actions);- posix_spawnattr_destroy(&attributes);+ int failure = vp_spawn(&child, executable, &actions, &attributes, arguments, environ);+ vp_spawn_file_actions_destroy(&actions);+ vp_spawnattr_destroy(&attributes);close(in[0]);close(out[1]);if (failure != 0) {diff --git a/VPhoneDaemon/Native/vphoned_session.m b/VPhoneDaemon/Native/vphoned_session.mindex 4a0ae417..cb58c681 100644--- a/VPhoneDaemon/Native/vphoned_session.m+++ b/VPhoneDaemon/Native/vphoned_session.m@@ -56,7 +56,7 @@ int vp_session_exec(void) {return 64;}vp_session_detach();- execv(argv[3], &argv[3]);+ vp_execv(argv[3], &argv[3]);fprintf(stderr, "vphoned session: %s: %s\n", argv[3], strerror(errno));return 127;}diff --git a/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.pbxproj b/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.pbxprojindex efd8f2aa..2d55a431 100644--- a/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.pbxproj+++ b/VPhoneDaemon/VPhoneDaemon.xcodeproj/project.pbxproj@@ -177,7 +177,7 @@);runOnlyForDeploymentPostprocessing = 0;shellPath = /bin/zsh;- shellScript = "set -euo pipefail\nroot=\"$(cd \"$SRCROOT/..\" && pwd)\"\n# Use the device SDK and product suffix without requiring a simulator runtime.\n/usr/bin/env -i HOME=\"$HOME\" TMPDIR=\"${TMPDIR:-/tmp}\" PATH=\"/usr/bin:/bin:/usr/sbin:/sbin\" /usr/bin/xcodebuild -project \"$root/VPhoneExecutable/VPhoneCommand/VPhoneCommand.xcodeproj\" -scheme VPhoneSign -configuration \"$CONFIGURATION\" -sdk iphoneos -derivedDataPath \"$root/.build/XcodeSignGuest-$CONFIGURATION\" CODE_SIGNING_ALLOWED=NO SUPPORTS_MACCATALYST=NO EFFECTIVE_PLATFORM_NAME=-iphoneos build\n";+ shellScript = "set -euo pipefail\nroot=\"$(cd \"$SRCROOT/..\" && pwd)\"\n# Use this build's device SDK and product suffix without requiring a simulator runtime.\n/usr/bin/env -i HOME=\"$HOME\" TMPDIR=\"${TMPDIR:-/tmp}\" PATH=\"/usr/bin:/bin:/usr/sbin:/sbin\" /usr/bin/xcodebuild -project \"$root/VPhoneExecutable/VPhoneCommand/VPhoneCommand.xcodeproj\" -scheme VPhoneSign -configuration \"$CONFIGURATION\" -sdk \"$PLATFORM_NAME\" -derivedDataPath \"$root/.build/XcodeSignGuest-$CONFIGURATION\" CODE_SIGNING_ALLOWED=NO SUPPORTS_MACCATALYST=NO EFFECTIVE_PLATFORM_NAME=\"$EFFECTIVE_PLATFORM_NAME\" build\n";};/* End PBXShellScriptBuildPhase section */@@ -222,9 +222,11 @@"$(PROJECT_DIR)/Native/Include",);IPHONEOS_DEPLOYMENT_TARGET = 15.0;+ TVOS_DEPLOYMENT_TARGET = 15.0;OTHER_LDFLAGS = "-ObjC";PRODUCT_NAME = "$(TARGET_NAME)";SDKROOT = iphoneos;+ SUPPORTED_PLATFORMS = "iphoneos appletvos";SKIP_INSTALL = YES;};name = Debug;@@ -244,9 +246,11 @@"$(PROJECT_DIR)/Native/Include",);IPHONEOS_DEPLOYMENT_TARGET = 15.0;+ TVOS_DEPLOYMENT_TARGET = 15.0;OTHER_LDFLAGS = "-ObjC";PRODUCT_NAME = "$(TARGET_NAME)";SDKROOT = iphoneos;+ SUPPORTED_PLATFORMS = "iphoneos appletvos";SKIP_INSTALL = YES;};name = Release;@@ -258,7 +262,8 @@DEFINES_MODULE = YES;HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/Native/Include";IPHONEOS_DEPLOYMENT_TARGET = 15.0;- LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../.build/XcodeSignGuest-$(CONFIGURATION)/Build/Products/$(CONFIGURATION)-iphoneos";+ TVOS_DEPLOYMENT_TARGET = 15.0;+ LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../.build/XcodeSignGuest-$(CONFIGURATION)/Build/Products/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";OTHER_LDFLAGS = ("-lVPhoneSign","-weak_framework",@@ -266,7 +271,8 @@);PRODUCT_NAME = "$(TARGET_NAME)";SDKROOT = iphoneos;- SWIFT_INCLUDE_PATHS = "$(SRCROOT)/../.build/XcodeSignGuest-$(CONFIGURATION)/Build/Products/$(CONFIGURATION)-iphoneos";+ SUPPORTED_PLATFORMS = "iphoneos appletvos";+ SWIFT_INCLUDE_PATHS = "$(SRCROOT)/../.build/XcodeSignGuest-$(CONFIGURATION)/Build/Products/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";SWIFT_STRICT_CONCURRENCY = complete;SWIFT_VERSION = 6.0;};@@ -279,7 +285,8 @@DEFINES_MODULE = YES;HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/Native/Include";IPHONEOS_DEPLOYMENT_TARGET = 15.0;- LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../.build/XcodeSignGuest-$(CONFIGURATION)/Build/Products/$(CONFIGURATION)-iphoneos";+ TVOS_DEPLOYMENT_TARGET = 15.0;+ LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../.build/XcodeSignGuest-$(CONFIGURATION)/Build/Products/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";OTHER_LDFLAGS = ("-lVPhoneSign","-weak_framework",@@ -287,7 +294,8 @@);PRODUCT_NAME = "$(TARGET_NAME)";SDKROOT = iphoneos;- SWIFT_INCLUDE_PATHS = "$(SRCROOT)/../.build/XcodeSignGuest-$(CONFIGURATION)/Build/Products/$(CONFIGURATION)-iphoneos";+ SUPPORTED_PLATFORMS = "iphoneos appletvos";+ SWIFT_INCLUDE_PATHS = "$(SRCROOT)/../.build/XcodeSignGuest-$(CONFIGURATION)/Build/Products/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";SWIFT_STRICT_CONCURRENCY = complete;SWIFT_VERSION = 6.0;};@@ -299,7 +307,9 @@CLANG_ENABLE_MODULES = YES;CODE_SIGNING_ALLOWED = NO;IPHONEOS_DEPLOYMENT_TARGET = 15.0;+ TVOS_DEPLOYMENT_TARGET = 15.0;SDKROOT = iphoneos;+ SUPPORTED_PLATFORMS = "iphoneos appletvos";SWIFT_VERSION = 6.0;};name = Debug;@@ -310,7 +320,9 @@CLANG_ENABLE_MODULES = YES;CODE_SIGNING_ALLOWED = NO;IPHONEOS_DEPLOYMENT_TARGET = 15.0;+ TVOS_DEPLOYMENT_TARGET = 15.0;SDKROOT = iphoneos;+ SUPPORTED_PLATFORMS = "iphoneos appletvos";SWIFT_VERSION = 6.0;};name = Release;diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand.xcodeproj/project.pbxproj b/VPhoneExecutable/VPhoneCommand/VPhoneCommand.xcodeproj/project.pbxprojindex c2f91d87..6731711a 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand.xcodeproj/project.pbxproj+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand.xcodeproj/project.pbxproj@@ -618,6 +618,7 @@SWIFT_INCLUDE_PATHS = "$(BUILT_PRODUCTS_DIR) $(SRCROOT)/../../.build/XcodeKit/Build/Products/$(CONFIGURATION) $(SRCROOT)/../../.build/XcodeRestore/Build/Products/$(CONFIGURATION)";SWIFT_STRICT_CONCURRENCY = complete;SWIFT_VERSION = 6.0;+ TVOS_DEPLOYMENT_TARGET = 15.0;};name = Release;};@@ -634,9 +635,10 @@PRODUCT_NAME = VPhoneSign;SDKROOT = auto;SKIP_INSTALL = YES;- SUPPORTED_PLATFORMS = "macosx iphoneos";+ SUPPORTED_PLATFORMS = "macosx iphoneos appletvos";SWIFT_STRICT_CONCURRENCY = complete;SWIFT_VERSION = 6.0;+ TVOS_DEPLOYMENT_TARGET = 15.0;};name = Debug;};@@ -652,9 +654,10 @@PRODUCT_NAME = VPhoneSign;SDKROOT = auto;SKIP_INSTALL = YES;- SUPPORTED_PLATFORMS = "macosx iphoneos";+ SUPPORTED_PLATFORMS = "macosx iphoneos appletvos";SWIFT_STRICT_CONCURRENCY = complete;SWIFT_VERSION = 6.0;+ TVOS_DEPLOYMENT_TARGET = 15.0;};name = Release;};diff --git a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.shindex e172b571..6965d32b 100755--- a/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh+++ b/VPhoneExecutable/VPhoneVirtualization/Build/StageBundle.sh@@ -40,6 +40,30 @@ build_project -project "$root/VPhoneDaemon/VPhoneDaemon.xcodeproj" \-derivedDataPath "$root/.build/XcodeDaemon" CODE_SIGNING_ALLOWED=NO \SUPPORTS_MACCATALYST=NO EFFECTIVE_PLATFORM_NAME=-iphoneos build+# Apple TV and HomePod guests run vphoned built against the AppleTVOS SDK, so+# its `#if os(tvOS)` branches and IcliKit's are the tvOS ones. That SDK has no+# IOKit.framework though tvOS ships one with the same exports, so the build+# links against the iPhoneOS SDK's IOKit headers and stub, targeted at tvOS.+tvos_frameworks="$root/.build/XcodeDaemon/tvos-frameworks"+iphoneos_iokit="$(/usr/bin/xcrun --sdk iphoneos --show-sdk-path)/System/Library/Frameworks/IOKit.framework/Versions/A"+/bin/rm -rf "$tvos_frameworks"+/bin/mkdir -p "$tvos_frameworks/IOKit.framework"+/bin/cp -R "$iphoneos_iokit/Headers" "$tvos_frameworks/IOKit.framework/Headers"+# Xcode 27's iPhoneOS SDK adds arm64e.x1; tvOS has arm64 and arm64e alone.+/usr/bin/sed -E -e 's/, *arm64e?\.[a-z0-9]+-ios//g' -e 's/arm64e?-ios/arm64-tvos, arm64e-tvos/' \+ "$iphoneos_iokit/IOKit.tbd" > "$tvos_frameworks/IOKit.framework/IOKit.tbd"+if ! /usr/bin/grep -q 'arm64-tvos' "$tvos_frameworks/IOKit.framework/IOKit.tbd" ||+ /usr/bin/grep -q -- '-ios[] ,]' "$tvos_frameworks/IOKit.framework/IOKit.tbd"; then+ print -u2 -- "Could not target the iPhoneOS SDK's IOKit.tbd at tvOS"+ exit 1+fi+build_project -project "$root/VPhoneDaemon/VPhoneDaemon.xcodeproj" \+ -scheme vphoned -configuration "$configuration" \+ -sdk appletvos \+ -derivedDataPath "$root/.build/XcodeDaemon" CODE_SIGNING_ALLOWED=NO \+ SUPPORTS_MACCATALYST=NO EFFECTIVE_PLATFORM_NAME=-appletvos \+ FRAMEWORK_SEARCH_PATHS="$tvos_frameworks" build+build_project -project "$root/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator.xcodeproj" \-scheme VPhoneEscalator -configuration "$configuration" \-derivedDataPath "$root/.build/XcodeAMFIAllow" \@@ -49,15 +73,18 @@ build_project -project "$root/VPhoneExecutable/VPhoneEscalator/VPhoneEscalator.xcommand_products="$root/.build/XcodeCommand/Build/Products/$configuration"daemon_products="$root/.build/XcodeDaemon/Build/Products/$configuration-iphoneos"+tvos_daemon_products="$root/.build/XcodeDaemon/Build/Products/$configuration-appletvos"amfi_products="$root/.build/XcodeAMFIAllow/Build/Products/$configuration"guest_products="$root/.build/guest-components/stage"# The iOS 26 Swift runtime lacks this symbol, and Swift 6.4 can import it# strongly even when vphoned targets iOS 15, causing a dyld crash loop.-if /usr/bin/nm -u "$daemon_products/vphoned" | /usr/bin/grep -q '_swift_initBorrow'; then- print -u2 -- "vphoned requires _swift_initBorrow, which is unavailable on iOS 26"- exit 1-fi+for daemon in "$daemon_products/vphoned" "$tvos_daemon_products/vphoned"; do+ if /usr/bin/nm -u "$daemon" | /usr/bin/grep -q '_swift_initBorrow'; then+ print -u2 -- "${daemon#$root/} requires _swift_initBorrow, which is unavailable on iOS 26 and tvOS 26"+ exit 1+ fi+done/bin/rm -rf "$macos" "$resources"/bin/mkdir -p "$macos" "$guest" "$frameworks"@@ -75,15 +102,14 @@ fi/bin/cp "$command_products/vphone-cli" "$macos/vphone-cli"/bin/cp "$amfi_products/vphone-escalator" "$macos/vphone-escalator"/bin/cp "$daemon_products/vphoned" "$guest/vphoned"-# Apple TV guests run the same arm64 daemon. tvOS dyld loads its system-# libraries only into a tvOS-platform process, so this copy says tvOS.+/bin/cp "$tvos_daemon_products/vphoned" "$guest/vphoned-tvos"+# Watch guests still run the iOS daemon marked watchOS: watchOS 8 is iOS 15's+# release.daemon_sdk="$(/usr/bin/otool -l "$guest/vphoned" | /usr/bin/awk '/LC_BUILD_VERSION/ { found = 1 } found && $1 == "sdk" { print $2; exit }')"-/usr/bin/xcrun vtool -set-build-version tvos 15.0 "$daemon_sdk" -replace -output "$guest/vphoned-tvos" "$guest/vphoned"-# The same for watch guests: watchOS 8 is iOS 15's release./usr/bin/xcrun vtool -set-build-version watchos 8.0 "$daemon_sdk" -replace -output "$guest/vphoned-watchos" "$guest/vphoned"# iOS before 26 needs Span's back-deployment library. Keep /usr/lib/swift# first so newer guests use their system implementation; only the iOS daemon-# gets this private fallback. TV/watch payloads above remain unchanged.+# gets this private fallback. The TV and watch daemons above have none.guest_compatibility_library="$(/usr/bin/xcrun swift-stdlib-tool --print \--scan-executable "$guest/vphoned" --platform iphoneos | \/usr/bin/grep '/libswiftCompatibilitySpan.dylib$')"diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plistindex 79f8bae8..fbba0f4a 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/Info.plist@@ -9,9 +9,9 @@<key>CFBundlePackageType</key><string>BNDL</string><key>CFBundleVersion</key>- <string>54</string>+ <string>55</string><key>CFBundleShortVersionString</key>- <string>2.13.6</string>+ <string>2.13.7</string><key>NSMicrophoneUsageDescription</key><string>Shares this Mac's microphone with the virtual iPhone so apps running inside it can record.</string></dict>diff --git a/VPhoneLaunchpad/Configuration/Version.xcconfig b/VPhoneLaunchpad/Configuration/Version.xcconfigindex e45ef7cb..772894b1 100644--- a/VPhoneLaunchpad/Configuration/Version.xcconfig+++ b/VPhoneLaunchpad/Configuration/Version.xcconfig@@ -1,4 +1,4 @@-MARKETING_VERSION = 2.13.6+MARKETING_VERSION = 2.13.7// Bump whenever the helper changes. The app blesses the helper again when the// installed helper's version or bytes differ from the copy it embeds.CURRENT_PROJECT_VERSION = 21