From 280d433d4c13f3b31722d446ec868053887caf06 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Fri, 13 Mar 2026 23:48:36 +0000 Subject: [PATCH] Vendor import of zlib 1.3.2. --- .cmake-format.yaml | 245 ++++ BUILD.bazel | 134 ++ CMakeLists.txt | 396 +++--- ChangeLog | 51 + FAQ | 46 +- INDEX | 3 +- LICENSE | 2 +- MODULE.bazel | 9 + Makefile.in | 52 +- README | 28 +- README-cmake.md | 79 ++ compress.c | 46 +- configure | 227 +++- contrib/CMakeLists.txt | 61 + contrib/README.contrib | 16 +- contrib/ada/CMakeLists.txt | 217 ++++ .../cmake/Modules/CMakeADACompiler.cmake.in | 23 + .../cmake/Modules/CMakeADAInformation.cmake | 133 ++ .../Modules/CMakeDetermineADACompiler.cmake | 33 + .../cmake/Modules/CMakeTestADACompiler.cmake | 46 + contrib/ada/cmake/binder_helper.cmake | 47 + contrib/ada/cmake/compile_helper.cmake | 32 + contrib/ada/cmake/exe_link_helper.cmake | 53 + contrib/ada/cmake/shared_link_helper.cmake | 52 + contrib/ada/cmake/static_link_helper.cmake | 25 + contrib/ada/readme.txt | 4 +- contrib/ada/zlib-thin.adb | 3 +- contrib/blast/CMakeLists.txt | 166 +++ contrib/blast/Makefile | 16 +- contrib/blast/blast-test.c | 42 + contrib/blast/blast.c | 44 - contrib/blast/blast.h | 1 + contrib/blast/blastConfig.cmake.in | 18 + contrib/blast/test/CMakeLists.txt | 193 +++ .../add_subdirectory_exclude_test.cmake.in | 27 + .../blast/test/add_subdirectory_test.cmake.in | 25 + .../find_package_no_components_test.cmake.in | 24 + contrib/blast/test/find_package_test.cmake.in | 24 + ...ind_package_wrong_components_test.cmake.in | 24 + contrib/blast/tester.cmake | 28 + contrib/crc32vx/CMakeLists.txt | 67 + contrib/crc32vx/README | 9 + contrib/crc32vx/crc32_vx.c | 254 ++++ contrib/crc32vx/crc32_vx_hooks.h | 9 + contrib/delphi/ZLib.pas | 2 +- contrib/dotzlib/DotZLib/ChecksumImpl.cs | 2 +- contrib/dotzlib/DotZLib/CircularBuffer.cs | 2 +- contrib/dotzlib/DotZLib/CodecBase.cs | 2 +- contrib/dotzlib/DotZLib/Deflater.cs | 2 +- contrib/dotzlib/DotZLib/DotZLib.cs | 2 +- contrib/dotzlib/DotZLib/GZipStream.cs | 2 +- contrib/dotzlib/DotZLib/Inflater.cs | 2 +- contrib/dotzlib/DotZLib/UnitTests.cs | 6 +- contrib/dotzlib/readme.txt | 2 +- contrib/gcc_gvmat64/CMakeLists.txt | 19 + contrib/gcc_gvmat64/gvmat64.S | 1144 ++++++++--------- contrib/infback9/CMakeLists.txt | 19 + contrib/infback9/infback9.c | 24 +- contrib/infback9/inftree9.c | 6 +- contrib/iostream2/zstream.h | 1 - contrib/iostream3/CMakeLists.txt | 200 +++ contrib/iostream3/iostream3Config.cmake.in | 23 + contrib/iostream3/test/CMakeLists.txt | 191 +++ .../add_subdirectory_exclude_test.cmake.in | 27 + .../test/add_subdirectory_test.cmake.in | 25 + .../find_package_no_components_test.cmake.in | 24 + .../iostream3/test/find_package_test.cmake.in | 24 + ...ind_package_wrong_components_test.cmake.in | 24 + contrib/minizip/CMakeLists.txt | 387 ++++++ contrib/minizip/LICENSE.Info-Zip | 58 + contrib/minizip/Makefile | 24 +- contrib/minizip/MiniZip64_info.txt | 15 +- contrib/minizip/configure.ac | 4 +- contrib/minizip/crypt.h | 11 +- contrib/minizip/ints.h | 57 + contrib/minizip/ioapi.c | 10 +- contrib/minizip/ioapi.h | 51 +- contrib/minizip/iowin32.c | 25 +- contrib/minizip/iowin32.h | 7 +- contrib/minizip/make_vms.com | 2 +- contrib/minizip/miniunz.c | 48 +- contrib/minizip/minizip.c | 30 +- contrib/minizip/minizip.pc.in | 3 +- contrib/minizip/minizip.pc.txt | 13 + contrib/minizip/minizipConfig.cmake.in | 27 + contrib/minizip/mztools.c | 71 +- contrib/minizip/skipset.h | 366 ++++++ contrib/minizip/test/CMakeLists.txt | 176 +++ .../add_subdirectory_exclude_test.cmake.in | 29 + .../test/add_subdirectory_test.cmake.in | 28 + .../find_package_no_components_test.cmake.in | 26 + .../minizip/test/find_package_test.cmake.in | 26 + ...ind_package_wrong_components_test.cmake.in | 26 + contrib/minizip/test/test_helper.cm | 32 + contrib/minizip/unzip.c | 35 +- contrib/minizip/unzip.h | 13 +- contrib/minizip/zip.c | 392 +++++- contrib/minizip/zip.h | 35 +- contrib/nuget/nuget.csproj | 6 +- contrib/pascal/zlibpas.pas | 2 +- contrib/puff/CMakeLists.txt | 154 +++ contrib/puff/bin-writer.c | 26 + contrib/puff/puff.c | 2 +- contrib/puff/puffConfig.cmake.in | 18 + contrib/puff/pufftest.c | 9 +- contrib/puff/test/CMakeLists.txt | 262 ++++ .../add_subdirectory_exclude_test.cmake.in | 26 + .../puff/test/add_subdirectory_test.cmake.in | 25 + .../find_package_no_components_test.cmake.in | 24 + contrib/puff/test/find_package_test.cmake.in | 24 + ...ind_package_wrong_components_test.cmake.in | 24 + contrib/puff/test/tester-cov.cmake | 58 + contrib/puff/test/tester.cmake | 16 + contrib/testzlib/CMakeLists.txt | 44 + contrib/testzlib/testzlib.c | 550 ++++---- contrib/testzlib/testzlib.txt | 20 +- contrib/untgz/Makefile | 14 - contrib/untgz/Makefile.msc | 17 - contrib/untgz/untgz.c | 667 ---------- contrib/vstudio/readme.txt | 93 +- contrib/vstudio/vc10/miniunz.vcxproj | 310 ----- contrib/vstudio/vc10/miniunz.vcxproj.filters | 22 - contrib/vstudio/vc10/minizip.vcxproj | 307 ----- contrib/vstudio/vc10/minizip.vcxproj.filters | 22 - contrib/vstudio/vc10/testzlib.vcxproj | 412 ------ contrib/vstudio/vc10/testzlib.vcxproj.filters | 55 - contrib/vstudio/vc10/testzlibdll.vcxproj | 310 ----- .../vstudio/vc10/testzlibdll.vcxproj.filters | 22 - contrib/vstudio/vc10/zlib.rc | 32 - contrib/vstudio/vc10/zlibstat.vcxproj | 449 ------- contrib/vstudio/vc10/zlibstat.vcxproj.filters | 74 -- contrib/vstudio/vc10/zlibvc.def | 158 --- contrib/vstudio/vc10/zlibvc.sln | 135 -- contrib/vstudio/vc10/zlibvc.vcxproj | 633 --------- contrib/vstudio/vc10/zlibvc.vcxproj.filters | 115 -- contrib/vstudio/vc11/miniunz.vcxproj | 314 ----- contrib/vstudio/vc11/minizip.vcxproj | 311 ----- contrib/vstudio/vc11/testzlib.vcxproj | 418 ------ contrib/vstudio/vc11/testzlibdll.vcxproj | 314 ----- contrib/vstudio/vc11/zlib.rc | 32 - contrib/vstudio/vc11/zlibstat.vcxproj | 456 ------- contrib/vstudio/vc11/zlibvc.def | 158 --- contrib/vstudio/vc11/zlibvc.sln | 117 -- contrib/vstudio/vc11/zlibvc.vcxproj | 664 ---------- contrib/vstudio/vc12/miniunz.vcxproj | 316 ----- contrib/vstudio/vc12/minizip.vcxproj | 313 ----- contrib/vstudio/vc12/testzlib.vcxproj | 422 ------ contrib/vstudio/vc12/testzlibdll.vcxproj | 316 ----- contrib/vstudio/vc12/zlib.rc | 32 - contrib/vstudio/vc12/zlibstat.vcxproj | 459 ------- contrib/vstudio/vc12/zlibvc.def | 158 --- contrib/vstudio/vc12/zlibvc.sln | 119 -- contrib/vstudio/vc12/zlibvc.vcxproj | 668 ---------- contrib/vstudio/vc14/miniunz.vcxproj | 316 ----- contrib/vstudio/vc14/minizip.vcxproj | 313 ----- contrib/vstudio/vc14/testzlib.vcxproj | 422 ------ contrib/vstudio/vc14/testzlibdll.vcxproj | 316 ----- contrib/vstudio/vc14/zlib.rc | 32 - contrib/vstudio/vc14/zlibstat.vcxproj | 459 ------- contrib/vstudio/vc14/zlibvc.def | 158 --- contrib/vstudio/vc14/zlibvc.sln | 119 -- contrib/vstudio/vc14/zlibvc.vcxproj | 668 ---------- contrib/vstudio/vc17/miniunz.vcxproj | 409 ------ contrib/vstudio/vc17/minizip.vcxproj | 405 ------ contrib/vstudio/vc17/testzlib.vcxproj | 473 ------- contrib/vstudio/vc17/testzlibdll.vcxproj | 409 ------ contrib/vstudio/vc17/zlib.rc | 32 - contrib/vstudio/vc17/zlibstat.vcxproj | 602 --------- contrib/vstudio/vc17/zlibvc.def | 158 --- contrib/vstudio/vc17/zlibvc.sln | 179 --- contrib/vstudio/vc17/zlibvc.vcxproj | 875 ------------- contrib/vstudio/vc9/miniunz.vcproj | 565 -------- contrib/vstudio/vc9/minizip.vcproj | 562 -------- contrib/vstudio/vc9/testzlib.vcproj | 796 ------------ contrib/vstudio/vc9/testzlibdll.vcproj | 565 -------- contrib/vstudio/vc9/zlib.rc | 32 - contrib/vstudio/vc9/zlibstat.vcproj | 781 ----------- contrib/vstudio/vc9/zlibvc.def | 158 --- contrib/vstudio/vc9/zlibvc.sln | 144 --- contrib/vstudio/vc9/zlibvc.vcproj | 1100 ---------------- contrib/zlib1-dll/CMakeLists.txt | 196 +++ contrib/zlib1-dll/readme.txt | 21 + crc32.c | 166 +-- deflate.c | 176 ++- deflate.h | 8 +- doc/algorithm.txt | 2 +- examples/enough.c | 24 +- examples/gun.c | 18 +- examples/gznorm.c | 4 + examples/zlib_how.html | 15 +- examples/zpipe.c | 5 +- examples/zran.c | 227 ++-- examples/zran.h | 12 +- gzguts.h | 64 +- gzlib.c | 103 +- gzread.c | 314 +++-- gzwrite.c | 267 ++-- infback.c | 87 +- inffast.c | 13 +- inffixed.h | 182 +-- inflate.c | 189 +-- inflate.h | 2 +- inftrees.c | 143 ++- inftrees.h | 4 +- msdos/Makefile.dj2 | 2 +- nintendods/Makefile | 126 -- nintendods/README | 5 - old/Makefile.emx | 69 - old/Makefile.riscos | 151 --- old/README | 3 - old/descrip.mms | 48 - old/os2/Makefile.os2 | 136 -- old/os2/zlib.def | 51 - old/visual-basic.txt | 160 --- os400/README400 | 2 +- os400/bndsrc | 17 + os400/make.sh | 27 +- os400/{zlib.inc => zlibfixed.rpgle} | 77 +- os400/zlibfree.rpgle | 634 +++++++++ qnx/package.qpg | 12 +- test/CMakeLists.txt | 318 +++++ test/add_subdirectory_exclude_test.cmake.in | 29 + test/add_subdirectory_test.cmake.in | 28 + test/example.c | 14 +- test/find_package_no_components_test.cmake.in | 27 + test/find_package_test.cmake.in | 27 + ...ind_package_wrong_components_test.cmake.in | 27 + test/infcover.c | 10 +- test/minigzip.c | 89 +- treebuild.xml | 4 +- trees.c | 28 +- uncompr.c | 62 +- win32/DLL_FAQ.txt | 2 +- win32/Makefile.gcc | 10 +- win32/README-WIN32.txt | 16 +- win32/zlib.def | 201 +-- win32/zlib1.rc | 9 +- zconf.h | 46 +- zconf.h.cmakein | 545 -------- zconf.h.in | 46 +- zlib.3 | 22 +- zlib.3.pdf | Bin 25523 -> 28222 bytes zlib.h | 307 +++-- zlib.map | 16 + zlib.pc.cmakein | 9 +- zlib.pc.in | 1 + zlibConfig.cmake.in | 18 + zutil.c | 84 +- zutil.h | 99 +- 249 files changed, 9884 insertions(+), 24580 deletions(-) create mode 100644 .cmake-format.yaml create mode 100644 BUILD.bazel create mode 100644 MODULE.bazel create mode 100644 README-cmake.md create mode 100644 contrib/CMakeLists.txt create mode 100644 contrib/ada/CMakeLists.txt create mode 100644 contrib/ada/cmake/Modules/CMakeADACompiler.cmake.in create mode 100644 contrib/ada/cmake/Modules/CMakeADAInformation.cmake create mode 100644 contrib/ada/cmake/Modules/CMakeDetermineADACompiler.cmake create mode 100644 contrib/ada/cmake/Modules/CMakeTestADACompiler.cmake create mode 100644 contrib/ada/cmake/binder_helper.cmake create mode 100644 contrib/ada/cmake/compile_helper.cmake create mode 100644 contrib/ada/cmake/exe_link_helper.cmake create mode 100644 contrib/ada/cmake/shared_link_helper.cmake create mode 100644 contrib/ada/cmake/static_link_helper.cmake create mode 100644 contrib/blast/CMakeLists.txt create mode 100644 contrib/blast/blast-test.c create mode 100644 contrib/blast/blastConfig.cmake.in create mode 100644 contrib/blast/test/CMakeLists.txt create mode 100644 contrib/blast/test/add_subdirectory_exclude_test.cmake.in create mode 100644 contrib/blast/test/add_subdirectory_test.cmake.in create mode 100644 contrib/blast/test/find_package_no_components_test.cmake.in create mode 100644 contrib/blast/test/find_package_test.cmake.in create mode 100644 contrib/blast/test/find_package_wrong_components_test.cmake.in create mode 100644 contrib/blast/tester.cmake create mode 100644 contrib/crc32vx/CMakeLists.txt create mode 100644 contrib/crc32vx/README create mode 100644 contrib/crc32vx/crc32_vx.c create mode 100644 contrib/crc32vx/crc32_vx_hooks.h create mode 100644 contrib/gcc_gvmat64/CMakeLists.txt create mode 100644 contrib/infback9/CMakeLists.txt create mode 100644 contrib/iostream3/CMakeLists.txt create mode 100644 contrib/iostream3/iostream3Config.cmake.in create mode 100644 contrib/iostream3/test/CMakeLists.txt create mode 100644 contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in create mode 100644 contrib/iostream3/test/add_subdirectory_test.cmake.in create mode 100644 contrib/iostream3/test/find_package_no_components_test.cmake.in create mode 100644 contrib/iostream3/test/find_package_test.cmake.in create mode 100644 contrib/iostream3/test/find_package_wrong_components_test.cmake.in create mode 100644 contrib/minizip/CMakeLists.txt create mode 100644 contrib/minizip/LICENSE.Info-Zip create mode 100644 contrib/minizip/ints.h create mode 100644 contrib/minizip/minizip.pc.txt create mode 100644 contrib/minizip/minizipConfig.cmake.in create mode 100644 contrib/minizip/skipset.h create mode 100644 contrib/minizip/test/CMakeLists.txt create mode 100644 contrib/minizip/test/add_subdirectory_exclude_test.cmake.in create mode 100644 contrib/minizip/test/add_subdirectory_test.cmake.in create mode 100644 contrib/minizip/test/find_package_no_components_test.cmake.in create mode 100644 contrib/minizip/test/find_package_test.cmake.in create mode 100644 contrib/minizip/test/find_package_wrong_components_test.cmake.in create mode 100644 contrib/minizip/test/test_helper.cm create mode 100644 contrib/puff/CMakeLists.txt create mode 100644 contrib/puff/bin-writer.c create mode 100644 contrib/puff/puffConfig.cmake.in create mode 100644 contrib/puff/test/CMakeLists.txt create mode 100644 contrib/puff/test/add_subdirectory_exclude_test.cmake.in create mode 100644 contrib/puff/test/add_subdirectory_test.cmake.in create mode 100644 contrib/puff/test/find_package_no_components_test.cmake.in create mode 100644 contrib/puff/test/find_package_test.cmake.in create mode 100644 contrib/puff/test/find_package_wrong_components_test.cmake.in create mode 100644 contrib/puff/test/tester-cov.cmake create mode 100644 contrib/puff/test/tester.cmake create mode 100644 contrib/testzlib/CMakeLists.txt delete mode 100644 contrib/untgz/Makefile delete mode 100644 contrib/untgz/Makefile.msc delete mode 100644 contrib/untgz/untgz.c delete mode 100644 contrib/vstudio/vc10/miniunz.vcxproj delete mode 100644 contrib/vstudio/vc10/miniunz.vcxproj.filters delete mode 100644 contrib/vstudio/vc10/minizip.vcxproj delete mode 100644 contrib/vstudio/vc10/minizip.vcxproj.filters delete mode 100644 contrib/vstudio/vc10/testzlib.vcxproj delete mode 100644 contrib/vstudio/vc10/testzlib.vcxproj.filters delete mode 100644 contrib/vstudio/vc10/testzlibdll.vcxproj delete mode 100644 contrib/vstudio/vc10/testzlibdll.vcxproj.filters delete mode 100644 contrib/vstudio/vc10/zlib.rc delete mode 100644 contrib/vstudio/vc10/zlibstat.vcxproj delete mode 100644 contrib/vstudio/vc10/zlibstat.vcxproj.filters delete mode 100644 contrib/vstudio/vc10/zlibvc.def delete mode 100644 contrib/vstudio/vc10/zlibvc.sln delete mode 100644 contrib/vstudio/vc10/zlibvc.vcxproj delete mode 100644 contrib/vstudio/vc10/zlibvc.vcxproj.filters delete mode 100644 contrib/vstudio/vc11/miniunz.vcxproj delete mode 100644 contrib/vstudio/vc11/minizip.vcxproj delete mode 100644 contrib/vstudio/vc11/testzlib.vcxproj delete mode 100644 contrib/vstudio/vc11/testzlibdll.vcxproj delete mode 100644 contrib/vstudio/vc11/zlib.rc delete mode 100644 contrib/vstudio/vc11/zlibstat.vcxproj delete mode 100644 contrib/vstudio/vc11/zlibvc.def delete mode 100644 contrib/vstudio/vc11/zlibvc.sln delete mode 100644 contrib/vstudio/vc11/zlibvc.vcxproj delete mode 100644 contrib/vstudio/vc12/miniunz.vcxproj delete mode 100644 contrib/vstudio/vc12/minizip.vcxproj delete mode 100644 contrib/vstudio/vc12/testzlib.vcxproj delete mode 100644 contrib/vstudio/vc12/testzlibdll.vcxproj delete mode 100644 contrib/vstudio/vc12/zlib.rc delete mode 100644 contrib/vstudio/vc12/zlibstat.vcxproj delete mode 100644 contrib/vstudio/vc12/zlibvc.def delete mode 100644 contrib/vstudio/vc12/zlibvc.sln delete mode 100644 contrib/vstudio/vc12/zlibvc.vcxproj delete mode 100644 contrib/vstudio/vc14/miniunz.vcxproj delete mode 100644 contrib/vstudio/vc14/minizip.vcxproj delete mode 100644 contrib/vstudio/vc14/testzlib.vcxproj delete mode 100644 contrib/vstudio/vc14/testzlibdll.vcxproj delete mode 100644 contrib/vstudio/vc14/zlib.rc delete mode 100644 contrib/vstudio/vc14/zlibstat.vcxproj delete mode 100644 contrib/vstudio/vc14/zlibvc.def delete mode 100644 contrib/vstudio/vc14/zlibvc.sln delete mode 100644 contrib/vstudio/vc14/zlibvc.vcxproj delete mode 100644 contrib/vstudio/vc17/miniunz.vcxproj delete mode 100644 contrib/vstudio/vc17/minizip.vcxproj delete mode 100644 contrib/vstudio/vc17/testzlib.vcxproj delete mode 100644 contrib/vstudio/vc17/testzlibdll.vcxproj delete mode 100644 contrib/vstudio/vc17/zlib.rc delete mode 100644 contrib/vstudio/vc17/zlibstat.vcxproj delete mode 100644 contrib/vstudio/vc17/zlibvc.def delete mode 100644 contrib/vstudio/vc17/zlibvc.sln delete mode 100644 contrib/vstudio/vc17/zlibvc.vcxproj delete mode 100644 contrib/vstudio/vc9/miniunz.vcproj delete mode 100644 contrib/vstudio/vc9/minizip.vcproj delete mode 100644 contrib/vstudio/vc9/testzlib.vcproj delete mode 100644 contrib/vstudio/vc9/testzlibdll.vcproj delete mode 100644 contrib/vstudio/vc9/zlib.rc delete mode 100644 contrib/vstudio/vc9/zlibstat.vcproj delete mode 100644 contrib/vstudio/vc9/zlibvc.def delete mode 100644 contrib/vstudio/vc9/zlibvc.sln delete mode 100644 contrib/vstudio/vc9/zlibvc.vcproj create mode 100644 contrib/zlib1-dll/CMakeLists.txt create mode 100644 contrib/zlib1-dll/readme.txt delete mode 100644 nintendods/Makefile delete mode 100644 nintendods/README delete mode 100644 old/Makefile.emx delete mode 100644 old/Makefile.riscos delete mode 100644 old/README delete mode 100644 old/descrip.mms delete mode 100644 old/os2/Makefile.os2 delete mode 100644 old/os2/zlib.def delete mode 100644 old/visual-basic.txt rename os400/{zlib.inc => zlibfixed.rpgle} (88%) create mode 100644 os400/zlibfree.rpgle create mode 100644 test/CMakeLists.txt create mode 100644 test/add_subdirectory_exclude_test.cmake.in create mode 100644 test/add_subdirectory_test.cmake.in create mode 100644 test/find_package_no_components_test.cmake.in create mode 100644 test/find_package_test.cmake.in create mode 100644 test/find_package_wrong_components_test.cmake.in delete mode 100644 zconf.h.cmakein create mode 100644 zlibConfig.cmake.in diff --git a/.cmake-format.yaml b/.cmake-format.yaml new file mode 100644 index 00000000000..9c554da15db --- /dev/null +++ b/.cmake-format.yaml @@ -0,0 +1,245 @@ +_help_parse: Options affecting listfile parsing +parse: + _help_additional_commands: + - Specify structure for custom cmake functions + additional_commands: + foo: + flags: + - BAR + - BAZ + kwargs: + HEADERS: '*' + SOURCES: '*' + DEPENDS: '*' + _help_override_spec: + - Override configurations per-command where available + override_spec: {} + _help_vartags: + - Specify variable tags. + vartags: [] + _help_proptags: + - Specify property tags. + proptags: [] +_help_format: Options affecting formatting. +format: + _help_disable: + - Disable formatting entirely, making cmake-format a no-op + disable: false + _help_line_width: + - How wide to allow formatted cmake files + line_width: 80 + _help_tab_size: + - How many spaces to tab for indent + tab_size: 4 + _help_use_tabchars: + - If true, lines are indented using tab characters (utf-8 + - 0x09) instead of space characters (utf-8 0x20). + - In cases where the layout would require a fractional tab + - character, the behavior of the fractional indentation is + - governed by + use_tabchars: false + _help_fractional_tab_policy: + - If is True, then the value of this variable + - indicates how fractional indentions are handled during + - whitespace replacement. If set to 'use-space', fractional + - indentation is left as spaces (utf-8 0x20). If set to + - '`round-up` fractional indentation is replaced with a single' + - tab character (utf-8 0x09) effectively shifting the column + - to the next tabstop + fractional_tab_policy: use-space + _help_max_subgroups_hwrap: + - If an argument group contains more than this many sub-groups + - (parg or kwarg groups) then force it to a vertical layout. + max_subgroups_hwrap: 2 + _help_max_pargs_hwrap: + - If a positional argument group contains more than this many + - arguments, then force it to a vertical layout. + max_pargs_hwrap: 6 + _help_max_rows_cmdline: + - If a cmdline positional group consumes more than this many + - lines without nesting, then invalidate the layout (and nest) + max_rows_cmdline: 2 + _help_separate_ctrl_name_with_space: + - If true, separate flow control names from their parentheses + - with a space + separate_ctrl_name_with_space: false + _help_separate_fn_name_with_space: + - If true, separate function names from parentheses with a + - space + separate_fn_name_with_space: false + _help_dangle_parens: + - If a statement is wrapped to more than one line, than dangle + - the closing parenthesis on its own line. + dangle_parens: false + _help_dangle_align: + - If the trailing parenthesis must be 'dangled' on its on + - 'line, then align it to this reference: `prefix`: the start' + - 'of the statement, `prefix-indent`: the start of the' + - 'statement, plus one indentation level, `child`: align to' + - the column of the arguments + dangle_align: prefix + _help_min_prefix_chars: + - If the statement spelling length (including space and + - parenthesis) is smaller than this amount, then force reject + - nested layouts. + min_prefix_chars: 4 + _help_max_prefix_chars: + - If the statement spelling length (including space and + - parenthesis) is larger than the tab width by more than this + - amount, then force reject un-nested layouts. + max_prefix_chars: 10 + _help_max_lines_hwrap: + - If a candidate layout is wrapped horizontally but it exceeds + - this many lines, then reject the layout. + max_lines_hwrap: 2 + _help_line_ending: + - What style line endings to use in the output. + line_ending: unix + _help_command_case: + - Format command names consistently as 'lower' or 'upper' case + command_case: canonical + _help_keyword_case: + - Format keywords consistently as 'lower' or 'upper' case + keyword_case: unchanged + _help_always_wrap: + - A list of command names which should always be wrapped + always_wrap: [] + _help_enable_sort: + - If true, the argument lists which are known to be sortable + - will be sorted lexicographicall + enable_sort: true + _help_autosort: + - If true, the parsers may infer whether or not an argument + - list is sortable (without annotation). + autosort: false + _help_require_valid_layout: + - By default, if cmake-format cannot successfully fit + - everything into the desired linewidth it will apply the + - last, most aggressive attempt that it made. If this flag is + - True, however, cmake-format will print error, exit with non- + - zero status code, and write-out nothing + require_valid_layout: false + _help_layout_passes: + - A dictionary mapping layout nodes to a list of wrap + - decisions. See the documentation for more information. + layout_passes: {} +_help_markup: Options affecting comment reflow and formatting. +markup: + _help_bullet_char: + - What character to use for bulleted lists + bullet_char: '*' + _help_enum_char: + - What character to use as punctuation after numerals in an + - enumerated list + enum_char: . + _help_first_comment_is_literal: + - If comment markup is enabled, don't reflow the first comment + - block in each listfile. Use this to preserve formatting of + - your copyright/license statements. + first_comment_is_literal: false + _help_literal_comment_pattern: + - If comment markup is enabled, don't reflow any comment block + - which matches this (regex) pattern. Default is `None` + - (disabled). + literal_comment_pattern: null + _help_fence_pattern: + - Regular expression to match preformat fences in comments + - default= ``r'^\s*([`~]{3}[`~]*)(.*)$'`` + fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$ + _help_ruler_pattern: + - Regular expression to match rulers in comments default= + - '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``' + ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$ + _help_explicit_trailing_pattern: + - If a comment line matches starts with this pattern then it + - is explicitly a trailing comment for the preceding argument. + - Default is '#<' + explicit_trailing_pattern: '#<' + _help_hashruler_min_length: + - If a comment line starts with at least this many consecutive + - hash characters, then don't lstrip() them off. This allows + - for lazy hash rulers where the first hash char is not + - separated by space + hashruler_min_length: 10 + _help_canonicalize_hashrulers: + - If true, then insert a space between the first hash char and + - remaining hash chars in a hash ruler, and normalize its + - length to fill the column + canonicalize_hashrulers: true + _help_enable_markup: + - enable comment markup parsing and reflow + enable_markup: true +_help_lint: Options affecting the linter +lint: + _help_disabled_codes: + - a list of lint codes to disable + disabled_codes: [] + _help_function_pattern: + - regular expression pattern describing valid function names + function_pattern: '[0-9a-z_]+' + _help_macro_pattern: + - regular expression pattern describing valid macro names + macro_pattern: '[0-9A-Z_]+' + _help_global_var_pattern: + - regular expression pattern describing valid names for + - variables with global (cache) scope + global_var_pattern: '[A-Z][0-9A-Z_]+' + _help_internal_var_pattern: + - regular expression pattern describing valid names for + - variables with global scope (but internal semantic) + internal_var_pattern: _[A-Z][0-9A-Z_]+ + _help_local_var_pattern: + - regular expression pattern describing valid names for + - variables with local scope + local_var_pattern: '[a-z][a-z0-9_]+' + _help_private_var_pattern: + - regular expression pattern describing valid names for + - privatedirectory variables + private_var_pattern: _[0-9a-z_]+ + _help_public_var_pattern: + - regular expression pattern describing valid names for public + - directory variables + public_var_pattern: '[A-Z][0-9A-Z_]+' + _help_argument_var_pattern: + - regular expression pattern describing valid names for + - function/macro arguments and loop variables. + argument_var_pattern: '[a-z][a-z0-9_]+' + _help_keyword_pattern: + - regular expression pattern describing valid names for + - keywords used in functions or macros + keyword_pattern: '[A-Z][0-9A-Z_]+' + _help_max_conditionals_custom_parser: + - In the heuristic for C0201, how many conditionals to match + - within a loop in before considering the loop a parser. + max_conditionals_custom_parser: 2 + _help_min_statement_spacing: + - Require at least this many newlines between statements + min_statement_spacing: 1 + _help_max_statement_spacing: + - Require no more than this many newlines between statements + max_statement_spacing: 2 + max_returns: 6 + max_branches: 12 + max_arguments: 5 + max_localvars: 15 + max_statements: 50 +_help_encode: Options affecting file encoding +encode: + _help_emit_byteorder_mark: + - If true, emit the unicode byte-order mark (BOM) at the start + - of the file + emit_byteorder_mark: false + _help_input_encoding: + - Specify the encoding of the input file. Defaults to utf-8 + input_encoding: utf-8 + _help_output_encoding: + - Specify the encoding of the output file. Defaults to utf-8. + - Note that cmake only claims to support utf-8 so be careful + - when using anything else + output_encoding: utf-8 +_help_misc: Miscellaneous configurations options. +misc: + _help_per_command: + - A dictionary containing any per-command configuration + - overrides. Currently only `command_case` is supported. + per_command: {} diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 00000000000..9a294f2f277 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,134 @@ +# Copied from https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/zlib/1.3.1.bcr.4/patches +# Adapted from https://github.com/protocolbuffers/protobuf/blob/master/third_party/zlib.BUILD + +# Copyright 2008 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Code generated by the Protocol Buffer compiler is owned by the owner +# of the input file used when generating it. This code is not +# standalone and requires a support library to be linked with it. This +# support library is itself covered by the above license. + +load("@rules_cc//cc:defs.bzl", "cc_library") +load("@rules_license//rules:license.bzl", "license") + +package( + default_applicable_licenses = [":license"], +) + +license( + name = "license", + license_kinds = ["@rules_license//licenses/spdx:Zlib"], + license_text = "LICENSE", +) + +exports_files([ + "LICENSE", +]) + +_ZLIB_HEADERS = [ + "crc32.h", + "deflate.h", + "gzguts.h", + "inffast.h", + "inffixed.h", + "inflate.h", + "inftrees.h", + "trees.h", + "zconf.h", + "zlib.h", + "zutil.h", +] + +_ZLIB_PREFIXED_HEADERS = ["zlib/include/" + hdr for hdr in _ZLIB_HEADERS] + +# In order to limit the damage from the `includes` propagation +# via `:zlib`, copy the public headers to a subdirectory and +# expose those. +genrule( + name = "copy_public_headers", + srcs = _ZLIB_HEADERS, + outs = _ZLIB_PREFIXED_HEADERS, + cmd_bash = "cp $(SRCS) $(@D)/zlib/include/", + cmd_bat = " && ".join( + ["@copy /Y \"$(location %s)\" \"$(@D)\\zlib\\include\\\" >NUL" % + s for s in _ZLIB_HEADERS], + ), +) + +config_setting( + name = "mingw_gcc_compiler", + flag_values = { + "@bazel_tools//tools/cpp:compiler": "mingw-gcc", + }, + visibility = [":__subpackages__"], +) + +cc_library( + name = "z", + srcs = [ + "adler32.c", + "compress.c", + "crc32.c", + "deflate.c", + "gzclose.c", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", + # Include the un-prefixed headers in srcs to work + # around the fact that zlib isn't consistent in its + # choice of <> or "" delimiter when including itself. + ] + _ZLIB_HEADERS, + hdrs = _ZLIB_PREFIXED_HEADERS, + copts = select({ + ":mingw_gcc_compiler": [ + "-fpermissive", + ], + "@platforms//os:windows": [], + "//conditions:default": [ + "-Wno-deprecated-non-prototype", + "-Wno-unused-variable", + "-Wno-implicit-function-declaration", + ], + }), + includes = ["zlib/include/"], + visibility = ["//visibility:public"], +) + +alias( + name = "zlib", + actual = ":z", + visibility = ["//visibility:public"], +) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15ceebe787e..e103c409a6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,98 +1,126 @@ -cmake_minimum_required(VERSION 2.4.4...3.15.0) -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) +cmake_minimum_required(VERSION 3.12...3.31) -project(zlib C) +project( + zlib + LANGUAGES C + VERSION 1.3.2 + HOMEPAGE_URL "https://zlib.net/" + DESCRIPTION "a general-purpose lossless data-compression library") -set(VERSION "1.3.1") +# ============================================================================ +# CPack +# ============================================================================ +set(CPACK_PACKAGE_VENDOR "zlib-Project") +set(CPACK_PACKAGE_DESCRIPTION_FILE ${zlib_SOURCE_DIR}/README) +set(CPACK_RESOURCE_FILE_LICENSE ${zlib_SOURCE_DIR}/LICENSE) +set(CPACK_RESOURCE_FILE_README ${zlib_SOURCE_DIR}/README) -option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON) +# ============================================================================ +# configuration +# ============================================================================ -set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") -set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") -set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") +option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON) +option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON) +option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON) +option(ZLIB_INSTALL "Enable installation of zlib" ON) +option(ZLIB_PREFIX "prefix for all types and library functions, see zconf.h.in" + OFF) +mark_as_advanced(ZLIB_PREFIX) -include(CheckTypeSize) +get_property(IS_MULTI GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + +if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI) + message(STATUS "No CMAKE_BUILD_TYPE set -- using Release") + set(CMAKE_BUILD_TYPE Release) +endif(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI) + +include(CheckCSourceCompiles) include(CheckFunctionExists) include(CheckIncludeFile) -include(CheckCSourceCompiles) -enable_testing() +include(CMakePackageConfigHelpers) +include(CheckTypeSize) +include(CPack) +include(GNUInstallDirs) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stddef.h HAVE_STDDEF_H) +set(CPACK_INCLUDED TRUE) + +if(NOT ZLIB_CONF_WRITTEN) + set(Z_PREFIX ${ZLIB_PREFIX}) + set(CONF_OUT_FILE ${zlib_BINARY_DIR}/zconf.h.cmakein) + file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT LIMIT 245) + file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT}) + file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX 1\n") + file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n") + file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n") + file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT OFFSET 244) + set(FIRST_ITEM TRUE) + + foreach(item IN LISTS ZCONF_CONTENT) + if(FIRST_ITEM) + string(APPEND OUT_CONTENT ${item}) + set(FIRST_ITEM FALSE) + else(FIRST_ITEM) + string(APPEND OUT_CONTENT "\;" ${item}) + endif(FIRST_ITEM) + endforeach(item IN LISTS ${ZCONF_CONTENT}) + + file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT}) + set(ZLIB_CONF_WRITTEN + TRUE + CACHE BOOL "zconf.h.cmakein was created") + mark_as_advanced(ZLIB_CONF_WRITTEN) +endif(NOT ZLIB_CONF_WRITTEN) # # Check to see if we have large file support # set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) -# We add these other definitions here because CheckTypeSize.cmake -# in CMake 2.4.x does not automatically do so and we want -# compatibility with CMake 2.4.x. -if(HAVE_SYS_TYPES_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) -endif() -if(HAVE_STDINT_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) -endif() -if(HAVE_STDDEF_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) -endif() check_type_size(off64_t OFF64_T) -if(HAVE_OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1) -endif() -set(CMAKE_REQUIRED_DEFINITIONS) # clear variable +unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable # # Check for fseeko # check_function_exists(fseeko HAVE_FSEEKO) -if(NOT HAVE_FSEEKO) - add_definitions(-DNO_FSEEKO) -endif() + +# +# Check for stdarg.h +# +check_include_file(stdarg.h HAVE_STDARG_H) # # Check for unistd.h # -check_include_file(unistd.h Z_HAVE_UNISTD_H) +check_include_file(unistd.h HAVE_UNISTD_H) +# +# Check visibility attribute is supported +# if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -endif() + set(CMAKE_REQUIRED_FLAGS "-WX") +else(MSVC) + set(CMAKE_REQUIRED_FLAGS "-Werror") +endif(MSVC) -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) - # If we're doing an out of source build and the user has a zconf.h - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) - message(STATUS "Renaming") - message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h") - message(STATUS "to 'zconf.h.included' because this file is included with zlib") - message(STATUS "but CMake generates it automatically in the build directory.") - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) - endif() -endif() +check_c_source_compiles( + " + #include + static void f(void) __attribute__ ((visibility(\"hidden\"))); + int main(void) {return 0;} + " + HAVE___ATTR__VIS_HIDDEN) -set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein - ${ZLIB_PC} @ONLY) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) +unset(CMAKE_COMPILE_FLAGS) +set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc) +configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY) +configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein ${zlib_BINARY_DIR}/zconf.h) - -#============================================================================ +# ============================================================================ # zlib -#============================================================================ +# ============================================================================ + +set(ZLIB_PUBLIC_HDRS ${zlib_BINARY_DIR}/zconf.h zlib.h) -set(ZLIB_PUBLIC_HDRS - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h - zlib.h -) set(ZLIB_PRIVATE_HDRS crc32.h deflate.h @@ -102,8 +130,8 @@ set(ZLIB_PRIVATE_HDRS inflate.h inftrees.h trees.h - zutil.h -) + zutil.h) + set(ZLIB_SRCS adler32.c compress.c @@ -119,100 +147,164 @@ set(ZLIB_SRCS inffast.c trees.c uncompr.c - zutil.c -) + zutil.c) -if(NOT MINGW) - set(ZLIB_DLL_SRCS - win32/zlib1.rc # If present will override custom build rule below. - ) -endif() +if(WIN32) + set(zlib_static_suffix "s") + set(CMAKE_DEBUG_POSTFIX "d") +endif(WIN32) -# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) +if(ZLIB_BUILD_SHARED) + add_library( + zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS} + $<$,$>:win32/zlib1.rc>) + add_library(ZLIB::ZLIB ALIAS zlib) + target_include_directories( + zlib + PUBLIC $ + $ + $) + target_compile_definitions( + zlib + PRIVATE ZLIB_BUILD + $<$:NO_FSEEKO> + $<$:HAVE_HIDDEN> + $<$:_CRT_SECURE_NO_DEPRECATE> + $<$:_CRT_NONSTDC_NO_DEPRECATE> + PUBLIC $<$:_LARGEFILE64_SOURCE=1>) + set(INSTALL_VERSION ${zlib_VERSION}) -if(MINGW) - # This gets us DLL resource information when compiling on MinGW. - if(NOT CMAKE_RC_COMPILER) - set(CMAKE_RC_COMPILER windres.exe) - endif() + if(NOT CYGWIN) + set_target_properties(zlib PROPERTIES SOVERSION ${zlib_VERSION_MAJOR} + VERSION ${INSTALL_VERSION}) + endif(NOT CYGWIN) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${CMAKE_RC_COMPILER} - -D GCC_WINDRES - -I ${CMAKE_CURRENT_SOURCE_DIR} - -I ${CMAKE_CURRENT_BINARY_DIR} - -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) - set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) -endif(MINGW) + set_target_properties( + zlib + PROPERTIES DEFINE_SYMBOL ZLIB_DLL + EXPORT_NAME ZLIB + OUTPUT_NAME z) + if(UNIX + AND NOT APPLE + AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX) + AND NOT (CMAKE_SYSTEM_NAME STREQUAL SunOS)) + # On unix-like platforms the library is almost always called libz + set_target_properties( + zlib + PROPERTIES LINK_FLAGS + "-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"") + endif( + UNIX + AND NOT APPLE + AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX) + AND NOT (CMAKE_SYSTEM_NAME STREQUAL SunOS)) +endif(ZLIB_BUILD_SHARED) -add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) -set_target_properties(zlib PROPERTIES SOVERSION 1) +if(ZLIB_BUILD_STATIC) + add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} + ${ZLIB_PRIVATE_HDRS}) + add_library(ZLIB::ZLIBSTATIC ALIAS zlibstatic) + target_include_directories( + zlibstatic + PUBLIC $ + $ + $) + target_compile_definitions( + zlibstatic + PRIVATE ZLIB_BUILD + $<$:NO_FSEEKO> + $<$:HAVE_HIDDEN> + $<$:_CRT_SECURE_NO_DEPRECATE> + $<$:_CRT_NONSTDC_NO_DEPRECATE> + PUBLIC $<$:_LARGEFILE64_SOURCE=1>) + set_target_properties( + zlibstatic PROPERTIES EXPORT_NAME ZLIBSTATIC OUTPUT_NAME + z${zlib_static_suffix}) +endif(ZLIB_BUILD_STATIC) -if(NOT CYGWIN) - # This property causes shared libraries on Linux to have the full version - # encoded into their final filename. We disable this on Cygwin because - # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll - # seems to be the default. - # - # This has no effect with MSVC, on that platform the version info for - # the DLL comes from the resource file win32/zlib1.rc - set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) -endif() +if(ZLIB_INSTALL) + if(ZLIB_BUILD_SHARED) + install( + TARGETS zlib + COMPONENT Runtime + EXPORT zlibSharedExport + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install( + EXPORT zlibSharedExport + FILE ZLIB-shared.cmake + NAMESPACE ZLIB:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) -if(UNIX) - # On unix-like platforms the library is almost always called libz - set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) - set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") - endif() -elseif(BUILD_SHARED_LIBS AND WIN32) - # Creates zlib1.dll when building shared library version - set_target_properties(zlib PROPERTIES SUFFIX "1.dll") -endif() + if(MSVC) + install( + FILES $ + COMPONENT Runtime + DESTINATION ${CMAKE_INSTALL_BINDIR} + CONFIGURATIONS Debug OR RelWithDebInfo + OPTIONAL) + endif(MSVC) + endif(ZLIB_BUILD_SHARED) -if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - install(TARGETS zlib zlibstatic - RUNTIME DESTINATION "${INSTALL_BIN_DIR}" - ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" - LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) -endif() -if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) - install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}") -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) - install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3") -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) - install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") -endif() + if(ZLIB_BUILD_STATIC) + install( + TARGETS zlibstatic + COMPONENT Development + EXPORT zlibStaticExport + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install( + EXPORT zlibStaticExport + FILE ZLIB-static.cmake + NAMESPACE ZLIB:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) + endif(ZLIB_BUILD_STATIC) -#============================================================================ -# Example binaries -#============================================================================ -if(ZLIB_BUILD_EXAMPLES) - add_executable(example test/example.c) - target_link_libraries(example zlib) - add_test(example example) + configure_package_config_file( + ${zlib_SOURCE_DIR}/zlibConfig.cmake.in + ${zlib_BINARY_DIR}/ZLIBConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) - add_executable(minigzip test/minigzip.c) - target_link_libraries(minigzip zlib) + write_basic_package_version_file( + "${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake" + VERSION "${zlib_VERSION}" + COMPATIBILITY AnyNewerVersion) - if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) + install(FILES ${zlib_BINARY_DIR}/ZLIBConfig.cmake + ${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) + install( + FILES ${ZLIB_PUBLIC_HDRS} + COMPONENT Development + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + install( + FILES zlib.3 + COMPONENT Docs + DESTINATION "${CMAKE_INSTALL_MANDIR}/man3") + install( + FILES LICENSE + doc/algorithm.txt + doc/crc-doc.1.0.pdf + doc/rfc1950.txt + doc/rfc1951.txt + doc/rfc1952.txt + doc/txtvsbin.txt + COMPONENT Docs + DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib") + install( + FILES ${ZLIB_PC} + COMPONENT Development + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +endif(ZLIB_INSTALL) - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - endif() -endif() +# ============================================================================ +# Tests +# ============================================================================ +if(ZLIB_BUILD_TESTING) + enable_testing() + add_subdirectory(test) +endif(ZLIB_BUILD_TESTING) + +add_subdirectory(contrib) diff --git a/ChangeLog b/ChangeLog index b801a1031ec..312753edade 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,57 @@ ChangeLog file for zlib +Changes in 1.3.2 (17 Feb 2026) +- Continued rewrite of CMake build [Vollstrecker] +- Various portability improvements +- Various github workflow additions and improvements +- Check for negative lengths in crc32_combine functions +- Copy only the initialized window contents in inflateCopy +- Prevent the use of insecure functions without an explicit request +- Add compressBound_z and deflateBound_z functions for large values +- Use atomics to build inflate fixed tables once +- Add definition of ZLIB_INSECURE to build tests with c89 and c94 +- Add --undefined option to ./configure for UBSan checker +- Copy only the initialized deflate state in deflateCopy +- Zero inflate state on allocation +- Remove untgz from contrib +- Add _z versions of the compress and uncompress functions +- Vectorize the CRC-32 calculation on the s390x +- Set bit 11 of the zip header flags in minizip if UTF-8 +- Update OS/400 support +- Add a test to configure to check for a working compiler +- Check for invalid NULL pointer inputs to zlib operations +- Add --mandir to ./configure to specify manual directory +- Add LICENSE.Info-Zip to contrib/minizip +- Remove vstudio projects in lieu of cmake-generated projects +- Replace strcpy() with memcpy() in contrib/minizip + +Changes in 1.3.1.2 (8 Dec 2025) +- Improve portability to RISC OS +- Permit compiling contrib/minizip/unzip.c with decryption +- Enable build of shared library on AIX +- Make deflateBound() more conservative and handle Z_STREAM_END +- Add zipAlreadyThere() to minizip zip.c to help avoid duplicates +- Make z_off_t 64 bits by default +- Add deflateUsed() function to get the used bits in the last byte +- Avoid out-of-bounds pointer arithmetic in inflateCopy() +- Add Haiku to configure for proper LDSHARED settings +- Add Bazel targets +- Complete rewrite of CMake build [Vollstrecker] +- Clarify the use of errnum in gzerror() +- Note that gzseek() requests are deferred until the next operation +- Note the use of gzungetc() to run a deferred seek while reading +- Fix bug in inflatePrime() for 16-bit ints +- Add a "G" option to force gzip, disabling transparency in gzread() +- Improve the discrimination between trailing garbage and bad gzip +- Allow gzflush() to write empty gzip members +- Remove redundant frees of point list on error in examples/zran.c +- Clarify the use of inflateGetHeader() +- Update links to the RFCs +- Return all available uncompressed data on error in gzread.c +- Support non-blocking devices in the gz* routines +- Various other small improvements + Changes in 1.3.1 (22 Jan 2024) - Reject overflows of zip header fields in minizip - Fix bug in inflateSync() for data held in bit buffer diff --git a/FAQ b/FAQ index 92f5d3e29fa..95c1a825acd 100644 --- a/FAQ +++ b/FAQ @@ -3,8 +3,8 @@ If your question is not there, please check the zlib home page -http://zlib.net/ which may have more recent information. -The latest zlib FAQ is at http://zlib.net/zlib_faq.html +https://zlib.net/ which may have more recent information. +The latest zlib FAQ is at https://zlib.net/zlib_faq.html 1. Is zlib Y2K-compliant? @@ -19,7 +19,7 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html 3. Where can I get a Visual Basic interface to zlib? See - * http://marknelson.us/1997/01/01/zlib-engine/ + * https://zlib.net/nelson/ * win32/DLL_FAQ.txt in the zlib distribution 4. compress() returns Z_BUF_ERROR. @@ -38,7 +38,7 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html made with more input or output space. A Z_BUF_ERROR may in fact be unavoidable depending on how the functions are used, since it is not possible to tell whether or not there is more output pending when - strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a + strm.avail_out returns with zero. See https://zlib.net/zlib_how.html for a heavily annotated example. 6. Where's the zlib documentation (man pages, etc.)? @@ -109,8 +109,8 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html 16. Can zlib decode Flate data in an Adobe PDF file? - Yes. See http://www.pdflib.com/ . To modify PDF forms, see - http://sourceforge.net/projects/acroformtool/ . + Yes. See https://www.pdflib.com/ . To modify PDF forms, see + https://sourceforge.net/projects/acroformtool/ . 17. Why am I getting this "register_frame_info not found" error on Solaris? @@ -156,6 +156,10 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html library memory allocation routines by default. zlib's *Init* functions allow for the application to provide custom memory allocation routines. + If the non-default BUILDFIXED or DYNAMIC_CRC_TABLE defines are used on a + system without atomics (e.g. pre-C11), then inflate() and crc32() will not + be thread safe. + Of course, you should only operate on any given zlib or gzip stream from a single thread at a time. @@ -235,7 +239,7 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html As far as we know, no. In fact, that was originally the whole point behind zlib. Look here for some more information: - http://www.gzip.org/#faq11 + https://web.archive.org/web/20180729212847/http://www.gzip.org/#faq11 32. Can zlib work with greater than 4 GB of data? @@ -258,20 +262,20 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html 33. Does zlib have any security vulnerabilities? The only one that we are aware of is potentially in gzprintf(). If zlib is - compiled to use sprintf() or vsprintf(), then there is no protection - against a buffer overflow of an 8K string space (or other value as set by - gzbuffer()), other than the caller of gzprintf() assuring that the output - will not exceed 8K. On the other hand, if zlib is compiled to use - snprintf() or vsnprintf(), which should normally be the case, then there is - no vulnerability. The ./configure script will display warnings if an - insecure variation of sprintf() will be used by gzprintf(). Also the - zlibCompileFlags() function will return information on what variant of - sprintf() is used by gzprintf(). + compiled to use sprintf() or vsprintf(), which requires that ZLIB_INSECURE + be defined, then there is no protection against a buffer overflow of an 8K + string space (or other value as set by gzbuffer()), other than the caller + of gzprintf() assuring that the output will not exceed 8K. On the other + hand, if zlib is compiled to use snprintf() or vsnprintf(), which should + normally be the case, then there is no vulnerability. The ./configure + script will display warnings if an insecure variation of sprintf() will be + used by gzprintf(). Also the zlibCompileFlags() function will return + information on what variant of sprintf() is used by gzprintf(). If you don't have snprintf() or vsnprintf() and would like one, you can - find a portable implementation here: + find a good portable implementation in stb_sprintf.h here: - http://www.ijs.si/software/snprintf/ + https://github.com/nothings/stb Note that you should be using the most recent version of zlib. Versions 1.1.3 and before were subject to a double-free vulnerability, and versions @@ -283,7 +287,7 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html Probably what you want is to use zlib in Java. zlib is already included as part of the Java SDK in the java.util.zip package. If you really want a version of zlib written in the Java language, look on the zlib home - page for links: http://zlib.net/ . + page for links: https://zlib.net/ . 35. I get this or that compiler or source-code scanner warning when I crank it up to maximally-pedantic. Can't you guys write proper code? @@ -314,9 +318,9 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html zlib doesn't support encryption. The original PKZIP encryption is very weak and can be broken with freely available programs. To get strong - encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib + encryption, use GnuPG, https://www.gnupg.org/ , which already includes zlib compression. For PKZIP compatible "encryption", look at - http://www.info-zip.org/ + https://infozip.sourceforge.net/ 39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? diff --git a/INDEX b/INDEX index 2ba06412048..ea022d62efd 100644 --- a/INDEX +++ b/INDEX @@ -21,12 +21,11 @@ zlib.pc.cmakein zlib.pc template for cmake zlib2ansi perl script to convert source files for C++ compilation amiga/ makefiles for Amiga SAS C -as400/ makefiles for AS/400 doc/ documentation for formats and algorithms msdos/ makefiles for MSDOS -nintendods/ makefile for Nintendo DS old/ makefiles for various architectures and zlib documentation files that have not yet been updated for zlib 1.2.x +os400/ makefiles for OS/400 qnx/ makefiles for QNX watcom/ makefiles for OpenWatcom win32/ makefiles for Windows diff --git a/LICENSE b/LICENSE index ab8ee6f7142..b7a69d058e6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Copyright notice: - (C) 1995-2022 Jean-loup Gailly and Mark Adler + (C) 1995-2026 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000000..cb4c13ef3ba --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,9 @@ +module( + name = "zlib", + version = "0.0.0", + compatibility_level = 1, +) + +bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "rules_cc", version = "0.0.16") +bazel_dep(name = "rules_license", version = "1.0.0") diff --git a/Makefile.in b/Makefile.in index cb8b00a9b07..bee83edf370 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler +# Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -13,6 +13,8 @@ # make install prefix=$HOME CC=cc +GCOV=GCOV +LLVM_GCOV_FLAG=LLMV_GCOV_FLAG CFLAGS=-O #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 @@ -25,10 +27,11 @@ LDFLAGS= TEST_LIBS=-L. libz.a LDSHARED=$(CC) CPP=$(CC) -E +VGFMAFLAG= STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.3.1 +SHAREDLIBV=libz.so.1.3.2 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -112,16 +115,16 @@ test64: all64 fi @rm -f tmp64_$$ -infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c +infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h $(SRCDIR)inflate.h $(SRCDIR)inftrees.h + $(CC) $(CFLAGS) $(ZINCOUT) -c -coverage -o $@ $(SRCDIR)test/infcover.c infcover: infcover.o libz.a - $(CC) $(CFLAGS) -o $@ infcover.o libz.a + $(CC) $(CFLAGS) -coverage -o $@ infcover.o libz.a cover: infcover rm -f *.gcda ${QEMU_RUN} ./infcover - gcov inf*.c + ${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda libz.a: $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) @@ -158,6 +161,9 @@ adler32.o: $(SRCDIR)adler32.c crc32.o: $(SRCDIR)crc32.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c +crc32_vx.o: $(SRCDIR)contrib/crc32vx/crc32_vx.c + $(CC) $(CFLAGS) $(VGFMAFLAG) $(ZINC) -c -o $@ $(SRCDIR)contrib/crc32vx/crc32_vx.c + deflate.o: $(SRCDIR)deflate.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c @@ -176,7 +182,7 @@ inftrees.o: $(SRCDIR)inftrees.c trees.o: $(SRCDIR)trees.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c -zutil.o: $(SRCDIR)zutil.c +zutil.o: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c compress.o: $(SRCDIR)compress.c @@ -208,6 +214,11 @@ crc32.lo: $(SRCDIR)crc32.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c -@mv objs/crc32.o $@ +crc32_vx.lo: $(SRCDIR)contrib/crc32vx/crc32_vx.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -DPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c + -@mv objs/crc32_vx.o $@ + deflate.lo: $(SRCDIR)deflate.c -@mkdir objs 2>/dev/null || test -d objs $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c @@ -238,7 +249,7 @@ trees.lo: $(SRCDIR)trees.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c -@mv objs/trees.o $@ -zutil.lo: $(SRCDIR)zutil.c +zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h -@mkdir objs 2>/dev/null || test -d objs $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c -@mv objs/zutil.o $@ @@ -274,7 +285,7 @@ gzwrite.lo: $(SRCDIR)gzwrite.c -@mv objs/gzwrite.o $@ -placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a +placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS) rm -f $(SHAREDLIB) $(SHAREDLIBM) ln -s $@ $(SHAREDLIB) @@ -349,12 +360,13 @@ docs: zlib.3.pdf zlib.3.pdf: $(SRCDIR)zlib.3 groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@ -zconf.h.cmakein: $(SRCDIR)zconf.h.in - -@ TEMPFILE=zconfh_$$; \ - echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ - sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\ - touch -r $(SRCDIR)zconf.h.in $@ &&\ - rm $$TEMPFILE +# zconf.h.cmakein: $(SRCDIR)zconf.h.in +# -@ TEMPFILE=zconfh_$$; \ +# echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ +# sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\ +# touch -r $(SRCDIR)zconf.h.in $@ &&\ +# rm $$TEMPFILE +# zconf: $(SRCDIR)zconf.h.in cp -p $(SRCDIR)zconf.h.in zconf.h @@ -378,7 +390,7 @@ clean: minizip-clean rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov maintainer-clean: distclean -distclean: clean zconf zconf.h.cmakein +distclean: clean zconf # zconf.h.cmakein rm -f Makefile zlib.pc configure.log -@rm -f .DS_Store @if [ -f Makefile.in ]; then \ @@ -389,7 +401,8 @@ distclean: clean zconf zconf.h.cmakein tags: etags $(SRCDIR)*.[ch] -adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +adler32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h @@ -398,8 +411,10 @@ infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees. inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h +crc32_vx.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h -adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +adler32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h @@ -408,3 +423,4 @@ infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftree inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h +crc32_vx.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h \ No newline at end of file diff --git a/README b/README index c5f917540b6..2b1e6f36fe3 100644 --- a/README +++ b/README @@ -1,10 +1,10 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3.1 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and -rfc1952 (gzip format). +zlib 1.3.2 is a general purpose data compression library. All the code is +thread safe (though see the FAQ for caveats). The data format used by the zlib +library is described by RFCs (Request for Comments) 1950 to 1952 at +https://datatracker.ietf.org/doc/html/rfc1950 (zlib format), rfc1951 (deflate +format) and rfc1952 (gzip format). All functions of the compression library are documented in the file zlib.h (volunteer to write man pages welcome, contact zlib@gzip.org). A usage example @@ -21,17 +21,17 @@ make_vms.com. Questions about zlib should be sent to , or to Gilles Vollant for the Windows DLL version. The zlib home page is -http://zlib.net/ . Before reporting a problem, please check this site to +https://zlib.net/ . Before reporting a problem, please check this site to verify that you have the latest version of zlib; otherwise get the latest version and check whether the problem still exists or not. -PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. +PLEASE read the zlib FAQ https://zlib.net/zlib_faq.html before asking for help. Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at -https://marknelson.us/posts/1997/01/01/zlib-engine.html . +https://zlib.net/nelson/ . -The changes made in version 1.3.1 are documented in the file ChangeLog. +The changes made in version 1.3.2 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -43,9 +43,9 @@ can be found at https://github.com/pmqs/IO-Compress . A Python interface to zlib written by A.M. Kuchling is available in Python 1.5 and later versions, see -http://docs.python.org/library/zlib.html . +https://docs.python.org/3/library/zlib.html . -zlib is built into tcl: http://wiki.tcl.tk/4610 . +zlib is built into tcl: https://wiki.tcl-lang.org/page/zlib . An experimental package to read and write files in .zip format, written on top of zlib by Gilles Vollant , is available in the @@ -69,9 +69,7 @@ Notes for some targets: - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with other compilers. Use "make test" to check your compiler. -- gzdopen is not supported on RISCOS or BEOS. - -- For PalmOs, see http://palmzlib.sourceforge.net/ +- For PalmOs, see https://palmzlib.sourceforge.net/ Acknowledgments: @@ -83,7 +81,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2024 Jean-loup Gailly and Mark Adler + (C) 1995-2026 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/README-cmake.md b/README-cmake.md new file mode 100644 index 00000000000..5f2764158e4 --- /dev/null +++ b/README-cmake.md @@ -0,0 +1,79 @@ +# For building with cmake at least version 3.12 (minizip 3.12) is needed + +In most cases the usual + + cmake -S . -B build -D CMAKE_BUILD_TYPE=Release + +will create everything you need, however if you want something off default you can adjust several options fit your needs. +Every option is list below (excluding the cmake-standard options), they can be set via cmake-gui or on cmdline with + + -D