Skip to content

Commit

Permalink
Test for microsoft/mimalloc@e14cfd2 (v3.0.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Feb 7, 2025
2 parents 28b407a + f3255fb commit 94cc605
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 37 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.12] - TBD

Uses libvips v8.16.0, compiled with Emscripten v3.1.73.
Uses libvips v8.16.0, compiled with Emscripten v4.0.2.

### Fixed

Expand Down
9 changes: 4 additions & 5 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.73
FROM docker.io/emscripten/emsdk:4.0.2

# Path settings
ENV \
Expand All @@ -13,7 +13,6 @@ RUN \
build-essential \
ccache \
libglib2.0-dev \
patchutils \
pkgconf \
# needed for Meson
ninja-build \
Expand All @@ -25,8 +24,8 @@ RUN \

# Emscripten patches
RUN \
curl -Ls https://github.com/emscripten-core/emscripten/compare/3.1.73...kleisauke:wasm-vips-3.1.73.patch | patch -p1 -d $EMSDK/upstream/emscripten && \
curl -Ls https://github.com/emscripten-core/emscripten/compare/06cebfc...kleisauke:mimalloc-update-577246d.patch | filterdiff -p1 -x ChangeLog.md | patch -p1 -d $EMSDK/upstream/emscripten && \
curl -Ls https://github.com/emscripten-core/emscripten/compare/4.0.2...kleisauke:wasm-vips-4.0.2.patch | patch -p1 -d $EMSDK/upstream/emscripten && \
curl -Ls https://github.com/emscripten-core/emscripten/compare/a9651ff...kleisauke:mimalloc-update-3.0.1.patch | patch -p1 -d $EMSDK/upstream/emscripten && \
emcc --clear-cache && embuilder build sysroot --force

# Rust
Expand All @@ -35,7 +34,7 @@ RUN \
--no-modify-path \
--profile minimal \
--target wasm32-unknown-emscripten \
--default-toolchain nightly-2024-11-19 \
--default-toolchain nightly-2025-01-30 \
--component rust-src

