Skip to content

Commit 429c02f

Browse files
committed
Use Joel's test build of WASI-SDK with dylib support for building the engine
Also produce relocatable code for Rust libraries and update to Rust 1.75 toolchain
1 parent 9bbabb9 commit 429c02f

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
run: |
3232
mkdir dist
3333
sudo apt-get update -y
34+
wget --no-verbose https://github.com/dicej/wasi-sdk/releases/download/filesystem-fix-v3/wasi-sdk-20.25g964191c91aac-linux.tar.gz
35+
tar -xf wasi-sdk-20.25g964191c91aac-linux.tar.gz
36+
export WASI_SDK_PREFIX=$PWD/wasi-sdk-20.25g964191c91aac
3437
bash ./build-engine.sh release
3538
tar -a -cf dist/spidermonkey-wasm-static-lib_release.tar.gz release
3639
rm -rf release obj-release

build-engine.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ ac_add_options --enable-portable-baseline-interp
2929
ac_add_options --prefix=${working_dir}/${objdir}/dist
3030
mk_add_options MOZ_OBJDIR=${working_dir}/${objdir}
3131
mk_add_options AUTOCLOBBER=1
32+
export RUSTFLAGS="-C relocation-model=pic"
33+
export RUSTC_BOOTSTRAP=1
34+
export CFLAGS="-fPIC"
35+
export CXXFLAGS="-fPIC"
36+
3237
EOF
3338

3439
target="$(uname)"
@@ -105,6 +110,15 @@ python3 \
105110

106111
cd "$working_dir"
107112

113+
if [[ -z "${WASI_SDK_PREFIX}" ]]; then
114+
echo "WASI_SDK_PREFIX not set, using default compiler and sysroot"
115+
else
116+
mv ~/.mozbuild/clang ~/.mozbuild/clang.orig
117+
mv ~/.mozbuild/sysroot-wasm32-wasi ~/.mozbuild/sysroot-wasm32-wasi.orig
118+
ln -s "${WASI_SDK_PREFIX}" ~/.mozbuild/clang
119+
ln -s "${WASI_SDK_PREFIX}/share/wasi-sysroot" ~/.mozbuild/sysroot-wasm32-wasi
120+
fi
121+
108122
# Build SpiderMonkey for WASI
109123
MOZCONFIG="${mozconfig}" \
110124
MOZ_FETCHES_DIR=~/.mozbuild \

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "1.68.2"
2+
channel = "1.75"
33
targets = [ "wasm32-wasi" ]
44
profile = "minimal"

0 commit comments

Comments
 (0)