118.5. libtiff-4.7.2
TIFF libraries and associated utilities
| Version | 4.7.2, release 1 |
| Shelf | image-libs — Raster image formats, codecs, metadata, processing, barcodes, and terminal image output |
| Phase | 41_system (System), 94 of 1047 in build order |
| Licence | libtiff |
| Homepage | https://libtiff.gitlab.io/libtiff/ |
| Build time | 0.8 SBU |
| Installed size | 1.8 MiB in 112 files |
| Recipe | ports/core/image-libs/libtiff/kpkgbuild |
About
libtiff reads and writes TIFF, the format scanners, fax software and document feeders write, and installs the classic tools: tiffinfo, tiffcp, tiffsplit, tiff2pdf, tiff2ps, fax2tiff and the rest. leptonica, and through it tesseract, reads multi-page TIFF through it; ghostscript, poppler, imagemagick, gimp, gdk-pixbuf and Qt’s image-format plugins link it.
Sources
libtiff-4.7.2.tar.gz(3.9 MiB)
sha256672bd7d10aee4606171afb864f3570b83340f6a33e2c186dc0512f7145ffdf6a
upstream: https://download.osgeo.org/libtiff/tiff-4.7.2.tar.gz
archive copy: sources-3/image-libs--libtiff-4.7.2.tar.gz
Dependencies
Depends on: cmake, ninja, zlib, libjpeg-turbo, xz, zstd, libdeflate, jbigkit.
Required by (55): blender, chafa, darktable, dcmtk, digikam, djvulibre, fontforge, gdal, gdk-pixbuf, gegl, ghostscript, gimp, gnuastro, grafx2, graphicsmagick, gthumb, gtk4, gutenprint, gwenview, imagemagick, imv, krita, lcms2, leptonica, libcupsfilters, libgd, libgeotiff, libgphoto2, libheif, libreoffice, libvips, libwebp, netpbm, okular, opencv, openimageio, openjpeg, podofo, poppler, proj, python3-pillow, qt6-qtimageformats, qt6-qtwebengine, R, rawtherapee, sane-airscan, sane-backends, satdump, sdl2-image, sdl3-image, swayimg, tesseract, vtk, wxwidgets, xastir.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
-Dwebp=OFF, line 26: libwebp (explained with the switches below)-Dsphinx=OFF, line 30: python3-sphinx (explained with the switches below)
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 libtiff'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/image-libs/libtiff.
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/libtiff
echo '672bd7d10aee4606171afb864f3570b83340f6a33e2c186dc0512f7145ffdf6a libtiff-4.7.2.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/libtiff
SRC=$SRC_ROOT/libtiff-4.7.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libtiff-4.7.2.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_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_LIBEXECDIR=lib \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS -DNDEBUG" \
-DCMAKE_INSTALL_DOCDIR=/usr/share/doc/libtiff \
-Dzlib=ON -DCMAKE_REQUIRE_FIND_PACKAGE_ZLIB=ON \
-Dpixarlog=ON \
-Dlibdeflate=ON -DCMAKE_REQUIRE_FIND_PACKAGE_Deflate=ON \
-Djpeg=ON -Dold-jpeg=ON -DCMAKE_REQUIRE_FIND_PACKAGE_libjpeg-turbo=ON \
-Dlzma=ON -DCMAKE_REQUIRE_FIND_PACKAGE_liblzma=ON \
-Dzstd=ON -DCMAKE_REQUIRE_FIND_PACKAGE_ZSTD=ON \
-Dwebp=OFF \
-Djbig=ON -DCMAKE_REQUIRE_FIND_PACKAGE_JBIG=ON \
-Dlerc=OFF \
-Dtiff-opengl=OFF \
-Dsphinx=OFF \
-Dtiff-tests=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
for m in doc/man-prebuilt/*.1; do
b=${m##*/}
if [ -e "$PKG/usr/bin/${b%.1}" ]; then
install -Dm644 "$m" -t "$PKG/usr/share/man/man1"
fi
done
install -Dm644 doc/man-prebuilt/*.3tiff -t "$PKG/usr/share/man/man3"
The switches, and why each is set:
-DCMAKE_REQUIRE_FIND_PACKAGE_ZLIB=ON— WithCMAKE_REQUIRE_FIND_PACKAGE_Deflate,_libjpeg-turbo,_liblzma,_ZSTDand_JBIG, stop the configure when a codec library is missing. Every codec option defaults to whether its library was found, and even set toONit takes effect only when the search succeeded. The requirements turn a missing library into an error instead of a libtiff that quietly reads fewer kinds of file.-DCMAKE_C_FLAGS_RELEASE="$CFLAGS -DNDEBUG"— Replace CMake’s Release flags,-O3 -DNDEBUG, with the tree’sCFLAGSand-DNDEBUG;-DCMAKE_CXX_FLAGS_RELEASEdoes the same fromCXXFLAGSfor the C++ library,libtiffxx. CMake puts the Release flags afterCFLAGSon every compile, so its-O3would otherwise override the tree’s-O2.-Dzlib=ON— Deflate (ZIP) compression, through zlib.-Dpixarlog=ON— Pixar’s log-encoded compression, which also needs zlib.-Dlibdeflate=ON— Use libdeflate for faster Deflate coding; zlib is still required beside it.-Djpeg=ON— JPEG compression inside TIFF, through libjpeg-turbo.-Dold-jpeg=ON— Read the obsolete “old-style” JPEG compression some old files carry; it is read-only.-Dlzma=ON— LZMA compression, through xz’s liblzma.-Dzstd=ON— Zstandard compression.-Djbig=ON— JBIG compression, through jbigkit.-Dwebp=OFF— Build no WebP codec. libwebp depends on libtiff for its TIFF input, so a WebP codec here would close the two into a dependency cycle.-Dlerc=OFF— Build no LERC codec; LibLerc is not a port.-Dtiff-opengl=OFF— Build notiffgt, an OpenGL and GLUT viewer.-Dsphinx=OFF— Do not build the manual with Sphinx. The release carries the same pages already built, indoc/man-prebuilt, andbuild.shinstalls those.-Dtiff-tests=OFF— Build no test programs.
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/libtiff, 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 libtiff-4.7.2-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/libtiff, and runs the triggers its paths call for.
Contents
Installed programs: fax2ps, fax2tiff, pal2rgb, ppm2tiff, raw2tiff, tiff2bw, tiff2pdf, tiff2ps, tiff2rgba, tiffcmp, tiffcp, tiffcrop, tiffdither, tiffdump, tiffinfo, tiffmedian, tiffset, tiffsplit.
Installed libraries: libtiff.so, libtiffxx.so.
Installed directories: /usr/lib/cmake/tiff, /usr/share/licenses/libtiff.
Short descriptions
fax2ps |
convert a TIFF facsimile to compressed PostScript™ |
fax2tiff |
create a TIFF Class F fax file from raw fax data |
pal2rgb |
convert a palette color TIFF image to a full color image |
ppm2tiff |
create a TIFF file from PPM, PGM and PBM image files Synopsis ppm2tiff [ options ] [ input.ppm ] output.tif |
raw2tiff |
create a TIFF file from a raw data file |
tiff2bw |
convert a color TIFF image to greyscale |
tiff2pdf |
convert a TIFF image to a PDF document |
tiff2ps |
convert TIFF image to PostScript™ |
tiff2rgba |
convert a TIFF image to RGBA color space |
tiffcmp |
compare two TIFF files |
tiffcp |
copy (and possibly convert) a TIFF file |
tiffcrop |
select, copy, crop, convert, extract, and/or process one or more TIFF files |
tiffdither |
convert a greyscale TIFF image to bilevel using dithering |
tiffdump |
print verbatim information about TIFF files |
tiffinfo |
print information about TIFF files |
tiffmedian |
apply the median cut algorithm to data in a TIFF file |
tiffset |
set or unset a field in a TIFF header |
tiffsplit |
split a multi-image TIFF into single-image TIFF files |
libtiff-4.pc |
Tag Image File Format (TIFF) library. |
Notes
The prebuilt section-1 pages cover every tool in the source tree, including tiffgt (not built here) and rgb2ycbcr and thumbnail, which upstream builds but never installs. build.sh therefore copies a page only when /usr/bin in the package has the program it describes. All the section-3 pages (*.3tiff) are installed.