Bug 1882661 - Add support for iPhoneSimulator. r=firefox-build-system-reviewers,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D203067
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$*" in
|
||||
"--show-sdk-path --sdk iphoneos"|"--show-sdk-path -sdk iphoneos")
|
||||
"--show-sdk-path --sdk iphoneos"|"--show-sdk-path -sdk iphoneos"|"--show-sdk-path --sdk iphonesimulator"|"--show-sdk-path -sdk iphonesimulator")
|
||||
;;
|
||||
*)
|
||||
echo We only expect this to be executed by third_party/rust/cc/src/lib.rs or rustc when targetting iOS >&2
|
||||
|
||||
@@ -531,6 +531,10 @@ def split_triplet(triplet, allow_wasi=False):
|
||||
# old-configure does plenty of tests against $target and $target_os
|
||||
# and expects darwin for iOS, so make it happy.
|
||||
sub_configure_alias = sub_configure_alias[: -len(os)] + "darwin"
|
||||
# rust knows ios-sim, clang knows ios-simulator. We only take the
|
||||
# former as --target, but we need to make clang happy.
|
||||
if os == "ios-sim":
|
||||
os = "ios-simulator"
|
||||
elif os.startswith("dragonfly"):
|
||||
canonical_os = canonical_kernel = "DragonFly"
|
||||
elif os.startswith("freebsd"):
|
||||
@@ -653,12 +657,13 @@ def help_host_target(help, host, target):
|
||||
|
||||
def config_sub(shell, triplet):
|
||||
config_sub = os.path.join(os.path.dirname(__file__), "..", "autoconf", "config.sub")
|
||||
# Config.sub doesn't like the *-windows-msvc/*-windows-gnu triplets, so
|
||||
# Config.sub doesn't like the *-windows-msvc/*-windows-gnu/*-ios-sim triplets, so
|
||||
# munge those before and after calling config.sub.
|
||||
suffix = None
|
||||
munging = {
|
||||
"-windows-msvc": "-mingw32",
|
||||
"-windows-gnu": "-mingw32",
|
||||
"-ios-sim": "-ios",
|
||||
}
|
||||
for check_suffix, replacement in munging.items():
|
||||
if triplet.endswith(check_suffix):
|
||||
|
||||
@@ -227,11 +227,11 @@ with only_when(target_is_ios):
|
||||
def ios_sdk_min_version():
|
||||
return "16.4"
|
||||
|
||||
@depends("--with-ios-sdk", host)
|
||||
@depends("--with-ios-sdk", host, target)
|
||||
@imports(_from="__builtin__", _import="Exception")
|
||||
@imports(_from="os.path", _import="isdir")
|
||||
@imports(_from="os", _import="listdir")
|
||||
def ios_sdk(sdk, host):
|
||||
def ios_sdk(sdk, host, target):
|
||||
if sdk:
|
||||
sdk = sdk[0]
|
||||
try:
|
||||
@@ -239,8 +239,9 @@ with only_when(target_is_ios):
|
||||
except Exception as e:
|
||||
die(e)
|
||||
elif host.os == "OSX":
|
||||
sdk_name = "iphonesimulator" if target.raw_os == "ios-sim" else "iphoneos"
|
||||
sdk = check_cmd_output(
|
||||
"xcrun", "--show-sdk-path", "--sdk", "iphoneos", onerror=lambda: ""
|
||||
"xcrun", "--show-sdk-path", "--sdk", sdk_name, onerror=lambda: ""
|
||||
).rstrip()
|
||||
if not sdk:
|
||||
die(
|
||||
@@ -251,7 +252,7 @@ with only_when(target_is_ios):
|
||||
sdk_dir = os.path.dirname(sdk)
|
||||
versions = []
|
||||
for d in listdir(sdk_dir):
|
||||
if d.lower().startswith("iphoneos"):
|
||||
if d.lower().startswith(sdk_name):
|
||||
try:
|
||||
sdk = os.path.join(sdk_dir, d)
|
||||
versions.append((get_sdk_version(sdk), sdk))
|
||||
@@ -552,7 +553,11 @@ def check_compiler(configure_cache, compiler, language, target, android_version)
|
||||
if "--target=arm64-apple-darwin" not in compiler:
|
||||
flags.append("--target=arm64-apple-darwin")
|
||||
has_target = True
|
||||
|
||||
elif target.os == "iOS":
|
||||
target_flag = "--target=%s" % toolchain
|
||||
if target_flag not in compiler:
|
||||
flags.append(target_flag)
|
||||
has_target = True
|
||||
elif (
|
||||
not info.kernel
|
||||
or info.kernel != target.kernel
|
||||
|
||||
Reference in New Issue
Block a user