From 14b7c4147e3492fec11d26c2d1f24967c12e91c3 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 5 Dec 2025 11:03:57 +0100 Subject: [PATCH 1/3] Move libjxl and brotli to 'web' group dependencies For JPEG XL support. --- README.md | 8 ++++---- build/plugins/all-deps/overrides.mk | 1 + build/plugins/all-deps/vips-all.mk | 2 +- build/plugins/web-deps/overrides.mk | 1 - build/plugins/web-deps/vips-web.mk | 2 ++ build/vips.mk | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 41975cf..817e5a0 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Run the top-level [build script](build.sh) with the `--help` parameter for help. | Dependency | Version | Used under the terms of | |-----------------|------------|--------------------------------------------------------------| | [aom] | 3.13.1 | BSD 2-Clause + [Alliance for Open Media Patent License 1.0] | +| [brotli] | 1.2.0 | MIT Licence | | [cairo] | 1.18.4 | Mozilla Public License 2.0 | | [cgif] | 0.5.0 | MIT Licence | | [expat] | 2.7.3 | MIT Licence | @@ -33,6 +34,7 @@ Run the top-level [build script](build.sh) with the `--help` parameter for help. | [libffi] | 3.5.2 | MIT Licence | | [libheif] | 1.20.2 | LGPLv3 | | [libimagequant] | 2.4.1[^1] | BSD 2-Clause | +| [libjxl] | 0.11.1 | BSD 3-Clause | | [libpng] | 1.6.53 | [libpng License version 2] | | [librsvg] | 2.61.3 | LGPLv3 | | [libtiff] | 4.7.1 | [libtiff License] (BSD-like) | @@ -54,6 +56,7 @@ https://github.com/libvips/libvips/releases/tag/v8.18.0-rc2 [aom]: https://aomedia.googlesource.com/aom/ [Alliance for Open Media Patent License 1.0]: https://aomedia.org/license/patent-license/ +[brotli]: https://github.com/google/brotli [cairo]: https://gitlab.freedesktop.org/cairo/cairo [cgif]: https://github.com/dloebl/cgif [expat]: https://github.com/libexpat/libexpat @@ -71,6 +74,7 @@ https://github.com/libvips/libvips/releases/tag/v8.18.0-rc2 [libffi]: https://github.com/libffi/libffi [libheif]: https://github.com/strukturag/libheif [libimagequant]: https://github.com/lovell/libimagequant +[libjxl]: https://github.com/libjxl/libjxl [libpng]: https://github.com/pnggroup/libpng [libpng License version 2]: https://github.com/pnggroup/libpng/blob/master/LICENSE [librsvg]: https://gitlab.gnome.org/GNOME/librsvg @@ -94,14 +98,12 @@ Same as libvips-web + these extra dependencies: | Dependency | Version | Used under the terms of | |-----------------|------------|--------------------------------------------------------------| -| [brotli] | 1.2.0 | MIT Licence | | [cfitsio] | 4.6.2 | BSD-like | | [fftw] | 3.3.10 | GPLv2 | | [gdk-pixbuf] | 2.44.4 | LGPLv3 | | [imagemagick] | 6.9.13-35 | [ImageMagick License] (Apache-2.0-like) | | [imath] | 3.1.9 | BSD 3-Clause | | [libdicom] | 1.2.0 | MIT Licence | -| [libjxl] | 0.11.1 | BSD 3-Clause | | [libraw] | 0.21.4 | LGPL-2.1-only | | [matio] | 1.5.29 | BSD 2-Clause | | [nifticlib] | 3.0.1 | Public domain | @@ -112,7 +114,6 @@ Same as libvips-web + these extra dependencies: | [sqlite] | 3.51.1 | Public domain | | [zstd] | 1.5.7 | BSD 3-Clause | -[brotli]: https://github.com/google/brotli [cfitsio]: https://github.com/HEASARC/cfitsio [fftw]: https://github.com/FFTW/fftw3 [gdk-pixbuf]: https://gitlab.gnome.org/GNOME/gdk-pixbuf @@ -120,7 +121,6 @@ Same as libvips-web + these extra dependencies: [ImageMagick License]: https://github.com/ImageMagick/ImageMagick6/blob/main/LICENSE [imath]: https://github.com/AcademySoftwareFoundation/Imath [libdicom]: https://github.com/ImagingDataCommons/libdicom -[libjxl]: https://github.com/libjxl/libjxl [libraw]: https://github.com/LibRaw/LibRaw [matio]: https://github.com/tbeu/matio [nifticlib]: https://github.com/NIFTI-Imaging/nifti_clib diff --git a/build/plugins/all-deps/overrides.mk b/build/plugins/all-deps/overrides.mk index 68ea88e..56879b5 100644 --- a/build/plugins/all-deps/overrides.mk +++ b/build/plugins/all-deps/overrides.mk @@ -11,6 +11,7 @@ vips_PATCHES := $(vips_PATCHES) \ vips_MESON_OPTS = \ -Dmodules=enabled \ -Dheif-module=$(if $(IS_HEVC),enabled,disabled) \ + -Djpeg-xl-module=disabled \ $(if $(findstring graphicsmagick,$(vips_all_DEPS)), -Dmagick-package=GraphicsMagick) \ -Dpdfium=disabled \ -Dquantizr=disabled \ diff --git a/build/plugins/all-deps/vips-all.mk b/build/plugins/all-deps/vips-all.mk index 819c697..88cb3e4 100644 --- a/build/plugins/all-deps/vips-all.mk +++ b/build/plugins/all-deps/vips-all.mk @@ -9,7 +9,7 @@ $(PKG)_SUBDIR = $(vips_SUBDIR) $(PKG)_FILE = $(vips_FILE) $(PKG)_URL = $(vips_URL) $(PKG)_DEPS := $(vips_DEPS) imagemagick matio openexr cfitsio \ - nifticlib poppler fftw openslide libjxl libraw + nifticlib poppler fftw openslide libraw define $(PKG)_PRE_CONFIGURE # Copy some files to the packaging directory diff --git a/build/plugins/web-deps/overrides.mk b/build/plugins/web-deps/overrides.mk index e1894ca..350b036 100644 --- a/build/plugins/web-deps/overrides.mk +++ b/build/plugins/web-deps/overrides.mk @@ -4,7 +4,6 @@ vips_MESON_OPTS = \ -Dmodules=disabled \ -Dcfitsio=disabled \ -Dfftw=disabled \ - -Djpeg-xl=disabled \ -Dmagick=disabled \ -Dmatio=disabled \ -Dnifti=disabled \ diff --git a/build/plugins/web-deps/vips-web.mk b/build/plugins/web-deps/vips-web.mk index d99478a..eaa176b 100644 --- a/build/plugins/web-deps/vips-web.mk +++ b/build/plugins/web-deps/vips-web.mk @@ -19,6 +19,7 @@ define $(PKG)_PRE_CONFIGURE (printf '{\n'; \ printf ' "aom": "$(aom_VERSION)",\n'; \ printf ' "archive": "$(libarchive_VERSION)",\n'; \ + printf ' "brotli": "$(brotli_VERSION)",\n'; \ printf ' "cairo": "$(cairo_VERSION)",\n'; \ printf ' "cgif": "$(cgif_VERSION)",\n'; \ printf ' "exif": "$(libexif_VERSION)",\n'; \ @@ -36,6 +37,7 @@ define $(PKG)_PRE_CONFIGURE $(if $(IS_JPEGLI), \ printf ' "jpegli": "$(jpegli_VERSION)"$(comma)\n';, \ $(if $(IS_MOZJPEG),,printf ' "jpeg": "$(libjpeg-turbo_VERSION)"$(comma)\n';)) \ + printf ' "jxl": "$(libjxl_VERSION)",\n'; \ printf ' "lcms": "$(lcms_VERSION)",\n'; \ $(if $(IS_MOZJPEG),printf ' "mozjpeg": "$(mozjpeg_VERSION)"$(comma)\n';) \ printf ' "pango": "$(pango_VERSION)",\n'; \ diff --git a/build/vips.mk b/build/vips.mk index 0c68ec2..f30273c 100644 --- a/build/vips.mk +++ b/build/vips.mk @@ -9,7 +9,7 @@ $(PKG)_GH_CONF := libvips/libvips/releases,v,,,,.tar.xz $(PKG)_SUBDIR := $(PKG)-$(firstword $(subst -, ,$($(PKG)_VERSION))) $(PKG)_DEPS := cc meson-wrapper libwebp librsvg glib pango libarchive \ libjpeg-turbo tiff lcms libexif libheif \ - libimagequant highway cgif uhdr + libimagequant highway cgif uhdr libjxl define $(PKG)_BUILD $(eval export CFLAGS += -O3) From 5e5aea32807ea605ccf92ce8206d90fcf5fdf777 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 5 Dec 2025 11:07:35 +0100 Subject: [PATCH 2/3] Update libjxl to libjxl/libjxl@53042ec --- README.md | 3 ++- build/libjxl.mk | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 817e5a0..acac640 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Run the top-level [build script](build.sh) with the `--help` parameter for help. | [libffi] | 3.5.2 | MIT Licence | | [libheif] | 1.20.2 | LGPLv3 | | [libimagequant] | 2.4.1[^1] | BSD 2-Clause | -| [libjxl] | 0.11.1 | BSD 3-Clause | +| [libjxl] | [53042ec] | BSD 3-Clause | | [libpng] | 1.6.53 | [libpng License version 2] | | [librsvg] | 2.61.3 | LGPLv3 | | [libtiff] | 4.7.1 | [libtiff License] (BSD-like) | @@ -52,6 +52,7 @@ Run the top-level [build script](build.sh) with the `--help` parameter for help. [^2]: libvips is built from the [`v8.18.0-rc2`](https://github.com/libvips/libvips/tree/v8.18.0-rc2) tag, see: https://github.com/libvips/libvips/releases/tag/v8.18.0-rc2 +[53042ec]: https://github.com/libjxl/libjxl/commit/53042ec537712e0df08709524f4df097d42174bc [0826579]: https://github.com/mozilla/mozjpeg/commit/08265790774cd0714832c9e675522acbe5581437 [aom]: https://aomedia.googlesource.com/aom/ diff --git a/build/libjxl.mk b/build/libjxl.mk index b62ebe1..acc3fc1 100644 --- a/build/libjxl.mk +++ b/build/libjxl.mk @@ -2,10 +2,11 @@ PKG := libjxl $(PKG)_WEBSITE := https://github.com/libjxl/libjxl $(PKG)_DESCR := JPEG XL image format reference implementation $(PKG)_IGNORE := -$(PKG)_VERSION := 0.11.1 -$(PKG)_CHECKSUM := 1492dfef8dd6c3036446ac3b340005d92ab92f7d48ee3271b5dac1d36945d3d9 +# https://github.com/libjxl/libjxl/tarball/53042ec537712e0df08709524f4df097d42174bc +$(PKG)_VERSION := 53042ec +$(PKG)_CHECKSUM := 8bb362724e2973f9cf57cefe4949bcfd47d6832bce706a691b29aa43d1c901e1 $(PKG)_PATCHES := $(realpath $(sort $(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/patches/$(PKG)-[0-9]*.patch))) -$(PKG)_GH_CONF := libjxl/libjxl/tags,v +$(PKG)_GH_CONF := libjxl/libjxl/branches/main $(PKG)_DEPS := cc brotli highway lcms libpng define $(PKG)_BUILD From 4071190b4d8b15d069465ba9cf3fbe46d5c9b690 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Mon, 8 Dec 2025 19:51:16 +0100 Subject: [PATCH 3/3] Reduce binary size - Only enable `HWY_AVX2` and `HWY_SSE2` (baseline) on x86. - Only enable `HWY_NEON_WITHOUT_AES` (baseline) on AArch64. - Ensure fallback emulation targets are always disabled. - Add patch to disable `HWY_AVX10_2` target. --- build/libjxl.mk | 20 ++++++++++++++++++++ build/patches/libjxl-0.12-fixes.patch | 26 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 build/patches/libjxl-0.12-fixes.patch diff --git a/build/libjxl.mk b/build/libjxl.mk index acc3fc1..e72a80d 100644 --- a/build/libjxl.mk +++ b/build/libjxl.mk @@ -21,6 +21,26 @@ define $(PKG)_BUILD -DJPEGXL_ENABLE_OPENEXR=OFF \ -DJPEGXL_ENABLE_SKCMS=OFF \ -DJPEGXL_ENABLE_TRANSCODE_JPEG=OFF \ + $(if $(call seq,aarch64,$(PROCESSOR)), \ + -DJPEGXL_ENABLE_HWY_SVE2_128=OFF \ + -DJPEGXL_ENABLE_HWY_SVE_256=OFF \ + -DJPEGXL_ENABLE_HWY_SVE2=OFF \ + -DJPEGXL_ENABLE_HWY_SVE=OFF \ + -DJPEGXL_ENABLE_HWY_NEON_BF16=OFF \ + -DJPEGXL_ENABLE_HWY_NEON=OFF \ + -DJPEGXL_ENABLE_HWY_NEON_WITHOUT_AES=ON \ + $(else), \ + -DJPEGXL_ENABLE_HWY_AVX10_2=OFF \ + -DJPEGXL_ENABLE_HWY_AVX3_SPR=OFF \ + -DJPEGXL_ENABLE_HWY_AVX3_ZEN4=OFF \ + -DJPEGXL_ENABLE_HWY_AVX3_DL=OFF \ + -DJPEGXL_ENABLE_HWY_AVX3=OFF \ + -DJPEGXL_ENABLE_HWY_AVX2=ON \ + -DJPEGXL_ENABLE_HWY_SSE4=OFF \ + -DJPEGXL_ENABLE_HWY_SSSE3=OFF \ + -DJPEGXL_ENABLE_HWY_SSE2=ON) \ + -DJPEGXL_ENABLE_HWY_EMU128=OFF \ + -DJPEGXL_ENABLE_HWY_SCALAR=OFF \ -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \ -DJPEGXL_FORCE_SYSTEM_LCMS2=ON \ -DJPEGXL_FORCE_SYSTEM_HWY=ON \ diff --git a/build/patches/libjxl-0.12-fixes.patch b/build/patches/libjxl-0.12-fixes.patch new file mode 100644 index 0000000..8814d24 --- /dev/null +++ b/build/patches/libjxl-0.12-fixes.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kleis Auke Wolthuizen +Date: Mon, 8 Dec 2025 19:41:56 +0100 +Subject: [PATCH 1/1] Allow disabling the `HWY_AVX10_2` target + +Upstream-Status: Inappropriate [other] +Requires Highway 1.3.0 or later, will fail on earlier versions with: +``` +error: use of undeclared identifier 'HWY_AVX10_2' +``` + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1111111..2222222 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -132,8 +132,8 @@ else() + set(ENABLE_SKCMS_DEFAULT YES) + endif() + +-set(JPEGXL_HWY_TARGETS AVX2 AVX3 AVX3_DL AVX3_SPR AVX3_ZEN4 EMU128 NEON NEON_BF16 NEON_WITHOUT_AES PPC10 PPC8 PPC9 RVV SCALAR SSE2 SSE4 SSSE3 SVE SVE_256 SVE2 SVE2_128 WASM WASM_EMU256 Z14 Z15) +-set(JPEGXL_HWY_TARGETS_OFF_BY_DEFAULT AVX3 AVX3_SPR AVX3_ZEN4 RVV SSSE3 SVE_256) ++set(JPEGXL_HWY_TARGETS AVX2 AVX3 AVX3_DL AVX3_SPR AVX3_ZEN4 AVX10_2 EMU128 NEON NEON_BF16 NEON_WITHOUT_AES PPC10 PPC8 PPC9 RVV SCALAR SSE2 SSE4 SSSE3 SVE SVE_256 SVE2 SVE2_128 WASM WASM_EMU256 Z14 Z15) ++set(JPEGXL_HWY_TARGETS_OFF_BY_DEFAULT AVX3 AVX3_SPR AVX3_ZEN4 AVX10_2 RVV SSSE3 SVE_256) + if (NOT CXX_SVE_SUPPORTED) + list(APPEND JPEGXL_HWY_TARGETS_OFF_BY_DEFAULT SVE SVE2 SVE_256 SVE2_128) + endif()