From 58c78be6ca4b633d40d69551c07c9be3295a33cd Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sat, 20 Jan 2024 11:42:29 +0100 Subject: [PATCH] Update Emscripten Docker image to 3.1.52 --- CHANGELOG.md | 2 +- Dockerfile | 4 ++-- build.sh | 19 +++++++------------ src/CMakeLists.txt | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 581417c3f..ed3db416e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Dockerfile b/Dockerfile index 4cc38b407..ff3ea6ada 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ @@ -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 diff --git a/build.sh b/build.sh index 8233db5e0..9ef7896b1 100755 --- a/build.sh +++ b/build.sh @@ -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: " diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c10ef240e..b81b3ee2e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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}" )