Skip to content

Commit

Permalink
Update Emscripten Docker image to 3.1.52
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Jan 20, 2024
1 parent 164d01e commit 58c78be
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 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.8] - TBD

Uses libvips v8.15.1, compiled with Emscripten v3.1.51.
Uses libvips v8.15.1, compiled with Emscripten v3.1.52.

## [v0.0.7] - 2023-11-12

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.51
FROM docker.io/emscripten/emsdk:3.1.52

# Path settings
ENV \
Expand Down Expand Up @@ -27,7 +27,7 @@ RUN \

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

# Rust
Expand Down
19 changes: 7 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -519,20 +519,15 @@ node --version
done

# Use a single wasm binary for web and Node.js
for file in vips-es6.js vips-node.js vips-node-es6.js; do
filename=$(basename "$file" .js)
sed -i "s/$filename.wasm/vips.wasm/g" $SOURCE_DIR/lib/$file
for file in vips-es6.js vips-node.js vips-node-es6.mjs; do
sed -i "s/${file%.*}.wasm/vips.wasm/g" $SOURCE_DIR/lib/$file
done

# Omit -es6 suffix from Node.js files, prefer .mjs extension instead
mv $SOURCE_DIR/lib/vips-node-es6.js $SOURCE_DIR/lib/vips-node.mjs
mv $SOURCE_DIR/lib/vips-node-es6.worker.js $SOURCE_DIR/lib/vips-node.worker.mjs
sed -i 's/vips-node-es6.worker.js/vips-node.worker.mjs/g' $SOURCE_DIR/lib/vips-node.mjs
sed -i 's/vips-node-es6.js/vips-node.mjs/g' $SOURCE_DIR/lib/vips-node.worker.mjs

# Add a static import declaration for require()
sed -i 's/var Module/import { createRequire } from "module";&/' $SOURCE_DIR/lib/vips-node.worker.mjs
sed -i 's/var Module/const require = createRequire(import.meta.url);&/' $SOURCE_DIR/lib/vips-node.worker.mjs
# Omit -es6 suffix from Node.js files
mv $SOURCE_DIR/lib/vips-node-es6.mjs $SOURCE_DIR/lib/vips-node.mjs
mv $SOURCE_DIR/lib/vips-node-es6.worker.mjs $SOURCE_DIR/lib/vips-node.worker.mjs
sed -i 's/vips-node-es6/vips-node/g' $SOURCE_DIR/lib/vips-node.mjs
sed -i 's/vips-node-es6/vips-node/g' $SOURCE_DIR/lib/vips-node.worker.mjs

# Print the target features section
echo -n "Used Wasm features: "
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if ("node" IN_LIST ENVIRONMENT)
)
set_target_properties(${PROJECT_NAME}-node-es6
PROPERTIES
SUFFIX "-node-es6.js"
SUFFIX "-node-es6.mjs"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
)

Expand Down

0 comments on commit 58c78be

Please sign in to comment.