Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Merge pull request #15 from cocoa-xu/cx-fix-make-venv-keystone

Lakrd9e66ae30d75
diff --git a/Package.swift b/Package.swift
index 120bae17..963fec43 100644
--- a/Package.swift
+++ b/Package.swift
@@ -18,7 +18,7 @@ let package = Package(
publicHeadersPath: "include",
linkerSettings: [
.linkedFramework("Virtualization"),
- ],
+ ]
),
// Swift executable
.executableTarget(
@@ -34,7 +34,7 @@ let package = Package(
linkerSettings: [
.linkedFramework("Virtualization"),
.linkedFramework("AppKit"),
- ],
- ),
- ],
+ ]
+ )
+ ]
)
diff --git a/scripts/setup_libimobiledevice.sh b/scripts/setup_libimobiledevice.sh
index d9ab6478..d789fe84 100755
--- a/scripts/setup_libimobiledevice.sh
+++ b/scripts/setup_libimobiledevice.sh
@@ -30,9 +30,11 @@ die() { echo "[-] $*" >&2; exit 1; }
check_tools() {
local missing=()
- for cmd in autoconf automake libtool pkg-config cmake git; do
+ for cmd in autoconf automake pkg-config cmake git; do
command -v "$cmd" &>/dev/null || missing+=("$cmd")
done
+ command -v glibtoolize &>/dev/null || command -v libtoolize &>/dev/null \
+ || missing+=("libtool(ize)")
(( ${#missing[@]} == 0 )) || die "Missing: ${missing[*]} — brew install ${missing[*]}"
}
diff --git a/scripts/setup_venv.sh b/scripts/setup_venv.sh
index b0a831eb..50f35439 100755
--- a/scripts/setup_venv.sh
+++ b/scripts/setup_venv.sh
@@ -41,8 +41,12 @@ pip install -r "${REQUIREMENTS}"
# so we build a dylib from it and place it inside the venv.
echo ""
echo "=== Building keystone dylib ==="
-
-KEYSTONE_STATIC="$(find /opt/homebrew/Cellar/keystone -name 'libkeystone.a' -type f 2>/dev/null | head -1)"
+KEYSTONE_DIR="/opt/homebrew/Cellar/keystone"
+if [ ! -d "${KEYSTONE_DIR}" ]; then
+ echo "Error: keystone not found. Install with: brew install keystone"
+ exit 1
+fi
+KEYSTONE_STATIC="$(find "${KEYSTONE_DIR}" -name 'libkeystone.a' -type f 2>/dev/null | head -1)"
if [[ -z "${KEYSTONE_STATIC}" ]]; then
echo "Error: libkeystone.a not found. Install with: brew install keystone"
exit 1
diff --git a/sources/vphone-cli/VPhoneCLI.swift b/sources/vphone-cli/VPhoneCLI.swift
index dcf8e3d7..5a2c6f5a 100644
--- a/sources/vphone-cli/VPhoneCLI.swift
+++ b/sources/vphone-cli/VPhoneCLI.swift
@@ -19,7 +19,7 @@ struct VPhoneCLI: AsyncParsableCommand {
Example:
vphone-cli --rom firmware/rom.bin --disk firmware/disk.img
- """,
+ """
)
@Option(help: "Path to the AVPBooter / ROM binary")
@@ -98,7 +98,7 @@ struct VPhoneCLI: AsyncParsableCommand {
sepRomURL: sepRomURL,
serialLogPath: serialLog,
stopOnPanic: stopOnPanic,
- stopOnFatalError: stopOnFatalError,
+ stopOnFatalError: stopOnFatalError
)
let vm = try VPhoneVM(options: options)
diff --git a/sources/vphone-cli/VPhoneVM.swift b/sources/vphone-cli/VPhoneVM.swift
index 57255031..7d706b1d 100644
--- a/sources/vphone-cli/VPhoneVM.swift
+++ b/sources/vphone-cli/VPhoneVM.swift
@@ -48,7 +48,7 @@ class VPhoneVM: NSObject, VZVirtualMachineDelegate {
let auxStorage = try VZMacAuxiliaryStorage(
creatingStorageAt: options.nvramURL,
hardwareModel: hwModel,
- options: .allowOverwrite,
+ options: .allowOverwrite
)
platform.auxiliaryStorage = auxStorage
platform.hardwareModel = hwModel