# Cache settings
Expand Down
2 changes: 1 addition & 1 deletion THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ used under the terms of the following licences:
| libvips | LGPLv3 |
| libwebp | New BSD License |
| mozjpeg | [zlib License, IJG License, BSD-3-Clause](https://github.com/mozilla/mozjpeg/blob/master/LICENSE.md) |
| resvg | MPL-2.0 License |
| resvg | MIT Licence |
| zlib-ng | [zlib Licence](https://github.com/zlib-ng/zlib-ng/blob/develop/LICENSE.md) |

Use of libraries under the terms of the LGPLv3 is via the
Expand Down
40 changes: 21 additions & 19 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ WASM_FS=false
# https://github.com/WebAssembly/exception-handling
WASM_EH=false

# Emit instructions for the new Wasm EH proposal with exnref
# Emit instructions for the standardized Wasm EH proposal with exnref
# (adopted on Oct 2023), disabled by default
# https://github.com/WebAssembly/exception-handling/issues/280
WASM_EXNREF=false
Expand Down Expand Up @@ -118,6 +118,8 @@ done
#export LDFLAGS+=" --source-map-base http://localhost:3000/lib/"

# Rust flags
# TODO(kleisauke): Remove +bulk-memory,+nontrapping-fptoint once Rust updates LLVM to 20, see:
# https://github.com/llvm/llvm-project/commit/1bc2cd98c58a1059170dc38697c7a29a8e21160b
export RUSTFLAGS="-Ctarget-feature=+atomics,+bulk-memory,+nontrapping-fptoint -Zdefault-visibility=hidden"

# Common compiler flags
Expand All @@ -128,13 +130,19 @@ if [ "$LTO" = "true" ]; then
fi
if [ "$WASM_EH" = "true" ]; then
COMMON_FLAGS+=" -fwasm-exceptions -sSUPPORT_LONGJMP=wasm"
# https://github.com/rust-lang/rust/issues/112195
export RUSTFLAGS+=" -Cllvm-args=-enable-emscripten-cxx-exceptions=0 -Cllvm-args=-wasm-enable-sjlj"
# https://github.com/rust-lang/rust/pull/131830
export RUSTFLAGS+=" -Zemscripten-wasm-eh"
if [ "$WASM_EXNREF" = "true" ]; then
COMMON_FLAGS+=" -sWASM_LEGACY_EXCEPTIONS=0"
# TODO(kleisauke): Switch to -wasm-use-legacy-eh=0 once Rust updates LLVM to 20, see:
# https://github.com/llvm/llvm-project/commit/a8e1135baa9074f7c088c8e1999561f88699b56e
export RUSTFLAGS+=" -Cllvm-args=-wasm-enable-exnref"
fi
else
COMMON_FLAGS+=" -fexceptions"
fi

export CFLAGS="$COMMON_FLAGS -mnontrapping-fptoint -fvisibility=hidden"
export CFLAGS="$COMMON_FLAGS -fvisibility=hidden"
if [ "$SIMD" = "true" ]; then
export CFLAGS+=" -msimd128 -DWASM_SIMD_COMPAT_SLOW"
export RUSTFLAGS+=" -Ctarget-feature=+simd128"
Expand All @@ -144,8 +152,7 @@ if [ "$PIC" = "true" ]; then export CFLAGS+=" -fPIC"; fi
export CXXFLAGS="$CFLAGS"

export LDFLAGS="$COMMON_FLAGS -L$TARGET/lib -sAUTO_JS_LIBRARIES=0 -sAUTO_NATIVE_LIBRARIES=0"
if [ "$WASM_BIGINT" = "true" ]; then export LDFLAGS+=" -sWASM_BIGINT"; fi
if [ "$WASM_EXNREF" = "true" ]; then export LDFLAGS+=" -sWASM_EXNREF"; fi
if [ "$WASM_BIGINT" = "false" ]; then export LDFLAGS+=" -sWASM_BIGINT=0"; fi

# Build paths
export CPATH="$TARGET/include"
Expand Down Expand Up @@ -177,24 +184,24 @@ export RUSTFLAGS+=" --remap-path-prefix=$CARGO_HOME/registry/src/="
export RUSTFLAGS+=" --remap-path-prefix=$DEPS/="

# Dependency version numbers
VERSION_ZLIB_NG=2.2.2 # https://github.com/zlib-ng/zlib-ng
VERSION_ZLIB_NG=2.2.3 # https://github.com/zlib-ng/zlib-ng
VERSION_FFI=3.4.6 # https://github.com/libffi/libffi
VERSION_GLIB=2.83.0 # https://gitlab.gnome.org/GNOME/glib
VERSION_GLIB=2.83.3 # https://gitlab.gnome.org/GNOME/glib
VERSION_EXPAT=2.6.4 # https://github.com/libexpat/libexpat
VERSION_EXIF=0.6.24 # https://github.com/libexif/libexif
VERSION_EXIF=0.6.25 # https://github.com/libexif/libexif
VERSION_LCMS2=2.16 # https://github.com/mm2/Little-CMS
VERSION_HWY=1.2.0 # https://github.com/google/highway
VERSION_BROTLI=1.1.0 # https://github.com/google/brotli
VERSION_MOZJPEG=4.1.5 # https://github.com/mozilla/mozjpeg
VERSION_JXL=0.11.0 # https://github.com/libjxl/libjxl
VERSION_JXL=0.11.1 # https://github.com/libjxl/libjxl
VERSION_SPNG=0.7.4 # https://github.com/randy408/libspng
VERSION_IMAGEQUANT=2.4.1 # https://github.com/lovell/libimagequant
VERSION_CGIF=0.4.1 # https://github.com/dloebl/cgif
VERSION_WEBP=1.4.0 # https://chromium.googlesource.com/webm/libwebp
VERSION_WEBP=1.5.0 # https://chromium.googlesource.com/webm/libwebp
VERSION_TIFF=4.7.0 # https://gitlab.com/libtiff/libtiff
VERSION_RESVG=0.44.0 # https://github.com/linebender/resvg
VERSION_AOM=3.11.0 # https://aomedia.googlesource.com/aom
VERSION_HEIF=1.19.3 # https://github.com/strukturag/libheif
VERSION_HEIF=1.19.5 # https://github.com/strukturag/libheif
VERSION_VIPS=8.16.0 # https://github.com/libvips/libvips

VERSION_EMSCRIPTEN="$(emcc -dumpversion)"
Expand Down Expand Up @@ -302,7 +309,7 @@ node --version
[ -f "$TARGET/lib/pkgconfig/libexif.pc" ] || (
stage "Compiling exif"
mkdir $DEPS/exif
curl -Ls https://github.com/libexif/libexif/releases/download/v$VERSION_EXIF/libexif-$VERSION_EXIF.tar.bz2 | tar xjC $DEPS/exif --strip-components=1
curl -Ls https://github.com/libexif/libexif/releases/download/v$VERSION_EXIF/libexif-$VERSION_EXIF.tar.xz | tar xJC $DEPS/exif --strip-components=1
cd $DEPS/exif
emconfigure ./configure --host=$CHOST --prefix=$TARGET --enable-static --disable-shared --disable-dependency-tracking \
--disable-docs --disable-nls --without-libiconv-prefix --without-libintl-prefix CPPFLAGS="-DNO_VERBOSE_TAG_DATA"
Expand Down Expand Up @@ -447,13 +454,8 @@ node --version
# Vendor dir doesn't work with -Zbuild-std due to https://github.com/rust-lang/wg-cargo-std-aware/issues/23
# Just delete the config so that all deps are downloaded from the internet
rm .cargo/config
# Update and regenerate the lockfile for zune-jpeg
# https://github.com/etemesi254/zune-image/pull/242
# https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
cat >> Cargo.toml <<EOL
[patch.crates-io]
zune-jpeg = { git = "https://github.com/etemesi254/zune-image.git", rev = "80e1957" }
EOL
# Regenerate the lockfile for zune-jpeg
cargo update zune-jpeg
# We don't want to build the shared library
sed -i '/^crate-type =/s/"cdylib", //' crates/c-api/Cargo.toml
Expand Down
10 changes: 5 additions & 5 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"fflate": "^0.8.2",
"html-webpack-plugin": "^5.6.3",
"mini-css-extract-plugin": "^2.9.2",
"monaco-editor": "^0.52.0",
"monaco-editor": "^0.52.2",
"monaco-editor-webpack-plugin": "^7.1.0",
"terser-webpack-plugin": "^5.3.10",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0"
"terser-webpack-plugin": "^5.3.11",
"webpack": "^5.97.1",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.0"
}
}
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ if ("web" IN_LIST ENVIRONMENT)
--pre-js=${CMAKE_CURRENT_SOURCE_DIR}/workaround-cors-pre.js
)
set(WEB_MIN_TARGETS
-sMIN_FIREFOX_VERSION=89
-sMIN_CHROME_VERSION=91
-sMIN_FIREFOX_VERSION=89
-sMIN_SAFARI_VERSION=160400
)

