195.1. libgd-2.3.3
GD graphics library — draws lines, shapes, text and images into PNG, JPEG, GIF, WebP, TIFF, HEIF, AVIF and BMP
| Version | 2.3.3, release 1 |
| Shelf | image-libs — Raster image formats, codecs, metadata, processing, barcodes, and terminal image output |
| Phase | 42_graphics (Graphics Stack), 65 of 189 in build order |
| Licence | GD |
| Homepage | https://libgd.github.io/ |
| Build time | 0.6 SBU |
| Installed size | 746.7 KiB in 29 files |
| Recipe | ports/core/image-libs/libgd/kpkgbuild |
About
GD is a C library for drawing images in code: lines, shapes, fills, text through FreeType, scaling and filters, read from and written to PNG, JPEG, GIF, WebP, TIFF, HEIF, AVIF and BMP. In KDOS, gnuplot’s PNG, GIF and JPEG terminals, graphviz’s GD renderer, libsixel, libgphoto2, ptouch-print and TeX Live build on it.
Sources
libgd-2.3.3.tar.xz(2.7 MiB)
sha2563fe822ece20796060af63b7c60acb151e5844204d289da0ce08f8fdf131e5a61
upstream: https://github.com/libgd/libgd/releases/download/gd-2.3.3/libgd-2.3.3.tar.xz
archive copy: sources-3/image-libs--libgd-2.3.3.tar.xzheif-stride.patch
sha2560dc217c7f78ed3347857c4f35bbadf14d4ff38efc80bc2b8d02910f4e0db8d65
Dependencies
Depends on: pkgconf, perl, zlib, libpng, libjpeg-turbo, libwebp, libtiff, libheif, libavif, freetype2, fontconfig, libraqm, libimagequant.
Required by (6): gnuplot, graphviz, libgphoto2, libsixel, ptouch-print, texlive.
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.
--without-xpm, line 30: libXpm (explained with the switches below)
Patches
build.sh applies these; kpkg applies nothing by itself.
heif-stride.patch— Reads and writes the interleaved RGBA plane of a HEIF image row by row at the stride libheif reports, in both_gdImageCreateFromHeifCtxand_gdImageHeifCtxinsrc/gd_heif.c, where upstream passesNULLfor the stride and walks the plane as one packed run ofwidth * 4bytes. libheif answersheif_image_get_plane_readonly()withNULLwhen the stride pointer isNULL, so without the patch every HEIF read and every HEIF write fails with “gd-heif cannot get image plane”; and libheif may pad each row, so a packed walk would shear the picture.
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/42_graphics/phase.env && kpkg install libgd'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/image-libs/libgd.
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/libgd
echo '3fe822ece20796060af63b7c60acb151e5844204d289da0ce08f8fdf131e5a61 libgd-2.3.3.tar.xz' | sha256sum -c -
echo '0dc217c7f78ed3347857c4f35bbadf14d4ff38efc80bc2b8d02910f4e0db8d65 heif-stride.patch' | 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/libgd
SRC=$SRC_ROOT/libgd-2.3.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libgd-2.3.3.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:
patch -p1 -i $PORT_SRC/heif-stride.patch
./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib \
--disable-static \
--disable-rpath \
--disable-werror \
--enable-gd-formats \
--without-x \
--with-zlib \
--with-png \
--with-jpeg \
--with-webp \
--with-tiff \
--with-heif \
--with-freetype \
--with-fontconfig \
--with-raqm \
--with-liq \
--without-xpm \
--with-avif \
ax_cv_c_openmp=unknown
make
make DESTDIR=$PKG install
The switches, and why each is set:
--disable-rpath— Hardcodes no run-time library path into the library and its programs. With every library in/usr/lib, the default search path, such an entry adds nothing, and the package lint warns on it (see What the package lint refuses).--disable-werror— Keeps-Werrorout of the compile. configure adds it for a GCC build of a git checkout; the release tarball has no.git, and the switch keeps it off whatever the tree.--enable-gd-formats— Builds the GD and GD2 file formats, GD’s own uncompressed and chunked image formats. Upstream’s default is off.--without-x— Skips configure’s search for X11 include and library paths, which it runs for FreeType and XPM.--with-zlib,--with-png,--with-jpeg,--with-webp,--with-tiff,--with-heif,--with-avif,--with-freetype,--with-fontconfig— Each format and the text path through its port. With--with-<name>given, configure stops with “requested but not found” when the library is missing; on its default,auto, it would build without that format.--with-raqm— Lays out text drawn withgdImageStringFTthrough libraqm, which adds bidirectional text and complex-script shaping with HarfBuzz.--with-liq— Converts a true-colour image to a palette (gdImageTrueColorToPalette) with libimagequant, instead of GD’s own quantiser.--without-xpm— Builds no XPM reader. libXpm is a port but not in this port’sdepends, so the switch keeps the result independent of build order.ax_cv_c_openmp=unknown— Answers configure’s OpenMP check in advance with “no flag found”, soOPENMP_CFLAGSis empty and the libimagequant link carries no-fopenmp.
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/libgd, 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 libgd-2.3.3-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/libgd, and runs the triggers its paths call for.
Contents
Installed programs: annotate, bdftogd, gd2copypal, gd2togif, gd2topng, gdcmpgif, gdparttopng, gdtopng, giftogd2, pngtogd, pngtogd2, webpng.
Installed libraries: libgd.so.
Installed directories: /usr/share/licenses/libgd.
Short descriptions
gdlib.pc |
GD graphics library |