Commit graph

489 commits

Author SHA1 Message Date
tbeu
b59f684429 #998 Add MZ_ICU option for string encoding conversion
Add ICU as an alternative backend to libiconv using ucnv_convert.
ICU is detected via CMake's FindICU module on non-Windows platforms.
Add CI build configuration for ICU in GitHub Actions.
2026-07-06 22:45:39 -07:00
pmas
dfa766eb53 Update to use upstream 7zip version 26.02 2026-07-01 08:37:05 -07:00
Paul Marquess
bf7aa90bcd Update to use upstream 7zip version 26.01 2026-06-30 09:47:47 -07:00
Nathan Moin Vaziri
7b2387161c
Version 4.2.2. 2026-06-30 09:44:28 -07:00
Nathan Moin Vaziri
26b4619120
Version 4.2.1. 2026-04-27 12:23:18 -07:00
Nathan Moin Vaziri
d195f3722e cmake: pick zstd and zlib-ng targets per BUILD_SHARED_LIBS
Both packages export separate static and shared imported targets, but
the find_package paths picked one variant unconditionally — zstd
preferred libzstd_static and zlib-ng always linked the shared zlib.
Building minizip-ng with BUILD_SHARED_LIBS=ON against a system zstd
that ships both variants therefore produced a libminizip.so with zstd
statically baked in (#983).
2026-04-27 12:22:37 -07:00
Nathan Moin Vaziri
ea91a3c01b
Version 4.2.0. 2026-04-26 18:54:36 -07:00
Nathan Moin Vaziri
8ec500fd38 cmake: rename MINIZIP_PUBLIC_LIB variable 2026-04-25 01:21:33 -07:00
Nathan Moin Vaziri
b3bb871157 cmake: clean up and tighten comments 2026-04-25 00:43:12 -07:00
Nathan Moin Vaziri
c6fd0d701e cmake: skip find_dependency for PRIVATE deps when building shared
A shared minizip encapsulates its PRIVATE backend deps (bzip2, lzma, zstd,
iconv, ...) inside the .so/.dylib, and minizip-targets.cmake doesn't
reference them. Emitting find_dependency() for those backends in the
generated package config forces consumers of shared minizip to install
every backend just to call find_package(minizip), even when nothing
needs them.

Split MINIZIP_DEP_PKG into a PUBLIC list (always required, e.g. ZLIB
under MZ_COMPAT) and a private list emitted only when minizip is built
static. The static archive still requires all of them transitively.

Fixes #898.
2026-04-25 00:43:12 -07:00
Nathan Moin Vaziri
74609ad447 cmake: delegate OpenSSL pkg-config naming to Requires.private
Hard-coding "-lssl -lcrypto" in Libs.private breaks for LibreSSL (different
library names), MSVC import libraries, and custom build suffixes. Reference
openssl in Requires.private instead so the consumer's pkg-config delegates
to openssl.pc and resolves the correct library names locally.

Caught in PR review on #983.
2026-04-25 00:43:12 -07:00
Nathan Moin Vaziri
8aabaf214e cmake: link zlib PUBLIC when MZ_COMPAT exposes it in headers
compat/zip.h and compat/unzip.h reference zlib types and macros (ZEXPORT,
Z_DEFLATED, ...), so any consumer including those headers needs zlib's
INTERFACE_INCLUDE_DIRECTORIES on its include path. Linking via the imported
target keeps the install portable: find_dependency(ZLIB) on the consumer
recreates the target with the consumer's local paths, not the build host's.

Other backends are pure implementation details and stay PRIVATE.

Refs #914.
2026-04-25 00:43:12 -07:00
Nathan Moin Vaziri
6e97fbea09 cmake: only register found packages in MINIZIP_DEP_PKG
The list drives find_dependency() calls in the generated minizip-config.cmake,
so registering a package whose CMake config doesn't exist on the consumer
machine (PPMD, fetched BZip2/LibLZMA/zstd, etc.) makes find_package(minizip)
fail at configure time. Only register a package when it was located via
find_package, not when built from a fetched source tree (those targets are
already carried forward through install(EXPORT)).

Add Threads to MINIZIP_DEP_PKG when liblzma is fetched, since upstream xz's
exported target lists Threads::Threads in its INTERFACE_LINK_LIBRARIES and
the consumer's config has to recreate that imported target.

Refs #914.
2026-04-25 00:43:12 -07:00
Nathan Moin Vaziri
6a99a9533f cmake: link backend deps as PRIVATE and drop target_link_directories
Backend libraries (zlib, bzip2, lzma, zstd, openssl, iconv, frameworks)
are implementation details that don't appear in mz.h's public API, so
their linkage is PRIVATE rather than PUBLIC. For static minizip CMake
still propagates them transitively via INTERFACE_LINK_LIBRARIES_PRIVATE
when needed; for shared minizip they stay encapsulated and don't pollute
consumer link lines.

The target_link_directories call is no longer needed because every
imported target carries its own library directory; MINIZIP_LBD is
removed along with it.

Refs #914.
2026-04-25 00:43:12 -07:00
Nathan Moin Vaziri
1d5bc8d591 cmake: use -framework linker flags for CoreFoundation and Security
find_library returns SDK-absolute paths like
/Applications/Xcode.app/.../MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework
which get baked into INTERFACE_LINK_LIBRARIES on install and break
downstream consumers whose SDK lives at a different path. Pass the
frameworks as plain "-framework Foo" linker flags so each consumer's
own toolchain resolves them.

Refs #914.
2026-04-25 00:43:12 -07:00
Nathan Moin Vaziri
a3c6e8c02d cmake: use imported targets for compression and crypto backends
Replace raw ${FOO_LIBRARIES} / ${FOO_LIBRARY_DIRS} / ${FOO_INCLUDE_DIRS}
appends with imported target references so installed targets files don't
bake build-machine paths into INTERFACE_LINK_LIBRARIES. Affects ZLIB-NG,
ZLIB, BZip2, LibLZMA, ZSTD, OpenSSL, Iconv, and libbsd. Drops the
pkg-config-first paths for LZMA/ZSTD/OpenSSL since find_package now
provides portable imported targets across CMake 3.14+.

Refs #914.
2026-04-25 00:43:12 -07:00
Nathan Moin Vaziri
9826cbd435
Version 4.1.2. 2026-04-24 22:50:35 -07:00
Benjamin Buch
9a92170979 cmake: rename target files to avoid overwrite of PACKAGE_VERSION 2026-04-24 22:49:28 -07:00
Andrew Patterson
288b7f1d4b cmake: install crypt.h if using compatability mode #862 2026-04-24 22:49:28 -07:00
Nathan Moin Vaziri
c7c6ea74fb cmake: remove duplicate source include dir 2026-04-24 22:49:28 -07:00
Nathan Moin Vaziri
0a7ddd02dc cmake: use target_link_options instead of set_target_properties 2026-04-24 22:49:28 -07:00
Nathan Moin Vaziri
31049d44e8 cmake: fix comment for check_function_exists calls 2026-04-24 22:49:28 -07:00
Nathan Moin Vaziri
322c161a2f cmake: don't check ZLIB_COMPAT before it is set in MZ_FETCH_LIBS 2026-04-24 22:49:28 -07:00
Nathan Moin Vaziri
597ee06152 cmake: fix formatting before HOMEPAGE_URL 2026-04-24 22:49:28 -07:00
Nathan Moin Vaziri
96f1134432 cmake: remove unnecessary include dirs for test binaries 2026-04-24 22:49:28 -07:00
Nathan Moin Vaziri
84f3b20390
cmake: generate mz_config.h in build directory 2026-04-24 22:01:02 -07:00
Sergey Markelov
423b6448e1 cmake: fix: mz_config.h was missing in install target (#980) 2026-04-24 21:56:06 -07:00
Nathan Moin Vaziri
37adbba1d1
Version 4.1.1. 2026-04-22 21:10:20 -07:00
Paul Marquess
3e10f4d502
Harden the cmake Address Sanitizer detection code. (#960) 2026-04-22 18:56:59 -07:00
Sergey
2f074dc2b6
cmake: improve: mz.h, mz_os.h are public API, shouldn't rely on user -D (#978) 2026-04-20 17:26:22 -07:00
Sergey
bf4c563d7c
improve: support for more platforms (#977) 2026-04-17 18:13:52 -07:00
Alexander Lobakin
a4fc642164 Restore ability to prefer OpenSSL over BCrypt on Windows
One may prefer to use OpenSSL instead of BCrypt even on Windows,
for example, for consistency in cross-platform projects,
performance reasons etc.

The current CMakeLists.txt fully support such configurations,
except that commit abc80d1049 ("Clean up CMake options and add
feature_info for MZ_BCRYPT") make the MZ_OPENSSL option not
available on Windows.

Restore the pre-commit behaviour. The default configuration will
behave the same way as before the change (use BCrypt by default
and don't test for OpenSSL on Windows).

Tested on Windows 11 w/clang-cl.

Signed-off-by: Alexander Lobakin <alobakin@mailbox.org>
2026-04-08 17:04:50 -07:00
Paul Marquess
811d287726 Replace ZLIB_ENABLE_TESTS with BUILD_TESTING 2026-03-11 19:32:02 -07:00
Paul Marquess
ea5c15cfd5 update to use ppmd from 7zip 26.00 2026-03-11 15:40:27 -07:00
Nathan Moinvaziri
b6bf9914db
Add cmake subdirectory support to clone_repo macro for zstd. 2026-03-02 16:59:55 -08:00
Nathan Moinvaziri
9975579a7f
Sync sanitizer detection CMake with zlib-ng. 2026-03-02 12:31:38 -08:00
Nathan Moinvaziri
db034d5618
Remove redundant MZ_ZLIB_FLAVORS variable and validation check 2026-02-18 10:27:25 -08:00
Nathan Moinvaziri
9c32106827
Fix for older versions of CMake without FetchContent EXCLUDE_FROM_ALL 2026-02-09 15:04:50 -08:00
Paul Marquess
b60d15c203
remove calls to add_subdirectory for lzma & zlib (#959) 2026-02-09 18:03:37 -05:00
Paul Marquess
5880418f43
Add support for PPMd compression 2026-01-30 10:03:22 -08:00
Nathan Moinvaziri
0fa77a3861
Resolve alias targets to their real targets for installation
This should fix CMake on Windows failing.
2026-01-27 09:13:59 -08:00
Nathan Moinvaziri
cf4b58e17e
Version 4.1.0. 2026-01-21 13:52:59 -08:00
noword
e2e889bc19 Compatible with systems without symbolic links
Check if the symlink and readlink functions exist, and define NO_SYMLINK and NO_READLINK based on the results.
VitaSDK will be recognized as Linux, but it does not support symbolic links.
2025-11-17 14:59:32 -08:00
Sebastian Goth
27d9a0cfa2 Add cmake control to select zlib flavor
Instead of assuming zlib-ng preference over zlib as a dependency, let
the user decide.

New cmake variable MZ_ZLIB_FLAVOR can be set to auto | zlib-ng | zlib
defaults to auto.
2025-06-19 08:56:05 -07:00
Sebastian Goth
897a68aad8 Fix transitive finding of zlib-ng 2025-06-19 08:56:05 -07:00
Peter Harris
152e7468c3 harden mz_zip_writer_add_file against link following
There is a small race where a file can be replaced with a link between the
call to mz_os_is_symlink and the call to mz_stream_os_open. Add
MZ_OPEN_MODE_NOFOLLOW to make sure that (on POSIX) a link cannot be
followed.
2025-06-16 16:14:24 -07:00
Nathan Moinvaziri
f3ed731e27
Version 4.0.10. 2025-05-04 21:36:06 -04:00
Nathan Moinvaziri
95ba7abdd2 Version 4.0.9. 2025-04-05 11:07:02 -07:00
Nathan Moinvaziri
55db144e03 Version 4.0.8. 2025-01-08 10:12:15 -08:00
Nathan Moinvaziri
7df56f7cc8 Split compat layer into different source files #806 2024-10-30 18:11:27 -04:00