Skip to content

Commit db348a1

Browse files
Build swift-testing
1 parent 51e8c2b commit db348a1

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ build_target_toolchain() {
2828
local SWIFT_BIN_DIR="$3"
2929
local TRIPLE="$4"
3030
local SHORT_TRIPLE="$5"
31-
local STDLIB_PRODUCT="$6"
32-
local COMPILER_RT_OS_DIR="$7"
31+
local CLANG_MULTIARCH_TRIPLE="$6"
32+
local STDLIB_PRODUCT="$7"
33+
local COMPILER_RT_OS_DIR="$8"
3334

3435
local HOST_SUFFIX
3536
HOST_SUFFIX=$(find "$TARGET_BUILD_ROOT" -name "wasmstdlib-*" -exec basename {} \; | sed 's/wasmstdlib-//')
@@ -39,9 +40,16 @@ build_target_toolchain() {
3940
env DESTDIR="$TRIPLE_DESTDIR" \
4041
cmake --install "$TARGET_BUILD_ROOT/$STDLIB_PRODUCT-$HOST_SUFFIX" --prefix /usr
4142

43+
local swift_testing_build_dir="$TARGET_BUILD_ROOT/swift-testing-$SHORT_TRIPLE"
44+
# TODO: Remove this check once we build swift-testing for +threads target
45+
if [[ -d "$swift_testing_build_dir" ]]; then
46+
env DESTDIR="$TRIPLE_DESTDIR" \
47+
cmake --install "$swift_testing_build_dir" --prefix /usr
48+
fi
49+
4250
rm -rf "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
4351
# XXX: Is this the right way to install compiler-rt?
44-
cp -R "$TARGET_BUILD_ROOT/wasi-sysroot/$SHORT_TRIPLE/lib/$COMPILER_RT_OS_DIR" "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
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"
4553

4654
# FIXME: Clang resource directory installation is not the best way currently.
4755
# We currently have two copies of compiler headers copied from the base toolchain in
@@ -160,8 +168,8 @@ main() {
160168
"$OPTIONS_SWIFT_BIN"
161169
)
162170

163-
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasi" "wasm32-wasi" "wasmstdlib" "wasi"
164-
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1-threads" "wasm32-wasip1-threads" "wasmthreadsstdlib" "wasip1"
171+
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasi" "wasi-wasm32" "wasm32-wasi" "wasmstdlib" "wasi"
172+
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1-threads" "wasip1-threads-wasm32" "wasm32-wasip1-threads" "wasmthreadsstdlib" "wasip1"
165173

166174
rsync -av "$WASI_SYSROOT_PATH/" "$PACKAGING_DIR/wasi-sysroot/"
167175

0 commit comments

Comments
 (0)