Skip to content

Commit a30e74f

Browse files
Add 6.2 scheme files
We already have 6.2 snapshot Swift SDKs available on swift.org but let's keep having the 6.2 snapshots in swiftwasm/swift as well for now until we make wasip1-threads target available in swift.org SDK
1 parent 70fbbbf commit a30e74f

File tree

4 files changed

+166
-0
lines changed

4 files changed

+166
-0
lines changed

.github/scripts/build-matrix.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"main": "ghcr.io/swiftwasm/swift-ci:main-ubuntu-22.04",
1313
"release-6.0": "ghcr.io/swiftwasm/swift-ci:main-ubuntu-20.04@sha256:06faf7795ea077b64986b1c821a27b2756242ebe6d73adcdae17f4e424c17dc5",
1414
"release-6.1": "ghcr.io/swiftwasm/swift-ci:main-ubuntu-20.04@sha256:06faf7795ea077b64986b1c821a27b2756242ebe6d73adcdae17f4e424c17dc5",
15+
"release-6.2": "ghcr.io/swiftwasm/swift-ci:main-ubuntu-20.04@sha256:ef0e9e4ff5b457103d8a060573050d9b33c91d9f680f7d4202412a99dc52cde0",
1516
},
1617
"run_stdlib_test": true,
1718
"run_full_test": false,
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#!/bin/bash
2+
#
3+
# Build the Swift standard library.
4+
5+
set -euo pipefail
6+
set -x
7+
8+
print_help() {
9+
echo "Usage: $0 [options]"
10+
echo ""
11+
echo "Options:"
12+
echo " --help Display this help message."
13+
echo " --llvm-bin Path to LLVM bin directory."
14+
echo " --swift-bin Path to Swift bin directory."
15+
}
16+
17+
SCHEMES_BUILD_PATH="$(cd "$(dirname "$0")" && pwd)"
18+
SOURCE_PATH="$(cd "$(dirname "$0")/../../../.." && pwd)"
19+
TARGET_BUILD_ROOT=$SOURCE_PATH/build/WebAssembly
20+
WASI_SYSROOT_PATH="$TARGET_BUILD_ROOT/wasi-sysroot"
21+
PACKAGING_DIR="$SOURCE_PATH/build/Packaging"
22+
TARGET_TOOLCHAIN_DESTDIR=$PACKAGING_DIR/target-toolchain
23+
24+
build_target_toolchain() {
25+
26+
local LLVM_BIN_DIR="$1"
27+
local CLANG_BIN_DIR="$2"
28+
local SWIFT_BIN_DIR="$3"
29+
local TRIPLE="$4"
30+
local SHORT_TRIPLE="$5"
31+
local CLANG_MULTIARCH_TRIPLE="$6"
32+
local STDLIB_PRODUCT="$7"
33+
local COMPILER_RT_OS_DIR="$8"
34+
35+
local HOST_SUFFIX
36+
HOST_SUFFIX=$(find "$TARGET_BUILD_ROOT" -name "wasmstdlib-*" -exec basename {} \; | sed 's/wasmstdlib-//')
37+
38+
local TRIPLE_DESTDIR="$TARGET_TOOLCHAIN_DESTDIR/$TRIPLE"
39+
40+
env DESTDIR="$TRIPLE_DESTDIR" \
41+
cmake --install "$TARGET_BUILD_ROOT/$STDLIB_PRODUCT-$HOST_SUFFIX" --prefix /usr
42+
43+
env DESTDIR="$TRIPLE_DESTDIR" \
44+
cmake --install "$TARGET_BUILD_ROOT/wasmswiftsdk-$HOST_SUFFIX/swift-testing/$TRIPLE" --prefix /usr
45+
env DESTDIR="$TRIPLE_DESTDIR" \
46+
cmake --install "$TARGET_BUILD_ROOT/wasmswiftsdk-$HOST_SUFFIX/foundation/$TRIPLE" --prefix /usr
47+
env DESTDIR="$TRIPLE_DESTDIR" \
48+
cmake --install "$TARGET_BUILD_ROOT/wasmswiftsdk-$HOST_SUFFIX/xctest/$TRIPLE" --prefix /usr
49+
50+
rm -rf "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
51+
# XXX: Is this the right way to install compiler-rt?
52+
cp -R "$TARGET_BUILD_ROOT/wasi-sysroot/$CLANG_MULTIARCH_TRIPLE/lib/$COMPILER_RT_OS_DIR" "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
53+
54+
# FIXME: The following is a workaround for the issue with wrong libxml2.a path
55+
local LIBXML2_PATH_TO_FIX="$TARGET_BUILD_ROOT/wasi-sysroot/$CLANG_MULTIARCH_TRIPLE/lib/libxml2.a"
56+
if [[ -f "$LIBXML2_PATH_TO_FIX" ]]; then
57+
cp "$LIBXML2_PATH_TO_FIX" "$TRIPLE_DESTDIR/usr/lib/swift_static/wasi/libxml2.a"
58+
fi
59+
}
60+
61+
main() {
62+
local OPTIONS_LLVM_BIN=""
63+
local OPTIONS_CLANG_BIN=""
64+
local OPTIONS_SWIFT_BIN=""
65+
66+
while [[ $# -gt 0 ]]; do
67+
case "$1" in
68+
--llvm-bin)
69+
OPTIONS_LLVM_BIN="$2"
70+
shift 2
71+
;;
72+
--clang-bin)
73+
OPTIONS_CLANG_BIN="$2"
74+
shift 2
75+
;;
76+
--swift-bin)
77+
OPTIONS_SWIFT_BIN="$2"
78+
shift 2
79+
;;
80+
--scheme)
81+
OPTIONS_SCHEME="$2"
82+
shift 2
83+
;;
84+
--help)
85+
print_help
86+
exit 0
87+
;;
88+
*)
89+
echo "Unknown option: $1"
90+
print_help
91+
exit 1
92+
;;
93+
esac
94+
done
95+
96+
if [[ -z "$OPTIONS_LLVM_BIN" ]]; then
97+
echo "Missing --llvm-bin option"
98+
print_help
99+
exit 1
100+
fi
101+
102+
if [[ -z "$OPTIONS_SWIFT_BIN" ]]; then
103+
echo "Missing --swift-bin option"
104+
print_help
105+
exit 1
106+
fi
107+
108+
if [[ -z "$OPTIONS_CLANG_BIN" ]]; then
109+
OPTIONS_CLANG_BIN="$OPTIONS_LLVM_BIN"
110+
fi
111+
112+
# NOTE: The llvm-cmake-options is a workaround for the issue on amazonlinux2
113+
# See https://github.com/apple/swift/commit/40c7268e8f7d402b27e3ad16a84180e07c37f92c
114+
# NOTE: Add llvm-bin directory to PATH so that wasmstdlib.py can find FileCheck during tests
115+
env PATH="$OPTIONS_LLVM_BIN:$OPTIONS_SWIFT_BIN:$PATH" "$SOURCE_PATH/swift/utils/build-script" \
116+
--build-subdir=WebAssembly \
117+
--release \
118+
--skip-build-llvm \
119+
--skip-build-swift \
120+
--skip-build-cmark \
121+
--skip-build-benchmarks \
122+
--skip-early-swift-driver \
123+
--wasmkit \
124+
--build-wasm-stdlib \
125+
--skip-test-wasm-stdlib \
126+
--native-swift-tools-path="$OPTIONS_SWIFT_BIN" \
127+
--native-clang-tools-path="$OPTIONS_CLANG_BIN" \
128+
--native-llvm-tools-path="$OPTIONS_LLVM_BIN" \
129+
--build-runtime-with-host-compiler \
130+
--extra-cmake-options="\
131+
-DSWIFT_STDLIB_TRACING=NO \
132+
-DSWIFT_STDLIB_HAS_ASL=NO \
133+
-DSWIFT_STDLIB_CONCURRENCY_TRACING=NO \
134+
-DSWIFT_RUNTIME_CRASH_REPORTER_CLIENT=NO \
135+
-DSWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS=NO \
136+
" \
137+
--llvm-cmake-options="\
138+
-DCROSS_TOOLCHAIN_FLAGS_LLVM_NATIVE='-DCMAKE_C_COMPILER=clang;-DCMAKE_CXX_COMPILER=clang++' \
139+
" \
140+
--sccache
141+
142+
local BUILD_TOOLS_ARGS=(
143+
"$OPTIONS_LLVM_BIN"
144+
"$OPTIONS_CLANG_BIN"
145+
"$OPTIONS_SWIFT_BIN"
146+
)
147+
148+
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1" "wasip1-wasm32" "wasm32-wasip1" "wasmstdlib" "wasip1"
149+
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1-threads" "wasip1-threads-wasm32" "wasm32-wasip1-threads" "wasmthreadsstdlib" "wasip1"
150+
151+
rsync -av "$WASI_SYSROOT_PATH/" "$PACKAGING_DIR/wasi-sysroot/"
152+
}
153+
154+
main "$@"

schemes/release-6.2/build/run-test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
5+
echo "Skipping test because we now run tests in build-script"

schemes/release-6.2/manifest.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"base-tag": "swift-6.2-DEVELOPMENT-SNAPSHOT-2025-08-14-a",
3+
"icu4c": [],
4+
"libxml2": [],
5+
"swift-org-download-channel": "swift-6.2-branch"
6+
}

0 commit comments

Comments
 (0)