Skip to content

Commit dd0215c

Browse files
Copy wasi-sysroot from target-triple specific directory
apple/swift build-script now builds wasi-sysroot for each target triple and stores them in target-triple specific directories.
1 parent 1a9604b commit dd0215c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tools/build/package-toolchain

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class SnapshotInfo:
3737
return f"{self.artifact_name}.artifactbundle.zip"
3838

3939

40-
def derive_wasi_sysroot(options, packaging_dir: str) -> str:
40+
def derive_wasi_sysroot(options, packaging_dir: str, target_triple: str) -> str:
4141
if options.download_wasi_sysroot:
4242
return os.path.join('..', 'build-sdk', 'wasi-sysroot')
4343
else:
44-
return os.path.join(packaging_dir, 'wasi-sysroot')
44+
return os.path.join(packaging_dir, 'wasi-sysroot', target_triple)
4545

4646

4747
def copy_icu_libs(build_sdk_path, dist_toolchain_path):
@@ -116,7 +116,7 @@ class PackageAction(Action):
116116
os.remove(swift_driver_path)
117117

118118
# Select wasi-sysroot
119-
wasi_sysroot_path = derive_wasi_sysroot(self.options, packaging_dir)
119+
wasi_sysroot_path = derive_wasi_sysroot(self.options, packaging_dir, 'wasm32-wasi')
120120
print("=====> Using wasi-sysroot from {}".format(wasi_sysroot_path))
121121

122122
# Now dist toolchain always has cross compiler regardless of whether
@@ -439,8 +439,9 @@ def main():
439439
os.path.dirname(__file__), '..', '..', '..', 'build', 'Packaging')
440440

441441
toolchain_channel = derive_toolchain_channel(options.scheme)
442-
for target_triple in [
443-
"wasm32-unknown-wasi", "wasm32-unknown-wasip1-threads"
442+
for target_triple, short_triple in [
443+
["wasm32-unknown-wasi", "wasm32-wasi"],
444+
["wasm32-unknown-wasip1-threads", "wasm32-wasip1-threads"]
444445
]:
445446
snapshot_info = SnapshotInfo(
446447
now.year, now.month, now.day,
@@ -454,7 +455,7 @@ def main():
454455
base_toolchain_path=os.path.join(packaging_dir, 'base-snapshot'),
455456
host_toolchain_path=None,
456457
target_toolchain_path=os.path.join(packaging_dir, 'target-toolchain', target_triple),
457-
wasi_sysroot_path=derive_wasi_sysroot(options, packaging_dir),
458+
wasi_sysroot_path=derive_wasi_sysroot(options, packaging_dir, short_triple),
458459
swift_sdk_name=f"{snapshot_info.swift_version}-{target_triple}",
459460
target_triple=target_triple,
460461
))

0 commit comments

Comments
 (0)