Run a virtual iPhone on an Apple Silicon Mac.
Swift
fix: preflight checks the running binary, not a dev .build path
zqxwce70ff75067ae2
diff --git a/scripts/boot_host_preflight.sh b/scripts/boot_host_preflight.shindex efd87603..26c35382 100755--- a/scripts/boot_host_preflight.sh+++ b/scripts/boot_host_preflight.sh@@ -34,7 +34,11 @@ donecd "$PROJECT_ROOT"-RELEASE_BIN="${PROJECT_ROOT}/.build/release/vphone-cli"+# The caller (vphone-cli) passes VPHONE_CLI_BIN = the running binary, so we+# check THAT — the bundled .app's Contents/MacOS/vphone-cli, not a dev+# .build/release path that doesn't exist inside the bundle. Falls back to the+# dev layout for standalone/`make` invocation.+RELEASE_BIN="${VPHONE_CLI_BIN:-${PROJECT_ROOT}/.build/release/vphone-cli}"DEBUG_BIN="${PROJECT_ROOT}/.build/debug/vphone-cli"ENTITLEMENTS="${PROJECT_ROOT}/sources/vphone.entitlements"TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/vphone-preflight.XXXXXX")"diff --git a/sources/vphone-cli/VPhoneVMLaunchCLI.swift b/sources/vphone-cli/VPhoneVMLaunchCLI.swiftindex 39dff3a9..784b1413 100644--- a/sources/vphone-cli/VPhoneVMLaunchCLI.swift+++ b/sources/vphone-cli/VPhoneVMLaunchCLI.swift@@ -25,27 +25,31 @@ struct VPhoneVMLaunchCommand: ParsableCommand {let resources = projectRoot.map { VPhoneResources(base: URL(fileURLWithPath: $0)) } ?? .resolve()let layout = VPhoneLaunchLayout(resources: resources)- // Host preflight — same gate make boot applies.+ // The running executable is BOTH what we boot from and what preflight+ // should check — a bundled .app is its own boot binary.+ let bootBinary = URL(fileURLWithPath: CommandLine.arguments[0]).resolvingSymlinksInPath()+ guard FileManager.default.isExecutableFile(atPath: bootBinary.path) else {+ FileHandle.standardError.write(Data(+ "error: \(bootBinary.path) not found — build it first (make build/bundle).\n".utf8))+ throw ExitCode(1)+ }++ // Host preflight — same gate make boot applies. Point it at THIS binary+ // (VPHONE_CLI_BIN) so it checks the vphone-cli we're running, not a dev+ // .build/release path that doesn't exist inside the bundled .app.var preflightArgs = ["--assert-bootable"]if variant == "less" { preflightArgs.append("--less") }+ var preflightEnv = ProcessInfo.processInfo.environment+ preflightEnv["VPHONE_CLI_BIN"] = bootBinary.pathlet pre = try VPhoneProcessRunner.runCapturing(URL(fileURLWithPath: "/bin/zsh"), [layout.preflightScript.path] + preflightArgs,- cwd: resources.base)+ cwd: resources.base, env: preflightEnv)if !pre.stdout.isEmpty { print(pre.stdout, terminator: "") }guard pre.succeeded else {FileHandle.standardError.write(Data(pre.stderr.utf8))throw ExitCode(pre.exitCode == 0 ? 1 : pre.exitCode)}- // A bundled .app is its own boot binary — self-spawn the running executable- // for both the GUI and --dfu (headless) boot paths.- let bootBinary = URL(fileURLWithPath: CommandLine.arguments[0]).resolvingSymlinksInPath()- guard FileManager.default.isExecutableFile(atPath: bootBinary.path) else {- FileHandle.standardError.write(Data(- "error: \(bootBinary.path) not found — build it first (make build/bundle).\n".utf8))- throw ExitCode(1)- }-if !dfu && !noVphoned {do {_ = try layout.stageVphoned(into: bundle)