Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

90.13. minizip-ng-4.2.2

Zip archive manipulation library, the zlib-ng fork of minizip

Version 4.2.2, release 2
Shelf archiver — Compression libraries and archive tools
Phase 41_system (System), 68 of 1047 in build order
Licence Zlib
Homepage https://github.com/zlib-ng/minizip-ng
Build time 0.1 SBU
Installed size 317.7 KiB in 28 files
Recipe ports/core/archiver/minizip-ng/kpkgbuild

About

minizip-ng is the zlib-ng project’s fork of minizip, a ZIP library with its own API, <minizip-ng/mz_zip.h> and the rest. It reads and writes the deflate, bzip2, xz, zstd and PPMd methods, and both PKWARE and WinZip AES encryption. opencolorio links it. zlib’s own minizip is the separate minizip port.

Sources

Dependencies

Depends on: cmake, ninja, zlib, bzip2, xz, zstd, openssl.

Required by (1): opencolorio.

Patches

build.sh applies these; kpkg applies nothing by itself.

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-ng'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/archiver/minizip-ng.

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-ng
echo '71af7b9799856d8b03619df3949e9c1be9703f8de0795af71399ba283cb27aac  minizip-ng-4.2.2.tar.gz' | sha256sum -c -
echo '74b11efd8559f9b3dc652e89dc8ebdf4acb66e514a745e44cf75582cdf4512fd  7zip-26.03.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/minizip-ng
SRC=$SRC_ROOT/minizip-ng-4.2.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf minizip-ng-4.2.2.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf 7zip-26.03.tar.gz -C "$SRC_ROOT"

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 recipe’s helpers _7zip and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/zstd-pkgconfig.patch"

mkdir build && cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib \
	-DBUILD_SHARED_LIBS=ON \
	-DMZ_COMPAT=OFF \
	-DMZ_FETCH_LIBS=OFF \
	-DMZ_FORCE_FETCH_LIBS=OFF \
	-DMZ_ZLIB=ON -DMZ_ZLIB_FLAVOR=zlib \
	-DMZ_BZIP2=ON \
	-DMZ_LZMA=ON \
	-DMZ_PPMD=ON \
	-DFETCHCONTENT_SOURCE_DIR_PPMD="$SRC_ROOT/7zip-$_7zip" \
	-DFETCHCONTENT_FULLY_DISCONNECTED=ON \
	-DMZ_ZSTD=ON \
	-DMZ_PKCRYPT=ON \
	-DMZ_WZAES=ON \
	-DMZ_OPENSSL=ON \
	-DMZ_LIBBSD=OFF \
	-DMZ_ICONV=ON \
	-DMZ_BUILD_TESTS=OFF \
	-DMZ_BUILD_UNIT_TESTS=OFF
ninja
DESTDIR=$PKG ninja install

readelf -d "$PKG/usr/lib/libminizip-ng.so" | grep -q "NEEDED.*libzstd"

The switches, and why each is set:

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-ng, 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-ng-4.2.2-2.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-ng, and runs the triggers its paths call for.

Contents

Installed libraries: libminizip-ng.so, libppmd.a.

Installed directories: /usr/include/minizip-ng, /usr/lib/cmake/minizip-ng, /usr/share/licenses/minizip-ng.

Short descriptions

minizip-ng.pc Zip manipulation library

Notes

The readelf line at the end of build.sh fails the build unless libminizip-ng.so needs libzstd, so a zstd that neither CMake nor pkg-config finds cannot ship a library without the method.

minizip-ng’s CMakeLists.txt names the 7-Zip version it clones for PPMd; the recipe’s _7zip is the 7zip port’s version, which can be a later release than that pin.

The package also installs libppmd.a, the static archive the build makes of those 7-Zip sources: minizip-ng’s exported CMake targets list it as MINIZIP::ppmd, so a consumer that finds the package through CMake needs it to be present.