Skip to content

Commit 42c6603

Browse files
committed
Update WASI SDK, create installable package on macOS (#14)
New WASI SDK package should contain a new version of the linker. Also, the script should now create an installable package on macOS so that one could create a full SwiftWasm package later after the build. * Update WASI SDK, create installable package on macOS * Fix sysroot path, update wasi-sdk on Linux * Exclude module net for wasm SDK in glibc.modulemap * Remove module termios from glic.modulemap for wasm * Disable _stdlib_mkstemps for wasm
1 parent e2c69ed commit 42c6603

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

build-linux.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#/bin/bash
22

3+
export sourcedir=$PWD/..
4+
35
./utils/build-script --release --wasm --verbose \
46
--skip-build-benchmarks \
57
--extra-cmake-options=" \

build-mac.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#/bin/bash
22

3+
export sourcedir=$PWD/..
4+
35
./utils/build-script --release --wasm --verbose \
46
--skip-build-benchmarks \
57
--extra-cmake-options=" \
@@ -22,4 +24,8 @@
2224
--wasm-icu-i18n-include "$sourcedir/icu_out/include" \
2325
--wasm-icu-uc "$sourcedir/icu_out/lib" \
2426
--wasm-icu-uc-include "$sourcedir/icu_out/include" \
25-
--wasm-wasi-sdk "$sourcedir/wasi-sdk"
27+
--wasm-wasi-sdk "$sourcedir/wasi-sdk" \
28+
--install-swift \
29+
--install-prefix="/opt/swiftwasm-sdk" \
30+
--install-destdir="$sourcedir/install" \
31+
--installable-package="$sourcedir/swiftwasm-mac.tar.gz"

ci-linux.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ sudo ./install_cmake.sh --skip-license --prefix=/opt/cmake
2222
sudo ln -sf /opt/cmake/bin/* /usr/local/bin
2323
cmake --version
2424

25-
wget -O wasi-sdk.tar.gz https://github.com/swiftwasm/wasi-sdk/releases/download/20190421.6/wasi-sdk-3.19gefb17cb478f9.m-linux.tar.gz
25+
wget -O wasi-sdk.tar.gz https://github.com/swiftwasm/wasi-sdk/releases/download/20191022.1/wasi-sdk-4.39g3025a5f47c04-linux.tar.gz
2626
tar xfz wasi-sdk.tar.gz
27-
mv wasi-sdk-3.19gefb17cb478f9+m/opt/wasi-sdk ./wasi-sdk
27+
mv wasi-sdk-4.39g3025a5f47c04 ./wasi-sdk
28+
mv wasi-sdk/share/wasi-sysroot wasi-sdk/share/sysroot
2829

2930
wget -O icu.tar.xz "https://github.com/swiftwasm/icu4c-wasi/releases/download/20190421.3/icu4c-wasi.tar.xz"
3031
tar xf icu.tar.xz

ci-mac.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ export current_sha=`git rev-parse HEAD`
66
git checkout $current_sha
77
export sourcedir=$PWD/..
88
cd $sourcedir
9-
wget -O wasi-sdk.tar.gz https://github.com/swiftwasm/wasi-sdk/releases/download/20190421.6/wasi-sdk-3.19gefb17cb478f9.m-linux.tar.gz
9+
wget -O wasi-sdk.tar.gz https://github.com/swiftwasm/wasi-sdk/releases/download/20191022.1/wasi-sdk-4.39g3025a5f47c04-linux.tar.gz
1010
tar xfz wasi-sdk.tar.gz
11-
mv wasi-sdk-3.19gefb17cb478f9+m/opt/wasi-sdk ./wasi-sdk
11+
mv wasi-sdk-4.39g3025a5f47c04 ./wasi-sdk
12+
mv wasi-sdk/share/wasi-sysroot wasi-sdk/share/sysroot
1213
# Link sysroot/usr/include to sysroot/include because Darwin sysroot doesn't
1314
# find header files in sysroot/include but sysroot/usr/include
1415
mkdir wasi-sdk/share/sysroot/usr/

stdlib/private/SwiftPrivateLibcExtras/SwiftPrivateLibcExtras.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import MSVCRT
2020
#endif
2121

2222
public func _stdlib_mkstemps(_ template: inout String, _ suffixlen: CInt) -> CInt {
23-
#if os(Android) || os(Haiku) || os(Windows)
23+
#if os(Android) || os(Haiku) || os(Windows) || os(Wasm)
2424
preconditionFailure("mkstemps doesn't work on your platform")
2525
#else
2626
var utf8CStr = template.utf8CString

stdlib/public/Platform/glibc.modulemap.gyb

+4
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,14 @@ module SwiftGlibc [system] {
353353
header "${GLIBC_INCLUDE_PATH}/libgen.h"
354354
export *
355355
}
356+
% if CMAKE_SDK != "WASM":
356357
module net {
357358
module if {
358359
header "${GLIBC_INCLUDE_PATH}/net/if.h"
359360
export *
360361
}
361362
}
363+
% end
362364
module netinet {
363365
module in {
364366
header "${GLIBC_INCLUDE_PATH}/netinet/in.h"
@@ -517,10 +519,12 @@ module SwiftGlibc [system] {
517519
export *
518520
}
519521
% end
522+
% if CMAKE_SDK != "WASM":
520523
module termios {
521524
header "${GLIBC_INCLUDE_PATH}/termios.h"
522525
export *
523526
}
527+
% end
524528
module unistd {
525529
header "${GLIBC_INCLUDE_PATH}/unistd.h"
526530
export *

0 commit comments

Comments
 (0)