Skip to content

Commit 2966c0a

Browse files
Update main snapshot to 2025-07-23
1 parent 3be2d4f commit 2966c0a

File tree

9 files changed

+76
-42
lines changed

9 files changed

+76
-42
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $ ./tools/build/install-build-sdk.sh main
1414
# Checkout the Swift repositories in the parent directory (swiftwasm-source) and apply patches
1515
$ ./tools/git-swift-workspace --scheme main
1616
# Build the toolchain (this will take a while)
17-
$ ./tools/build/build-toolchain.sh main
17+
$ ./tools/build/build-toolchain main
1818
```
1919

2020
See [SwiftWasm book](https://book.swiftwasm.org/contribution-guide/how-to-build-toolchain.html) for more details about dependencies you need to install and how to build on Docker.

docs/upstreaming.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,7 @@ If it's first time to build or patch files are changed, you need to checkout the
6565
If you want to build the whole toolchain, run the following command:
6666

6767
```
68-
./tools/build/build-toolchain.sh
69-
```
70-
71-
If you already built the compiler and want to build only the standard library for WebAssembly, run the following command:
72-
73-
```
74-
./tools/build/build-toolchain.sh --skip-build-host-toolchain
68+
./tools/build/build-toolchain --scheme main
7569
```
7670

7771
### Edit

schemes/main/build/build-target-toolchain.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,22 @@ main() {
137137

138138
# NOTE: The llvm-cmake-options is a workaround for the issue on amazonlinux2
139139
# See https://github.com/apple/swift/commit/40c7268e8f7d402b27e3ad16a84180e07c37f92c
140-
"$SOURCE_PATH/swift/utils/build-script" \
140+
# NOTE: Add llvm-bin directory to PATH so that wasmstdlib.py can find FileCheck during tests
141+
env PATH="$OPTIONS_LLVM_BIN:$OPTIONS_SWIFT_BIN:$PATH" "$SOURCE_PATH/swift/utils/build-script" \
141142
--build-subdir=WebAssembly \
142143
--release \
143144
--skip-build-llvm \
144145
--skip-build-swift \
145146
--skip-build-cmark \
146147
--skip-build-benchmarks \
147148
--skip-early-swift-driver \
149+
--wasmkit \
148150
--build-wasm-stdlib \
149151
--skip-test-wasm-stdlib \
150152
--native-swift-tools-path="$OPTIONS_SWIFT_BIN" \
151153
--native-clang-tools-path="$OPTIONS_CLANG_BIN" \
152154
--native-llvm-tools-path="$OPTIONS_LLVM_BIN" \
155+
--build-runtime-with-host-compiler \
153156
--extra-cmake-options="\
154157
-DSWIFT_STDLIB_TRACING=NO \
155158
-DSWIFT_STDLIB_HAS_ASL=NO \

schemes/main/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"base-tag": "swift-DEVELOPMENT-SNAPSHOT-2025-07-18-a",
2+
"base-tag": "swift-DEVELOPMENT-SNAPSHOT-2025-07-23-a",
33
"icu4c": [],
44
"libxml2": [
55
"https://github.com/swiftwasm/libxml2-wasm/releases/download/2.0.0/libxml2-wasm32-unknown-wasi.tar.gz",

tools/build/build-toolchain

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import argparse
5+
import pathlib
6+
import subprocess
7+
from build_support.actions import derive_options_from_args, REPO_ROOT, DownloadBaseSnapshotAction
8+
9+
10+
def main():
11+
parser = argparse.ArgumentParser(description='Build the Swift toolchain')
12+
options = derive_options_from_args(sys.argv[1:], parser)
13+
14+
# Calculate paths
15+
repo_path = pathlib.Path(REPO_ROOT)
16+
source_path = repo_path.parent
17+
tools_build_path = pathlib.Path(__file__).parent
18+
19+
build_dir = source_path / "build"
20+
cross_compiler_destdir = pathlib.Path(DownloadBaseSnapshotAction.toolchain_path(options))
21+
22+
# Install base toolchain
23+
print("=====> Installing base toolchain")
24+
subprocess.check_call([
25+
str(tools_build_path / "install-base-toolchain"),
26+
"--scheme", options.scheme
27+
])
28+
29+
# Build LLVM tools
30+
print("=====> Building LLVM tools")
31+
subprocess.check_call([
32+
str(tools_build_path / "build-llvm-tools"),
33+
"--toolchain", str(cross_compiler_destdir)
34+
])
35+
36+
# Build target toolchain
37+
print("=====> Building target toolchain")
38+
scheme_build_script = repo_path / "schemes" / options.scheme / "build" / "build-target-toolchain.sh"
39+
40+
subprocess.check_call([
41+
str(scheme_build_script),
42+
"--llvm-bin", str(build_dir / "llvm-tools" / "bin"),
43+
"--clang-bin", str(cross_compiler_destdir / "usr" / "bin"),
44+
"--swift-bin", str(cross_compiler_destdir / "usr" / "bin"),
45+
"--scheme", options.scheme
46+
])
47+
48+
49+
if __name__ == '__main__':
50+
main()

tools/build/build-toolchain.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

tools/build/build_support/actions.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,25 @@ def run(self):
114114
self.system('git', '-C', f'../{repo}', 'checkout', rev)
115115

116116
class DownloadBaseSnapshotAction(Action):
117+
118+
@staticmethod
119+
def toolchains_dir():
120+
return os.path.join(REPO_ROOT, '..', 'build', 'Packaging', 'base-toolchain')
121+
122+
@staticmethod
123+
def toolchain_path(options):
124+
return os.path.join(DownloadBaseSnapshotAction.toolchains_dir(), options.tag)
125+
117126
def run(self):
118127
platform_info = platform.PlatformInfo.derive()
119128
snapshot_url, tarball_name = platform_info.snapshot_url(self.options.swift_org_download_channel, self.options.tag)
120129
extension = platform_info.package_extension
121130

122-
tarball_path = os.path.join('..', 'build', 'Packaging', f'base-snapshot.{extension}')
123-
base_snapshot_dir = os.path.join('..', 'build', 'Packaging', 'base-snapshot')
131+
base_toolchain_dir = DownloadBaseSnapshotAction.toolchain_path(self.options)
132+
tarball_path = os.path.join(os.path.dirname(base_toolchain_dir), tarball_name)
124133

125-
if os.path.exists(os.path.join(base_snapshot_dir, 'usr')):
126-
print(f"=====> Base snapshot '{base_snapshot_dir}' already exists")
134+
if os.path.exists(os.path.join(base_toolchain_dir, 'usr')):
135+
print(f"=====> Base snapshot '{base_toolchain_dir}' already exists")
127136
return
128137

129138
if not os.path.exists(tarball_path):
@@ -132,15 +141,15 @@ def run(self):
132141
self.system('curl', '--fail', '-L', '-o', tarball_path, snapshot_url)
133142

134143
print(f"=====> Unpacking base snapshot {tarball_name}")
135-
os.makedirs(base_snapshot_dir, exist_ok=True)
144+
os.makedirs(base_toolchain_dir, exist_ok=True)
136145
if extension == "tar.gz":
137-
self.system('tar', '-C', base_snapshot_dir, '--strip-components', '1', '-xzf', tarball_path)
146+
self.system('tar', '-C', base_toolchain_dir, '--strip-components', '1', '-xzf', tarball_path)
138147
elif extension == "pkg":
139148
import tempfile
140149
with tempfile.TemporaryDirectory() as tmpdir:
141150
self.system('xar', '-xf', tarball_path, '-C', tmpdir)
142151
old_cwd = os.getcwd()
143-
os.chdir(base_snapshot_dir)
152+
os.chdir(base_toolchain_dir)
144153
pkg_name = tarball_name.replace(".pkg", "-package.pkg")
145154
self.system('cpio', '-i', '-I', os.path.join(tmpdir, pkg_name, 'Payload'))
146155
os.chdir(old_cwd)

tools/build/build_support/llvm_tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
# These tools are used by Swift test suite
99
'llvm-nm',
1010
'FileCheck',
11-
]
11+
'split-file',
12+
]

tools/build/ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ install_sccache_if_needed() {
3434
install_sccache_if_needed
3535
export PATH="$SCCACHE_INSTALL_PATH:$PATH"
3636

37-
$TOOLS_BUILD_PATH/build-toolchain.sh "$SCHEME"
37+
$TOOLS_BUILD_PATH/build-toolchain --scheme "$SCHEME"
3838

3939
$TOOLS_BUILD_PATH/package-toolchain --scheme "$SCHEME" --daily-snapshot

0 commit comments

Comments
 (0)