Skip to content

Commit

Permalink
Update Emscripten Docker image to 3.1.48
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Nov 6, 2023
1 parent 04c0e13 commit 31b23b1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [v0.0.6] - TBD

Uses libvips v8.14.5, compiled with Emscripten v3.1.47.
Uses libvips v8.14.5, compiled with Emscripten v3.1.48.

## [v0.0.5] - 2023-04-27

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://github.com/emscripten-core/emsdk
FROM docker.io/emscripten/emsdk:3.1.47
FROM docker.io/emscripten/emsdk:3.1.48

# Path settings
ENV \
Expand All @@ -25,7 +25,7 @@ RUN \

# Emscripten patches
RUN \
curl -Ls https://github.com/emscripten-core/emscripten/compare/3.1.47...kleisauke:wasm-vips-3.1.47.patch | patch -p1 -d $EMSDK/upstream/emscripten && \
curl -Ls https://github.com/emscripten-core/emscripten/compare/3.1.48...kleisauke:wasm-vips-3.1.48.patch | patch -p1 -d $EMSDK/upstream/emscripten && \
emcc --clear-cache && embuilder build sysroot --force

# Rust
Expand Down
15 changes: 3 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,6 @@ node --version
# Building for both Node.js and web, prepare NPM package
stage "Prepare NPM package"

# Ensure compatibility with Deno (classic workers are not supported)
# TODO(kleisauke): Remove when Emscripten 3.1.48 is released - https://github.com/emscripten-core/emscripten/pull/20452
sed -i 's/new Worker(\([^()]\+\))/new Worker(\1,{type:"module"})/g' $SOURCE_DIR/lib/vips-es6.js
sed -i 's/new Worker(\(new URL([^)]\+)\)/new Worker(\1,{type:"module"}/g' $SOURCE_DIR/lib/vips-es6.js

# The produced binary should be the same across the different variants (sanity check)
expected_sha256=$(sha256sum "$SOURCE_DIR/lib/vips.wasm" | awk '{ print $1 }')
for file in vips-es6.wasm vips-node.wasm vips-node-es6.wasm; do
Expand All @@ -527,13 +522,9 @@ node --version
sed -i 's/var Module/const require = createRequire(import.meta.url);&/' $SOURCE_DIR/lib/vips-node.worker.mjs

# Print the target features section
PYTHONPATH="$(dirname $(which emcc))" python3 - << EOF
from tools import webassembly
with webassembly.Module('$SOURCE_DIR/lib/vips.wasm') as m:
features = [f[1] for f in m.parse_features_section() if f[0] == '+']
print('Used Wasm features:', ' '.join(features))
EOF
echo -n "Used Wasm features: "
$EMSDK/upstream/bin/wasm-opt --mvp-features --print-features -o /dev/null $SOURCE_DIR/lib/vips.wasm | \
sed 's/^--enable-//' | paste -sd' '

# Copy dynamic loadable modules
module_dir=$(printf '%s\n' $TARGET/lib/vips-modules-* | sort -n | tail -1)
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ set(MAIN_LINK_OPTIONS
-sFORCE_FILESYSTEM
-sEXPORTED_RUNTIME_METHODS=FS,ENV,deletionQueue,addFunction,bigintToI53Checked
-sEXCEPTION_STACK_TRACES
-sBINARYEN_EXTRA_PASSES=--emit-target-features
)

set_target_properties(${TARGETS}
Expand Down

0 comments on commit 31b23b1

Please sign in to comment.