├── RELEASE ├── COMMIT ├── UPSTREAM ├── .gitignore ├── tag.sh ├── README.md ├── object-files.list ├── mozconfigs ├── release └── debug ├── download.sh └── .github └── workflows └── publish.yml /RELEASE: -------------------------------------------------------------------------------- 1 | FIREFOX_96_0_3_RELEASE 2 | -------------------------------------------------------------------------------- /COMMIT: -------------------------------------------------------------------------------- 1 | f02b118c818e7596e90c5e650d890ab2e6515bbb 2 | -------------------------------------------------------------------------------- /UPSTREAM: -------------------------------------------------------------------------------- 1 | https://github.com/mozilla/gecko-dev/ 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | gecko-dev/ 2 | obj/ 3 | lib/ 4 | include/ 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /tag.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | set -ex 3 | 4 | tag_name=rev-$(cat COMMIT) 5 | git tag $tag_name 6 | git push origin $tag_name 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

Utilities to compile SpiderMonkey to wasm32-wasi

3 |
4 | 5 | ## Development Requirements 6 | 7 | - Node >= 14.13.1 8 | - Rust >= 1.56.1 with the `wasm32-wasi` target 9 | 10 | ## Building from source 11 | 12 | - Run `./build.mjs` 13 | - Build artifacts will be placed under the `./obj` directory 14 | 15 | ## Creating a release 16 | 17 | - Run `./tag.sh` 18 | -------------------------------------------------------------------------------- /object-files.list: -------------------------------------------------------------------------------- 1 | memory/build/Unified_cpp_memory_build0.o 2 | memory/mozalloc/Unified_cpp_memory_mozalloc0.o 3 | mozglue/misc/AutoProfilerLabel.o 4 | mozglue/misc/ConditionVariable_noop.o 5 | mozglue/misc/MmapFaultHandler.o 6 | mozglue/misc/Mutex_noop.o 7 | mozglue/misc/Printf.o 8 | mozglue/misc/StackWalk.o 9 | mozglue/misc/TimeStamp.o 10 | mozglue/misc/TimeStamp_posix.o 11 | mozglue/misc/Uptime.o 12 | mozglue/misc/Decimal.o 13 | mfbt/lz4.o 14 | mfbt/lz4frame.o 15 | mfbt/lz4hc.o 16 | mfbt/xxhash.o 17 | mfbt/Unified_cpp_mfbt0.o 18 | mfbt/Unified_cpp_mfbt1.o 19 | -------------------------------------------------------------------------------- /mozconfigs/release: -------------------------------------------------------------------------------- 1 | ac_add_options --enable-project=js 2 | ac_add_options --enable-application=js 3 | ac_add_options --target=wasm32-unknown-wasi 4 | ac_add_options --enable-optimize 5 | ac_add_options --without-system-zlib 6 | ac_add_options --without-intl-api 7 | ac_add_options --disable-jit 8 | ac_add_options --disable-shared-js 9 | ac_add_options --disable-shared-memory 10 | ac_add_options --disable-tests 11 | ac_add_options --disable-cranelift 12 | ac_add_options --disable-clang-plugin 13 | ac_add_options --disable-jemalloc 14 | ac_add_options --disable-debug 15 | -------------------------------------------------------------------------------- /mozconfigs/debug: -------------------------------------------------------------------------------- 1 | ac_add_options --enable-project=js 2 | ac_add_options --enable-application=js 3 | ac_add_options --target=wasm32-unknown-wasi 4 | ac_add_options --enable-optimize 5 | ac_add_options --without-system-zlib 6 | ac_add_options --without-intl-api 7 | ac_add_options --disable-jit 8 | ac_add_options --disable-shared-js 9 | ac_add_options --disable-shared-memory 10 | ac_add_options --disable-cranelift 11 | ac_add_options --disable-clang-plugin 12 | ac_add_options --disable-jemalloc 13 | ac_add_options --enable-debug 14 | 15 | export CXXFLAGS="-D_WASI_EMULATED_SIGNAL=1" 16 | -------------------------------------------------------------------------------- /download.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | set -ex 3 | 4 | rev=$(cat COMMIT) 5 | asset=spidermonkey-wasm.tar.gz 6 | 7 | curl --fail -L -O \ 8 | https://github.com/bytecodealliance/spidermonkey-wasm-build/releases/download/rev-$rev/$asset 9 | 10 | rm -rf release-build 11 | mkdir release-build 12 | 13 | tar xf $asset -C release-build 14 | rm -rf $asset 15 | 16 | 17 | asset_debug=spidermonkey-wasm-debug.tar.gz 18 | 19 | curl --fail -L -O \ 20 | https://github.com/bytecodealliance/spidermonkey-wasm-build/releases/download/rev-$rev/$asset_debug 21 | 22 | rm -rf debug-build 23 | mkdir debug-build 24 | 25 | tar xf $asset_debug -C debug-build 26 | rm -rf $asset_debug 27 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | tags: 8 | - "rev-*" 9 | pull_request: 10 | branches: 11 | - main 12 | 13 | jobs: 14 | compile: 15 | name: Compile SpiderMonkey to wasm32-wasi 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Cache build 21 | uses: actions/cache@v2 22 | id: build-cache 23 | with: 24 | path: | 25 | lib 26 | include 27 | 28 | key: cache-${{ hashFiles('build.mjs') }}-${{ hashFiles('COMMIT') }}-${{ hashFiles('object-files.list') }} 29 | 30 | - uses: actions/setup-node@v2 31 | if: steps.build-cache.outputs.cache-hit != 'true' 32 | with: 33 | node-version: 16 34 | 35 | - uses: actions-rs/toolchain@v1 36 | if: steps.build-cache.outputs.cache-hit != 'true' 37 | with: 38 | profile: default 39 | target: wasm32-wasi 40 | toolchain: 1.57.0 41 | default: true 42 | 43 | - run: sudo apt-get update 44 | 45 | - name: Compile (Debug) 46 | run: node ./build.mjs debug 47 | if: steps.build-cache.outputs.cache-hit != 'true' 48 | 49 | - name: Archive assets 50 | run: tar -zcvf spidermonkey-wasm-debug.tar.gz lib/ include/ 51 | 52 | - name: Upload artifacts 53 | uses: actions/upload-artifact@v2 54 | if: github.event_name == 'pull_request' 55 | with: 56 | name: spidermonkey-wasm-debug.tar.gz 57 | path: spidermonkey-wasm-debug.tar.gz 58 | 59 | - name: Compile (Release) 60 | run: node ./build.mjs 61 | if: steps.build-cache.outputs.cache-hit != 'true' 62 | 63 | - name: Archive assets 64 | run: tar -zcvf spidermonkey-wasm.tar.gz lib/ include/ 65 | 66 | - name: Upload artifacts 67 | uses: actions/upload-artifact@v2 68 | if: github.event_name == 'pull_request' 69 | with: 70 | name: spidermonkey-wasm.tar.gz 71 | path: spidermonkey-wasm.tar.gz 72 | 73 | - name: Get the version 74 | if: startsWith(github.ref, 'refs/tags/rev-') 75 | id: get-revision 76 | run: echo ::set-output name=REV::${GITHUB_REF/refs\/tags\//} 77 | 78 | - name: Create release 79 | uses: marvinpinto/action-automatic-releases@latest 80 | if: startsWith(github.ref, 'refs/tags/rev-') 81 | with: 82 | title: spidermonkey-wasm32-wasi-${{ steps.get-revision.outputs.REV }} 83 | automatic_release_tag: ${{ steps.get-revision.outputs.REV }} 84 | repo_token: "${{ secrets.GITHUB_TOKEN }}" 85 | prerelease: false 86 | files: | 87 | spidermonkey-wasm.tar.gz 88 | spidermonkey-wasm-debug.tar.gz 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | --------------------------------------------------------------------------------