Fix minizip packaging, large-file detection, and EOCD lookup #1375
Where's the meaning in creating installed_headers.c? The test compiles zip.c which already includes zip.h, if the include-path doesn't match that one fails no matter of unzip.h would be found.
And you do this in find_package_test which operates only on the installed tree, there are no references to the sourcetree (if you find some, that needs to be corrected).
For the interface $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/minizip>) should be enough as this is the only place headers are installed. But I guess the moving of the headers was intended to end up in stuff like #include "minizip/zip.h" which would mean the BUILD_INTERFACE and the source itself would need adjustments. @madler: What was the intention?
For the version: Correct.
For pkgconfig: Nothing I know enough about to judge.
Why do you start copying files around instead of using a function to modify the environment of the test like demonstrated in /test/CMakeLists.txt Lines 1-14 which would be reuseable if more tests are added?
Fixed the new archive test's Cygwin runtime setup in 1230746093dbe71e3f981d0b83d7fe2671bb2cf3: Cygwin also needs the shared minizip/zlib DLLs beside the test executable, despite WIN32 being false. No test was disabled or weakened.
The new Cygwin job now passes 26/26 tests, including both archive regressions: https://github.com/madler/zlib/actions/runs/42235455471/job/127951741676
The focused shared/static archive tests also remain passing on Windows VS 2026 and Linux after this platform-condition correction.
It's not some optional feature, if minizip is compiled with bzip2 bzip2 is required, otherwise presence of bzip2 is irrelevant. Simulating a user do weird stuff gives no benefit.
As the docs say, this module can be used in find-modules to preserve the env they where called in. Needed because these modules get included. This file here is either toplevel or used via add_subdirectory, so this changes nothing in behaviour and just adds lines.
It's intended to be in the cache. If minizip is searched in a subdir, the normal var wouldn't propagate to the parentdir so users can't check there if minizip supports bzip2. As bzip2 could be found in by previous searched dep, checking for that doesn't tell the user anything about the abilities of minizip.
I guess now you start to mix things.
Follow-up 057660cc generates configuration-specific pkg-config metadata from actual library filenames, fixing static-only Windows/MinGW names and Debug postfixes. Added an installed pkg-config link consumer and explicit static-only mingw64 CI coverage. Locally validated shared/static and static-only Linux builds with BZip2 OFF/ON, Windows VS 2026 package suites, and a native Windows static consumer compiled/linked/run using actual pkg-config --msvc-syntax output. The new MinGW job will provide validation on that exact toolchain.
Exact-toolchain validation is now green on 057660cc: MSys mingw64 passed all 30 standard tests and all 4 selected static-only tests (including both pkg-config configure/build tests). The job log confirms the static build produces libminizips.a and libzs.a and the installed metadata consumer links successfully. Cygwin also passed. Job: https://github.com/madler/zlib/actions/runs/42270706157/job/128074202848
The new pkg-config consumer exposed a failure on OpenBSD, where BZip2 was found under /usr/local/lib. Follow-up 5107ca28 adds imported dependency search directories and resolves BZip2 filenames per configuration; the consumer no longer adds zlib library directories outside the metadata. Windows native MSVC and all four Linux mixed/static-only BZip2 OFF/ON variants pass. OpenBSD now uses --output-on-failure so any remaining failure is visible. Awaiting the new exact-platform CI results.
Superflous as it's a complicated way to say if(BUILD_NOTHING)
If built completely from that source the target is not imported. What happens then?
Follow-up c16e80b9 also exports non-system zlib include directories: minizip public headers include zlib.h. Removed find_package(ZLIB) and all manual dependency path injection from the pkg-config consumer. Reproduced native MSVC C1083 before the fix; afterward the consumer compiles, links and runs using only actual pkg-config compiler/linker flags. All five Linux consumer configurations pass. This strengthens the regression instead of masking the missing headers.
This whole block basically tries to find the name of installed zlib. It's a complex block to adjust for systems that insist on using different names. This whole system is designed to have consistent naming everwhere, if anyone wants to rename them it's basically their problem to take to adjust the naming everywhere.
Depending on what @madler intended with this change only one of those 2 lines it needed.
Should it be #include "zip.h" or #include "minizip/zip.h"?
It seems that you just commit what the copilot in vcpkg tells you to adjust this project to their (strange) way of doing thing without even reading comments.
Vollstrecker
bmehta001
This fixes six related minizip build, packaging, and archive-reading issues:
includeandinclude/minizipfor installed shared/static targets, so consumers can include the installedzip.handunzip.hwithout source-tree header paths.Libsand zlib plus optional BZip2 inLibs.private, preserving static link order; expose the installed header directory inCflags.libminizip.so.1).fopen64under_LARGEFILE64_SOURCE=1, matching library compilation rather than selectingUSE_FILE32APIon glibc. Preserve and restore the caller's CMake check state.Regression coverage extends the existing installed-consumer test and adds shared/static archive tests for classic/ZIP64 read and append, self-extracting prefixes, truncated false EOCD signatures, mismatched comment lengths, scan-window boundaries, maximum-length comments, and file callback seeks beyond 4 GiB. The archive and stale-dependency regressions failed on both Windows and Linux before the production fixes.
Validation:
fopen64, and neither shared nor static builds selectUSE_FILE32API.git diff --checkpass. A 32-bit Linux runtime was not exercised because the local multilib CRT is unavailable.Earlier validation also verified
libminizip.so.1and actualpkg-config --staticconsumers in both BZip2 configurations.