118.14. libjxl-0.12.0
JPEG XL reference implementation — libjxl, cjxl, djxl and the gdk-pixbuf loader
| Version | 0.12.0, release 1 |
| Shelf | image-libs — Raster image formats, codecs, metadata, processing, barcodes, and terminal image output |
| Phase | 41_system (System), 688 of 1047 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://jpeg.org/jpegxl/ |
| Build time | 3.7 SBU |
| Installed size | 8.8 MiB in 44 files |
| Recipe | ports/core/image-libs/libjxl/kpkgbuild |
About
libjxl is the reference implementation of JPEG XL: libjxl and libjxl_threads, libjxl_cms, the cjxl and djxl converters, and a gdk-pixbuf loader, so GTK programs open .jxl files. ffmpeg, imagemagick, gimp, krita, the web engines and KDE’s kimageformats link it.
Sources
libjxl-0.12.0.tar.gz(1.6 MiB)
sha25603e9be69a30be4011f559da75328b6d7cea8ad921fabfbd551ce10bf45cdc992
upstream: https://github.com/libjxl/libjxl/archive/refs/tags/v0.12.0.tar.gz
archive copy: sources-3/image-libs--libjxl-0.12.0.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, highway, brotli, lcms2, libpng, giflib, libjpeg-turbo, openexr, gdk-pixbuf, asciidoc.
Required by (24): chafa, darktable, digikam, ffmpeg, gdal, gimp, graphicsmagick, gthumb, imagemagick, imv, kimageformats, krita, lagrange, libcupsfilters, libvips, netsurf, opencv, openimageio, rawtherapee, sdl2-image, sdl3-image, swayimg, webkitgtk, webkitgtk6.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install libjxl'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/image-libs/libjxl.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/image-libs/libjxl
echo '03e9be69a30be4011f559da75328b6d7cea8ad921fabfbd551ce10bf45cdc992 libjxl-0.12.0.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/libjxl
SRC=$SRC_ROOT/libjxl-0.12.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libjxl-0.12.0.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
cmake -S . -B build -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DJPEGXL_FORCE_SYSTEM_HWY=ON \
-DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
-DJPEGXL_FORCE_SYSTEM_LCMS2=ON \
-DJPEGXL_BUNDLE_LIBPNG=OFF \
-DJPEGXL_ENABLE_SKCMS=OFF \
-DJPEGXL_ENABLE_SJPEG=OFF \
-DJPEGXL_ENABLE_OPENEXR=ON \
-DJPEGXL_ENABLE_TRANSCODE_JPEG=ON \
-DJPEGXL_ENABLE_BOXES=ON \
-DJPEGXL_ENABLE_TOOLS=ON \
-DJPEGXL_ENABLE_MANPAGES=ON \
-DJPEGXL_ENABLE_DOXYGEN=OFF \
-DJPEGXL_ENABLE_BENCHMARK=OFF \
-DJPEGXL_ENABLE_EXAMPLES=OFF \
-DJPEGXL_ENABLE_DEVTOOLS=OFF \
-DJPEGXL_ENABLE_VIEWERS=OFF \
-DJPEGXL_ENABLE_FUZZERS=OFF \
-DJPEGXL_ENABLE_JNI=OFF \
-DJPEGXL_ENABLE_TCMALLOC=OFF \
-DJPEGXL_ENABLE_COVERAGE=OFF \
-DJPEGXL_ENABLE_PLUGINS=ON \
-DJPEGXL_ENABLE_PLUGIN_GDKPIXBUF=ON \
-DJPEGXL_ENABLE_PLUGIN_MIME=OFF \
-DJPEGXL_WARNINGS_AS_ERRORS=OFF \
-DCMAKE_REQUIRE_FIND_PACKAGE_GIF=ON \
-DCMAKE_REQUIRE_FIND_PACKAGE_JPEG=ON \
-DCMAKE_REQUIRE_FIND_PACKAGE_PNG=ON
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-DJPEGXL_FORCE_SYSTEM_HWY=ON— WithJPEGXL_FORCE_SYSTEM_BROTLIandJPEGXL_FORCE_SYSTEM_LCMS2, take highway, brotli and lcms2 from the system. The release tarball carriesthird_party/with every submodule empty, so there is no bundled copy to build; the switches make the configure look only for the ports.-DJPEGXL_BUNDLE_LIBPNG=OFF— Link the system libpng; upstream bundles it only for sanitizer and Emscripten builds.-DJPEGXL_ENABLE_SKCMS=OFF— Manage colour with lcms2 instead of skcms. Upstream defaults to skcms on a little-endian machine and to lcms2 only on a big-endian one; skcms is one of the empty submodules, so the switch is needed here.-DJPEGXL_ENABLE_SJPEG=OFF— Build without sjpeg, an alternative JPEG encoder forcjxl, also an empty submodule.-DJPEGXL_ENABLE_OPENEXR=ON— Let the tools read and write OpenEXR.-DJPEGXL_ENABLE_TRANSCODE_JPEG=ON— WithJPEGXL_ENABLE_BOXES, keep two decoder features that upstream builds by default: reconstructing the original JPEG from a losslessly recompressed file, and reading the metadata boxes in a file.-DJPEGXL_ENABLE_TOOLS=ON— Buildcjxlanddjxl.-DJPEGXL_ENABLE_MANPAGES=ON— Build their manual pages, with asciidoc’sa2x;asciidocis a dependency for this.-DJPEGXL_ENABLE_DOXYGEN=OFF— With_BENCHMARK,_EXAMPLES,_DEVTOOLS,_VIEWERS,_FUZZERS,_JNI,_TCMALLOCand_COVERAGEallOFF, build no API reference, benchmark, examples, developer tools, viewers, fuzzers, Java binding, tcmalloc allocator or coverage instrumentation. Several are on by default, and the Java binding and tcmalloc are built whenever their dependencies happen to be installed.-DJPEGXL_ENABLE_PLUGINS=ON— With-DJPEGXL_ENABLE_PLUGIN_GDKPIXBUF=ON, build the gdk-pixbuf loader; upstream builds no plugins by default.-DJPEGXL_ENABLE_PLUGIN_MIME=OFF— Install noimage-jxl.xml. shared-mime-info’s own database already definesimage/jxl.-DJPEGXL_WARNINGS_AS_ERRORS=OFF— Upstream’s default, named.-DCMAKE_REQUIRE_FIND_PACKAGE_GIF=ON— With_JPEGand_PNG, stop the configure if giflib, libjpeg-turbo or libpng is missing.cjxlanddjxlwould otherwise build without that input or output format and say nothing.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/libjxl, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf libjxl-0.12.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/libjxl, and runs the triggers its paths call for.
Contents
Installed programs: cjxl, djxl, jxlinfo, jxltran.
Installed libraries: libjxl.so, libjxl_cms.so, libjxl_extras_codec.a, libjxl_threads.so.
Installed directories: /usr/include/jxl, /usr/share/licenses/libjxl.
Short descriptions
cjxl |
compress images to JPEG XL |
djxl |
decompress JPEG XL images |
libjxl.pc |
Loads and saves JPEG XL files |
libjxl_cms.pc |
CMS support library for libjxl |
libjxl_threads.pc |
JPEG XL multi-thread runner using std::threads. |