118.34. graphicsmagick-1.3.48
Image processing and Magick++, behind Octave's imread and imwrite
| Version | 1.3.48, release 1 |
| Shelf | image-libs — Raster image formats, codecs, metadata, processing, barcodes, and terminal image output |
| Phase | 41_system (System), 713 of 1047 in build order |
| Licence | MIT |
| Homepage | http://www.graphicsmagick.org/ |
| Build time | 1.3 SBU |
| Installed size | 6.3 MiB in 163 files |
| Recipe | ports/core/image-libs/graphicsmagick/kpkgbuild |
About
GraphicsMagick is the image-processing library and gm command that forked from ImageMagick, kept in KDOS for Magick++, its C++ API. Octave’s imread, imwrite and imfinfo are built on it, because Octave needs the ImageMagick 6 API (Magick::PixelPacket), which GraphicsMagick keeps and ImageMagick 7 dropped; inkscape, timg and xastir link it too. The imagemagick port is a separate program and installs its own commands.
Sources
graphicsmagick-1.3.48.tar.xz(5.8 MiB)
sha2569218eb78179110f91371066ab75cb3b4dd034b9bb464b29ce9bab7a11979232b
upstream: https://downloads.sourceforge.net/graphicsmagick/GraphicsMagick-1.3.48.tar.xz
archive copy: sources-3/image-libs--graphicsmagick-1.3.48.tar.xz
Dependencies
Depends on: gcc, bzip2, zlib, zstd, xz, libpng, libjpeg-turbo, jasper, libjxl, jbigkit, libtiff, libwebp, libheif, lcms2, freetype2, libxml2, libzip, ghostscript.
Required by (4): inkscape, octave, timg, 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.
--without-perl, line 19: perl (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 graphicsmagick'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/image-libs/graphicsmagick.
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/graphicsmagick
echo '9218eb78179110f91371066ab75cb3b4dd034b9bb464b29ce9bab7a11979232b graphicsmagick-1.3.48.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/graphicsmagick
SRC=$SRC_ROOT/graphicsmagick-1.3.48
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf graphicsmagick-1.3.48.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:
LDFLAGS= ./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib \
--enable-shared \
--disable-static \
--enable-openmp \
--without-modules \
--with-quantum-depth=16 \
--with-magick-plus-plus \
--without-perl \
--disable-magick-compat \
--with-threads \
--with-bzlib \
--with-zlib \
--with-zstd \
--with-lzma \
--with-png \
--with-jpeg \
--with-jp2 \
--with-jxl \
--with-jbig \
--with-tiff \
--with-webp \
--with-heif \
--with-lcms2 \
--with-ttf \
--with-xml \
--with-libzip \
--with-gs \
--without-fpx \
--without-wmf \
--without-trio \
--without-x
make LDFLAGS="$LDFLAGS"
make LDFLAGS="$LDFLAGS" DESTDIR=$PKG install
test -e "$PKG"/usr/lib/libGraphicsMagick++.so
test -e "$PKG"/usr/lib/pkgconfig/GraphicsMagick++.pc
readelf -d "$PKG"/usr/lib/libGraphicsMagick.so | grep -q "NEEDED.*libgomp"
readelf -d "$PKG"/usr/lib/libGraphicsMagick.so | grep -q "NEEDED.*libjasper"
The switches, and why each is set:
LDFLAGS=— Run configure with an emptyLDFLAGS, and pass the tree’s flags tomakeinstead. The configure script writes itsLDFLAGSinto theLibs.privateline ofGraphicsMagick.pc, so a consumer that links statically would inherit the tree’s linker flags; given tomake, they apply to this build alone.--enable-openmp— Run the resize, convolution and colour-conversion loops in parallel with OpenMP, over gcc’slibgomp.--without-modules— Link every coder into the library rather than build each as a loadable module.--with-quantum-depth=16— Store 16 bits per sample instead of the default 8, so 16-bit images, Octave’suint16among them, keep their full range.--with-magick-plus-plus— Build Magick++, the C++ library Octave links.--without-perl— Build no PerlMagick binding.--disable-magick-compat— Install no ImageMagick-named commands (convert,identifyand the rest), which upstream offers as shortcuts togm, so nothing collides with the imagemagick port. It is upstream’s default, named.--with-threads— With--with-bzlib,--with-zlib,--with-zstd,--with-lzma,--with-png,--with-jpeg,--with-jp2,--with-jxl,--with-jbig,--with-tiff,--with-webp,--with-heif,--with-lcms2,--with-ttf,--with-xml,--with-libzipand--with-gs, build every coder and helper whose library is a port: JPEG 2000 here is JasPer’s (--with-jp2), TrueType is FreeType’s, and--with-gslets it render PostScript and PDF through ghostscript. Each is a probe that disables its coder when the library is missing, so each library is independs.--without-fpx— With--without-wmfand--without-trio, build no FlashPIX or WMF coder and no TRIO printf replacement; libfpx, libwmf and trio are not ports.
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/graphicsmagick, 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 graphicsmagick-1.3.48-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/graphicsmagick, and runs the triggers its paths call for.
Contents
Installed programs: GraphicsMagick++-config, GraphicsMagick-config, GraphicsMagickWand-config, gm.
Installed libraries: libGraphicsMagick++.so, libGraphicsMagick.so, libGraphicsMagickWand.so.
Installed directories: /usr/include/GraphicsMagick, /usr/lib/GraphicsMagick-1.3.48, /usr/share/GraphicsMagick-1.3.48, /usr/share/doc/GraphicsMagick, /usr/share/licenses/graphicsmagick.
Short descriptions
GraphicsMagick++-config |
get information about the installed version of Magick++ |
GraphicsMagick-config |
get information about the installed version of GraphicsMagick |
GraphicsMagickWand-config |
get information about the installed version of GraphicsMagick |
gm |
command-line utility to create, edit, compare, convert, or display images |
GraphicsMagick.pc |
GraphicsMagick image processing library |
GraphicsMagick++.pc |
C++ API for GraphicsMagick image processing library |
GraphicsMagickWand.pc |
GraphicsMagick Wand image processing library |
Notes
The configure script drops OpenMP without an error when the compiler refuses -fopenmp, so build.sh checks the installed libGraphicsMagick.so with readelf for a NEEDED entry on libgomp, and likewise on libjasper, the one coder library it checks by name. It also checks that libGraphicsMagick++.so and GraphicsMagick++.pc were installed, since Octave builds against them.