From d154dbe2d540547f7ca0c17d3d4cc89cbf73b8de Mon Sep 17 00:00:00 2001 From: Eric Miotto <1094986+edymtt@users.noreply.github.com> Date: Fri, 2 Sep 2022 04:46:14 -0700 Subject: [PATCH 1/2] bootstrap: generalize check for cross-compilation on Darwin ...so that the build with swiftpm can start. This will allow to build a Swift toolchain on Apple Silicon Addresses rdar://99484030 --- Utilities/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/bootstrap b/Utilities/bootstrap index 4e4898c5cd6..b859106b3d7 100755 --- a/Utilities/bootstrap +++ b/Utilities/bootstrap @@ -815,7 +815,7 @@ def get_swiftpm_flags(args): build_target = get_build_target(args) cross_compile_hosts = args.cross_compile_hosts - if build_target == 'x86_64-apple-macosx' and "macosx-arm64" in cross_compile_hosts: + if cross_compile_hosts and re.match('macosx-', cross_compile_hosts): build_flags += ["--arch", "x86_64", "--arch", "arm64"] elif cross_compile_hosts and re.match('android-', cross_compile_hosts): build_flags.extend(["--destination", args.cross_compile_config]) From 90c5645c0bbff01c87d6fdce1b0197b4c3e33458 Mon Sep 17 00:00:00 2001 From: Eric Miotto <1094986+edymtt@users.noreply.github.com> Date: Mon, 5 Sep 2022 07:00:20 -0700 Subject: [PATCH 2/2] Integrate review feedback --- Utilities/bootstrap | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Utilities/bootstrap b/Utilities/bootstrap index b859106b3d7..1c9b926a138 100755 --- a/Utilities/bootstrap +++ b/Utilities/bootstrap @@ -815,12 +815,13 @@ def get_swiftpm_flags(args): build_target = get_build_target(args) cross_compile_hosts = args.cross_compile_hosts - if cross_compile_hosts and re.match('macosx-', cross_compile_hosts): - build_flags += ["--arch", "x86_64", "--arch", "arm64"] - elif cross_compile_hosts and re.match('android-', cross_compile_hosts): - build_flags.extend(["--destination", args.cross_compile_config]) - elif cross_compile_hosts: - error("cannot cross-compile for %s" % cross_compile_hosts) + if cross_compile_hosts: + if re.search('-apple-macosx', build_target) and re.match('macosx-', cross_compile_hosts): + build_flags += ["--arch", "x86_64", "--arch", "arm64"] + elif re.match('android-', cross_compile_hosts): + build_flags.extend(["--destination", args.cross_compile_config]) + else: + error("cannot cross-compile for %s" % cross_compile_hosts) # Ensure we are not sharing the module cache with concurrent builds in CI local_module_cache_path=os.path.join(args.build_dir, "module-cache")