Skip to content

Commit 3a1dc8d

Browse files
authored
Manually set the target for iOS when building XCFramework (#7114)
1 parent 1a7a3b0 commit 3a1dc8d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

megazords/ios-rust/build-xcframework.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
BUILD_PROFILE="release"
66
FRAMEWORK_NAME="MozillaRustComponents"
77
IS_FOCUS=
8+
# This should match firefox-ios deployment target
9+
IOS_DEPLOYMENT_TARGET=${IOS_DEPLOYMENT_TARGET:-15.0}
810
# Optional flags to pass on to generate-files.sh
911
GENERATE_ARGS=()
1012
# FRAMEWORK_FILENAME exist purely because we would like to ship
@@ -106,6 +108,10 @@ cargo_build () {
106108
env -i \
107109
NSS_STATIC=1 \
108110
NSS_DIR="$LIBS_DIR/nss" \
111+
IPHONEOS_DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET" \
112+
CFLAGS_x86_64_apple_ios="${CFLAGS_x86_64_apple_ios:-}" \
113+
CFLAGS_aarch64_apple_ios="${CFLAGS_aarch64_apple_ios:-}" \
114+
CFLAGS_aarch64_apple_ios_simulator="${CFLAGS_aarch64_apple_ios_simulator:-}" \
109115
PATH="${PATH}" \
110116
RUSTC_WRAPPER="${RUSTC_WRAPPER:-}" \
111117
SCCACHE_IDLE_TIMEOUT="${SCCACHE_IDLE_TIMEOUT:-}" \
@@ -119,14 +125,15 @@ cargo_build () {
119125
set -euvx
120126

121127
# Intel iOS simulator
122-
CFLAGS_x86_64_apple_ios="-target x86_64-apple-ios" \
128+
CFLAGS_x86_64_apple_ios="-target x86_64-apple-ios -mios-simulator-version-min=${IOS_DEPLOYMENT_TARGET}" \
123129
cargo_build x86_64-apple-ios
124130

125131
# Hardware iOS targets
126-
cargo_build aarch64-apple-ios
132+
CFLAGS_aarch64_apple_ios="-target aarch64-apple-ios -miphoneos-version-min=${IOS_DEPLOYMENT_TARGET}" \
133+
cargo_build aarch64-apple-ios
127134

128135
# M1 iOS simulator.
129-
CFLAGS_aarch64_apple_ios_sim="--target aarch64-apple-ios-sim" \
136+
CFLAGS_aarch64_apple_ios_simulator="-target aarch64-apple-ios-sim -mios-simulator-version-min=${IOS_DEPLOYMENT_TARGET}" \
130137
cargo_build aarch64-apple-ios-sim
131138

132139
# TODO: would it be useful to also include desktop builds here?

0 commit comments

Comments
 (0)