118.6. libpng-1.6.59
A collection of routines used to create PNG format graphics files
| Version | 1.6.59, release 1 |
| Shelf | image-libs — Raster image formats, codecs, metadata, processing, barcodes, and terminal image output |
| Phase | 41_system (System), 95 of 1047 in build order |
| Licence | libpng-2.0 |
| Homepage | https://www.libpng.org/pub/png/libpng.html |
| Build time | 0.2 SBU |
| Installed size | 1.1 MiB in 24 files |
| Recipe | ports/core/image-libs/libpng/kpkgbuild |
About
libpng is the reference library for PNG images, and the most depended-on image library in the tree: freetype, cairo, harfbuzz, gdk-pixbuf, both Qt versions, KDOS’s identity generator kdos-theme and most of the graphical applications link it. It also installs pngfix, which checks and repairs PNG files, png-fix-itxt, which corrects the length field of the uncompressed iTXt chunks libpng 1.6.0 and 1.6.1 wrote wrong, and the libpng-config script.
Sources
libpng-1.6.59.tar.xz(1.0 MiB)
sha256d80dd2a38a37f803cb9b6ac7b14bd6e74ddc3b654780a8380bdf93523fdb4389
upstream: https://downloads.sourceforge.net/libpng/libpng-1.6.59.tar.xz
archive copy: sources-3/image-libs--libpng-1.6.59.tar.xz
Dependencies
Depends on: zlib.
Required by (132): abiword, amiberry, ardour, audacity, baresip, blender, cairo, celestia, chocolate-doom, crawl-tiles, crispy-doom, curaengine, darktable, dcmtk, ddnet, deutex, devilutionx, digikam, dosbox-staging, dosbox-x, endless-sky, farbfeld, fheroes2, fig2dev, fldigi, fltk, fontforge, freerdp, freetype2, fuse-emulator, gdal, gdk-pixbuf, gegl, ghostscript, gimp, gl2ps, glmark2, gmsh, gnuplot, goxel, grafx2, graphicsmagick, graphviz, gst-plugins-base, gst-plugins-good, gthumb, gtk4, gutenprint, gwenview, harfbuzz, hatari, horizon-eda, imagemagick, imv, inkscape, jbig2dec, kdos-theme, kodi, krita, leptonica, libavif, libcupsfilters, libgd, libharu, libheif, libjxl, libreoffice, libretro-mupen64plus-next, libsixel, libvips, libvncserver, libwebp, luanti, mgba, motif, mupen64plus, netpbm, netsurf, neverball, opencv, openimageio, openjdk, openjpeg, openmsx, openrct2, openttd, optipng, orcaslicer, pdf4qt, pdfio, pdfium, pngquant, podofo, poppler, powder-toy, ppsspp, prusaslicer, qemu, qrencode, qt5-qtbase, qt6-qtbase, qt6-qtwebengine, R, rawtherapee, sane-airscan, sane-backends, satdump, scummvm, sdl2-image, sdl3-image, slang, solvespace, sox, srb2, stella, supertux, supertuxkart, swayimg, texlive, tuxpaint, vice, vlc, vtk, warzone2100, webkitgtk, webkitgtk6, widelands, wlvncc, wv, wxwidgets, xonotic, zint.
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 libpng'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/image-libs/libpng.
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/libpng
echo 'd80dd2a38a37f803cb9b6ac7b14bd6e74ddc3b654780a8380bdf93523fdb4389 libpng-1.6.59.tar.xz' | 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/libpng
SRC=$SRC_ROOT/libpng-1.6.59
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libpng-1.6.59.tar.xz -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:
LIBS=-lpthread ./configure --prefix=/usr
make
make DESTDIR=$PKG install
The switches, and why each is set:
LIBS=-lpthread— Add-lpthreadto every link configure tests and the build makes. musl keeps its threads in libc, and itslibpthread.ais an empty archive, so on this tree the flag links nothing and adds no dependency.
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/libpng, 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 libpng-1.6.59-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/libpng, and runs the triggers its paths call for.
Contents
Installed programs: libpng-config, libpng16-config, png-fix-itxt, pngfix.
Installed libraries: libpng.a, libpng.so, libpng16.a, libpng16.so.
Installed directories: /usr/include/libpng16, /usr/share/licenses/libpng.
Short descriptions
libpng16.pc |
Loads and saves PNG files |
Notes
The recipe keeps upstream’s default of building the static archive as well, so libpng16.a (and the libpng.a link to it) are installed beside the shared library.