117.1. lcms2-2.19.1
Little CMS colour management engine — applies ICC profiles
| Version | 2.19.1, release 1 |
| Shelf | graphics-libs — 2D rendering, vector and SVG, text layout, colour management and graph drawing libraries |
| Phase | 41_system (System), 100 of 1047 in build order |
| Licence | MIT |
| Homepage | https://littlecms.com/ |
| Build time | 0.3 SBU |
| Installed size | 825.2 KiB in 17 files |
| Recipe | ports/core/graphics-libs/lcms2/kpkgbuild |
About
Little CMS is a colour-management engine: liblcms2 transforms pixels between colour spaces by applying ICC profiles, the files that describe how a camera, scanner, screen or printer renders colour. It also installs the command-line tools transicc, linkicc, psicc, jpgicc and tificc, the last two applying a profile to a whole JPEG or TIFF image. Many ports link it, ffmpeg, imagemagick and gst-plugins-bad among them.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/graphics-libs.txt:
Colour management that ffmpeg, imagemagick and the gst plugin packages are configured against. Each of those build systems answers a missing library by disabling the feature rather than failing.
Sources
lcms2-2.19.1.tar.gz(5.5 MiB)
sha256bfc54f7bab59fbc921012014a8032e4cba4abd46db47d46b76416a8c0b2815c8
upstream: https://github.com/mm2/Little-CMS/releases/download/lcms2.19.1/lcms2-2.19.1.tar.gz
archive copy: sources-2/graphics-libs--lcms2-2.19.1.tar.gz
Dependencies
Depends on: libtiff, libjpeg-turbo, zlib.
Required by (37): babl, calligra, darktable, digikam, ffmpeg, gegl, gimp, graphicsmagick, gst-plugins-bad, gthumb, gwenview, imagemagick, inkscape, kodi, krita, kwin, libcdr, libcupsfilters, libjxl, libplacebo, libraw, libreoffice, libvips, mpv, opencolorio, openjdk, openjpeg, pdf4qt, pdfium, pngquant, podofo, poppler, python3-pillow, qt6-qtwebengine, rawtherapee, 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 lcms2'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/graphics-libs/lcms2.
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/graphics-libs/lcms2
echo 'bfc54f7bab59fbc921012014a8032e4cba4abd46db47d46b76416a8c0b2815c8 lcms2-2.19.1.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/lcms2
SRC=$SRC_ROOT/lcms2-2.19.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf lcms2-2.19.1.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:
./configure --prefix=/usr --libdir=/usr/lib --disable-static \
--with-jpeg --with-tiff --with-zlib
for _l in 'LIB_JPEG = -ljpeg' 'LIB_TIFF = -ltiff' 'LIB_ZLIB = -lz'; do
grep -q "^$_l\$" Makefile || { echo "lcms2: $_l missing" >&2; exit 1; }
done
make
make DESTDIR=$PKG install
The switches, and why each is set:
--with-jpeg,--with-tiff,--with-zlib— Build with libjpeg-turbo, libtiff and zlib. In lcms2’sconfigurethese only say “try”: each library is probed by its headers and a test link, and a probe that fails sets the library aside with no error.jpgiccandtificcare then left out of the build, since each is built only under the matchingHasJPEGorHasTIFFcondition.
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/lcms2, 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 lcms2-2.19.1-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/lcms2, and runs the triggers its paths call for.
Contents
Installed programs: jpgicc, linkicc, psicc, tificc, transicc.
Installed libraries: liblcms2.so.
Installed directories: /usr/share/licenses/lcms2.
Short descriptions
jpgicc |
little cms ICC profile applier for JPEG. |
linkicc |
little cms device link generator. |
psicc |
little cms PostScript converter. |
tificc |
little cms ICC profile applier for TIFF. |
transicc |
little cms ColorSpace conversion calculator. |
lcms2.pc |
LCMS Color Management Library |
Notes
Because the three switches cannot make configure fail, build.sh checks its result: after configure it looks in the generated Makefile for LIB_JPEG = -ljpeg, LIB_TIFF = -ltiff and LIB_ZLIB = -lz, the values each probe sets only on success, and stops the build naming whichever is missing. A library that disappears from the build therefore fails the port instead of shipping it without jpgicc or tificc.