Skip to content

Commit

Permalink
Add script to compile jq to WASM
Browse files Browse the repository at this point in the history
  • Loading branch information
robertaboukhalil committed Feb 16, 2019
1 parent 24b4230 commit 25672b1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Compile jq to WebAssembly
# Need Emscripten installed

# Update jq repo and its submodules
cd jq
git submodule update --init

# Generate ./configure file
autoreconf -fi

# Run ./configure
emconfigure ./configure \
--with-oniguruma=builtin \
--disable-maintainer-mode

# Build jq executable
emmake make LDFLAGS=-all-static

# Convert to .o; otherwise emcc complains
# that the "file has an unknown suffix"
cp jq ../jq.o
cd ..

# Compile to WebAssembly (we need .js/.wasm files; we can't execute jq.o in the browser)
# - Use "ERROR_ON_UNDEFINED_SYMBOLS=0" to ignore "undefined symbol: llvm_fma_f64" warning
emcc jq.o -o jq.js \
-s ERROR_ON_UNDEFINED_SYMBOLS=0

0 comments on commit 25672b1

Please sign in to comment.