# libvips requires spawning at least VIPS_CONCURRENCY threads synchronously, with a minimum of 3 threads per
Expand Down
10 changes: 6 additions & 4 deletions test/unit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>wasm-vips testsuite</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- FIXME(kleisauke): https://github.com/cdnjs/tools/issues/285 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.8.2/mocha.css" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/11.1.0/mocha.css" crossorigin="anonymous">
<style>
html,
body {
Expand All @@ -14,6 +14,10 @@
margin: 0;
}

:root {
--mocha-test-pass-color: forestgreen;
}

#mocha-stats {
font-size: initial;
}
Expand Down Expand Up @@ -44,13 +48,11 @@
#mocha .test.pass::before {
content: '\2714';
font-size: initial;
color: forestgreen;
}

#mocha .test.pending::before {
content: '\25CF';
font-size: initial;
color: var(--mocha-test-pending-color);
}

#mocha .test.pending:hover h2::after {
Expand All @@ -64,7 +66,7 @@
</head>
<body>
<div id="mocha"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.7.3/mocha.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/11.1.0/mocha.min.js" crossorigin="anonymous"></script>
<script class="mocha-init">
mocha.setup({
ui: 'bdd',
Expand Down
2 changes: 1 addition & 1 deletion test/unit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"chai": "^5.1.2",
"mocha": "^10.8.2"
"mocha": "^11.1.0"
},
"engines": {
"node": ">=16.4.0"
Expand Down

0 comments on commit 94cc605

Please sign in to comment.