90.1. minizip-1.3.2
Read and write ZIP archives: the minizip library from zlib's contrib
| Version | 1.3.2, release 1 |
| Shelf | archiver — Compression libraries and archive tools |
| Phase | 41_system (System), 1 of 1047 in build order |
| Licence | Zlib |
| Homepage | https://www.zlib.net/ |
| Build time | 0.2 SBU |
| Installed size | 111.4 KiB in 11 files |
| Recipe | ports/core/archiver/minizip/kpkgbuild |
About
minizip is the small ZIP library in zlib’s contrib/minizip: libminizip, with the <minizip/zip.h>, <minizip/unzip.h> and <minizip/ioapi.h> headers that chromium, qt6-qtwebengine, keepassxc, wireshark, vlc and the other ports that name it in depends include. It is built from the zlib release archive itself, which is why the recipe’s source saves zlib’s tarball under the port’s own name, and the version is the zlib release it comes from.
The zlib-ng fork of the library is the separate minizip-ng port, which installs under its own names, so the two can be installed together.
Sources
minizip-1.3.2.tar.xz(1.3 MiB)
sha256d7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3
upstream: https://zlib.net/zlib-1.3.2.tar.xz
archive copy: sources-1/archiver--minizip-1.3.2.tar.xz
Dependencies
Depends on: autoconf, automake, libtool, pkgconf, zlib.
Required by (13): assimp, chromium, endless-sky, freexl, keepassxc, libretro-mupen64plus-next, libspatialite, libxlsxwriter, mupen64plus, qt6-qtwebengine, vlc, widelands, wireshark.
Patches
build.sh applies these; kpkg applies nothing by itself.
install-ints-header.patch— contrib/minizip: install ints.hzlib-1.2.8-minizip-include.patch— minizip: Add missing includeInclude zconf.h for z_crc_t, fixes a regression from commit 63ba7582b80eb81b126c2931e485481c35596aab.
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 minizip'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/archiver/minizip.
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/archiver/minizip
echo 'd7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3 minizip-1.3.2.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/minizip
SRC=$SRC_ROOT/minizip-1.3.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf minizip-1.3.2.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:
cd contrib/minizip
patch -p1 -i "$PORT_SRC/install-ints-header.patch"
patch -p1 -i "$PORT_SRC/zlib-1.2.8-minizip-include.patch"
autoreconf -fi
./configure --prefix=/usr --libdir=/usr/lib --disable-static
make
make DESTDIR=$PKG install
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/minizip, 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 minizip-1.3.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/minizip, and runs the triggers its paths call for.
Contents
Installed libraries: libminizip.so.
Installed directories: /usr/include/minizip, /usr/share/licenses/minizip.
Short descriptions
minizip.pc |
Minizip zip file manipulation library |
Notes
build.sh works in contrib/minizip alone; the rest of the zlib tree is not built, and the library links the zlib port. That directory carries a configure.ac and a Makefile.am but no generated configure, so autoreconf -fi makes one, after install-ints-header.patch has edited Makefile.am.
Both patches carry their own description. install-ints-header.patch, from zlib’s pull request 1165, adds ints.h to the installed headers: ioapi.h includes it, and without it a consumer’s #include <minizip/ioapi.h> fails. zlib-1.2.8-minizip-include.patch makes crypt.h include zconf.h for the z_crc_t type it uses.