Skip to content

Commit f837809

Browse files
Update to SpiderMonkey 94beta (#3)
This PR updates to the current beta of SpiderMonkey 94. Previously we were using an arbitrary commit from the Nightly 92 cycle. Switching to beta means that we get more stability, but also get some important improvements that landed in that cycle. Over time, we should switch to stable releases, though. This PR also improves some aspects of the build script: - It can now be run from other directories, while still resolving its dependencies correctly - It continues working correctly when there already is a checkout of the gecko-dev repository, and updates that to the expected revision - It spends significantly less time on cloning the gecko-dev repository by not unconditionally fetching all tags and branches
1 parent 94b6b46 commit f837809

File tree

2 files changed

+35
-17
lines changed

2 files changed

+35
-17
lines changed

build-engine.sh

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,48 @@
11
#!/usr/bin/env bash
22
set -ex
33

4+
working_dir="$(pwd)"
5+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
6+
7+
# Ensure apt-get is current, because otherwise bootstrapping might fail
8+
sudo apt-get update -y
9+
10+
# Ensure the Rust version matches that used by Gecko, and can compile to WASI
11+
rustup update 1.55.0
12+
rustup default 1.55.0
13+
rustup target add wasm32-wasi
14+
415
if [[ ! -a gecko-dev ]]
516
then
6-
# Ensure apt-get is current, because otherwise bootstrapping might fail
7-
sudo apt-get update -y
8-
9-
# Ensure the Rust version matches that used by Gecko, and can compile to WASI
10-
rustup update 1.54.0
11-
rustup default 1.54.0
12-
rustup target add wasm32-wasi
1317

1418
# Clone Gecko repository at the required revision
1519
mkdir gecko-dev
1620
cd gecko-dev
1721

1822
git init
19-
git remote add origin $(cat ../gecko-repository)
20-
git fetch --depth 1 origin $(cat ../gecko-revision)
21-
git checkout FETCH_HEAD
22-
23-
# Use Gecko's build system bootstrapping to ensure all dependencies are installed
24-
./mach bootstrap --application-choice=js
25-
23+
git remote add --no-tags -t wasi-embedding origin $(cat $script_dir/gecko-repository)
2624
cd ..
2725
fi
2826

27+
cd gecko-dev
28+
git fetch --depth 1 origin $(cat $script_dir/gecko-revision)
29+
git checkout FETCH_HEAD
30+
31+
# Use Gecko's build system bootstrapping to ensure all dependencies are installed
32+
./mach bootstrap --application-choice=js
33+
34+
# ... except, that doesn't install the wasi-sysroot, which we need, so we do that manually.
35+
cd ~/.mozbuild
36+
_virtualenvs/mach/bin/python \
37+
${working_dir}/gecko-dev/mach \
38+
artifact \
39+
toolchain \
40+
--bootstrap \
41+
--from-build \
42+
sysroot-wasm32-wasi
43+
44+
cd ${working_dir}
45+
2946
flags="--optimize --no-debug --build-only"
3047
rust_lib_dir="release"
3148
if [[ $1 == 'debug' ]]
@@ -37,12 +54,13 @@ fi
3754
echo $flags $rust_lib_dir
3855

3956
# Build SpiderMonkey for WASI
40-
MOZ_FETCHES_DIR=~/.mozbuild gecko-dev/js/src/devtools/automation/autospider.py --objdir=obj $flags wasi
57+
MOZ_FETCHES_DIR=~/.mozbuild CC=~/.mozbuild/clang/bin/clang gecko-dev/js/src/devtools/automation/autospider.py --objdir=obj $flags wasi
4158

4259
# Copy header, object, and static lib files
60+
rm -rf lib include
4361
mkdir lib
4462

4563
cd obj
4664
cp -Lr dist/include ..
47-
cp $(cat ../object-files.list) ../lib
65+
cp $(cat $script_dir/object-files.list) ../lib
4866
cp js/src/build/libjs_static.a wasm32-wasi/${rust_lib_dir}/libjsrust.a ../lib

gecko-revision

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b32c3ef364c2045b6daed0337cd6cd9a90e98bda
1+
5f992458881b445a12d9b18aff91d56210743a73

0 commit comments

Comments
 (0)