Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Pull in weval branch of SpiderMonkey and add build. (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfallin authored May 25, 2023
1 parent 7148777 commit d0c486c
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 51 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ jobs:
run: |
mkdir dist
sudo apt-get update -y
bash ./build-engine.sh release
tar -a -cf dist/spidermonkey-wasm-static-lib_release.tar.gz release
rm -rf release obj-release
bash ./build-engine.sh debug
tar -a -cf dist/spidermonkey-wasm-static-lib_debug.tar.gz debug
bash ./build-engine.sh release normal
tar -a -cf dist/spidermonkey-wasm-static-lib_release_normal.tar.gz release-normal
rm -rf release-normal obj-release-normal
bash ./build-engine.sh release weval
tar -a -cf dist/spidermonkey-wasm-static-lib_release_weval.tar.gz release-weval
rm -rf release-weval obj-release-weval
bash ./build-engine.sh debug normal
tar -a -cf dist/spidermonkey-wasm-static-lib_debug_normal.tar.gz debug-normal
rm -rf debug-normal obj-debug-normal
- name: Calculate tag name
run: |
Expand Down
49 changes: 30 additions & 19 deletions build-engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,44 @@
set -euo pipefail
set -x

if (wasm-opt --version | grep -q "wasm-opt version" ); then
echo "wasm-opt corrupts the SpiderMonkey build; please remove it or alias it to /bin/true!"
exit 1
fi

if [ $# -lt 1 ]; then
echo "Usage: build.sh {release|debug} [{normal|weval}]"
exit 1
fi

if [ $# -eq 1 ]; then
$0 $1 normal
$0 $1 weval
exit 0
fi

working_dir="$(pwd)"
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

mode="${1:-release}"
mozconfig="${working_dir}/mozconfig-${mode}"
objdir="obj-$mode"
outdir="$mode"

cat << EOF > "$mozconfig"
ac_add_options --enable-project=js
ac_add_options --enable-application=js
ac_add_options --target=wasm32-unknown-wasi
ac_add_options --without-system-zlib
ac_add_options --without-intl-api
ac_add_options --disable-jit
ac_add_options --disable-shared-js
ac_add_options --disable-shared-memory
ac_add_options --disable-tests
ac_add_options --disable-clang-plugin
ac_add_options --enable-jitspew
ac_add_options --enable-optimize
ac_add_options --enable-js-streams
# Mode: release or debug
mode=$1
# Variant: normal or weval
variant=$2
mozconfig="${working_dir}/mozconfig-${mode}-${variant}"
objdir="obj-$mode-$variant"
outdir="$mode-$variant"

cat $script_dir/mozconfig.defaults > "$mozconfig"
cat << EOF >> "$mozconfig"
ac_add_options --prefix=${working_dir}/${objdir}/dist
mk_add_options MOZ_OBJDIR=${working_dir}/${objdir}
mk_add_options AUTOCLOBBER=1
EOF

if [ "$variant" == "weval" ]; then
cat $script_dir/mozconfig.weval >> "$mozconfig"
fi

target="$(uname)"
case "$target" in
Linux)
Expand Down
9 changes: 3 additions & 6 deletions download-engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# # Get github repository url
gh_url='https://github.'$(cd "$script_dir" && git remote get-url origin | cut -f2 -d. | tr ':' /)

mode="release"
if [[ $1 == "debug" ]]
then
mode="debug"
fi
mode=${1:release}
variant=${2:normal}

git_rev="$(git -C "$script_dir" rev-parse HEAD)"
file="spidermonkey-wasm-static-lib_${mode}.tar.gz"
file="spidermonkey-wasm-static-lib_${mode}_${variant}.tar.gz"
bundle_url="${gh_url}/releases/download/rev_${git_rev}/${file}"

curl --fail -L -O "$bundle_url"
Expand Down
2 changes: 1 addition & 1 deletion gecko-repository
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/bytecodealliance/gecko-dev
https://github.com/bytecodealliance/gecko-dev
2 changes: 1 addition & 1 deletion gecko-revision
Original file line number Diff line number Diff line change
@@ -1 +1 @@
69d3daaa3aa4589ac8e60a94c7c7e0592882d272
0c6ce134d5358dc92ab5959a2b65d6dd5ba9506a
13 changes: 13 additions & 0 deletions mozconfig.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ac_add_options --enable-project=js
ac_add_options --enable-application=js
ac_add_options --target=wasm32-unknown-wasi
ac_add_options --without-system-zlib
ac_add_options --without-intl-api
ac_add_options --disable-jit
ac_add_options --disable-shared-js
ac_add_options --disable-shared-memory
ac_add_options --disable-tests
ac_add_options --disable-clang-plugin
ac_add_options --enable-jitspew
ac_add_options --enable-optimize
ac_add_options --enable-js-streams
3 changes: 3 additions & 0 deletions mozconfig.weval
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ac_add_options --enable-js-interp-native-callstack
ac_add_options --enable-js-interp-specialization
ac_add_options --enable-js-interp-weval
42 changes: 23 additions & 19 deletions rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,37 @@
set -euo pipefail
set -x

if [ $# -lt 3 ]; then
echo "Usage: rebuild.sh {release|debug} {normal|weval}"
exit 1
fi

wasm-opt --version | grep -q "wasm-opt version"
if [ $? -eq 0 ]; then
echo "wasm-opt corrupts the SpiderMonkey build; please remove it or alias it to /bin/true!"
exit 1
fi

working_dir="$(pwd)"
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

mode="${1:-release}"
mozconfig="${working_dir}/mozconfig-${mode}"
objdir="obj-$mode"
outdir="$mode"

cat << EOF > "$mozconfig"
ac_add_options --enable-project=js
ac_add_options --enable-application=js
ac_add_options --target=wasm32-unknown-wasi
ac_add_options --without-system-zlib
ac_add_options --without-intl-api
ac_add_options --disable-jit
ac_add_options --disable-shared-js
ac_add_options --disable-shared-memory
ac_add_options --disable-tests
ac_add_options --disable-clang-plugin
ac_add_options --enable-jitspew
ac_add_options --enable-optimize
ac_add_options --enable-js-streams
mode=$1
variant=$2
mozconfig="${working_dir}/mozconfig-${mode}-${variant}"
objdir="obj-$mode-$variant"
outdir="$mode-$variant"

cat $script_dir/mozconfig.defaults > "$mozconfig"
cat << EOF >> "$mozconfig"
ac_add_options --prefix=${working_dir}/${objdir}/dist
mk_add_options MOZ_OBJDIR=${working_dir}/${objdir}
mk_add_options AUTOCLOBBER=1
EOF

if [ "$variant" == "weval" ]; then
cat $script_dir/mozconfig.weval >> "$mozconfig"
fi

target="$(uname)"
case "$target" in
Linux)
Expand Down

0 comments on commit d0c486c

Please sign in to comment.