summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/create_release.yml66
-rw-r--r--README.md33
2 files changed, 98 insertions, 1 deletions
diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml
index 8b5bb8ac0..a5d1f459e 100644
--- a/.github/workflows/create_release.yml
+++ b/.github/workflows/create_release.yml
@@ -168,3 +168,69 @@ jobs:
files: |
${{ steps.archive.outputs.tarball }}
${{ steps.archive.outputs.shasum }}
+
+ # Build using Emscripten to JavaScript+WebAssembly.
+ build-node:
+ name: node
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+ steps:
+ - uses: actions/setup-python@v1
+ with:
+ python-version: '3.x'
+ - uses: actions/checkout@v1
+ with:
+ submodules: true
+ - name: install ninja
+ run: sudo apt-get install ninja-build
+ - name: emsdk install
+ run: |
+ mkdir $HOME/emsdk
+ git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk
+ $HOME/emsdk/emsdk update-tags
+ $HOME/emsdk/emsdk install tot
+ $HOME/emsdk/emsdk activate tot
+ - name: update path
+ run: echo "PATH=$PATH:$HOME/emsdk" >> $GITHUB_ENV
+
+ # Configure with wasm EH and pthreads for maximal performance.
+ - name: cmake
+ run: |
+ source $HOME/emsdk/emsdk_env.sh
+ emcmake cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install -DEMSCRIPTEN_ENABLE_WASM_EH=ON -DEMSCRIPTEN_ENABLE_PTHREADS=ON
+
+ # Build wasm-opt for now TODO add other tools as desired
+ - name: build
+ run: ninja -C out wasm-opt
+
+ # Minimal smoke test: roundtrip a file.
+ # TODO: Add more testing here, but the full test suite is overkill as there
+ # is a 0.5 second cost to each run of wasm-opt.js
+ - name: test
+ run: |
+ node out/bin/wasm-opt.js test/hello_world.wat --print > out/t.wat
+ diff test/hello_world.wat out/t.wat
+
+ - name: archive
+ id: archive
+ run: |
+ VERSION=$GITHUB_REF_NAME
+ PKGNAME="binaryen-$VERSION-node"
+ TARBALL=$PKGNAME.tar.gz
+ SHASUM=$PKGNAME.tar.gz.sha256
+ mkdir binaryen-$VERSION
+ cp out/bin/wasm-opt* binaryen-$VERSION/
+ tar -czf $TARBALL binaryen-$VERSION
+ cmake -E sha256sum $TARBALL > $SHASUM
+ echo "::set-output name=tarball::$TARBALL"
+ echo "::set-output name=shasum::$SHASUM"
+
+ - name: upload tarball
+ uses: softprops/action-gh-release@v1
+ with:
+ draft: true
+ files: |
+ ${{ steps.archive.outputs.tarball }}
+ ${{ steps.archive.outputs.shasum }}
diff --git a/README.md b/README.md
index e4b47e2c5..943da98a0 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,18 @@ effective**:
wasm [minification], similar to minification for JavaScript, CSS, etc., all
of which are language-specific.
-Compilers using Binaryen include:
+Toolchains using Binaryen as a **component** (typically running `wasm-opt`) include:
+
+ * [`Emscripten`](http://emscripten.org) (C/C++)
+ * [`wasm-pack`](https://github.com/rustwasm/wasm-pack) (Rust)
+ * [`J2CL`](https://j2cl.io/) (Java; [`J2Wasm`](https://github.com/google/j2cl/tree/master/samples/wasm))
+ * [`Kotlin`](https://kotl.in/wasmgc) (Kotlin/Wasm)
+ * [`Dart`](https://flutter.dev/wasm) (Flutter)
+
+For more on how some of those work, see the toolchain architecture parts of
+the [V8 WasmGC porting blogpost](https://v8.dev/blog/wasm-gc-porting).
+
+Compilers using Binaryen as a **library** include:
* [`AssemblyScript`](https://github.com/AssemblyScript/assemblyscript) which compiles a variant of TypeScript to WebAssembly
* [`wasm2js`](https://github.com/WebAssembly/binaryen/blob/main/src/wasm2js.h) which compiles WebAssembly to JS
@@ -387,6 +398,26 @@ Binaryen.js can be built using Emscripten, which can be installed via [the SDK](
CMake generates a project named "ALL_BUILD.vcxproj" for conveniently building all the projects.
+## Releases
+
+Builds are distributed by the various toolchains that use Binaryen, like
+Emscripten, `wasm-pack`, etc. There are also official releases on GitHub:
+
+https://github.com/WebAssembly/binaryen/releases
+
+Currently builds of the following platforms are included:
+
+ * `Linux-x86_64`
+ * `Linux-arm64`
+ * `MacOS-x86_64`
+ * `MacOS-arm64`
+ * `Windows-x86_64`
+ * `Node.js` (experimental): A port of `wasm-opt` to JavaScript+WebAssembly.
+ Run `node wasm-opt.js` as a drop-in replacement for a native build of
+ `wasm-opt`, on any platform that Node.js runs on. Requires Node.js 18+ (for
+ Wasm EH and Wasm Threads). (Note that this build may also run in Deno, Bun,
+ or other JavaScript+WebAssembly environments, but is tested only on Node.js.)
+
## Running
### wasm-opt