Skip to content

Commit bced3f9

Browse files
committed
pipeline: Run proper cross compile host
The build-using-self script was always using macos arm64 as a cross compile host. Modify the build-using-self's cross compile host to use x86_64 when on ARM, and arm64 when on another host architecture.
1 parent 71ab073 commit bced3f9

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

Diff for: Utilities/build-using-self

+19-18
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_swiftpm_bin_dir(config: Configuration) -> pathlib.Path:
8989

9090

9191
def is_on_darwin() -> bool:
92-
return platform.uname().system == "Darwin"
92+
return platform.system() == "Darwin"
9393

9494

9595
def set_environment(*, swiftpm_bin_dir: pathlib.Path,) -> None:
@@ -107,22 +107,22 @@ def set_environment(*, swiftpm_bin_dir: pathlib.Path,) -> None:
107107

108108

109109
def run_bootstrap(swiftpm_bin_dir: pathlib.Path) -> None:
110-
if is_on_darwin():
111-
logging.info("Current working directory is %s", pathlib.Path.cwd())
112-
logging.info("Bootstrapping with the XCBuild codepath...")
113-
call(
114-
[
115-
REPO_ROOT_PATH / "Utilities" / "bootstrap",
116-
"build",
117-
"--release",
118-
"--verbose",
119-
"--cross-compile-hosts",
120-
"macosx-arm64",
121-
"--skip-cmake-bootstrap",
122-
"--swift-build-path",
123-
(swiftpm_bin_dir / "swift-build").resolve(),
124-
],
125-
)
110+
logging.info("Current working directory is %s", pathlib.Path.cwd())
111+
logging.info("Bootstrapping with the XCBuild codepath...")
112+
cross_compile_arch = "x86_64" if platform.machine() == "arm64" else "arm64"
113+
call(
114+
[
115+
REPO_ROOT_PATH / "Utilities" / "bootstrap",
116+
"build",
117+
"--release",
118+
"--verbose",
119+
"--cross-compile-hosts",
120+
f"macosx-{cross_compile_arch}",
121+
"--skip-cmake-bootstrap",
122+
"--swift-build-path",
123+
(swiftpm_bin_dir / "swift-build").resolve(),
124+
],
125+
)
126126

127127

128128
def main() -> None:
@@ -158,7 +158,8 @@ def main() -> None:
158158
),
159159
)
160160

161-
run_bootstrap(swiftpm_bin_dir=swiftpm_bin_dir)
161+
if is_on_darwin():
162+
run_bootstrap(swiftpm_bin_dir=swiftpm_bin_dir)
162163

163164

164165
if __name__ == "__main__":

0 commit comments

Comments
 (0)