- Extended iOS platform support to handle simulator targets with arm64-apple-ios-simulator - Added new ios-simulator.yml configuration for building simulator-compatible executables - Created build-ios.sh script to handle both device and simulator builds with parameter selection - Implemented dynamic SDK directory selection based on target platform (iphoneos vs iphonesimulator) - Updated error messages to reflect generic iOS SDK terminology instead of iPhoneOS specific - Added package-ios-simulator-app.sh for packaging simulator applications without provisioning profiles - Updated README documentation with complete iOS simulator setup and build instructions - Modified codesign commands to include --generate-entitlement-der flag for proper entitlement handling - Adjusted gitignore to exclude new ios-simulator-build directory and simulator executablemaster
parent
dddff48650
commit
b9c42eed1f
8 changed files with 148 additions and 11 deletions
@ -1,7 +1,9 @@ |
||||
/build/ |
||||
/build-*/ |
||||
/ios-build/ |
||||
/ios-simulator-build/ |
||||
/dist/ |
||||
/*.rsp |
||||
/typephp_macos_hello |
||||
/typephp_ios_hello |
||||
/typephp_ios_simulator_hello |
||||
|
||||
@ -0,0 +1,36 @@ |
||||
#!/bin/sh |
||||
|
||||
set -eu |
||||
|
||||
project_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) |
||||
repo_dir=$(CDPATH= cd -- "$project_dir/../.." && pwd) |
||||
|
||||
if [ -z "${PHPX_HOME:-}" ]; then |
||||
echo "Set PHPX_HOME to the PHPX checkout containing both iOS SDK prefixes." >&2 |
||||
exit 2 |
||||
fi |
||||
|
||||
case "${1:-}" in |
||||
device) |
||||
config=ios.yml |
||||
package_script=package-ios-app.sh |
||||
;; |
||||
simulator) |
||||
config=ios-simulator.yml |
||||
package_script=package-ios-simulator-app.sh |
||||
;; |
||||
*) |
||||
echo "Usage: $0 <device|simulator>" >&2 |
||||
exit 2 |
||||
;; |
||||
esac |
||||
|
||||
cd "$repo_dir" |
||||
php bin/tpc.php "examples/apple-native/$config" --no-progress |
||||
|
||||
if [ "$package_script" = package-ios-app.sh ] && |
||||
{ [ -z "${TYPEPHP_IOS_PROVISIONING_PROFILE:-}" ] || [ -z "${TYPEPHP_IOS_CODE_SIGN_IDENTITY:-}" ]; }; then |
||||
echo "Device executable built. Set the provisioning profile and signing identity, then run $project_dir/$package_script to package it." |
||||
else |
||||
sh "$project_dir/$package_script" |
||||
fi |
||||
@ -0,0 +1,26 @@ |
||||
name: typephp_ios_simulator_hello |
||||
version: 0.1.0 |
||||
mode: bin |
||||
output: typephp_ios_simulator_hello |
||||
php-version: "8.4" |
||||
cxx-std: c++17 |
||||
cpp-compiler: xcrun --sdk iphonesimulator clang++ |
||||
target-platform: arm64-apple-ios15.0-simulator |
||||
build-dir: ios-simulator-build |
||||
|
||||
sources: |
||||
- php-src/application.php |
||||
- php-src/ios-main.php |
||||
- ios-src |
||||
|
||||
cxx-flags: |
||||
- -fobjc-arc |
||||
- -mios-simulator-version-min=15.0 |
||||
|
||||
ld-flags: |
||||
- -mios-simulator-version-min=15.0 |
||||
- -Wl,-dead_strip |
||||
- -framework UIKit |
||||
- -framework Foundation |
||||
- -framework CoreGraphics |
||||
- -lresolv |
||||
@ -0,0 +1,23 @@ |
||||
#!/bin/sh |
||||
|
||||
set -eu |
||||
|
||||
project_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) |
||||
executable="$project_dir/typephp_ios_simulator_hello" |
||||
bundle="$project_dir/dist/TypePHP iOS Simulator Hello.app" |
||||
|
||||
if [ ! -x "$executable" ]; then |
||||
echo "Missing $executable; build ios-simulator.yml first." >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
mkdir -p "$bundle" |
||||
cp "$project_dir/Info-iOS.plist" "$bundle/Info.plist" |
||||
plutil -replace CFBundleExecutable -string typephp_ios_simulator_hello "$bundle/Info.plist" |
||||
plutil -replace CFBundleIdentifier -string org.swoole.typephp.ios-simulator-hello "$bundle/Info.plist" |
||||
cp "$executable" "$bundle/typephp_ios_simulator_hello" |
||||
cp "$project_dir"/ios-assets/AppIcon*.png "$bundle/" |
||||
codesign --force --sign - --timestamp=none "$bundle" |
||||
codesign --verify --deep --strict "$bundle" |
||||
|
||||
echo "Created $bundle" |
||||
Loading…
Reference in new issue