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
minizip-ng-4.2.2.tar.gz(597.6 KiB)
sha25671af7b9799856d8b03619df3949e9c1be9703f8de0795af71399ba283cb27aac
upstream: https://github.com/zlib-ng/minizip-ng/archive/refs/tags/4.2.2.tar.gz
archive copy: sources-1/archiver--minizip-ng-4.2.2.tar.gz7zip-26.03.tar.gz(2.1 MiB)
sha25674b11efd8559f9b3dc652e89dc8ebdf4acb66e514a745e44cf75582cdf4512fd
upstream: https://github.com/ip7z/7zip/archive/refs/tags/26.03.tar.gz
archive copy: sources-1/archiver--7zip-26.03.tar.gz
Dependencies
Depends on: cmake, ninja, zlib, bzip2, xz, zstd, openssl.
Required by (1): opencolorio.
Patches
build.sh applies these; kpkg applies nothing by itself.
zstd-pkgconfig.patch— whenfind_package(zstd CONFIG)finds nothing, looks forlibzstdthrough pkg-config and links the importedPkgConfig::ZSTD_PCtarget. minizip-ng otherwise finds zstd only as a CMake package, and the zstd port, built with zstd’s plain makefiles, installslibzstd.pcand no CMake package, so the method would be silently disabled.
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:
-DMZ_COMPAT=OFF— install the library and headers under minizip-ng’s own names,libminizip-ngand<minizip-ng/…>. The compatibility layer, upstream’s default, would install alibminizipand<unzip.h>that collide with theminizipport’s.-DMZ_ZLIB_FLAVOR=zlib— link zlib. Left atauto, minizip-ng looks for zlib-ng first, and the zlib-ng port, which installs a CMake package, is in the same phase without being independs, so the library linked would depend on build order.-DMZ_FETCH_LIBS=OFF— with-DMZ_FORCE_FETCH_LIBS=OFF: never download a compression library. A library that is not found disables its method instead. Both are upstream’s defaults on Linux.-DMZ_PPMD=ON— the PPMd method. There is no PPMd library to find: minizip-ng compiles three source files of 7-Zip’s for it, and clones 7-Zip to get them whateverMZ_FETCH_LIBSsays.-DFETCHCONTENT_SOURCE_DIR_PPMD— points that clone at the 7-Zip release unpacked from the recipe’s second source, the same tarball, under the same name and hash, as the 7zip port’s, so the source archive holds the file once.-DFETCHCONTENT_FULLY_DISCONNECTED=ON— make any other download CMake’sFetchContentwould attempt an error instead of a network call.-DMZ_ZSTD=ON— the zstd method, with zstd found aszstd-pkgconfig.patchlets it be.-DMZ_LIBBSD=OFF— do not look for libbsd’sarc4random_buf. Upstream’s default on Unix is on, but its random-number probe runs only when OpenSSL is off; withMZ_OPENSSL, the random bytes for encryption come from OpenSSL’sRAND_bytes, and the switch changes nothing.-DMZ_OPENSSL=ON— with-DMZ_PKCRYPT=ONand-DMZ_WZAES=ON: PKWARE’s traditional encryption and WinZip AES, with the cryptography from openssl.-DMZ_ICONV=ON— convert file-name encodings withiconv, which musl provides itself, so no library is added.
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.