Fossil SCM

Update the built-in zlib to version 1.4, released on 2026-11-04, taking into account check-ins [eea86cee3a], [511ad59ae3], and [0f8bae079e] ([368d97869b] is moot).

danield 2026-11-12 15:37 UTC trunk merge
Commit 20c836f944506942a424d1a03fe9b8b980969e3796ce78f083cfdca8d8a28cd8
103 files changed +150 -35 +31 +435 -4 +435 -4 +29 -19 +2 -2 +5 -3 +2 -2 +40 -3 +4 +25 -68 +26 -4 -1 +77 -64 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 -28 +9 -9 +1 -1 +1 -1 +13 -12 +10 -12 +33 -89 +26 -4 +65 -50 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +206 -209 +2 -1 +1 -1 +12 -11 +1 -1 +92 -38 +35 -7 +1 -1 +131 -116 +109 -80 +1 -1 +1 -1 +1 -1 +9 -3 +1 -1 +117 -119 +4 -3 +145 -131 +8 -3 +1 -1 +2 -2 +29 -17 +26 -4 +103 -86 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +1 -1 +30 -9 +168 -46 +1 -1 +72 -36 +26 -3 +37 -37 +100 -41 +44 -9 -2 +43 -13 +3 -1 +2 -2 +8 -2 +1 -1 +5 -5 +5 -5 +5 -5 +157 -119 +1 -2 +2 -3 +1 -2 +1 -2 +1 -2 +4 -1 +6 -3 +2 -2 +1 -1 +2 -2 +1 -1 +2 -2 +12 -3 +10 -1 +2 -2 +45 -34 +4 -4 +26 -4 +5 -2
~ compat/zlib/CMakeLists.txt ~ compat/zlib/ChangeLog ~ compat/zlib/Makefile ~ compat/zlib/Makefile ~ compat/zlib/Makefile.in ~ compat/zlib/README ~ compat/zlib/README-cmake.md ~ compat/zlib/compress.c ~ compat/zlib/configure ~ compat/zlib/contrib/CMakeLists.txt ~ compat/zlib/contrib/blast/CMakeLists.txt ~ compat/zlib/contrib/blast/blastConfig.cmake.in - compat/zlib/contrib/blast/test.pk - compat/zlib/contrib/blast/test.txt ~ compat/zlib/contrib/blast/test/CMakeLists.txt ~ compat/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in ~ compat/zlib/contrib/blast/test/add_subdirectory_test.cmake.in ~ compat/zlib/contrib/blast/test/find_package_no_components_test.cmake.in ~ compat/zlib/contrib/blast/test/find_package_test.cmake.in ~ compat/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in - compat/zlib/contrib/blast/tester.cmake ~ compat/zlib/contrib/crc32vx/crc32_vx.c ~ compat/zlib/contrib/delphi/ZLib.pas ~ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs ~ compat/zlib/contrib/gcc_gvmat64/CMakeLists.txt ~ compat/zlib/contrib/infback9/inftree9.c ~ compat/zlib/contrib/iostream3/CMakeLists.txt ~ compat/zlib/contrib/iostream3/iostream3Config.cmake.in ~ compat/zlib/contrib/iostream3/test/CMakeLists.txt ~ compat/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in ~ compat/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in ~ compat/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in ~ compat/zlib/contrib/iostream3/test/find_package_test.cmake.in ~ compat/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in ~ compat/zlib/contrib/minizip/CMakeLists.txt ~ compat/zlib/contrib/minizip/Makefile.am ~ compat/zlib/contrib/minizip/configure.ac ~ compat/zlib/contrib/minizip/crypt.h ~ compat/zlib/contrib/minizip/ioapi.h ~ compat/zlib/contrib/minizip/miniunz.c ~ compat/zlib/contrib/minizip/minizipConfig.cmake.in ~ compat/zlib/contrib/minizip/mztools.c ~ compat/zlib/contrib/minizip/skipset.h ~ compat/zlib/contrib/minizip/test/CMakeLists.txt ~ compat/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in ~ compat/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in ~ compat/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in ~ compat/zlib/contrib/minizip/test/find_package_test.cmake.in ~ compat/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in ~ compat/zlib/contrib/minizip/unzip.c ~ compat/zlib/contrib/minizip/unzip.h ~ compat/zlib/contrib/minizip/zip.c ~ compat/zlib/contrib/minizip/zip.h ~ compat/zlib/contrib/nuget/nuget.csproj ~ compat/zlib/contrib/pascal/zlibpas.pas ~ compat/zlib/contrib/puff/CMakeLists.txt ~ compat/zlib/contrib/puff/puffConfig.cmake.in ~ compat/zlib/contrib/puff/test/CMakeLists.txt ~ compat/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in ~ compat/zlib/contrib/puff/test/add_subdirectory_test.cmake.in ~ compat/zlib/contrib/puff/test/find_package_no_components_test.cmake.in ~ compat/zlib/contrib/puff/test/find_package_test.cmake.in ~ compat/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in ~ compat/zlib/contrib/puff/test/tester-cov.cmake ~ compat/zlib/contrib/puff/test/tester.cmake ~ compat/zlib/contrib/testzlib/CMakeLists.txt ~ compat/zlib/contrib/zlib1-dll/CMakeLists.txt ~ compat/zlib/crc32.c ~ compat/zlib/deflate.c ~ compat/zlib/gzguts.h ~ compat/zlib/gzlib.c ~ compat/zlib/gzread.c ~ compat/zlib/gzwrite.c ~ compat/zlib/infback.c ~ compat/zlib/inflate.c ~ compat/zlib/inflate.h ~ compat/zlib/inftrees.c ~ compat/zlib/inftrees.h ~ compat/zlib/os400/README400 ~ compat/zlib/os400/zlibfixed.rpgle ~ compat/zlib/os400/zlibfree.rpgle ~ compat/zlib/qnx/package.qpg ~ compat/zlib/test/CMakeLists.txt ~ compat/zlib/test/add_subdirectory_exclude_test.cmake.in ~ compat/zlib/test/add_subdirectory_test.cmake.in ~ compat/zlib/test/find_package_no_components_test.cmake.in ~ compat/zlib/test/find_package_test.cmake.in ~ compat/zlib/test/find_package_wrong_components_test.cmake.in ~ compat/zlib/test/infcover.c ~ compat/zlib/test/minigzip.c ~ compat/zlib/treebuild.xml ~ compat/zlib/trees.c ~ compat/zlib/uncompr.c ~ compat/zlib/win32/Makefile.msc ~ compat/zlib/win32/README-WIN32.txt ~ compat/zlib/zconf.h ~ compat/zlib/zconf.h.in ~ compat/zlib/zlib.3 ~ compat/zlib/zlib.3.pdf ~ compat/zlib/zlib.h ~ compat/zlib/zlib.pc.cmakein ~ compat/zlib/zlibConfig.cmake.in ~ compat/zlib/zutil.c
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,11 +1,11 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
zlib
55
LANGUAGES C
6
- VERSION 1.3.2
6
+ VERSION 1.4
77
HOMEPAGE_URL "https://zlib.net/"
88
DESCRIPTION "a general-purpose lossless data-compression library")
99
1010
# ============================================================================
1111
# CPack
@@ -21,12 +21,12 @@
2121
2222
option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON)
2323
option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON)
2424
option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON)
2525
option(ZLIB_INSTALL "Enable installation of zlib" ON)
26
-option(ZLIB_PREFIX "prefix for all types and library functions, see zconf.h.in"
27
- OFF)
26
+set(ZLIB_PREFIX "" CACHE STRING
27
+ "prefix for all types and library functions, see zconf.h.in")
2828
mark_as_advanced(ZLIB_PREFIX)
2929
3030
get_property(IS_MULTI GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
3131
3232
if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI)
@@ -33,25 +33,29 @@
3333
message(STATUS "No CMAKE_BUILD_TYPE set -- using Release")
3434
set(CMAKE_BUILD_TYPE Release)
3535
endif(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI)
3636
3737
include(CheckCSourceCompiles)
38
-include(CheckFunctionExists)
38
+include(CheckSymbolExists)
3939
include(CheckIncludeFile)
4040
include(CMakePackageConfigHelpers)
4141
include(CheckTypeSize)
4242
include(CPack)
4343
include(GNUInstallDirs)
4444
4545
set(CPACK_INCLUDED TRUE)
4646
47
+set(Z_PREFIX "${ZLIB_PREFIX}")
48
+
49
+#
50
+# Create zconf.h.cmakein
51
+#
4752
if(NOT ZLIB_CONF_WRITTEN)
48
- set(Z_PREFIX ${ZLIB_PREFIX})
4953
set(CONF_OUT_FILE ${zlib_BINARY_DIR}/zconf.h.cmakein)
5054
file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT LIMIT 245)
5155
file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT})
52
- file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX 1\n")
56
+ file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX @Z_PREFIX@\n")
5357
file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n")
5458
file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n")
5559
file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT OFFSET 244)
5660
set(FIRST_ITEM TRUE)
5761
@@ -69,10 +73,77 @@
6973
TRUE
7074
CACHE BOOL "zconf.h.cmakein was created")
7175
mark_as_advanced(ZLIB_CONF_WRITTEN)
7276
endif(NOT ZLIB_CONF_WRITTEN)
7377
78
+#
79
+# Create zlib.def.cmakein
80
+#
81
+if(NOT ZLIB_DEF_WRITTEN)
82
+ file(STRINGS "${zlib_SOURCE_DIR}/win32/zlib.def" ZLIB_DEF_LINES)
83
+
84
+ set(ZLIB_DEF_OUT "")
85
+
86
+ foreach(line IN LISTS ZLIB_DEF_LINES)
87
+ if(line MATCHES "^;")
88
+ string(APPEND ZLIB_DEF_OUT "${line}\n")
89
+ elseif(line MATCHES "^(LIBRARY|EXPORTS|DESCRIPTION)")
90
+ string(APPEND ZLIB_DEF_OUT "${line}\n")
91
+ elseif(line MATCHES "^ *$")
92
+ string(APPEND ZLIB_DEF_OUT "\n")
93
+ elseif(line MATCHES "^ *[A-Za-z_][A-Za-z0-9_]*")
94
+ string(REGEX REPLACE "^ +" "" sym "${line}")
95
+ string(APPEND ZLIB_DEF_OUT
96
+ " @ZLIB_PREFIX@${sym}\n")
97
+ else()
98
+ string(APPEND ZLIB_DEF_OUT "${line}\n")
99
+ endif()
100
+ endforeach()
101
+
102
+ file(WRITE
103
+ "${CMAKE_CURRENT_BINARY_DIR}/zlib.def.cmakein"
104
+ "${ZLIB_DEF_OUT}"
105
+ )
106
+
107
+ set(ZLIB_DEF_WRITTEN
108
+ TRUE
109
+ CACHE BOOL "zlib.def.cmakein was created")
110
+ mark_as_advanced(ZLIB_DEF_WRITTEN)
111
+endif(NOT ZLIB_DEF_WRITTEN)
112
+
113
+#
114
+#Create zlib.map
115
+#
116
+if(NOT ZLIB_MAP_WRITTEN)
117
+ file(STRINGS "${zlib_SOURCE_DIR}/zlib.map" ZLIB_MAP_CONTENT)
118
+ set(ZLIB_MAP_OUT "")
119
+
120
+ foreach(line IN LISTS ZLIB_MAP_CONTENT)
121
+ if(line MATCHES "^ *[A-Za-z_][A-Za-z0-9_]* *; *$")
122
+ if(line MATCHES "^ *\\* *; *$")
123
+ string(APPEND ZLIB_MAP_OUT "${line}\n")
124
+ else()
125
+ string(REGEX REPLACE "^ +" "" sym "${line}")
126
+ string(APPEND ZLIB_MAP_OUT
127
+ " @ZLIB_PREFIX@${sym}\n")
128
+ endif()
129
+ else()
130
+ string(APPEND ZLIB_MAP_OUT "${line}\n")
131
+ endif()
132
+ endforeach()
133
+
134
+ file(WRITE
135
+ "${zlib_BINARY_DIR}/zlib.map.cmakein"
136
+ "${ZLIB_MAP_OUT}"
137
+ )
138
+
139
+ set(ZLIB_MAP_WRITTEN
140
+ TRUE
141
+ CACHE BOOL "zlib.map.cmakein was created")
142
+ mark_as_advanced(ZLIB_MAP_WRITTEN)
143
+endif(NOT ZLIB_MAP_WRITTEN)
144
+
74145
#
75146
# Check to see if we have large file support
76147
#
77148
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
78149
check_type_size(off64_t OFF64_T)
@@ -79,11 +150,11 @@
79150
unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable
80151
81152
#
82153
# Check for fseeko
83154
#
84
-check_function_exists(fseeko HAVE_FSEEKO)
155
+check_symbol_exists(fseeko stdio.h HAVE_FSEEKO)
85156
86157
#
87158
# Check for stdarg.h
88159
#
89160
check_include_file(stdarg.h HAVE_STDARG_H)
@@ -110,12 +181,25 @@
110181
"
111182
HAVE___ATTR__VIS_HIDDEN)
112183
113184
unset(CMAKE_COMPILE_FLAGS)
114185
set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc)
186
+if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
187
+ set(pc_includedir "${CMAKE_INSTALL_INCLUDEDIR}")
188
+else()
189
+ set(pc_includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
190
+endif()
191
+if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
192
+ set(pc_libdir "${CMAKE_INSTALL_LIBDIR}")
193
+else()
194
+ set(pc_libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
195
+endif()
196
+
115197
configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY)
116198
configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein ${zlib_BINARY_DIR}/zconf.h)
199
+configure_file(${zlib_BINARY_DIR}/zlib.def.cmakein ${zlib_BINARY_DIR}/zlib.def)
200
+configure_file(${zlib_BINARY_DIR}/zlib.map.cmakein ${zlib_BINARY_DIR}/zlib.map)
117201
118202
# ============================================================================
119203
# zlib
120204
# ============================================================================
121205
@@ -154,52 +238,66 @@
154238
set(CMAKE_DEBUG_POSTFIX "d")
155239
endif(WIN32)
156240
157241
if(ZLIB_BUILD_SHARED)
158242
add_library(
159
- zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}
160
- $<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib1.rc>)
243
+ zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS}
244
+ ${ZLIB_PRIVATE_HDRS}
245
+ $<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib-cmake.rc>
246
+ $<$<BOOL:${MSVC}>:${zlib_BINARY_DIR}/zlib.def>)
161247
add_library(ZLIB::ZLIB ALIAS zlib)
248
+
162249
target_include_directories(
163250
zlib
164251
PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
165252
$<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
166253
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
167254
target_compile_definitions(
168255
zlib
169256
PRIVATE ZLIB_BUILD
170
- $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
257
+ $<$<NOT:$<BOOL:${HAVE_FSEEKO}>>:NO_FSEEKO>
171258
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
172259
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
173260
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
174
- PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
261
+ PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
262
+ $<$<BOOL:${ZLIB_PREFIX}>:Z_PREFIX=${ZLIB_PREFIX}>)
263
+
175264
set(INSTALL_VERSION ${zlib_VERSION})
176265
177
- if(NOT CYGWIN)
266
+ if(CYGWIN)
267
+ set_target_properties(zlib PROPERTIES PREFIX "lib")
268
+ else(CYGWIN)
178269
set_target_properties(zlib PROPERTIES SOVERSION ${zlib_VERSION_MAJOR}
179270
VERSION ${INSTALL_VERSION})
180
- endif(NOT CYGWIN)
271
+ endif(CYGWIN)
272
+
273
+ set_target_properties(zlib
274
+ PROPERTIES
275
+ DEFINE_SYMBOL ZLIB_DLL
276
+ EXPORT_NAME ZLIB
277
+ PUBLIC_HEADER "${ZLIB_PUBLIC_HDRS}")
181278
182
- set_target_properties(
183
- zlib
184
- PROPERTIES DEFINE_SYMBOL ZLIB_DLL
185
- EXPORT_NAME ZLIB
186
- OUTPUT_NAME z)
279
+ if(MSVC)
280
+ set_target_properties(zlib PROPERTIES OUTPUT_NAME libz)
281
+ else(MSVC)
282
+ set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
283
+ endif(MSVC)
284
+
187285
if(UNIX
188286
AND NOT APPLE
189
- AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX)
190
- AND NOT (CMAKE_SYSTEM_NAME STREQUAL SunOS))
287
+ AND NOT (CMAKE_SYSTEM_NAME STREQUAL "AIX")
288
+ AND NOT (CMAKE_SYSTEM_NAME STREQUAL "SunOS"))
191289
# On unix-like platforms the library is almost always called libz
192290
set_target_properties(
193291
zlib
194292
PROPERTIES LINK_FLAGS
195
- "-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"")
293
+ "-Wl,--version-script,\"${zlib_BINARY_DIR}/zlib.map\"")
196294
endif(
197295
UNIX
198296
AND NOT APPLE
199
- AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX)
200
- AND NOT (CMAKE_SYSTEM_NAME STREQUAL SunOS))
297
+ AND NOT (CMAKE_SYSTEM_NAME STREQUAL "AIX")
298
+ AND NOT (CMAKE_SYSTEM_NAME STREQUAL "SunOS"))
201299
endif(ZLIB_BUILD_SHARED)
202300
203301
if(ZLIB_BUILD_STATIC)
204302
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS}
205303
${ZLIB_PRIVATE_HDRS})
@@ -210,18 +308,35 @@
210308
$<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
211309
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
212310
target_compile_definitions(
213311
zlibstatic
214312
PRIVATE ZLIB_BUILD
215
- $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
313
+ $<$<NOT:$<BOOL:${HAVE_FSEEKO}>>:NO_FSEEKO>
216314
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
217315
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
218316
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
219
- PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
220
- set_target_properties(
221
- zlibstatic PROPERTIES EXPORT_NAME ZLIBSTATIC OUTPUT_NAME
222
- z${zlib_static_suffix})
317
+ PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
318
+ $<$<BOOL:${ZLIB_PREFIX}>:Z_PREFIX=${ZLIB_PREFIX}>)
319
+
320
+ if(CYGWIN)
321
+ set_target_properties(zlibstatic PROPERTIES PREFIX "lib")
322
+ endif(CYGWIN)
323
+
324
+ if(MSVC)
325
+ set_target_properties(zlibstatic
326
+ PROPERTIES
327
+ ARCHIVE_OUTPUT_NAME libz${zlib_static_suffix})
328
+ else(MSVC)
329
+ set_target_properties(zlibstatic
330
+ PROPERTIES
331
+ ARCHIVE_OUTPUT_NAME z${zlib_static_suffix})
332
+ endif(MSVC)
333
+
334
+ set_target_properties(zlibstatic
335
+ PROPERTIES
336
+ EXPORT_NAME ZLIBSTATIC
337
+ PUBLIC_HEADER "${ZLIB_PUBLIC_HDRS}")
223338
endif(ZLIB_BUILD_STATIC)
224339
225340
if(ZLIB_INSTALL)
226341
if(ZLIB_BUILD_SHARED)
227342
install(
@@ -228,11 +343,14 @@
228343
TARGETS zlib
229344
COMPONENT Runtime
230345
EXPORT zlibSharedExport
231346
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
232347
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
233
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
348
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
349
+ PUBLIC_HEADER
350
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
351
+ COMPONENT Development)
234352
install(
235353
EXPORT zlibSharedExport
236354
FILE ZLIB-shared.cmake
237355
NAMESPACE ZLIB::
238356
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
@@ -252,11 +370,12 @@
252370
TARGETS zlibstatic
253371
COMPONENT Development
254372
EXPORT zlibStaticExport
255373
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
256374
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
257
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
375
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
376
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
258377
install(
259378
EXPORT zlibStaticExport
260379
FILE ZLIB-static.cmake
261380
NAMESPACE ZLIB::
262381
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
@@ -274,14 +393,10 @@
274393
275394
install(FILES ${zlib_BINARY_DIR}/ZLIBConfig.cmake
276395
${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake
277396
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
278397
install(
279
- FILES ${ZLIB_PUBLIC_HDRS}
280
- COMPONENT Development
281
- DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
282
- install(
283398
FILES zlib.3
284399
COMPONENT Docs
285400
DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
286401
install(
287402
FILES LICENSE
288403
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,11 +1,11 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib
5 LANGUAGES C
6 VERSION 1.3.2
7 HOMEPAGE_URL "https://zlib.net/"
8 DESCRIPTION "a general-purpose lossless data-compression library")
9
10 # ============================================================================
11 # CPack
@@ -21,12 +21,12 @@
21
22 option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON)
23 option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON)
24 option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON)
25 option(ZLIB_INSTALL "Enable installation of zlib" ON)
26 option(ZLIB_PREFIX "prefix for all types and library functions, see zconf.h.in"
27 OFF)
28 mark_as_advanced(ZLIB_PREFIX)
29
30 get_property(IS_MULTI GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
31
32 if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI)
@@ -33,25 +33,29 @@
33 message(STATUS "No CMAKE_BUILD_TYPE set -- using Release")
34 set(CMAKE_BUILD_TYPE Release)
35 endif(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI)
36
37 include(CheckCSourceCompiles)
38 include(CheckFunctionExists)
39 include(CheckIncludeFile)
40 include(CMakePackageConfigHelpers)
41 include(CheckTypeSize)
42 include(CPack)
43 include(GNUInstallDirs)
44
45 set(CPACK_INCLUDED TRUE)
46
 
 
 
 
 
47 if(NOT ZLIB_CONF_WRITTEN)
48 set(Z_PREFIX ${ZLIB_PREFIX})
49 set(CONF_OUT_FILE ${zlib_BINARY_DIR}/zconf.h.cmakein)
50 file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT LIMIT 245)
51 file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT})
52 file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX 1\n")
53 file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n")
54 file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n")
55 file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT OFFSET 244)
56 set(FIRST_ITEM TRUE)
57
@@ -69,10 +73,77 @@
69 TRUE
70 CACHE BOOL "zconf.h.cmakein was created")
71 mark_as_advanced(ZLIB_CONF_WRITTEN)
72 endif(NOT ZLIB_CONF_WRITTEN)
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74 #
75 # Check to see if we have large file support
76 #
77 set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
78 check_type_size(off64_t OFF64_T)
@@ -79,11 +150,11 @@
79 unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable
80
81 #
82 # Check for fseeko
83 #
84 check_function_exists(fseeko HAVE_FSEEKO)
85
86 #
87 # Check for stdarg.h
88 #
89 check_include_file(stdarg.h HAVE_STDARG_H)
@@ -110,12 +181,25 @@
110 "
111 HAVE___ATTR__VIS_HIDDEN)
112
113 unset(CMAKE_COMPILE_FLAGS)
114 set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc)
 
 
 
 
 
 
 
 
 
 
 
115 configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY)
116 configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein ${zlib_BINARY_DIR}/zconf.h)
 
 
117
118 # ============================================================================
119 # zlib
120 # ============================================================================
121
@@ -154,52 +238,66 @@
154 set(CMAKE_DEBUG_POSTFIX "d")
155 endif(WIN32)
156
157 if(ZLIB_BUILD_SHARED)
158 add_library(
159 zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}
160 $<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib1.rc>)
 
 
161 add_library(ZLIB::ZLIB ALIAS zlib)
 
162 target_include_directories(
163 zlib
164 PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
165 $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
166 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
167 target_compile_definitions(
168 zlib
169 PRIVATE ZLIB_BUILD
170 $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
171 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
172 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
173 $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
174 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
 
 
175 set(INSTALL_VERSION ${zlib_VERSION})
176
177 if(NOT CYGWIN)
 
 
178 set_target_properties(zlib PROPERTIES SOVERSION ${zlib_VERSION_MAJOR}
179 VERSION ${INSTALL_VERSION})
180 endif(NOT CYGWIN)
 
 
 
 
 
 
181
182 set_target_properties(
183 zlib
184 PROPERTIES DEFINE_SYMBOL ZLIB_DLL
185 EXPORT_NAME ZLIB
186 OUTPUT_NAME z)
 
187 if(UNIX
188 AND NOT APPLE
189 AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX)
190 AND NOT (CMAKE_SYSTEM_NAME STREQUAL SunOS))
191 # On unix-like platforms the library is almost always called libz
192 set_target_properties(
193 zlib
194 PROPERTIES LINK_FLAGS
195 "-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"")
196 endif(
197 UNIX
198 AND NOT APPLE
199 AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX)
200 AND NOT (CMAKE_SYSTEM_NAME STREQUAL SunOS))
201 endif(ZLIB_BUILD_SHARED)
202
203 if(ZLIB_BUILD_STATIC)
204 add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS}
205 ${ZLIB_PRIVATE_HDRS})
@@ -210,18 +308,35 @@
210 $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
211 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
212 target_compile_definitions(
213 zlibstatic
214 PRIVATE ZLIB_BUILD
215 $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
216 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
217 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
218 $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
219 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
220 set_target_properties(
221 zlibstatic PROPERTIES EXPORT_NAME ZLIBSTATIC OUTPUT_NAME
222 z${zlib_static_suffix})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223 endif(ZLIB_BUILD_STATIC)
224
225 if(ZLIB_INSTALL)
226 if(ZLIB_BUILD_SHARED)
227 install(
@@ -228,11 +343,14 @@
228 TARGETS zlib
229 COMPONENT Runtime
230 EXPORT zlibSharedExport
231 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
232 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
233 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
 
 
 
234 install(
235 EXPORT zlibSharedExport
236 FILE ZLIB-shared.cmake
237 NAMESPACE ZLIB::
238 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
@@ -252,11 +370,12 @@
252 TARGETS zlibstatic
253 COMPONENT Development
254 EXPORT zlibStaticExport
255 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
256 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
257 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
 
258 install(
259 EXPORT zlibStaticExport
260 FILE ZLIB-static.cmake
261 NAMESPACE ZLIB::
262 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
@@ -274,14 +393,10 @@
274
275 install(FILES ${zlib_BINARY_DIR}/ZLIBConfig.cmake
276 ${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake
277 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
278 install(
279 FILES ${ZLIB_PUBLIC_HDRS}
280 COMPONENT Development
281 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
282 install(
283 FILES zlib.3
284 COMPONENT Docs
285 DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
286 install(
287 FILES LICENSE
288
--- compat/zlib/CMakeLists.txt
+++ compat/zlib/CMakeLists.txt
@@ -1,11 +1,11 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 zlib
5 LANGUAGES C
6 VERSION 1.4
7 HOMEPAGE_URL "https://zlib.net/"
8 DESCRIPTION "a general-purpose lossless data-compression library")
9
10 # ============================================================================
11 # CPack
@@ -21,12 +21,12 @@
21
22 option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON)
23 option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON)
24 option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON)
25 option(ZLIB_INSTALL "Enable installation of zlib" ON)
26 set(ZLIB_PREFIX "" CACHE STRING
27 "prefix for all types and library functions, see zconf.h.in")
28 mark_as_advanced(ZLIB_PREFIX)
29
30 get_property(IS_MULTI GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
31
32 if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI)
@@ -33,25 +33,29 @@
33 message(STATUS "No CMAKE_BUILD_TYPE set -- using Release")
34 set(CMAKE_BUILD_TYPE Release)
35 endif(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI)
36
37 include(CheckCSourceCompiles)
38 include(CheckSymbolExists)
39 include(CheckIncludeFile)
40 include(CMakePackageConfigHelpers)
41 include(CheckTypeSize)
42 include(CPack)
43 include(GNUInstallDirs)
44
45 set(CPACK_INCLUDED TRUE)
46
47 set(Z_PREFIX "${ZLIB_PREFIX}")
48
49 #
50 # Create zconf.h.cmakein
51 #
52 if(NOT ZLIB_CONF_WRITTEN)
 
53 set(CONF_OUT_FILE ${zlib_BINARY_DIR}/zconf.h.cmakein)
54 file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT LIMIT 245)
55 file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT})
56 file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX @Z_PREFIX@\n")
57 file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n")
58 file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n")
59 file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT OFFSET 244)
60 set(FIRST_ITEM TRUE)
61
@@ -69,10 +73,77 @@
73 TRUE
74 CACHE BOOL "zconf.h.cmakein was created")
75 mark_as_advanced(ZLIB_CONF_WRITTEN)
76 endif(NOT ZLIB_CONF_WRITTEN)
77
78 #
79 # Create zlib.def.cmakein
80 #
81 if(NOT ZLIB_DEF_WRITTEN)
82 file(STRINGS "${zlib_SOURCE_DIR}/win32/zlib.def" ZLIB_DEF_LINES)
83
84 set(ZLIB_DEF_OUT "")
85
86 foreach(line IN LISTS ZLIB_DEF_LINES)
87 if(line MATCHES "^;")
88 string(APPEND ZLIB_DEF_OUT "${line}\n")
89 elseif(line MATCHES "^(LIBRARY|EXPORTS|DESCRIPTION)")
90 string(APPEND ZLIB_DEF_OUT "${line}\n")
91 elseif(line MATCHES "^ *$")
92 string(APPEND ZLIB_DEF_OUT "\n")
93 elseif(line MATCHES "^ *[A-Za-z_][A-Za-z0-9_]*")
94 string(REGEX REPLACE "^ +" "" sym "${line}")
95 string(APPEND ZLIB_DEF_OUT
96 " @ZLIB_PREFIX@${sym}\n")
97 else()
98 string(APPEND ZLIB_DEF_OUT "${line}\n")
99 endif()
100 endforeach()
101
102 file(WRITE
103 "${CMAKE_CURRENT_BINARY_DIR}/zlib.def.cmakein"
104 "${ZLIB_DEF_OUT}"
105 )
106
107 set(ZLIB_DEF_WRITTEN
108 TRUE
109 CACHE BOOL "zlib.def.cmakein was created")
110 mark_as_advanced(ZLIB_DEF_WRITTEN)
111 endif(NOT ZLIB_DEF_WRITTEN)
112
113 #
114 #Create zlib.map
115 #
116 if(NOT ZLIB_MAP_WRITTEN)
117 file(STRINGS "${zlib_SOURCE_DIR}/zlib.map" ZLIB_MAP_CONTENT)
118 set(ZLIB_MAP_OUT "")
119
120 foreach(line IN LISTS ZLIB_MAP_CONTENT)
121 if(line MATCHES "^ *[A-Za-z_][A-Za-z0-9_]* *; *$")
122 if(line MATCHES "^ *\\* *; *$")
123 string(APPEND ZLIB_MAP_OUT "${line}\n")
124 else()
125 string(REGEX REPLACE "^ +" "" sym "${line}")
126 string(APPEND ZLIB_MAP_OUT
127 " @ZLIB_PREFIX@${sym}\n")
128 endif()
129 else()
130 string(APPEND ZLIB_MAP_OUT "${line}\n")
131 endif()
132 endforeach()
133
134 file(WRITE
135 "${zlib_BINARY_DIR}/zlib.map.cmakein"
136 "${ZLIB_MAP_OUT}"
137 )
138
139 set(ZLIB_MAP_WRITTEN
140 TRUE
141 CACHE BOOL "zlib.map.cmakein was created")
142 mark_as_advanced(ZLIB_MAP_WRITTEN)
143 endif(NOT ZLIB_MAP_WRITTEN)
144
145 #
146 # Check to see if we have large file support
147 #
148 set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
149 check_type_size(off64_t OFF64_T)
@@ -79,11 +150,11 @@
150 unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable
151
152 #
153 # Check for fseeko
154 #
155 check_symbol_exists(fseeko stdio.h HAVE_FSEEKO)
156
157 #
158 # Check for stdarg.h
159 #
160 check_include_file(stdarg.h HAVE_STDARG_H)
@@ -110,12 +181,25 @@
181 "
182 HAVE___ATTR__VIS_HIDDEN)
183
184 unset(CMAKE_COMPILE_FLAGS)
185 set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc)
186 if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
187 set(pc_includedir "${CMAKE_INSTALL_INCLUDEDIR}")
188 else()
189 set(pc_includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
190 endif()
191 if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
192 set(pc_libdir "${CMAKE_INSTALL_LIBDIR}")
193 else()
194 set(pc_libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
195 endif()
196
197 configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY)
198 configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein ${zlib_BINARY_DIR}/zconf.h)
199 configure_file(${zlib_BINARY_DIR}/zlib.def.cmakein ${zlib_BINARY_DIR}/zlib.def)
200 configure_file(${zlib_BINARY_DIR}/zlib.map.cmakein ${zlib_BINARY_DIR}/zlib.map)
201
202 # ============================================================================
203 # zlib
204 # ============================================================================
205
@@ -154,52 +238,66 @@
238 set(CMAKE_DEBUG_POSTFIX "d")
239 endif(WIN32)
240
241 if(ZLIB_BUILD_SHARED)
242 add_library(
243 zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS}
244 ${ZLIB_PRIVATE_HDRS}
245 $<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib-cmake.rc>
246 $<$<BOOL:${MSVC}>:${zlib_BINARY_DIR}/zlib.def>)
247 add_library(ZLIB::ZLIB ALIAS zlib)
248
249 target_include_directories(
250 zlib
251 PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
252 $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
253 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
254 target_compile_definitions(
255 zlib
256 PRIVATE ZLIB_BUILD
257 $<$<NOT:$<BOOL:${HAVE_FSEEKO}>>:NO_FSEEKO>
258 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
259 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
260 $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
261 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
262 $<$<BOOL:${ZLIB_PREFIX}>:Z_PREFIX=${ZLIB_PREFIX}>)
263
264 set(INSTALL_VERSION ${zlib_VERSION})
265
266 if(CYGWIN)
267 set_target_properties(zlib PROPERTIES PREFIX "lib")
268 else(CYGWIN)
269 set_target_properties(zlib PROPERTIES SOVERSION ${zlib_VERSION_MAJOR}
270 VERSION ${INSTALL_VERSION})
271 endif(CYGWIN)
272
273 set_target_properties(zlib
274 PROPERTIES
275 DEFINE_SYMBOL ZLIB_DLL
276 EXPORT_NAME ZLIB
277 PUBLIC_HEADER "${ZLIB_PUBLIC_HDRS}")
278
279 if(MSVC)
280 set_target_properties(zlib PROPERTIES OUTPUT_NAME libz)
281 else(MSVC)
282 set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
283 endif(MSVC)
284
285 if(UNIX
286 AND NOT APPLE
287 AND NOT (CMAKE_SYSTEM_NAME STREQUAL "AIX")
288 AND NOT (CMAKE_SYSTEM_NAME STREQUAL "SunOS"))
289 # On unix-like platforms the library is almost always called libz
290 set_target_properties(
291 zlib
292 PROPERTIES LINK_FLAGS
293 "-Wl,--version-script,\"${zlib_BINARY_DIR}/zlib.map\"")
294 endif(
295 UNIX
296 AND NOT APPLE
297 AND NOT (CMAKE_SYSTEM_NAME STREQUAL "AIX")
298 AND NOT (CMAKE_SYSTEM_NAME STREQUAL "SunOS"))
299 endif(ZLIB_BUILD_SHARED)
300
301 if(ZLIB_BUILD_STATIC)
302 add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS}
303 ${ZLIB_PRIVATE_HDRS})
@@ -210,18 +308,35 @@
308 $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
309 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
310 target_compile_definitions(
311 zlibstatic
312 PRIVATE ZLIB_BUILD
313 $<$<NOT:$<BOOL:${HAVE_FSEEKO}>>:NO_FSEEKO>
314 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
315 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
316 $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
317 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
318 $<$<BOOL:${ZLIB_PREFIX}>:Z_PREFIX=${ZLIB_PREFIX}>)
319
320 if(CYGWIN)
321 set_target_properties(zlibstatic PROPERTIES PREFIX "lib")
322 endif(CYGWIN)
323
324 if(MSVC)
325 set_target_properties(zlibstatic
326 PROPERTIES
327 ARCHIVE_OUTPUT_NAME libz${zlib_static_suffix})
328 else(MSVC)
329 set_target_properties(zlibstatic
330 PROPERTIES
331 ARCHIVE_OUTPUT_NAME z${zlib_static_suffix})
332 endif(MSVC)
333
334 set_target_properties(zlibstatic
335 PROPERTIES
336 EXPORT_NAME ZLIBSTATIC
337 PUBLIC_HEADER "${ZLIB_PUBLIC_HDRS}")
338 endif(ZLIB_BUILD_STATIC)
339
340 if(ZLIB_INSTALL)
341 if(ZLIB_BUILD_SHARED)
342 install(
@@ -228,11 +343,14 @@
343 TARGETS zlib
344 COMPONENT Runtime
345 EXPORT zlibSharedExport
346 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
347 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
348 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
349 PUBLIC_HEADER
350 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
351 COMPONENT Development)
352 install(
353 EXPORT zlibSharedExport
354 FILE ZLIB-shared.cmake
355 NAMESPACE ZLIB::
356 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
@@ -252,11 +370,12 @@
370 TARGETS zlibstatic
371 COMPONENT Development
372 EXPORT zlibStaticExport
373 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
374 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
375 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
376 PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
377 install(
378 EXPORT zlibStaticExport
379 FILE ZLIB-static.cmake
380 NAMESPACE ZLIB::
381 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
@@ -274,14 +393,10 @@
393
394 install(FILES ${zlib_BINARY_DIR}/ZLIBConfig.cmake
395 ${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake
396 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
397 install(
 
 
 
 
398 FILES zlib.3
399 COMPONENT Docs
400 DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
401 install(
402 FILES LICENSE
403
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,39 @@
11
22
ChangeLog file for zlib
33
4
+Changes in 1.4 (4 Nov 2026)
5
+- Change CMake library names on MSVC
6
+- Return z_off_t default to long for portability
7
+- Fail gzopen() with "x" if O_EXCL not available
8
+- Deliver all gzip data before reporting error
9
+- Fix gzwrite() buffer overflow (CVE-2026-85091)
10
+- Fix inflateGetDictionary() write past buffer on invalid window size
11
+- Fix window write overrun after inflateSync()
12
+- Fix read before provided data after repeated inflatePrime()'s
13
+- Fix write past pending buffer after repeated deflatePrime()'s
14
+- Fix copy of uninitialized memory by inflateBack() on invalid data
15
+- Fix copy of uninitialized memory after gzseek() as first write action
16
+- Fix read outside window after a deflateResetKeep() mid-stream
17
+- Avoid out-of-bounds pointer arithmetic in infback9() (CVE-2026-4738)
18
+- Fix several vulnerabilities in contrib/minizip
19
+- Fix truncated stream detection in gzread()
20
+- Fix pending skip handling in gzread()
21
+- Fix loss of zero fill on repeated gzseek()'s when writing
22
+- Fix inaccurate total_in after Z_NEED_DICT returned
23
+- Detect and report bad deflateSetDictionary() calls
24
+- Avoid undefined behaviors in C language usage
25
+- Fix minizip extra field overflows when almost full and need Zip64
26
+- Don't assume NULL is defined in compress.c and uncompr.c
27
+- Use the generated zconf.h when building test programs out of tree
28
+- Improve portability and functionality of CMake builds
29
+- Provide 64-bit file offsets on Windows with #defines as on Linux
30
+- Improve portability to Android, AIX, PowerPC, s390x, and Windows
31
+- Use a PCG random number generator instead of rand() in minizip
32
+- Clarify documentation
33
+- (See https://github.com/madler/zlib for all 195 commits)
34
+
435
Changes in 1.3.2 (17 Feb 2026)
536
- Continued rewrite of CMake build [Vollstrecker]
637
- Various portability improvements
738
- Various github workflow additions and improvements
839
- Check for negative lengths in crc32_combine functions
940
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,39 @@
1
2 ChangeLog file for zlib
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4 Changes in 1.3.2 (17 Feb 2026)
5 - Continued rewrite of CMake build [Vollstrecker]
6 - Various portability improvements
7 - Various github workflow additions and improvements
8 - Check for negative lengths in crc32_combine functions
9
--- compat/zlib/ChangeLog
+++ compat/zlib/ChangeLog
@@ -1,8 +1,39 @@
1
2 ChangeLog file for zlib
3
4 Changes in 1.4 (4 Nov 2026)
5 - Change CMake library names on MSVC
6 - Return z_off_t default to long for portability
7 - Fail gzopen() with "x" if O_EXCL not available
8 - Deliver all gzip data before reporting error
9 - Fix gzwrite() buffer overflow (CVE-2026-85091)
10 - Fix inflateGetDictionary() write past buffer on invalid window size
11 - Fix window write overrun after inflateSync()
12 - Fix read before provided data after repeated inflatePrime()'s
13 - Fix write past pending buffer after repeated deflatePrime()'s
14 - Fix copy of uninitialized memory by inflateBack() on invalid data
15 - Fix copy of uninitialized memory after gzseek() as first write action
16 - Fix read outside window after a deflateResetKeep() mid-stream
17 - Avoid out-of-bounds pointer arithmetic in infback9() (CVE-2026-4738)
18 - Fix several vulnerabilities in contrib/minizip
19 - Fix truncated stream detection in gzread()
20 - Fix pending skip handling in gzread()
21 - Fix loss of zero fill on repeated gzseek()'s when writing
22 - Fix inaccurate total_in after Z_NEED_DICT returned
23 - Detect and report bad deflateSetDictionary() calls
24 - Avoid undefined behaviors in C language usage
25 - Fix minizip extra field overflows when almost full and need Zip64
26 - Don't assume NULL is defined in compress.c and uncompr.c
27 - Use the generated zconf.h when building test programs out of tree
28 - Improve portability and functionality of CMake builds
29 - Provide 64-bit file offsets on Windows with #defines as on Linux
30 - Improve portability to Android, AIX, PowerPC, s390x, and Windows
31 - Use a PCG random number generator instead of rand() in minizip
32 - Clarify documentation
33 - (See https://github.com/madler/zlib for all 195 commits)
34
35 Changes in 1.3.2 (17 Feb 2026)
36 - Continued rewrite of CMake build [Vollstrecker]
37 - Various portability improvements
38 - Various github workflow additions and improvements
39 - Check for negative lengths in crc32_combine functions
40
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,5 +1,436 @@
1
-all:
2
- -@echo "Please use ./configure first. Thank you."
1
+# Makefile for zlib
2
+# Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
3
+# For conditions of distribution and use, see copyright notice in zlib.h
4
+
5
+# To compile and test, type:
6
+# ./configure; make test
7
+# Normally configure builds both a static and a shared library.
8
+# If you want to build just a static library, use: ./configure --static
9
+
10
+# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
11
+# make install
12
+# To install in $HOME instead of /usr/local, use:
13
+# make install prefix=$HOME
14
+
15
+CC=gcc
16
+GCOV=gcov
17
+LLVM_GCOV_FLAG=
18
+
19
+CFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
20
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
21
+#CFLAGS=-g -DZLIB_DEBUG
22
+#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
23
+# -Wstrict-prototypes -Wmissing-prototypes
24
+
25
+SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
26
+LDFLAGS=
27
+TEST_LIBS=-L. libz.a
28
+LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
29
+CPP=
30
+VGFMAFLAG=
31
+
32
+STATICLIB=libz.a
33
+SHAREDLIB=libz.so
34
+SHAREDLIBV=libz.so.1.4
35
+SHAREDLIBM=libz.so.1
36
+LIBS=$(STATICLIB) $(SHAREDLIBV)
37
+
38
+AR=ar
39
+ARFLAGS=rc
40
+RANLIB=ranlib
41
+LDCONFIG=ldconfig
42
+LDSHAREDLIBC=-lc
43
+SHAREDEXP=
44
+SHAREDEXPFLAG=
45
+TAR=tar
46
+SHELL=/bin/sh
47
+EXE=
48
+
49
+prefix =/usr/local
50
+exec_prefix =${prefix}
51
+libdir =${exec_prefix}/lib
52
+sharedlibdir =${libdir}
53
+includedir =${prefix}/include
54
+mandir =${prefix}/share/man
55
+man3dir = ${mandir}/man3
56
+pkgconfigdir = ${libdir}/pkgconfig
57
+SRCDIR=
58
+ZINC=
59
+ZINCOUT=-I.
60
+
61
+OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
62
+OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
63
+OBJC = $(OBJZ) $(OBJG)
64
+
65
+PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
66
+PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
67
+PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
68
+
69
+# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
70
+OBJA =
71
+PIC_OBJA =
72
+
73
+OBJS = $(OBJC) $(OBJA)
74
+
75
+PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
76
+
77
+all: static shared all64
78
+
79
+static: example$(EXE) minigzip$(EXE)
80
+
81
+shared: examplesh$(EXE) minigzipsh$(EXE)
82
+
83
+all64: example64$(EXE) minigzip64$(EXE)
84
+
85
+check: test
86
+
87
+test: all teststatic testshared test64
88
+
89
+teststatic: static
90
+ @TMPST=tmpst_$$; \
91
+ if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \
92
+ echo ' *** zlib test OK ***'; \
93
+ else \
94
+ echo ' *** zlib test FAILED ***'; false; \
95
+ fi
96
+ @rm -f tmpst_$$
97
+
98
+testshared: shared
99
+ @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
100
+ LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
101
+ DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
102
+ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
103
+ TMPSH=tmpsh_$$; \
104
+ if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \
105
+ echo ' *** zlib shared test OK ***'; \
106
+ else \
107
+ echo ' *** zlib shared test FAILED ***'; false; \
108
+ fi
109
+ @rm -f tmpsh_$$
110
+
111
+test64: all64
112
+ @TMP64=tmp64_$$; \
113
+ if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \
114
+ echo ' *** zlib 64-bit test OK ***'; \
115
+ else \
116
+ echo ' *** zlib 64-bit test FAILED ***'; false; \
117
+ fi
118
+ @rm -f tmp64_$$
119
+
120
+infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h $(SRCDIR)inflate.h $(SRCDIR)inftrees.h
121
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -coverage -o $@ $(SRCDIR)test/infcover.c
122
+
123
+infcover: infcover.o libz.a
124
+ $(CC) $(CFLAGS) -coverage -o $@ infcover.o libz.a
125
+
126
+cover: infcover
127
+ rm -f *.gcda
128
+ ${QEMU_RUN} ./infcover
129
+ ${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda
130
+
131
+libz.a: $(OBJS)
132
+ $(AR) $(ARFLAGS) $@ $(OBJS)
133
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
134
+
135
+match.o: match.S
136
+ $(CPP) match.S > _match.s
137
+ $(CC) -c _match.s
138
+ mv _match.o match.o
139
+ rm -f _match.s
140
+
141
+match.lo: match.S
142
+ $(CPP) match.S > _match.s
143
+ $(CC) -c -fPIC _match.s
144
+ mv _match.o match.lo
145
+ rm -f _match.s
146
+
147
+example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
148
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
149
+
150
+minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
151
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
152
+
153
+example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
154
+ $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
155
+
156
+minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
157
+ $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
158
+
159
+
160
+adler32.o: $(SRCDIR)adler32.c
161
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
162
+
163
+crc32.o: $(SRCDIR)crc32.c
164
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
165
+
166
+crc32_vx.o: $(SRCDIR)contrib/crc32vx/crc32_vx.c
167
+ $(CC) $(CFLAGS) $(VGFMAFLAG) $(ZINC) -c -o $@ $(SRCDIR)contrib/crc32vx/crc32_vx.c
168
+
169
+deflate.o: $(SRCDIR)deflate.c
170
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
171
+
172
+infback.o: $(SRCDIR)infback.c
173
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
174
+
175
+inffast.o: $(SRCDIR)inffast.c
176
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
177
+
178
+inflate.o: $(SRCDIR)inflate.c
179
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
180
+
181
+inftrees.o: $(SRCDIR)inftrees.c
182
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
183
+
184
+trees.o: $(SRCDIR)trees.c
185
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
186
+
187
+zutil.o: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
188
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
189
+
190
+compress.o: $(SRCDIR)compress.c
191
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
192
+
193
+uncompr.o: $(SRCDIR)uncompr.c
194
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
195
+
196
+gzclose.o: $(SRCDIR)gzclose.c
197
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
198
+
199
+gzlib.o: $(SRCDIR)gzlib.c
200
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
201
+
202
+gzread.o: $(SRCDIR)gzread.c
203
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
204
+
205
+gzwrite.o: $(SRCDIR)gzwrite.c
206
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
207
+
208
+
209
+adler32.lo: $(SRCDIR)adler32.c
210
+ -@mkdir objs 2>/dev/null || test -d objs
211
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
212
+ -@mv objs/adler32.o $@
213
+
214
+crc32.lo: $(SRCDIR)crc32.c
215
+ -@mkdir objs 2>/dev/null || test -d objs
216
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
217
+ -@mv objs/crc32.o $@
218
+
219
+crc32_vx.lo: $(SRCDIR)contrib/crc32vx/crc32_vx.c
220
+ -@mkdir objs 2>/dev/null || test -d objs
221
+ $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -DPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c
222
+ -@mv objs/crc32_vx.o $@
223
+
224
+deflate.lo: $(SRCDIR)deflate.c
225
+ -@mkdir objs 2>/dev/null || test -d objs
226
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
227
+ -@mv objs/deflate.o $@
228
+
229
+infback.lo: $(SRCDIR)infback.c
230
+ -@mkdir objs 2>/dev/null || test -d objs
231
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
232
+ -@mv objs/infback.o $@
233
+
234
+inffast.lo: $(SRCDIR)inffast.c
235
+ -@mkdir objs 2>/dev/null || test -d objs
236
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
237
+ -@mv objs/inffast.o $@
238
+
239
+inflate.lo: $(SRCDIR)inflate.c
240
+ -@mkdir objs 2>/dev/null || test -d objs
241
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
242
+ -@mv objs/inflate.o $@
243
+
244
+inftrees.lo: $(SRCDIR)inftrees.c
245
+ -@mkdir objs 2>/dev/null || test -d objs
246
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
247
+ -@mv objs/inftrees.o $@
248
+
249
+trees.lo: $(SRCDIR)trees.c
250
+ -@mkdir objs 2>/dev/null || test -d objs
251
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
252
+ -@mv objs/trees.o $@
253
+
254
+zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
255
+ -@mkdir objs 2>/dev/null || test -d objs
256
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
257
+ -@mv objs/zutil.o $@
258
+
259
+compress.lo: $(SRCDIR)compress.c
260
+ -@mkdir objs 2>/dev/null || test -d objs
261
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
262
+ -@mv objs/compress.o $@
263
+
264
+uncompr.lo: $(SRCDIR)uncompr.c
265
+ -@mkdir objs 2>/dev/null || test -d objs
266
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
267
+ -@mv objs/uncompr.o $@
268
+
269
+gzclose.lo: $(SRCDIR)gzclose.c
270
+ -@mkdir objs 2>/dev/null || test -d objs
271
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
272
+ -@mv objs/gzclose.o $@
273
+
274
+gzlib.lo: $(SRCDIR)gzlib.c
275
+ -@mkdir objs 2>/dev/null || test -d objs
276
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
277
+ -@mv objs/gzlib.o $@
278
+
279
+gzread.lo: $(SRCDIR)gzread.c
280
+ -@mkdir objs 2>/dev/null || test -d objs
281
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
282
+ -@mv objs/gzread.o $@
283
+
284
+gzwrite.lo: $(SRCDIR)gzwrite.c
285
+ -@mkdir objs 2>/dev/null || test -d objs
286
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
287
+ -@mv objs/gzwrite.o $@
288
+
289
+
290
+placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map $(SHAREDEXP)
291
+ $(LDSHARED) $(SFLAGS) $(SHAREDEXPFLAG) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
292
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
293
+ ln -s $@ $(SHAREDLIB)
294
+ ln -s $@ $(SHAREDLIBM)
295
+ -@rmdir objs
296
+
297
+libz.exp: $(PIC_OBJS)
298
+ dump -tov -X 32_64 $(PIC_OBJS) | \
299
+ awk '$$1 ~ /^\[[0-9]+\]$$/ && $$2 == "m" && \
300
+ $$4 ~ /^\.(text|data|bss)$$/ && ($$6 == "extern" || $$6 == "weak") && \
301
+ $$7 != "HIDDEN" && $$7 != "INTERNAL" && $$NF !~ /^\./ { print $$NF }' | \
302
+ sort -u > $@
303
+ @test -s $@ || { echo "no symbols found for $@" >&2; rm -f $@; false; }
304
+
305
+example$(EXE): example.o $(STATICLIB)
306
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
307
+
308
+minigzip$(EXE): minigzip.o $(STATICLIB)
309
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
310
+
311
+examplesh$(EXE): example.o $(SHAREDLIBV)
312
+ $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
313
+
314
+minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
315
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
316
+
317
+example64$(EXE): example64.o $(STATICLIB)
318
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS)
319
+
320
+minigzip64$(EXE): minigzip64.o $(STATICLIB)
321
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS)
322
+
323
+install-libs: $(LIBS)
324
+ -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
325
+ -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
326
+ -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
327
+ -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
328
+ -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
329
+ rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
330
+ cp $(STATICLIB) $(DESTDIR)$(libdir)
331
+ chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
332
+ -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
333
+ -@if test -n "$(SHAREDLIBV)"; then \
334
+ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
335
+ cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
336
+ echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
337
+ chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
338
+ echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
339
+ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
340
+ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
341
+ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
342
+ ($(LDCONFIG) || true) >/dev/null 2>&1; \
343
+ fi
344
+ rm -f $(DESTDIR)$(man3dir)/zlib.3
345
+ cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
346
+ chmod 644 $(DESTDIR)$(man3dir)/zlib.3
347
+ rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
348
+ cp zlib.pc $(DESTDIR)$(pkgconfigdir)
349
+ chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
350
+# The ranlib in install is needed on NeXTSTEP which checks file times
351
+# ldconfig is for Linux
352
+
353
+install: install-libs
354
+ -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
355
+ rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
356
+ cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
357
+ chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
358
+
359
+uninstall:
360
+ cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
361
+ cd $(DESTDIR)$(libdir) && rm -f libz.a; \
362
+ if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
363
+ rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
364
+ fi
365
+ cd $(DESTDIR)$(man3dir) && rm -f zlib.3
366
+ cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
367
+
368
+docs: zlib.3.pdf
369
+
370
+zlib.3.pdf: $(SRCDIR)zlib.3
371
+ groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
372
+
373
+# zconf.h.cmakein: $(SRCDIR)zconf.h.in
374
+# -@ TEMPFILE=zconfh_$$; \
375
+# echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
376
+# sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
377
+# touch -r $(SRCDIR)zconf.h.in $@ &&\
378
+# rm $$TEMPFILE
379
+#
380
+
381
+zconf: $(SRCDIR)zconf.h.in
382
+ cp -p $(SRCDIR)zconf.h.in zconf.h
383
+
384
+minizip-test: static
385
+ cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
386
+
387
+minizip-clean:
388
+ cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
389
+
390
+mostlyclean: clean
391
+clean: minizip-clean
392
+ rm -f *.o *.lo *~ \
393
+ example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
394
+ example64$(EXE) minigzip64$(EXE) \
395
+ infcover \
396
+ libz.* foo.gz so_locations \
397
+ _match.s maketree contrib/infback9/*.o
398
+ rm -rf objs
399
+ rm -f *.gcda *.gcno *.gcov
400
+ rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
401
+
402
+maintainer-clean: distclean
403
+distclean: clean zconf # zconf.h.cmakein
404
+ rm -f Makefile zlib.pc configure.log
405
+ -@rm -f .DS_Store
406
+ @if [ -f Makefile.in ]; then \
407
+ printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
408
+ printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
409
+ touch -r $(SRCDIR)Makefile.in Makefile ; fi
410
+
411
+tags:
412
+ etags $(SRCDIR)*.[ch]
413
+
414
+adler32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
415
+zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
416
+gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
417
+compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
418
+crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
419
+deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
420
+infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
421
+inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
422
+inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
423
+trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
424
+crc32_vx.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h
3425
4
-distclean:
5
- make -f Makefile.in distclean
426
+adler32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
427
+zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
428
+gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
429
+compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
430
+crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
431
+deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
432
+infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
433
+inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
434
+inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
435
+trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
436
+crc32_vx.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h
6437
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,5 +1,436 @@
1 all:
2 -@echo "Please use ./configure first. Thank you."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
4 distclean:
5 make -f Makefile.in distclean
 
 
 
 
 
 
 
 
 
6
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,5 +1,436 @@
1 # Makefile for zlib
2 # Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
3 # For conditions of distribution and use, see copyright notice in zlib.h
4
5 # To compile and test, type:
6 # ./configure; make test
7 # Normally configure builds both a static and a shared library.
8 # If you want to build just a static library, use: ./configure --static
9
10 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
11 # make install
12 # To install in $HOME instead of /usr/local, use:
13 # make install prefix=$HOME
14
15 CC=gcc
16 GCOV=gcov
17 LLVM_GCOV_FLAG=
18
19 CFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
20 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
21 #CFLAGS=-g -DZLIB_DEBUG
22 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
23 # -Wstrict-prototypes -Wmissing-prototypes
24
25 SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
26 LDFLAGS=
27 TEST_LIBS=-L. libz.a
28 LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
29 CPP=
30 VGFMAFLAG=
31
32 STATICLIB=libz.a
33 SHAREDLIB=libz.so
34 SHAREDLIBV=libz.so.1.4
35 SHAREDLIBM=libz.so.1
36 LIBS=$(STATICLIB) $(SHAREDLIBV)
37
38 AR=ar
39 ARFLAGS=rc
40 RANLIB=ranlib
41 LDCONFIG=ldconfig
42 LDSHAREDLIBC=-lc
43 SHAREDEXP=
44 SHAREDEXPFLAG=
45 TAR=tar
46 SHELL=/bin/sh
47 EXE=
48
49 prefix =/usr/local
50 exec_prefix =${prefix}
51 libdir =${exec_prefix}/lib
52 sharedlibdir =${libdir}
53 includedir =${prefix}/include
54 mandir =${prefix}/share/man
55 man3dir = ${mandir}/man3
56 pkgconfigdir = ${libdir}/pkgconfig
57 SRCDIR=
58 ZINC=
59 ZINCOUT=-I.
60
61 OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
62 OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
63 OBJC = $(OBJZ) $(OBJG)
64
65 PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
66 PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
67 PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
68
69 # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
70 OBJA =
71 PIC_OBJA =
72
73 OBJS = $(OBJC) $(OBJA)
74
75 PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
76
77 all: static shared all64
78
79 static: example$(EXE) minigzip$(EXE)
80
81 shared: examplesh$(EXE) minigzipsh$(EXE)
82
83 all64: example64$(EXE) minigzip64$(EXE)
84
85 check: test
86
87 test: all teststatic testshared test64
88
89 teststatic: static
90 @TMPST=tmpst_$$; \
91 if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \
92 echo ' *** zlib test OK ***'; \
93 else \
94 echo ' *** zlib test FAILED ***'; false; \
95 fi
96 @rm -f tmpst_$$
97
98 testshared: shared
99 @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
100 LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
101 DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
102 SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
103 TMPSH=tmpsh_$$; \
104 if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \
105 echo ' *** zlib shared test OK ***'; \
106 else \
107 echo ' *** zlib shared test FAILED ***'; false; \
108 fi
109 @rm -f tmpsh_$$
110
111 test64: all64
112 @TMP64=tmp64_$$; \
113 if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \
114 echo ' *** zlib 64-bit test OK ***'; \
115 else \
116 echo ' *** zlib 64-bit test FAILED ***'; false; \
117 fi
118 @rm -f tmp64_$$
119
120 infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h $(SRCDIR)inflate.h $(SRCDIR)inftrees.h
121 $(CC) $(CFLAGS) $(ZINCOUT) -c -coverage -o $@ $(SRCDIR)test/infcover.c
122
123 infcover: infcover.o libz.a
124 $(CC) $(CFLAGS) -coverage -o $@ infcover.o libz.a
125
126 cover: infcover
127 rm -f *.gcda
128 ${QEMU_RUN} ./infcover
129 ${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda
130
131 libz.a: $(OBJS)
132 $(AR) $(ARFLAGS) $@ $(OBJS)
133 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
134
135 match.o: match.S
136 $(CPP) match.S > _match.s
137 $(CC) -c _match.s
138 mv _match.o match.o
139 rm -f _match.s
140
141 match.lo: match.S
142 $(CPP) match.S > _match.s
143 $(CC) -c -fPIC _match.s
144 mv _match.o match.lo
145 rm -f _match.s
146
147 example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
148 $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
149
150 minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
151 $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
152
153 example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
154 $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
155
156 minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
157 $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
158
159
160 adler32.o: $(SRCDIR)adler32.c
161 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
162
163 crc32.o: $(SRCDIR)crc32.c
164 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
165
166 crc32_vx.o: $(SRCDIR)contrib/crc32vx/crc32_vx.c
167 $(CC) $(CFLAGS) $(VGFMAFLAG) $(ZINC) -c -o $@ $(SRCDIR)contrib/crc32vx/crc32_vx.c
168
169 deflate.o: $(SRCDIR)deflate.c
170 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
171
172 infback.o: $(SRCDIR)infback.c
173 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
174
175 inffast.o: $(SRCDIR)inffast.c
176 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
177
178 inflate.o: $(SRCDIR)inflate.c
179 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
180
181 inftrees.o: $(SRCDIR)inftrees.c
182 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
183
184 trees.o: $(SRCDIR)trees.c
185 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
186
187 zutil.o: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
188 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
189
190 compress.o: $(SRCDIR)compress.c
191 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
192
193 uncompr.o: $(SRCDIR)uncompr.c
194 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
195
196 gzclose.o: $(SRCDIR)gzclose.c
197 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
198
199 gzlib.o: $(SRCDIR)gzlib.c
200 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
201
202 gzread.o: $(SRCDIR)gzread.c
203 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
204
205 gzwrite.o: $(SRCDIR)gzwrite.c
206 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
207
208
209 adler32.lo: $(SRCDIR)adler32.c
210 -@mkdir objs 2>/dev/null || test -d objs
211 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
212 -@mv objs/adler32.o $@
213
214 crc32.lo: $(SRCDIR)crc32.c
215 -@mkdir objs 2>/dev/null || test -d objs
216 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
217 -@mv objs/crc32.o $@
218
219 crc32_vx.lo: $(SRCDIR)contrib/crc32vx/crc32_vx.c
220 -@mkdir objs 2>/dev/null || test -d objs
221 $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -DPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c
222 -@mv objs/crc32_vx.o $@
223
224 deflate.lo: $(SRCDIR)deflate.c
225 -@mkdir objs 2>/dev/null || test -d objs
226 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
227 -@mv objs/deflate.o $@
228
229 infback.lo: $(SRCDIR)infback.c
230 -@mkdir objs 2>/dev/null || test -d objs
231 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
232 -@mv objs/infback.o $@
233
234 inffast.lo: $(SRCDIR)inffast.c
235 -@mkdir objs 2>/dev/null || test -d objs
236 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
237 -@mv objs/inffast.o $@
238
239 inflate.lo: $(SRCDIR)inflate.c
240 -@mkdir objs 2>/dev/null || test -d objs
241 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
242 -@mv objs/inflate.o $@
243
244 inftrees.lo: $(SRCDIR)inftrees.c
245 -@mkdir objs 2>/dev/null || test -d objs
246 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
247 -@mv objs/inftrees.o $@
248
249 trees.lo: $(SRCDIR)trees.c
250 -@mkdir objs 2>/dev/null || test -d objs
251 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
252 -@mv objs/trees.o $@
253
254 zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
255 -@mkdir objs 2>/dev/null || test -d objs
256 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
257 -@mv objs/zutil.o $@
258
259 compress.lo: $(SRCDIR)compress.c
260 -@mkdir objs 2>/dev/null || test -d objs
261 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
262 -@mv objs/compress.o $@
263
264 uncompr.lo: $(SRCDIR)uncompr.c
265 -@mkdir objs 2>/dev/null || test -d objs
266 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
267 -@mv objs/uncompr.o $@
268
269 gzclose.lo: $(SRCDIR)gzclose.c
270 -@mkdir objs 2>/dev/null || test -d objs
271 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
272 -@mv objs/gzclose.o $@
273
274 gzlib.lo: $(SRCDIR)gzlib.c
275 -@mkdir objs 2>/dev/null || test -d objs
276 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
277 -@mv objs/gzlib.o $@
278
279 gzread.lo: $(SRCDIR)gzread.c
280 -@mkdir objs 2>/dev/null || test -d objs
281 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
282 -@mv objs/gzread.o $@
283
284 gzwrite.lo: $(SRCDIR)gzwrite.c
285 -@mkdir objs 2>/dev/null || test -d objs
286 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
287 -@mv objs/gzwrite.o $@
288
289
290 placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map $(SHAREDEXP)
291 $(LDSHARED) $(SFLAGS) $(SHAREDEXPFLAG) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
292 rm -f $(SHAREDLIB) $(SHAREDLIBM)
293 ln -s $@ $(SHAREDLIB)
294 ln -s $@ $(SHAREDLIBM)
295 -@rmdir objs
296
297 libz.exp: $(PIC_OBJS)
298 dump -tov -X 32_64 $(PIC_OBJS) | \
299 awk '$$1 ~ /^\[[0-9]+\]$$/ && $$2 == "m" && \
300 $$4 ~ /^\.(text|data|bss)$$/ && ($$6 == "extern" || $$6 == "weak") && \
301 $$7 != "HIDDEN" && $$7 != "INTERNAL" && $$NF !~ /^\./ { print $$NF }' | \
302 sort -u > $@
303 @test -s $@ || { echo "no symbols found for $@" >&2; rm -f $@; false; }
304
305 example$(EXE): example.o $(STATICLIB)
306 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
307
308 minigzip$(EXE): minigzip.o $(STATICLIB)
309 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
310
311 examplesh$(EXE): example.o $(SHAREDLIBV)
312 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
313
314 minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
315 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
316
317 example64$(EXE): example64.o $(STATICLIB)
318 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS)
319
320 minigzip64$(EXE): minigzip64.o $(STATICLIB)
321 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS)
322
323 install-libs: $(LIBS)
324 -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
325 -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
326 -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
327 -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
328 -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
329 rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
330 cp $(STATICLIB) $(DESTDIR)$(libdir)
331 chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
332 -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
333 -@if test -n "$(SHAREDLIBV)"; then \
334 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
335 cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
336 echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
337 chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
338 echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
339 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
340 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
341 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
342 ($(LDCONFIG) || true) >/dev/null 2>&1; \
343 fi
344 rm -f $(DESTDIR)$(man3dir)/zlib.3
345 cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
346 chmod 644 $(DESTDIR)$(man3dir)/zlib.3
347 rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
348 cp zlib.pc $(DESTDIR)$(pkgconfigdir)
349 chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
350 # The ranlib in install is needed on NeXTSTEP which checks file times
351 # ldconfig is for Linux
352
353 install: install-libs
354 -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
355 rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
356 cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
357 chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
358
359 uninstall:
360 cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
361 cd $(DESTDIR)$(libdir) && rm -f libz.a; \
362 if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
363 rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
364 fi
365 cd $(DESTDIR)$(man3dir) && rm -f zlib.3
366 cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
367
368 docs: zlib.3.pdf
369
370 zlib.3.pdf: $(SRCDIR)zlib.3
371 groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
372
373 # zconf.h.cmakein: $(SRCDIR)zconf.h.in
374 # -@ TEMPFILE=zconfh_$$; \
375 # echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
376 # sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
377 # touch -r $(SRCDIR)zconf.h.in $@ &&\
378 # rm $$TEMPFILE
379 #
380
381 zconf: $(SRCDIR)zconf.h.in
382 cp -p $(SRCDIR)zconf.h.in zconf.h
383
384 minizip-test: static
385 cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
386
387 minizip-clean:
388 cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
389
390 mostlyclean: clean
391 clean: minizip-clean
392 rm -f *.o *.lo *~ \
393 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
394 example64$(EXE) minigzip64$(EXE) \
395 infcover \
396 libz.* foo.gz so_locations \
397 _match.s maketree contrib/infback9/*.o
398 rm -rf objs
399 rm -f *.gcda *.gcno *.gcov
400 rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
401
402 maintainer-clean: distclean
403 distclean: clean zconf # zconf.h.cmakein
404 rm -f Makefile zlib.pc configure.log
405 -@rm -f .DS_Store
406 @if [ -f Makefile.in ]; then \
407 printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
408 printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
409 touch -r $(SRCDIR)Makefile.in Makefile ; fi
410
411 tags:
412 etags $(SRCDIR)*.[ch]
413
414 adler32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
415 zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
416 gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
417 compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
418 crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
419 deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
420 infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
421 inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
422 inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
423 trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
424 crc32_vx.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h
425
426 adler32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
427 zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
428 gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
429 compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
430 crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
431 deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
432 infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
433 inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
434 inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
435 trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
436 crc32_vx.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h
437
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,5 +1,436 @@
1
-all:
2
- -@echo "Please use ./configure first. Thank you."
1
+# Makefile for zlib
2
+# Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
3
+# For conditions of distribution and use, see copyright notice in zlib.h
4
+
5
+# To compile and test, type:
6
+# ./configure; make test
7
+# Normally configure builds both a static and a shared library.
8
+# If you want to build just a static library, use: ./configure --static
9
+
10
+# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
11
+# make install
12
+# To install in $HOME instead of /usr/local, use:
13
+# make install prefix=$HOME
14
+
15
+CC=gcc
16
+GCOV=gcov
17
+LLVM_GCOV_FLAG=
18
+
19
+CFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
20
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
21
+#CFLAGS=-g -DZLIB_DEBUG
22
+#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
23
+# -Wstrict-prototypes -Wmissing-prototypes
24
+
25
+SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
26
+LDFLAGS=
27
+TEST_LIBS=-L. libz.a
28
+LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
29
+CPP=
30
+VGFMAFLAG=
31
+
32
+STATICLIB=libz.a
33
+SHAREDLIB=libz.so
34
+SHAREDLIBV=libz.so.1.4
35
+SHAREDLIBM=libz.so.1
36
+LIBS=$(STATICLIB) $(SHAREDLIBV)
37
+
38
+AR=ar
39
+ARFLAGS=rc
40
+RANLIB=ranlib
41
+LDCONFIG=ldconfig
42
+LDSHAREDLIBC=-lc
43
+SHAREDEXP=
44
+SHAREDEXPFLAG=
45
+TAR=tar
46
+SHELL=/bin/sh
47
+EXE=
48
+
49
+prefix =/usr/local
50
+exec_prefix =${prefix}
51
+libdir =${exec_prefix}/lib
52
+sharedlibdir =${libdir}
53
+includedir =${prefix}/include
54
+mandir =${prefix}/share/man
55
+man3dir = ${mandir}/man3
56
+pkgconfigdir = ${libdir}/pkgconfig
57
+SRCDIR=
58
+ZINC=
59
+ZINCOUT=-I.
60
+
61
+OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
62
+OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
63
+OBJC = $(OBJZ) $(OBJG)
64
+
65
+PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
66
+PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
67
+PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
68
+
69
+# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
70
+OBJA =
71
+PIC_OBJA =
72
+
73
+OBJS = $(OBJC) $(OBJA)
74
+
75
+PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
76
+
77
+all: static shared all64
78
+
79
+static: example$(EXE) minigzip$(EXE)
80
+
81
+shared: examplesh$(EXE) minigzipsh$(EXE)
82
+
83
+all64: example64$(EXE) minigzip64$(EXE)
84
+
85
+check: test
86
+
87
+test: all teststatic testshared test64
88
+
89
+teststatic: static
90
+ @TMPST=tmpst_$$; \
91
+ if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \
92
+ echo ' *** zlib test OK ***'; \
93
+ else \
94
+ echo ' *** zlib test FAILED ***'; false; \
95
+ fi
96
+ @rm -f tmpst_$$
97
+
98
+testshared: shared
99
+ @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
100
+ LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
101
+ DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
102
+ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
103
+ TMPSH=tmpsh_$$; \
104
+ if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \
105
+ echo ' *** zlib shared test OK ***'; \
106
+ else \
107
+ echo ' *** zlib shared test FAILED ***'; false; \
108
+ fi
109
+ @rm -f tmpsh_$$
110
+
111
+test64: all64
112
+ @TMP64=tmp64_$$; \
113
+ if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \
114
+ echo ' *** zlib 64-bit test OK ***'; \
115
+ else \
116
+ echo ' *** zlib 64-bit test FAILED ***'; false; \
117
+ fi
118
+ @rm -f tmp64_$$
119
+
120
+infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h $(SRCDIR)inflate.h $(SRCDIR)inftrees.h
121
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -coverage -o $@ $(SRCDIR)test/infcover.c
122
+
123
+infcover: infcover.o libz.a
124
+ $(CC) $(CFLAGS) -coverage -o $@ infcover.o libz.a
125
+
126
+cover: infcover
127
+ rm -f *.gcda
128
+ ${QEMU_RUN} ./infcover
129
+ ${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda
130
+
131
+libz.a: $(OBJS)
132
+ $(AR) $(ARFLAGS) $@ $(OBJS)
133
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
134
+
135
+match.o: match.S
136
+ $(CPP) match.S > _match.s
137
+ $(CC) -c _match.s
138
+ mv _match.o match.o
139
+ rm -f _match.s
140
+
141
+match.lo: match.S
142
+ $(CPP) match.S > _match.s
143
+ $(CC) -c -fPIC _match.s
144
+ mv _match.o match.lo
145
+ rm -f _match.s
146
+
147
+example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
148
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
149
+
150
+minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
151
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
152
+
153
+example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
154
+ $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
155
+
156
+minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
157
+ $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
158
+
159
+
160
+adler32.o: $(SRCDIR)adler32.c
161
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
162
+
163
+crc32.o: $(SRCDIR)crc32.c
164
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
165
+
166
+crc32_vx.o: $(SRCDIR)contrib/crc32vx/crc32_vx.c
167
+ $(CC) $(CFLAGS) $(VGFMAFLAG) $(ZINC) -c -o $@ $(SRCDIR)contrib/crc32vx/crc32_vx.c
168
+
169
+deflate.o: $(SRCDIR)deflate.c
170
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
171
+
172
+infback.o: $(SRCDIR)infback.c
173
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
174
+
175
+inffast.o: $(SRCDIR)inffast.c
176
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
177
+
178
+inflate.o: $(SRCDIR)inflate.c
179
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
180
+
181
+inftrees.o: $(SRCDIR)inftrees.c
182
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
183
+
184
+trees.o: $(SRCDIR)trees.c
185
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
186
+
187
+zutil.o: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
188
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
189
+
190
+compress.o: $(SRCDIR)compress.c
191
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
192
+
193
+uncompr.o: $(SRCDIR)uncompr.c
194
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
195
+
196
+gzclose.o: $(SRCDIR)gzclose.c
197
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
198
+
199
+gzlib.o: $(SRCDIR)gzlib.c
200
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
201
+
202
+gzread.o: $(SRCDIR)gzread.c
203
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
204
+
205
+gzwrite.o: $(SRCDIR)gzwrite.c
206
+ $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
207
+
208
+
209
+adler32.lo: $(SRCDIR)adler32.c
210
+ -@mkdir objs 2>/dev/null || test -d objs
211
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
212
+ -@mv objs/adler32.o $@
213
+
214
+crc32.lo: $(SRCDIR)crc32.c
215
+ -@mkdir objs 2>/dev/null || test -d objs
216
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
217
+ -@mv objs/crc32.o $@
218
+
219
+crc32_vx.lo: $(SRCDIR)contrib/crc32vx/crc32_vx.c
220
+ -@mkdir objs 2>/dev/null || test -d objs
221
+ $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -DPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c
222
+ -@mv objs/crc32_vx.o $@
223
+
224
+deflate.lo: $(SRCDIR)deflate.c
225
+ -@mkdir objs 2>/dev/null || test -d objs
226
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
227
+ -@mv objs/deflate.o $@
228
+
229
+infback.lo: $(SRCDIR)infback.c
230
+ -@mkdir objs 2>/dev/null || test -d objs
231
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
232
+ -@mv objs/infback.o $@
233
+
234
+inffast.lo: $(SRCDIR)inffast.c
235
+ -@mkdir objs 2>/dev/null || test -d objs
236
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
237
+ -@mv objs/inffast.o $@
238
+
239
+inflate.lo: $(SRCDIR)inflate.c
240
+ -@mkdir objs 2>/dev/null || test -d objs
241
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
242
+ -@mv objs/inflate.o $@
243
+
244
+inftrees.lo: $(SRCDIR)inftrees.c
245
+ -@mkdir objs 2>/dev/null || test -d objs
246
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
247
+ -@mv objs/inftrees.o $@
248
+
249
+trees.lo: $(SRCDIR)trees.c
250
+ -@mkdir objs 2>/dev/null || test -d objs
251
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
252
+ -@mv objs/trees.o $@
253
+
254
+zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
255
+ -@mkdir objs 2>/dev/null || test -d objs
256
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
257
+ -@mv objs/zutil.o $@
258
+
259
+compress.lo: $(SRCDIR)compress.c
260
+ -@mkdir objs 2>/dev/null || test -d objs
261
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
262
+ -@mv objs/compress.o $@
263
+
264
+uncompr.lo: $(SRCDIR)uncompr.c
265
+ -@mkdir objs 2>/dev/null || test -d objs
266
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
267
+ -@mv objs/uncompr.o $@
268
+
269
+gzclose.lo: $(SRCDIR)gzclose.c
270
+ -@mkdir objs 2>/dev/null || test -d objs
271
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
272
+ -@mv objs/gzclose.o $@
273
+
274
+gzlib.lo: $(SRCDIR)gzlib.c
275
+ -@mkdir objs 2>/dev/null || test -d objs
276
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
277
+ -@mv objs/gzlib.o $@
278
+
279
+gzread.lo: $(SRCDIR)gzread.c
280
+ -@mkdir objs 2>/dev/null || test -d objs
281
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
282
+ -@mv objs/gzread.o $@
283
+
284
+gzwrite.lo: $(SRCDIR)gzwrite.c
285
+ -@mkdir objs 2>/dev/null || test -d objs
286
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
287
+ -@mv objs/gzwrite.o $@
288
+
289
+
290
+placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map $(SHAREDEXP)
291
+ $(LDSHARED) $(SFLAGS) $(SHAREDEXPFLAG) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
292
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
293
+ ln -s $@ $(SHAREDLIB)
294
+ ln -s $@ $(SHAREDLIBM)
295
+ -@rmdir objs
296
+
297
+libz.exp: $(PIC_OBJS)
298
+ dump -tov -X 32_64 $(PIC_OBJS) | \
299
+ awk '$$1 ~ /^\[[0-9]+\]$$/ && $$2 == "m" && \
300
+ $$4 ~ /^\.(text|data|bss)$$/ && ($$6 == "extern" || $$6 == "weak") && \
301
+ $$7 != "HIDDEN" && $$7 != "INTERNAL" && $$NF !~ /^\./ { print $$NF }' | \
302
+ sort -u > $@
303
+ @test -s $@ || { echo "no symbols found for $@" >&2; rm -f $@; false; }
304
+
305
+example$(EXE): example.o $(STATICLIB)
306
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
307
+
308
+minigzip$(EXE): minigzip.o $(STATICLIB)
309
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
310
+
311
+examplesh$(EXE): example.o $(SHAREDLIBV)
312
+ $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
313
+
314
+minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
315
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
316
+
317
+example64$(EXE): example64.o $(STATICLIB)
318
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS)
319
+
320
+minigzip64$(EXE): minigzip64.o $(STATICLIB)
321
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS)
322
+
323
+install-libs: $(LIBS)
324
+ -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
325
+ -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
326
+ -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
327
+ -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
328
+ -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
329
+ rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
330
+ cp $(STATICLIB) $(DESTDIR)$(libdir)
331
+ chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
332
+ -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
333
+ -@if test -n "$(SHAREDLIBV)"; then \
334
+ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
335
+ cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
336
+ echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
337
+ chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
338
+ echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
339
+ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
340
+ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
341
+ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
342
+ ($(LDCONFIG) || true) >/dev/null 2>&1; \
343
+ fi
344
+ rm -f $(DESTDIR)$(man3dir)/zlib.3
345
+ cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
346
+ chmod 644 $(DESTDIR)$(man3dir)/zlib.3
347
+ rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
348
+ cp zlib.pc $(DESTDIR)$(pkgconfigdir)
349
+ chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
350
+# The ranlib in install is needed on NeXTSTEP which checks file times
351
+# ldconfig is for Linux
352
+
353
+install: install-libs
354
+ -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
355
+ rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
356
+ cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
357
+ chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
358
+
359
+uninstall:
360
+ cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
361
+ cd $(DESTDIR)$(libdir) && rm -f libz.a; \
362
+ if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
363
+ rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
364
+ fi
365
+ cd $(DESTDIR)$(man3dir) && rm -f zlib.3
366
+ cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
367
+
368
+docs: zlib.3.pdf
369
+
370
+zlib.3.pdf: $(SRCDIR)zlib.3
371
+ groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
372
+
373
+# zconf.h.cmakein: $(SRCDIR)zconf.h.in
374
+# -@ TEMPFILE=zconfh_$$; \
375
+# echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
376
+# sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
377
+# touch -r $(SRCDIR)zconf.h.in $@ &&\
378
+# rm $$TEMPFILE
379
+#
380
+
381
+zconf: $(SRCDIR)zconf.h.in
382
+ cp -p $(SRCDIR)zconf.h.in zconf.h
383
+
384
+minizip-test: static
385
+ cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
386
+
387
+minizip-clean:
388
+ cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
389
+
390
+mostlyclean: clean
391
+clean: minizip-clean
392
+ rm -f *.o *.lo *~ \
393
+ example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
394
+ example64$(EXE) minigzip64$(EXE) \
395
+ infcover \
396
+ libz.* foo.gz so_locations \
397
+ _match.s maketree contrib/infback9/*.o
398
+ rm -rf objs
399
+ rm -f *.gcda *.gcno *.gcov
400
+ rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
401
+
402
+maintainer-clean: distclean
403
+distclean: clean zconf # zconf.h.cmakein
404
+ rm -f Makefile zlib.pc configure.log
405
+ -@rm -f .DS_Store
406
+ @if [ -f Makefile.in ]; then \
407
+ printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
408
+ printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
409
+ touch -r $(SRCDIR)Makefile.in Makefile ; fi
410
+
411
+tags:
412
+ etags $(SRCDIR)*.[ch]
413
+
414
+adler32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
415
+zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
416
+gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
417
+compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
418
+crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
419
+deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
420
+infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
421
+inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
422
+inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
423
+trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
424
+crc32_vx.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h
3425
4
-distclean:
5
- make -f Makefile.in distclean
426
+adler32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
427
+zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
428
+gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
429
+compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
430
+crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
431
+deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
432
+infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
433
+inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
434
+inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
435
+trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
436
+crc32_vx.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h
6437
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,5 +1,436 @@
1 all:
2 -@echo "Please use ./configure first. Thank you."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
4 distclean:
5 make -f Makefile.in distclean
 
 
 
 
 
 
 
 
 
6
--- compat/zlib/Makefile
+++ compat/zlib/Makefile
@@ -1,5 +1,436 @@
1 # Makefile for zlib
2 # Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
3 # For conditions of distribution and use, see copyright notice in zlib.h
4
5 # To compile and test, type:
6 # ./configure; make test
7 # Normally configure builds both a static and a shared library.
8 # If you want to build just a static library, use: ./configure --static
9
10 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
11 # make install
12 # To install in $HOME instead of /usr/local, use:
13 # make install prefix=$HOME
14
15 CC=gcc
16 GCOV=gcov
17 LLVM_GCOV_FLAG=
18
19 CFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
20 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
21 #CFLAGS=-g -DZLIB_DEBUG
22 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
23 # -Wstrict-prototypes -Wmissing-prototypes
24
25 SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
26 LDFLAGS=
27 TEST_LIBS=-L. libz.a
28 LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
29 CPP=
30 VGFMAFLAG=
31
32 STATICLIB=libz.a
33 SHAREDLIB=libz.so
34 SHAREDLIBV=libz.so.1.4
35 SHAREDLIBM=libz.so.1
36 LIBS=$(STATICLIB) $(SHAREDLIBV)
37
38 AR=ar
39 ARFLAGS=rc
40 RANLIB=ranlib
41 LDCONFIG=ldconfig
42 LDSHAREDLIBC=-lc
43 SHAREDEXP=
44 SHAREDEXPFLAG=
45 TAR=tar
46 SHELL=/bin/sh
47 EXE=
48
49 prefix =/usr/local
50 exec_prefix =${prefix}
51 libdir =${exec_prefix}/lib
52 sharedlibdir =${libdir}
53 includedir =${prefix}/include
54 mandir =${prefix}/share/man
55 man3dir = ${mandir}/man3
56 pkgconfigdir = ${libdir}/pkgconfig
57 SRCDIR=
58 ZINC=
59 ZINCOUT=-I.
60
61 OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
62 OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
63 OBJC = $(OBJZ) $(OBJG)
64
65 PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
66 PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
67 PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
68
69 # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
70 OBJA =
71 PIC_OBJA =
72
73 OBJS = $(OBJC) $(OBJA)
74
75 PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
76
77 all: static shared all64
78
79 static: example$(EXE) minigzip$(EXE)
80
81 shared: examplesh$(EXE) minigzipsh$(EXE)
82
83 all64: example64$(EXE) minigzip64$(EXE)
84
85 check: test
86
87 test: all teststatic testshared test64
88
89 teststatic: static
90 @TMPST=tmpst_$$; \
91 if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \
92 echo ' *** zlib test OK ***'; \
93 else \
94 echo ' *** zlib test FAILED ***'; false; \
95 fi
96 @rm -f tmpst_$$
97
98 testshared: shared
99 @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
100 LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
101 DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
102 SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
103 TMPSH=tmpsh_$$; \
104 if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \
105 echo ' *** zlib shared test OK ***'; \
106 else \
107 echo ' *** zlib shared test FAILED ***'; false; \
108 fi
109 @rm -f tmpsh_$$
110
111 test64: all64
112 @TMP64=tmp64_$$; \
113 if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \
114 echo ' *** zlib 64-bit test OK ***'; \
115 else \
116 echo ' *** zlib 64-bit test FAILED ***'; false; \
117 fi
118 @rm -f tmp64_$$
119
120 infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h $(SRCDIR)inflate.h $(SRCDIR)inftrees.h
121 $(CC) $(CFLAGS) $(ZINCOUT) -c -coverage -o $@ $(SRCDIR)test/infcover.c
122
123 infcover: infcover.o libz.a
124 $(CC) $(CFLAGS) -coverage -o $@ infcover.o libz.a
125
126 cover: infcover
127 rm -f *.gcda
128 ${QEMU_RUN} ./infcover
129 ${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda
130
131 libz.a: $(OBJS)
132 $(AR) $(ARFLAGS) $@ $(OBJS)
133 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
134
135 match.o: match.S
136 $(CPP) match.S > _match.s
137 $(CC) -c _match.s
138 mv _match.o match.o
139 rm -f _match.s
140
141 match.lo: match.S
142 $(CPP) match.S > _match.s
143 $(CC) -c -fPIC _match.s
144 mv _match.o match.lo
145 rm -f _match.s
146
147 example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
148 $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
149
150 minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
151 $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
152
153 example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
154 $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
155
156 minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
157 $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
158
159
160 adler32.o: $(SRCDIR)adler32.c
161 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
162
163 crc32.o: $(SRCDIR)crc32.c
164 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
165
166 crc32_vx.o: $(SRCDIR)contrib/crc32vx/crc32_vx.c
167 $(CC) $(CFLAGS) $(VGFMAFLAG) $(ZINC) -c -o $@ $(SRCDIR)contrib/crc32vx/crc32_vx.c
168
169 deflate.o: $(SRCDIR)deflate.c
170 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
171
172 infback.o: $(SRCDIR)infback.c
173 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
174
175 inffast.o: $(SRCDIR)inffast.c
176 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
177
178 inflate.o: $(SRCDIR)inflate.c
179 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
180
181 inftrees.o: $(SRCDIR)inftrees.c
182 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
183
184 trees.o: $(SRCDIR)trees.c
185 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
186
187 zutil.o: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
188 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
189
190 compress.o: $(SRCDIR)compress.c
191 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
192
193 uncompr.o: $(SRCDIR)uncompr.c
194 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
195
196 gzclose.o: $(SRCDIR)gzclose.c
197 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
198
199 gzlib.o: $(SRCDIR)gzlib.c
200 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
201
202 gzread.o: $(SRCDIR)gzread.c
203 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
204
205 gzwrite.o: $(SRCDIR)gzwrite.c
206 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
207
208
209 adler32.lo: $(SRCDIR)adler32.c
210 -@mkdir objs 2>/dev/null || test -d objs
211 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
212 -@mv objs/adler32.o $@
213
214 crc32.lo: $(SRCDIR)crc32.c
215 -@mkdir objs 2>/dev/null || test -d objs
216 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
217 -@mv objs/crc32.o $@
218
219 crc32_vx.lo: $(SRCDIR)contrib/crc32vx/crc32_vx.c
220 -@mkdir objs 2>/dev/null || test -d objs
221 $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -DPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c
222 -@mv objs/crc32_vx.o $@
223
224 deflate.lo: $(SRCDIR)deflate.c
225 -@mkdir objs 2>/dev/null || test -d objs
226 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
227 -@mv objs/deflate.o $@
228
229 infback.lo: $(SRCDIR)infback.c
230 -@mkdir objs 2>/dev/null || test -d objs
231 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
232 -@mv objs/infback.o $@
233
234 inffast.lo: $(SRCDIR)inffast.c
235 -@mkdir objs 2>/dev/null || test -d objs
236 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
237 -@mv objs/inffast.o $@
238
239 inflate.lo: $(SRCDIR)inflate.c
240 -@mkdir objs 2>/dev/null || test -d objs
241 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
242 -@mv objs/inflate.o $@
243
244 inftrees.lo: $(SRCDIR)inftrees.c
245 -@mkdir objs 2>/dev/null || test -d objs
246 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
247 -@mv objs/inftrees.o $@
248
249 trees.lo: $(SRCDIR)trees.c
250 -@mkdir objs 2>/dev/null || test -d objs
251 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
252 -@mv objs/trees.o $@
253
254 zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
255 -@mkdir objs 2>/dev/null || test -d objs
256 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
257 -@mv objs/zutil.o $@
258
259 compress.lo: $(SRCDIR)compress.c
260 -@mkdir objs 2>/dev/null || test -d objs
261 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
262 -@mv objs/compress.o $@
263
264 uncompr.lo: $(SRCDIR)uncompr.c
265 -@mkdir objs 2>/dev/null || test -d objs
266 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
267 -@mv objs/uncompr.o $@
268
269 gzclose.lo: $(SRCDIR)gzclose.c
270 -@mkdir objs 2>/dev/null || test -d objs
271 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
272 -@mv objs/gzclose.o $@
273
274 gzlib.lo: $(SRCDIR)gzlib.c
275 -@mkdir objs 2>/dev/null || test -d objs
276 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
277 -@mv objs/gzlib.o $@
278
279 gzread.lo: $(SRCDIR)gzread.c
280 -@mkdir objs 2>/dev/null || test -d objs
281 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
282 -@mv objs/gzread.o $@
283
284 gzwrite.lo: $(SRCDIR)gzwrite.c
285 -@mkdir objs 2>/dev/null || test -d objs
286 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
287 -@mv objs/gzwrite.o $@
288
289
290 placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map $(SHAREDEXP)
291 $(LDSHARED) $(SFLAGS) $(SHAREDEXPFLAG) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
292 rm -f $(SHAREDLIB) $(SHAREDLIBM)
293 ln -s $@ $(SHAREDLIB)
294 ln -s $@ $(SHAREDLIBM)
295 -@rmdir objs
296
297 libz.exp: $(PIC_OBJS)
298 dump -tov -X 32_64 $(PIC_OBJS) | \
299 awk '$$1 ~ /^\[[0-9]+\]$$/ && $$2 == "m" && \
300 $$4 ~ /^\.(text|data|bss)$$/ && ($$6 == "extern" || $$6 == "weak") && \
301 $$7 != "HIDDEN" && $$7 != "INTERNAL" && $$NF !~ /^\./ { print $$NF }' | \
302 sort -u > $@
303 @test -s $@ || { echo "no symbols found for $@" >&2; rm -f $@; false; }
304
305 example$(EXE): example.o $(STATICLIB)
306 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
307
308 minigzip$(EXE): minigzip.o $(STATICLIB)
309 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
310
311 examplesh$(EXE): example.o $(SHAREDLIBV)
312 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
313
314 minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
315 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
316
317 example64$(EXE): example64.o $(STATICLIB)
318 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS)
319
320 minigzip64$(EXE): minigzip64.o $(STATICLIB)
321 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS)
322
323 install-libs: $(LIBS)
324 -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
325 -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
326 -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
327 -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
328 -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
329 rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
330 cp $(STATICLIB) $(DESTDIR)$(libdir)
331 chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
332 -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
333 -@if test -n "$(SHAREDLIBV)"; then \
334 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
335 cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
336 echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
337 chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
338 echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
339 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
340 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
341 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
342 ($(LDCONFIG) || true) >/dev/null 2>&1; \
343 fi
344 rm -f $(DESTDIR)$(man3dir)/zlib.3
345 cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
346 chmod 644 $(DESTDIR)$(man3dir)/zlib.3
347 rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
348 cp zlib.pc $(DESTDIR)$(pkgconfigdir)
349 chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
350 # The ranlib in install is needed on NeXTSTEP which checks file times
351 # ldconfig is for Linux
352
353 install: install-libs
354 -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
355 rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
356 cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
357 chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
358
359 uninstall:
360 cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
361 cd $(DESTDIR)$(libdir) && rm -f libz.a; \
362 if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
363 rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
364 fi
365 cd $(DESTDIR)$(man3dir) && rm -f zlib.3
366 cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
367
368 docs: zlib.3.pdf
369
370 zlib.3.pdf: $(SRCDIR)zlib.3
371 groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
372
373 # zconf.h.cmakein: $(SRCDIR)zconf.h.in
374 # -@ TEMPFILE=zconfh_$$; \
375 # echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
376 # sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
377 # touch -r $(SRCDIR)zconf.h.in $@ &&\
378 # rm $$TEMPFILE
379 #
380
381 zconf: $(SRCDIR)zconf.h.in
382 cp -p $(SRCDIR)zconf.h.in zconf.h
383
384 minizip-test: static
385 cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
386
387 minizip-clean:
388 cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
389
390 mostlyclean: clean
391 clean: minizip-clean
392 rm -f *.o *.lo *~ \
393 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
394 example64$(EXE) minigzip64$(EXE) \
395 infcover \
396 libz.* foo.gz so_locations \
397 _match.s maketree contrib/infback9/*.o
398 rm -rf objs
399 rm -f *.gcda *.gcno *.gcov
400 rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
401
402 maintainer-clean: distclean
403 distclean: clean zconf # zconf.h.cmakein
404 rm -f Makefile zlib.pc configure.log
405 -@rm -f .DS_Store
406 @if [ -f Makefile.in ]; then \
407 printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
408 printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
409 touch -r $(SRCDIR)Makefile.in Makefile ; fi
410
411 tags:
412 etags $(SRCDIR)*.[ch]
413
414 adler32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
415 zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
416 gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
417 compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
418 crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
419 deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
420 infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
421 inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
422 inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
423 trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
424 crc32_vx.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h
425
426 adler32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
427 zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
428 gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
429 compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
430 crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
431 deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
432 infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
433 inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
434 inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
435 trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
436 crc32_vx.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)contrib/crc32vx/crc32_vx_hooks.h
437
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -29,19 +29,21 @@
2929
CPP=$(CC) -E
3030
VGFMAFLAG=
3131
3232
STATICLIB=libz.a
3333
SHAREDLIB=libz.so
34
-SHAREDLIBV=libz.so.1.3.2
34
+SHAREDLIBV=libz.so.1.4
3535
SHAREDLIBM=libz.so.1
3636
LIBS=$(STATICLIB) $(SHAREDLIBV)
3737
3838
AR=ar
3939
ARFLAGS=rc
4040
RANLIB=ranlib
4141
LDCONFIG=ldconfig
4242
LDSHAREDLIBC=-lc
43
+SHAREDEXP=
44
+SHAREDEXPFLAG=
4345
TAR=tar
4446
SHELL=/bin/sh
4547
EXE=
4648
4749
prefix = /usr/local
@@ -204,96 +206,104 @@
204206
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
205207
206208
207209
adler32.lo: $(SRCDIR)adler32.c
208210
-@mkdir objs 2>/dev/null || test -d objs
209
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
211
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
210212
-@mv objs/adler32.o $@
211213
212214
crc32.lo: $(SRCDIR)crc32.c
213215
-@mkdir objs 2>/dev/null || test -d objs
214
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
216
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
215217
-@mv objs/crc32.o $@
216218
217219
crc32_vx.lo: $(SRCDIR)contrib/crc32vx/crc32_vx.c
218220
-@mkdir objs 2>/dev/null || test -d objs
219
- $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -fPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c
221
+ $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -DPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c
220222
-@mv objs/crc32_vx.o $@
221223
222224
deflate.lo: $(SRCDIR)deflate.c
223225
-@mkdir objs 2>/dev/null || test -d objs
224
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
226
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
225227
-@mv objs/deflate.o $@
226228
227229
infback.lo: $(SRCDIR)infback.c
228230
-@mkdir objs 2>/dev/null || test -d objs
229
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/infback.o $(SRCDIR)infback.c
231
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
230232
-@mv objs/infback.o $@
231233
232234
inffast.lo: $(SRCDIR)inffast.c
233235
-@mkdir objs 2>/dev/null || test -d objs
234
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
236
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
235237
-@mv objs/inffast.o $@
236238
237239
inflate.lo: $(SRCDIR)inflate.c
238240
-@mkdir objs 2>/dev/null || test -d objs
239
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
241
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
240242
-@mv objs/inflate.o $@
241243
242244
inftrees.lo: $(SRCDIR)inftrees.c
243245
-@mkdir objs 2>/dev/null || test -d objs
244
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
246
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
245247
-@mv objs/inftrees.o $@
246248
247249
trees.lo: $(SRCDIR)trees.c
248250
-@mkdir objs 2>/dev/null || test -d objs
249
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/trees.o $(SRCDIR)trees.c
251
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
250252
-@mv objs/trees.o $@
251253
252254
zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
253255
-@mkdir objs 2>/dev/null || test -d objs
254
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
256
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
255257
-@mv objs/zutil.o $@
256258
257259
compress.lo: $(SRCDIR)compress.c
258260
-@mkdir objs 2>/dev/null || test -d objs
259
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/compress.o $(SRCDIR)compress.c
261
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
260262
-@mv objs/compress.o $@
261263
262264
uncompr.lo: $(SRCDIR)uncompr.c
263265
-@mkdir objs 2>/dev/null || test -d objs
264
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
266
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
265267
-@mv objs/uncompr.o $@
266268
267269
gzclose.lo: $(SRCDIR)gzclose.c
268270
-@mkdir objs 2>/dev/null || test -d objs
269
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
271
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
270272
-@mv objs/gzclose.o $@
271273
272274
gzlib.lo: $(SRCDIR)gzlib.c
273275
-@mkdir objs 2>/dev/null || test -d objs
274
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
276
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
275277
-@mv objs/gzlib.o $@
276278
277279
gzread.lo: $(SRCDIR)gzread.c
278280
-@mkdir objs 2>/dev/null || test -d objs
279
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
281
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
280282
-@mv objs/gzread.o $@
281283
282284
gzwrite.lo: $(SRCDIR)gzwrite.c
283285
-@mkdir objs 2>/dev/null || test -d objs
284
- $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
286
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
285287
-@mv objs/gzwrite.o $@
286288
287289
288
-placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map
289
- $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
290
+placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map $(SHAREDEXP)
291
+ $(LDSHARED) $(SFLAGS) $(SHAREDEXPFLAG) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
290292
rm -f $(SHAREDLIB) $(SHAREDLIBM)
291293
ln -s $@ $(SHAREDLIB)
292294
ln -s $@ $(SHAREDLIBM)
293295
-@rmdir objs
294296
297
+libz.exp: $(PIC_OBJS)
298
+ dump -tov -X 32_64 $(PIC_OBJS) | \
299
+ awk '$$1 ~ /^\[[0-9]+\]$$/ && $$2 == "m" && \
300
+ $$4 ~ /^\.(text|data|bss)$$/ && ($$6 == "extern" || $$6 == "weak") && \
301
+ $$7 != "HIDDEN" && $$7 != "INTERNAL" && $$NF !~ /^\./ { print $$NF }' | \
302
+ sort -u > $@
303
+ @test -s $@ || { echo "no symbols found for $@" >&2; rm -f $@; false; }
304
+
295305
example$(EXE): example.o $(STATICLIB)
296306
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
297307
298308
minigzip$(EXE): minigzip.o $(STATICLIB)
299309
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
300310
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -29,19 +29,21 @@
29 CPP=$(CC) -E
30 VGFMAFLAG=
31
32 STATICLIB=libz.a
33 SHAREDLIB=libz.so
34 SHAREDLIBV=libz.so.1.3.2
35 SHAREDLIBM=libz.so.1
36 LIBS=$(STATICLIB) $(SHAREDLIBV)
37
38 AR=ar
39 ARFLAGS=rc
40 RANLIB=ranlib
41 LDCONFIG=ldconfig
42 LDSHAREDLIBC=-lc
 
 
43 TAR=tar
44 SHELL=/bin/sh
45 EXE=
46
47 prefix = /usr/local
@@ -204,96 +206,104 @@
204 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
205
206
207 adler32.lo: $(SRCDIR)adler32.c
208 -@mkdir objs 2>/dev/null || test -d objs
209 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
210 -@mv objs/adler32.o $@
211
212 crc32.lo: $(SRCDIR)crc32.c
213 -@mkdir objs 2>/dev/null || test -d objs
214 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
215 -@mv objs/crc32.o $@
216
217 crc32_vx.lo: $(SRCDIR)contrib/crc32vx/crc32_vx.c
218 -@mkdir objs 2>/dev/null || test -d objs
219 $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -fPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c
220 -@mv objs/crc32_vx.o $@
221
222 deflate.lo: $(SRCDIR)deflate.c
223 -@mkdir objs 2>/dev/null || test -d objs
224 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
225 -@mv objs/deflate.o $@
226
227 infback.lo: $(SRCDIR)infback.c
228 -@mkdir objs 2>/dev/null || test -d objs
229 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/infback.o $(SRCDIR)infback.c
230 -@mv objs/infback.o $@
231
232 inffast.lo: $(SRCDIR)inffast.c
233 -@mkdir objs 2>/dev/null || test -d objs
234 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
235 -@mv objs/inffast.o $@
236
237 inflate.lo: $(SRCDIR)inflate.c
238 -@mkdir objs 2>/dev/null || test -d objs
239 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
240 -@mv objs/inflate.o $@
241
242 inftrees.lo: $(SRCDIR)inftrees.c
243 -@mkdir objs 2>/dev/null || test -d objs
244 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
245 -@mv objs/inftrees.o $@
246
247 trees.lo: $(SRCDIR)trees.c
248 -@mkdir objs 2>/dev/null || test -d objs
249 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/trees.o $(SRCDIR)trees.c
250 -@mv objs/trees.o $@
251
252 zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
253 -@mkdir objs 2>/dev/null || test -d objs
254 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
255 -@mv objs/zutil.o $@
256
257 compress.lo: $(SRCDIR)compress.c
258 -@mkdir objs 2>/dev/null || test -d objs
259 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/compress.o $(SRCDIR)compress.c
260 -@mv objs/compress.o $@
261
262 uncompr.lo: $(SRCDIR)uncompr.c
263 -@mkdir objs 2>/dev/null || test -d objs
264 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
265 -@mv objs/uncompr.o $@
266
267 gzclose.lo: $(SRCDIR)gzclose.c
268 -@mkdir objs 2>/dev/null || test -d objs
269 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
270 -@mv objs/gzclose.o $@
271
272 gzlib.lo: $(SRCDIR)gzlib.c
273 -@mkdir objs 2>/dev/null || test -d objs
274 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
275 -@mv objs/gzlib.o $@
276
277 gzread.lo: $(SRCDIR)gzread.c
278 -@mkdir objs 2>/dev/null || test -d objs
279 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
280 -@mv objs/gzread.o $@
281
282 gzwrite.lo: $(SRCDIR)gzwrite.c
283 -@mkdir objs 2>/dev/null || test -d objs
284 $(CC) $(SFLAGS) $(ZINC) -fPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
285 -@mv objs/gzwrite.o $@
286
287
288 placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map
289 $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
290 rm -f $(SHAREDLIB) $(SHAREDLIBM)
291 ln -s $@ $(SHAREDLIB)
292 ln -s $@ $(SHAREDLIBM)
293 -@rmdir objs
294
 
 
 
 
 
 
 
 
295 example$(EXE): example.o $(STATICLIB)
296 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
297
298 minigzip$(EXE): minigzip.o $(STATICLIB)
299 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
300
--- compat/zlib/Makefile.in
+++ compat/zlib/Makefile.in
@@ -29,19 +29,21 @@
29 CPP=$(CC) -E
30 VGFMAFLAG=
31
32 STATICLIB=libz.a
33 SHAREDLIB=libz.so
34 SHAREDLIBV=libz.so.1.4
35 SHAREDLIBM=libz.so.1
36 LIBS=$(STATICLIB) $(SHAREDLIBV)
37
38 AR=ar
39 ARFLAGS=rc
40 RANLIB=ranlib
41 LDCONFIG=ldconfig
42 LDSHAREDLIBC=-lc
43 SHAREDEXP=
44 SHAREDEXPFLAG=
45 TAR=tar
46 SHELL=/bin/sh
47 EXE=
48
49 prefix = /usr/local
@@ -204,96 +206,104 @@
206 $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
207
208
209 adler32.lo: $(SRCDIR)adler32.c
210 -@mkdir objs 2>/dev/null || test -d objs
211 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
212 -@mv objs/adler32.o $@
213
214 crc32.lo: $(SRCDIR)crc32.c
215 -@mkdir objs 2>/dev/null || test -d objs
216 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
217 -@mv objs/crc32.o $@
218
219 crc32_vx.lo: $(SRCDIR)contrib/crc32vx/crc32_vx.c
220 -@mkdir objs 2>/dev/null || test -d objs
221 $(CC) $(SFLAGS) $(VGFMAFLAG) $(ZINC) -DPIC -c -o objs/crc32_vx.o $(SRCDIR)contrib/crc32vx/crc32_vx.c
222 -@mv objs/crc32_vx.o $@
223
224 deflate.lo: $(SRCDIR)deflate.c
225 -@mkdir objs 2>/dev/null || test -d objs
226 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
227 -@mv objs/deflate.o $@
228
229 infback.lo: $(SRCDIR)infback.c
230 -@mkdir objs 2>/dev/null || test -d objs
231 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
232 -@mv objs/infback.o $@
233
234 inffast.lo: $(SRCDIR)inffast.c
235 -@mkdir objs 2>/dev/null || test -d objs
236 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
237 -@mv objs/inffast.o $@
238
239 inflate.lo: $(SRCDIR)inflate.c
240 -@mkdir objs 2>/dev/null || test -d objs
241 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
242 -@mv objs/inflate.o $@
243
244 inftrees.lo: $(SRCDIR)inftrees.c
245 -@mkdir objs 2>/dev/null || test -d objs
246 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
247 -@mv objs/inftrees.o $@
248
249 trees.lo: $(SRCDIR)trees.c
250 -@mkdir objs 2>/dev/null || test -d objs
251 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
252 -@mv objs/trees.o $@
253
254 zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
255 -@mkdir objs 2>/dev/null || test -d objs
256 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
257 -@mv objs/zutil.o $@
258
259 compress.lo: $(SRCDIR)compress.c
260 -@mkdir objs 2>/dev/null || test -d objs
261 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
262 -@mv objs/compress.o $@
263
264 uncompr.lo: $(SRCDIR)uncompr.c
265 -@mkdir objs 2>/dev/null || test -d objs
266 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
267 -@mv objs/uncompr.o $@
268
269 gzclose.lo: $(SRCDIR)gzclose.c
270 -@mkdir objs 2>/dev/null || test -d objs
271 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
272 -@mv objs/gzclose.o $@
273
274 gzlib.lo: $(SRCDIR)gzlib.c
275 -@mkdir objs 2>/dev/null || test -d objs
276 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
277 -@mv objs/gzlib.o $@
278
279 gzread.lo: $(SRCDIR)gzread.c
280 -@mkdir objs 2>/dev/null || test -d objs
281 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
282 -@mv objs/gzread.o $@
283
284 gzwrite.lo: $(SRCDIR)gzwrite.c
285 -@mkdir objs 2>/dev/null || test -d objs
286 $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
287 -@mv objs/gzwrite.o $@
288
289
290 placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map $(SHAREDEXP)
291 $(LDSHARED) $(SFLAGS) $(SHAREDEXPFLAG) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
292 rm -f $(SHAREDLIB) $(SHAREDLIBM)
293 ln -s $@ $(SHAREDLIB)
294 ln -s $@ $(SHAREDLIBM)
295 -@rmdir objs
296
297 libz.exp: $(PIC_OBJS)
298 dump -tov -X 32_64 $(PIC_OBJS) | \
299 awk '$$1 ~ /^\[[0-9]+\]$$/ && $$2 == "m" && \
300 $$4 ~ /^\.(text|data|bss)$$/ && ($$6 == "extern" || $$6 == "weak") && \
301 $$7 != "HIDDEN" && $$7 != "INTERNAL" && $$NF !~ /^\./ { print $$NF }' | \
302 sort -u > $@
303 @test -s $@ || { echo "no symbols found for $@" >&2; rm -f $@; false; }
304
305 example$(EXE): example.o $(STATICLIB)
306 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
307
308 minigzip$(EXE): minigzip.o $(STATICLIB)
309 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
310
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
11
ZLIB DATA COMPRESSION LIBRARY
22
3
-zlib 1.3.2 is a general purpose data compression library. All the code is
3
+zlib 1.4 is a general purpose data compression library. All the code is
44
thread safe (though see the FAQ for caveats). The data format used by the zlib
55
library is described by RFCs (Request for Comments) 1950 to 1952 at
66
https://datatracker.ietf.org/doc/html/rfc1950 (zlib format), rfc1951 (deflate
77
format) and rfc1952 (gzip format).
88
@@ -29,11 +29,11 @@
2929
3030
Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
3131
issue of Dr. Dobb's Journal; a copy of the article is available at
3232
https://zlib.net/nelson/ .
3333
34
-The changes made in version 1.3.2 are documented in the file ChangeLog.
34
+The changes made in version 1.4 are documented in the file ChangeLog.
3535
3636
Unsupported third party contributions are provided in directory contrib/ .
3737
3838
zlib is available in Java using the java.util.zip package. Follow the API
3939
Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
4040
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
1 ZLIB DATA COMPRESSION LIBRARY
2
3 zlib 1.3.2 is a general purpose data compression library. All the code is
4 thread safe (though see the FAQ for caveats). The data format used by the zlib
5 library is described by RFCs (Request for Comments) 1950 to 1952 at
6 https://datatracker.ietf.org/doc/html/rfc1950 (zlib format), rfc1951 (deflate
7 format) and rfc1952 (gzip format).
8
@@ -29,11 +29,11 @@
29
30 Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
31 issue of Dr. Dobb's Journal; a copy of the article is available at
32 https://zlib.net/nelson/ .
33
34 The changes made in version 1.3.2 are documented in the file ChangeLog.
35
36 Unsupported third party contributions are provided in directory contrib/ .
37
38 zlib is available in Java using the java.util.zip package. Follow the API
39 Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
40
--- compat/zlib/README
+++ compat/zlib/README
@@ -1,8 +1,8 @@
1 ZLIB DATA COMPRESSION LIBRARY
2
3 zlib 1.4 is a general purpose data compression library. All the code is
4 thread safe (though see the FAQ for caveats). The data format used by the zlib
5 library is described by RFCs (Request for Comments) 1950 to 1952 at
6 https://datatracker.ietf.org/doc/html/rfc1950 (zlib format), rfc1951 (deflate
7 format) and rfc1952 (gzip format).
8
@@ -29,11 +29,11 @@
29
30 Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
31 issue of Dr. Dobb's Journal; a copy of the article is available at
32 https://zlib.net/nelson/ .
33
34 The changes made in version 1.4 are documented in the file ChangeLog.
35
36 Unsupported third party contributions are provided in directory contrib/ .
37
38 zlib is available in Java using the java.util.zip package. Follow the API
39 Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
40
--- compat/zlib/README-cmake.md
+++ compat/zlib/README-cmake.md
@@ -1,6 +1,6 @@
1
-# For building with cmake at least version 3.12 (minizip 3.12) is needed
1
+# For building with cmake at least version 3.15 (minizip 3.15) is needed
22
33
In most cases the usual
44
55
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
66
@@ -64,16 +64,18 @@
6464
6565
find_package(minizip CONFIG COMPONENTS shared static REQUIRED)
6666
6767
As it's possible to only build the shared or the static lib, you can make sure that everything you need
6868
is found. If no COMPONENTS are requested, everything needs to be found to satisfy your request. If the
69
-libraries are optional in you project, you can omit the REQUIRED and check yourself if the targets you
70
-want to link against are created.
69
+libraries are optional in your project, you can omit the REQUIRED and check yourself which components were
70
+found, either by checking for existence of the target, or by checking the ZLIB_shared_FOUND variable, for example.
7171
7272
When you search for minizip, it will search zlib for you, so only one of both is needed.
73
+
74
+Note: If you don't list the components you want to use and one of them is not present, this is a hard error.
7375
7476
## Imported targets ##
7577
7678
When found the following targets are created for you:
7779
7880
ZLIB::ZLIB and ZLIB::ZLIBSTATIC -- for zlib
7981
MINIZIP::minizip and MINIZIP::minizipstatic -- for minizip
8082
--- compat/zlib/README-cmake.md
+++ compat/zlib/README-cmake.md
@@ -1,6 +1,6 @@
1 # For building with cmake at least version 3.12 (minizip 3.12) is needed
2
3 In most cases the usual
4
5 cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
6
@@ -64,16 +64,18 @@
64
65 find_package(minizip CONFIG COMPONENTS shared static REQUIRED)
66
67 As it's possible to only build the shared or the static lib, you can make sure that everything you need
68 is found. If no COMPONENTS are requested, everything needs to be found to satisfy your request. If the
69 libraries are optional in you project, you can omit the REQUIRED and check yourself if the targets you
70 want to link against are created.
71
72 When you search for minizip, it will search zlib for you, so only one of both is needed.
 
 
73
74 ## Imported targets ##
75
76 When found the following targets are created for you:
77
78 ZLIB::ZLIB and ZLIB::ZLIBSTATIC -- for zlib
79 MINIZIP::minizip and MINIZIP::minizipstatic -- for minizip
80
--- compat/zlib/README-cmake.md
+++ compat/zlib/README-cmake.md
@@ -1,6 +1,6 @@
1 # For building with cmake at least version 3.15 (minizip 3.15) is needed
2
3 In most cases the usual
4
5 cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
6
@@ -64,16 +64,18 @@
64
65 find_package(minizip CONFIG COMPONENTS shared static REQUIRED)
66
67 As it's possible to only build the shared or the static lib, you can make sure that everything you need
68 is found. If no COMPONENTS are requested, everything needs to be found to satisfy your request. If the
69 libraries are optional in your project, you can omit the REQUIRED and check yourself which components were
70 found, either by checking for existence of the target, or by checking the ZLIB_shared_FOUND variable, for example.
71
72 When you search for minizip, it will search zlib for you, so only one of both is needed.
73
74 Note: If you don't list the components you want to use and one of them is not present, this is a hard error.
75
76 ## Imported targets ##
77
78 When found the following targets are created for you:
79
80 ZLIB::ZLIB and ZLIB::ZLIBSTATIC -- for zlib
81 MINIZIP::minizip and MINIZIP::minizipstatic -- for minizip
82
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -26,12 +26,12 @@
2626
z_stream stream;
2727
int err;
2828
const uInt max = (uInt)-1;
2929
z_size_t left;
3030
31
- if ((sourceLen > 0 && source == NULL) ||
32
- destLen == NULL || (*destLen > 0 && dest == NULL))
31
+ if ((sourceLen > 0 && source == Z_NULL) ||
32
+ destLen == Z_NULL || (*destLen > 0 && dest == Z_NULL))
3333
return Z_STREAM_ERROR;
3434
3535
left = *destLen;
3636
*destLen = 0;
3737
3838
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -26,12 +26,12 @@
26 z_stream stream;
27 int err;
28 const uInt max = (uInt)-1;
29 z_size_t left;
30
31 if ((sourceLen > 0 && source == NULL) ||
32 destLen == NULL || (*destLen > 0 && dest == NULL))
33 return Z_STREAM_ERROR;
34
35 left = *destLen;
36 *destLen = 0;
37
38
--- compat/zlib/compress.c
+++ compat/zlib/compress.c
@@ -26,12 +26,12 @@
26 z_stream stream;
27 int err;
28 const uInt max = (uInt)-1;
29 z_size_t left;
30
31 if ((sourceLen > 0 && source == Z_NULL) ||
32 destLen == Z_NULL || (*destLen > 0 && dest == Z_NULL))
33 return Z_STREAM_ERROR;
34
35 left = *destLen;
36 *destLen = 0;
37
38
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -24,11 +24,11 @@
2424
ZINC=""
2525
ZINCOUT="-I."
2626
SRCDIR=""
2727
else
2828
ZINC='-I. -include zconf.h'
29
- ZINCOUT='-I. -I$(SRCDIR)'
29
+ ZINCOUT='-I. -I$(SRCDIR) -include zconf.h'
3030
SRCDIR="$SRCDIR/"
3131
fi
3232
3333
# set command prefix for cross-compilation
3434
if [ -n "${CHOST}" ]; then
@@ -319,11 +319,13 @@
319319
shared_ext='.sl'
320320
SHAREDLIB='libz.sl' ;;
321321
esac ;;
322322
AIX*)
323323
LDSHARED=${LDSHARED-"$cc -shared"}
324
- LDFLAGS="${LDFLAGS} -Wl,-brtl" ;;
324
+ LDFLAGS="${LDFLAGS} -Wl,-brtl"
325
+ SHAREDEXP=libz.exp
326
+ SHAREDEXPFLAG=-Wl,-bE:libz.exp ;;
325327
Darwin* | darwin* | *-darwin*)
326328
shared_ext='.dylib'
327329
SHAREDLIB=libz$shared_ext
328330
SHAREDLIBV=libz.$VER$shared_ext
329331
SHAREDLIBM=libz.$VER1$shared_ext
@@ -401,10 +403,11 @@
401403
esac
402404
fi
403405
fi
404406
if test -n "$ZINC"; then
405407
ZINC='-I- -I. -I$(SRCDIR)'
408
+ ZINCOUT='-I- -I. -I$(SRCDIR)'
406409
fi
407410
;;
408411
SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
409412
CFLAGS=${CFLAGS-"-O2"}
410413
LDSHARED=${LDSHARED-"ld"} ;;
@@ -504,10 +507,33 @@
504507
:
505508
else
506509
echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
507510
leave 1
508511
fi
512
+
513
+# turn off useless GCC 5 warning about PowerPC vector type alignments.
514
+if test "$gcc" -eq 1; then
515
+ cat > $test.c << EOF
516
+typedef int zvec __attribute__((vector_size(8)));
517
+struct zstruct { char c; zvec v; };
518
+int zfunc(struct zstruct *s) { return s->c; }
519
+EOF
520
+ echo "Checking for gcc vector ABI notes..." >> configure.log
521
+ show $CC -c $CFLAGS $test.c
522
+ got=`( $CC -c $CFLAGS $test.c ) 2>&1`
523
+ if test "$got" != ""; then
524
+ printf "%s\n" "$got" >> configure.log
525
+ fi
526
+ case "$got" in
527
+ *"changed in GCC 5"*)
528
+ if tryboth $CC -c $CFLAGS -Wno-psabi $test.c; then
529
+ echo "... turning the notes off with -Wno-psabi" >> configure.log
530
+ CFLAGS="${CFLAGS} -Wno-psabi"
531
+ SFLAGS="${SFLAGS} -Wno-psabi"
532
+ fi ;;
533
+ esac
534
+fi
509535
510536
echo >> configure.log
511537
512538
# see if shared library build supported
513539
cat > $test.c <<EOF
@@ -515,12 +541,19 @@
515541
int hello() {return getchar();}
516542
EOF
517543
if test $shared -eq 1; then
518544
echo Checking for shared library support... | tee -a configure.log
519545
# we must test in two steps (cc then ld), required at least on SunOS 4.x
546
+ # the second link test is for linkers like lld that by default reject a
547
+ # version script naming symbols that the test object doesn't define -- if
548
+ # that's needed, keep the option, since some builds (e.g. --solo) don't
549
+ # define all of the symbols in zlib.map
520550
if try $CC -c $SFLAGS $test.c &&
521
- try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then
551
+ { try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o ||
552
+ { try $LDSHARED $SFLAGS $LDFLAGS -Wl,--undefined-version \
553
+ -o $test$shared_ext $test.o &&
554
+ LDSHARED="$LDSHARED -Wl,--undefined-version"; }; }; then
522555
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
523556
elif test -z "$old_cc" -a -z "$old_cflags"; then
524557
echo No shared library support. | tee -a configure.log
525558
shared=0;
526559
else
@@ -1022,19 +1055,22 @@
10221055
/^CFLAGS *=/s#=.*#=$CFLAGS#
10231056
/^SFLAGS *=/s#=.*#=$SFLAGS#
10241057
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
10251058
/^LDSHARED *=/s#=.*#=$LDSHARED#
10261059
/^CPP *=/s#=.*#=$CPP#
1060
+/^VGFMAFLAG *=/s#=.*#=$VGFMAFLAG#
10271061
/^STATICLIB *=/s#=.*#=$STATICLIB#
10281062
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
10291063
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
10301064
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
10311065
/^AR *=/s#=.*#=$AR#
10321066
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
10331067
/^RANLIB *=/s#=.*#=$RANLIB#
10341068
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
10351069
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
1070
+/^SHAREDEXP *=/s#=.*#=$SHAREDEXP#
1071
+/^SHAREDEXPFLAG *=/s#=.*#=$SHAREDEXPFLAG#
10361072
/^EXE *=/s#=.*#=$EXE#
10371073
/^SRCDIR *=/s#=.*#=$SRCDIR#
10381074
/^ZINC *=/s#=.*#=$ZINC#
10391075
/^ZINCOUT *=/s#=.*#=$ZINCOUT#
10401076
/^prefix *=/s#=.*#=$prefix#
@@ -1052,10 +1088,11 @@
10521088
# create zlib.pc with the configure results
10531089
sed < ${SRCDIR}zlib.pc.in "
10541090
/^CC *=/s#=.*#=$CC#
10551091
/^CFLAGS *=/s#=.*#=$CFLAGS#
10561092
/^CPP *=/s#=.*#=$CPP#
1093
+/^VGFMAFLAG *=/s#=.*#=$VGFMAFLAG#
10571094
/^LDSHARED *=/s#=.*#=$LDSHARED#
10581095
/^STATICLIB *=/s#=.*#=$STATICLIB#
10591096
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
10601097
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
10611098
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
10621099
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -24,11 +24,11 @@
24 ZINC=""
25 ZINCOUT="-I."
26 SRCDIR=""
27 else
28 ZINC='-I. -include zconf.h'
29 ZINCOUT='-I. -I$(SRCDIR)'
30 SRCDIR="$SRCDIR/"
31 fi
32
33 # set command prefix for cross-compilation
34 if [ -n "${CHOST}" ]; then
@@ -319,11 +319,13 @@
319 shared_ext='.sl'
320 SHAREDLIB='libz.sl' ;;
321 esac ;;
322 AIX*)
323 LDSHARED=${LDSHARED-"$cc -shared"}
324 LDFLAGS="${LDFLAGS} -Wl,-brtl" ;;
 
 
325 Darwin* | darwin* | *-darwin*)
326 shared_ext='.dylib'
327 SHAREDLIB=libz$shared_ext
328 SHAREDLIBV=libz.$VER$shared_ext
329 SHAREDLIBM=libz.$VER1$shared_ext
@@ -401,10 +403,11 @@
401 esac
402 fi
403 fi
404 if test -n "$ZINC"; then
405 ZINC='-I- -I. -I$(SRCDIR)'
 
406 fi
407 ;;
408 SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
409 CFLAGS=${CFLAGS-"-O2"}
410 LDSHARED=${LDSHARED-"ld"} ;;
@@ -504,10 +507,33 @@
504 :
505 else
506 echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
507 leave 1
508 fi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
510 echo >> configure.log
511
512 # see if shared library build supported
513 cat > $test.c <<EOF
@@ -515,12 +541,19 @@
515 int hello() {return getchar();}
516 EOF
517 if test $shared -eq 1; then
518 echo Checking for shared library support... | tee -a configure.log
519 # we must test in two steps (cc then ld), required at least on SunOS 4.x
 
 
 
 
520 if try $CC -c $SFLAGS $test.c &&
521 try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then
 
 
 
522 echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
523 elif test -z "$old_cc" -a -z "$old_cflags"; then
524 echo No shared library support. | tee -a configure.log
525 shared=0;
526 else
@@ -1022,19 +1055,22 @@
1022 /^CFLAGS *=/s#=.*#=$CFLAGS#
1023 /^SFLAGS *=/s#=.*#=$SFLAGS#
1024 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
1025 /^LDSHARED *=/s#=.*#=$LDSHARED#
1026 /^CPP *=/s#=.*#=$CPP#
 
1027 /^STATICLIB *=/s#=.*#=$STATICLIB#
1028 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
1029 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
1030 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
1031 /^AR *=/s#=.*#=$AR#
1032 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
1033 /^RANLIB *=/s#=.*#=$RANLIB#
1034 /^LDCONFIG *=/s#=.*#=$LDCONFIG#
1035 /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
 
 
1036 /^EXE *=/s#=.*#=$EXE#
1037 /^SRCDIR *=/s#=.*#=$SRCDIR#
1038 /^ZINC *=/s#=.*#=$ZINC#
1039 /^ZINCOUT *=/s#=.*#=$ZINCOUT#
1040 /^prefix *=/s#=.*#=$prefix#
@@ -1052,10 +1088,11 @@
1052 # create zlib.pc with the configure results
1053 sed < ${SRCDIR}zlib.pc.in "
1054 /^CC *=/s#=.*#=$CC#
1055 /^CFLAGS *=/s#=.*#=$CFLAGS#
1056 /^CPP *=/s#=.*#=$CPP#
 
1057 /^LDSHARED *=/s#=.*#=$LDSHARED#
1058 /^STATICLIB *=/s#=.*#=$STATICLIB#
1059 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
1060 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
1061 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
1062
--- compat/zlib/configure
+++ compat/zlib/configure
@@ -24,11 +24,11 @@
24 ZINC=""
25 ZINCOUT="-I."
26 SRCDIR=""
27 else
28 ZINC='-I. -include zconf.h'
29 ZINCOUT='-I. -I$(SRCDIR) -include zconf.h'
30 SRCDIR="$SRCDIR/"
31 fi
32
33 # set command prefix for cross-compilation
34 if [ -n "${CHOST}" ]; then
@@ -319,11 +319,13 @@
319 shared_ext='.sl'
320 SHAREDLIB='libz.sl' ;;
321 esac ;;
322 AIX*)
323 LDSHARED=${LDSHARED-"$cc -shared"}
324 LDFLAGS="${LDFLAGS} -Wl,-brtl"
325 SHAREDEXP=libz.exp
326 SHAREDEXPFLAG=-Wl,-bE:libz.exp ;;
327 Darwin* | darwin* | *-darwin*)
328 shared_ext='.dylib'
329 SHAREDLIB=libz$shared_ext
330 SHAREDLIBV=libz.$VER$shared_ext
331 SHAREDLIBM=libz.$VER1$shared_ext
@@ -401,10 +403,11 @@
403 esac
404 fi
405 fi
406 if test -n "$ZINC"; then
407 ZINC='-I- -I. -I$(SRCDIR)'
408 ZINCOUT='-I- -I. -I$(SRCDIR)'
409 fi
410 ;;
411 SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
412 CFLAGS=${CFLAGS-"-O2"}
413 LDSHARED=${LDSHARED-"ld"} ;;
@@ -504,10 +507,33 @@
507 :
508 else
509 echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
510 leave 1
511 fi
512
513 # turn off useless GCC 5 warning about PowerPC vector type alignments.
514 if test "$gcc" -eq 1; then
515 cat > $test.c << EOF
516 typedef int zvec __attribute__((vector_size(8)));
517 struct zstruct { char c; zvec v; };
518 int zfunc(struct zstruct *s) { return s->c; }
519 EOF
520 echo "Checking for gcc vector ABI notes..." >> configure.log
521 show $CC -c $CFLAGS $test.c
522 got=`( $CC -c $CFLAGS $test.c ) 2>&1`
523 if test "$got" != ""; then
524 printf "%s\n" "$got" >> configure.log
525 fi
526 case "$got" in
527 *"changed in GCC 5"*)
528 if tryboth $CC -c $CFLAGS -Wno-psabi $test.c; then
529 echo "... turning the notes off with -Wno-psabi" >> configure.log
530 CFLAGS="${CFLAGS} -Wno-psabi"
531 SFLAGS="${SFLAGS} -Wno-psabi"
532 fi ;;
533 esac
534 fi
535
536 echo >> configure.log
537
538 # see if shared library build supported
539 cat > $test.c <<EOF
@@ -515,12 +541,19 @@
541 int hello() {return getchar();}
542 EOF
543 if test $shared -eq 1; then
544 echo Checking for shared library support... | tee -a configure.log
545 # we must test in two steps (cc then ld), required at least on SunOS 4.x
546 # the second link test is for linkers like lld that by default reject a
547 # version script naming symbols that the test object doesn't define -- if
548 # that's needed, keep the option, since some builds (e.g. --solo) don't
549 # define all of the symbols in zlib.map
550 if try $CC -c $SFLAGS $test.c &&
551 { try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o ||
552 { try $LDSHARED $SFLAGS $LDFLAGS -Wl,--undefined-version \
553 -o $test$shared_ext $test.o &&
554 LDSHARED="$LDSHARED -Wl,--undefined-version"; }; }; then
555 echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
556 elif test -z "$old_cc" -a -z "$old_cflags"; then
557 echo No shared library support. | tee -a configure.log
558 shared=0;
559 else
@@ -1022,19 +1055,22 @@
1055 /^CFLAGS *=/s#=.*#=$CFLAGS#
1056 /^SFLAGS *=/s#=.*#=$SFLAGS#
1057 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
1058 /^LDSHARED *=/s#=.*#=$LDSHARED#
1059 /^CPP *=/s#=.*#=$CPP#
1060 /^VGFMAFLAG *=/s#=.*#=$VGFMAFLAG#
1061 /^STATICLIB *=/s#=.*#=$STATICLIB#
1062 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
1063 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
1064 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
1065 /^AR *=/s#=.*#=$AR#
1066 /^ARFLAGS *=/s#=.*#=$ARFLAGS#
1067 /^RANLIB *=/s#=.*#=$RANLIB#
1068 /^LDCONFIG *=/s#=.*#=$LDCONFIG#
1069 /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
1070 /^SHAREDEXP *=/s#=.*#=$SHAREDEXP#
1071 /^SHAREDEXPFLAG *=/s#=.*#=$SHAREDEXPFLAG#
1072 /^EXE *=/s#=.*#=$EXE#
1073 /^SRCDIR *=/s#=.*#=$SRCDIR#
1074 /^ZINC *=/s#=.*#=$ZINC#
1075 /^ZINCOUT *=/s#=.*#=$ZINCOUT#
1076 /^prefix *=/s#=.*#=$prefix#
@@ -1052,10 +1088,11 @@
1088 # create zlib.pc with the configure results
1089 sed < ${SRCDIR}zlib.pc.in "
1090 /^CC *=/s#=.*#=$CC#
1091 /^CFLAGS *=/s#=.*#=$CFLAGS#
1092 /^CPP *=/s#=.*#=$CPP#
1093 /^VGFMAFLAG *=/s#=.*#=$VGFMAFLAG#
1094 /^LDSHARED *=/s#=.*#=$LDSHARED#
1095 /^STATICLIB *=/s#=.*#=$STATICLIB#
1096 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
1097 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
1098 /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
1099
--- compat/zlib/contrib/CMakeLists.txt
+++ compat/zlib/contrib/CMakeLists.txt
@@ -35,10 +35,14 @@
3535
3636
if(ZLIB_WITH_${name})
3737
add_subdirectory(${dir}/)
3838
endif(ZLIB_WITH_${name})
3939
endfunction(zlib_add_contrib_feature name description dir)
40
+
41
+set(WORK_DIR ${zlib_BINARY_DIR}/test)
42
+set(ZLIB_CONTRIB_PREFIX "zlib_")
43
+set(inst_setup zlib_install)
4044
4145
zlib_add_contrib_feature("GVMAT64"
4246
"of an optimized longest_match for 32 bits x86_64"
4347
gcc_gvmat64)
4448
4549
--- compat/zlib/contrib/CMakeLists.txt
+++ compat/zlib/contrib/CMakeLists.txt
@@ -35,10 +35,14 @@
35
36 if(ZLIB_WITH_${name})
37 add_subdirectory(${dir}/)
38 endif(ZLIB_WITH_${name})
39 endfunction(zlib_add_contrib_feature name description dir)
 
 
 
 
40
41 zlib_add_contrib_feature("GVMAT64"
42 "of an optimized longest_match for 32 bits x86_64"
43 gcc_gvmat64)
44
45
--- compat/zlib/contrib/CMakeLists.txt
+++ compat/zlib/contrib/CMakeLists.txt
@@ -35,10 +35,14 @@
35
36 if(ZLIB_WITH_${name})
37 add_subdirectory(${dir}/)
38 endif(ZLIB_WITH_${name})
39 endfunction(zlib_add_contrib_feature name description dir)
40
41 set(WORK_DIR ${zlib_BINARY_DIR}/test)
42 set(ZLIB_CONTRIB_PREFIX "zlib_")
43 set(inst_setup zlib_install)
44
45 zlib_add_contrib_feature("GVMAT64"
46 "of an optimized longest_match for 32 bits x86_64"
47 gcc_gvmat64)
48
49
--- compat/zlib/contrib/blast/CMakeLists.txt
+++ compat/zlib/contrib/blast/CMakeLists.txt
@@ -1,148 +1,105 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
blast
55
VERSION 1.3.0
66
LANGUAGES C
77
DESCRIPTION "A library for creating zipfiles based in zlib"
88
HOMEPAGE_URL "https://www.zlib.net")
99
10
+if(ZLIB_BUILD_BLAST)
11
+ set(ZLIB_BLAST_BUILD_SHARED ${ZLIB_BUILD_SHARED} CACHE BOOL "")
12
+ set(ZLIB_BLAST_BUILD_STATIC ${ZLIB_BUILD_STATIC} CACHE BOOL "")
13
+ set(ZLIB_BLAST_BUILD_TESTING ${ZLIB_BUILD_TESTING} CACHE BOOL "")
14
+ set(ZLIB_BLAST_INSTALL ${ZLIB_INSTALL} CACHE BOOL "")
15
+endif(ZLIB_BUILD_BLAST)
16
+
1017
option(ZLIB_BLAST_BUILD_SHARED "Enable building blast shared library" ON)
1118
option(ZLIB_BLAST_BUILD_STATIC "Enable building blast static library" ON)
1219
option(ZLIB_BLAST_BUILD_TESTING "Enable building tests for blast" ON)
1320
option(ZLIB_BLAST_INSTALL "Enable installation of blast" ON)
1421
1522
include(GNUInstallDirs)
1623
include(CMakePackageConfigHelpers)
1724
1825
if(WIN32 OR CYGWIN)
19
- set(zlibblast_static_suffix "s")
26
+ set(${ZLIB_CONTRIB_PREFIX}blast_static_suffix "s")
2027
set(CMAKE_DEBUG_POSTFIX "d")
2128
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
2229
endif(WIN32 OR CYGWIN)
2330
24
-function(blast_findTestEnv testName)
25
- set(testEnv "PATH=")
26
-
27
- if(MSVC OR MINGW)
28
- set(separator "\\\;")
29
- else()
30
- set(separator ":")
31
- endif()
32
-
33
- string(APPEND testEnv "$<TARGET_FILE_DIR:BLAST::BLAST>${separator}")
34
- string(APPEND testEnv "$ENV{PATH}")
35
-
36
- set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
37
-endfunction(blast_findTestEnv testName)
38
-
3931
if(ZLIB_BLAST_BUILD_SHARED)
40
- add_library(zlib_blast_blast SHARED
32
+ add_library(${ZLIB_CONTRIB_PREFIX}blast_blast SHARED
4133
blast.c
4234
blast.h)
4335
44
- add_library(BLAST::BLAST ALIAS zlib_blast_blast)
36
+ add_library(BLAST::BLAST ALIAS ${ZLIB_CONTRIB_PREFIX}blast_blast)
4537
4638
if(NOT CYGWIN)
47
- set_target_properties(zlib_blast_blast
39
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}blast_blast
4840
PROPERTIES
4941
SOVERSION ${blast_VERSION_MAJOR}
5042
VERSION ${blast_VERSION})
5143
endif(NOT CYGWIN)
5244
53
- set_target_properties(zlib_blast_blast
45
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}blast_blast
5446
PROPERTIES
5547
EXPORT_NAME BLAST
5648
OUTPUT_NAME blast)
57
-
58
- if(ZLIB_BLAST_BUILD_TESTING)
59
- enable_testing()
60
- add_executable(zlib_blast_blast-test blast-test.c)
61
- target_link_libraries(zlib_blast_blast-test PRIVATE zlib_blast_blast)
62
-
63
- add_test(NAME zlib_blast_blast-test
64
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
65
- "$<TARGET_FILE:zlib_blast_blast-test>"
66
- "${CMAKE_CURRENT_SOURCE_DIR}"
67
- "${CMAKE_CURRENT_BINARY_DIR}")
68
-
69
- if(MSVC
70
- OR MSYS
71
- OR MINGW
72
- OR CYGWIN)
73
- blast_findtestenv(zlib_blast_blast-test)
74
- endif(
75
- MSVC
76
- OR MSYS
77
- OR MINGW
78
- OR CYGWIN)
79
- endif(ZLIB_BLAST_BUILD_TESTING)
8049
endif(ZLIB_BLAST_BUILD_SHARED)
8150
8251
if(ZLIB_BLAST_BUILD_STATIC)
83
- add_library(zlib_blast_blastStatic STATIC
52
+ add_library(${ZLIB_CONTRIB_PREFIX}blast_blastStatic STATIC
8453
blast.c
8554
blast.h)
8655
87
- add_library(BLAST::BLASTSTATIC ALIAS zlib_blast_blastStatic)
56
+ add_library(BLAST::BLASTSTATIC ALIAS ${ZLIB_CONTRIB_PREFIX}blast_blastStatic)
8857
89
- set_target_properties(zlib_blast_blastStatic
58
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}blast_blastStatic
9059
PROPERTIES
9160
EXPORT_NAME BLASTSTATIC
92
- OUTPUT_NAME blast${zlibblast_static_suffix})
93
-
94
- if(ZLIB_BLAST_BUILD_TESTING)
95
- enable_testing()
96
- add_executable(zlib_blast_testStatic blast-test.c)
97
- target_link_libraries(zlib_blast_testStatic
98
- PRIVATE zlib_blast_blastStatic)
99
-
100
- add_test(NAME zlib_blast_testStatic
101
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
102
- "$<TARGET_FILE:zlib_blast_testStatic>"
103
- "${CMAKE_CURRENT_SOURCE_DIR}"
104
- "${CMAKE_CURRENT_BINARY_DIR}")
105
- endif(ZLIB_BLAST_BUILD_TESTING)
61
+ OUTPUT_NAME blast${${ZLIB_CONTRIB_PREFIX}blast_static_suffix})
10662
endif(ZLIB_BLAST_BUILD_STATIC)
10763
10864
if(ZLIB_BLAST_BUILD_TESTING)
65
+ enable_testing()
10966
add_subdirectory(test)
11067
endif(ZLIB_BLAST_BUILD_TESTING)
11168
11269
if(ZLIB_BLAST_INSTALL)
11370
if(ZLIB_BLAST_BUILD_SHARED)
11471
install(
115
- TARGETS zlib_blast_blast
72
+ TARGETS ${ZLIB_CONTRIB_PREFIX}blast_blast
11673
COMPONENT Runtime
117
- EXPORT zlibBlastSharedExport
74
+ EXPORT blastSharedExport
11875
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
11976
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
12077
install(
121
- EXPORT zlibBlastSharedExport
78
+ EXPORT blastSharedExport
12279
FILE blast-shared.cmake
12380
NAMESPACE BLAST::
12481
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
12582
12683
if(MSVC)
12784
install(
128
- FILES $<TARGET_PDB_FILE:zlib_blast_blast>
85
+ FILES $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}blast_blast>
12986
COMPONENT Development
13087
DESTINATION ${CMAKE_INSTALL_BINDIR}
13188
CONFIGURATIONS Debug OR RelWithDebInfo
13289
OPTIONAL)
13390
endif(MSVC)
13491
endif(ZLIB_BLAST_BUILD_SHARED)
13592
13693
if(ZLIB_BLAST_BUILD_STATIC)
13794
install(
138
- TARGETS zlib_blast_blastStatic
95
+ TARGETS ${ZLIB_CONTRIB_PREFIX}blast_blastStatic
13996
COMPONENT Development
140
- EXPORT zlibBlastStaticExport
97
+ EXPORT blastStaticExport
14198
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
14299
install(
143
- EXPORT zlibBlastStaticExport
100
+ EXPORT blastStaticExport
144101
FILE blast-static.cmake
145102
NAMESPACE BLAST::
146103
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
147104
endif(ZLIB_BLAST_BUILD_STATIC)
148105
149106
--- compat/zlib/contrib/blast/CMakeLists.txt
+++ compat/zlib/contrib/blast/CMakeLists.txt
@@ -1,148 +1,105 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 blast
5 VERSION 1.3.0
6 LANGUAGES C
7 DESCRIPTION "A library for creating zipfiles based in zlib"
8 HOMEPAGE_URL "https://www.zlib.net")
9
 
 
 
 
 
 
 
10 option(ZLIB_BLAST_BUILD_SHARED "Enable building blast shared library" ON)
11 option(ZLIB_BLAST_BUILD_STATIC "Enable building blast static library" ON)
12 option(ZLIB_BLAST_BUILD_TESTING "Enable building tests for blast" ON)
13 option(ZLIB_BLAST_INSTALL "Enable installation of blast" ON)
14
15 include(GNUInstallDirs)
16 include(CMakePackageConfigHelpers)
17
18 if(WIN32 OR CYGWIN)
19 set(zlibblast_static_suffix "s")
20 set(CMAKE_DEBUG_POSTFIX "d")
21 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
22 endif(WIN32 OR CYGWIN)
23
24 function(blast_findTestEnv testName)
25 set(testEnv "PATH=")
26
27 if(MSVC OR MINGW)
28 set(separator "\\\;")
29 else()
30 set(separator ":")
31 endif()
32
33 string(APPEND testEnv "$<TARGET_FILE_DIR:BLAST::BLAST>${separator}")
34 string(APPEND testEnv "$ENV{PATH}")
35
36 set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
37 endfunction(blast_findTestEnv testName)
38
39 if(ZLIB_BLAST_BUILD_SHARED)
40 add_library(zlib_blast_blast SHARED
41 blast.c
42 blast.h)
43
44 add_library(BLAST::BLAST ALIAS zlib_blast_blast)
45
46 if(NOT CYGWIN)
47 set_target_properties(zlib_blast_blast
48 PROPERTIES
49 SOVERSION ${blast_VERSION_MAJOR}
50 VERSION ${blast_VERSION})
51 endif(NOT CYGWIN)
52
53 set_target_properties(zlib_blast_blast
54 PROPERTIES
55 EXPORT_NAME BLAST
56 OUTPUT_NAME blast)
57
58 if(ZLIB_BLAST_BUILD_TESTING)
59 enable_testing()
60 add_executable(zlib_blast_blast-test blast-test.c)
61 target_link_libraries(zlib_blast_blast-test PRIVATE zlib_blast_blast)
62
63 add_test(NAME zlib_blast_blast-test
64 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
65 "$<TARGET_FILE:zlib_blast_blast-test>"
66 "${CMAKE_CURRENT_SOURCE_DIR}"
67 "${CMAKE_CURRENT_BINARY_DIR}")
68
69 if(MSVC
70 OR MSYS
71 OR MINGW
72 OR CYGWIN)
73 blast_findtestenv(zlib_blast_blast-test)
74 endif(
75 MSVC
76 OR MSYS
77 OR MINGW
78 OR CYGWIN)
79 endif(ZLIB_BLAST_BUILD_TESTING)
80 endif(ZLIB_BLAST_BUILD_SHARED)
81
82 if(ZLIB_BLAST_BUILD_STATIC)
83 add_library(zlib_blast_blastStatic STATIC
84 blast.c
85 blast.h)
86
87 add_library(BLAST::BLASTSTATIC ALIAS zlib_blast_blastStatic)
88
89 set_target_properties(zlib_blast_blastStatic
90 PROPERTIES
91 EXPORT_NAME BLASTSTATIC
92 OUTPUT_NAME blast${zlibblast_static_suffix})
93
94 if(ZLIB_BLAST_BUILD_TESTING)
95 enable_testing()
96 add_executable(zlib_blast_testStatic blast-test.c)
97 target_link_libraries(zlib_blast_testStatic
98 PRIVATE zlib_blast_blastStatic)
99
100 add_test(NAME zlib_blast_testStatic
101 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
102 "$<TARGET_FILE:zlib_blast_testStatic>"
103 "${CMAKE_CURRENT_SOURCE_DIR}"
104 "${CMAKE_CURRENT_BINARY_DIR}")
105 endif(ZLIB_BLAST_BUILD_TESTING)
106 endif(ZLIB_BLAST_BUILD_STATIC)
107
108 if(ZLIB_BLAST_BUILD_TESTING)
 
109 add_subdirectory(test)
110 endif(ZLIB_BLAST_BUILD_TESTING)
111
112 if(ZLIB_BLAST_INSTALL)
113 if(ZLIB_BLAST_BUILD_SHARED)
114 install(
115 TARGETS zlib_blast_blast
116 COMPONENT Runtime
117 EXPORT zlibBlastSharedExport
118 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
119 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
120 install(
121 EXPORT zlibBlastSharedExport
122 FILE blast-shared.cmake
123 NAMESPACE BLAST::
124 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
125
126 if(MSVC)
127 install(
128 FILES $<TARGET_PDB_FILE:zlib_blast_blast>
129 COMPONENT Development
130 DESTINATION ${CMAKE_INSTALL_BINDIR}
131 CONFIGURATIONS Debug OR RelWithDebInfo
132 OPTIONAL)
133 endif(MSVC)
134 endif(ZLIB_BLAST_BUILD_SHARED)
135
136 if(ZLIB_BLAST_BUILD_STATIC)
137 install(
138 TARGETS zlib_blast_blastStatic
139 COMPONENT Development
140 EXPORT zlibBlastStaticExport
141 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
142 install(
143 EXPORT zlibBlastStaticExport
144 FILE blast-static.cmake
145 NAMESPACE BLAST::
146 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
147 endif(ZLIB_BLAST_BUILD_STATIC)
148
149
--- compat/zlib/contrib/blast/CMakeLists.txt
+++ compat/zlib/contrib/blast/CMakeLists.txt
@@ -1,148 +1,105 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 blast
5 VERSION 1.3.0
6 LANGUAGES C
7 DESCRIPTION "A library for creating zipfiles based in zlib"
8 HOMEPAGE_URL "https://www.zlib.net")
9
10 if(ZLIB_BUILD_BLAST)
11 set(ZLIB_BLAST_BUILD_SHARED ${ZLIB_BUILD_SHARED} CACHE BOOL "")
12 set(ZLIB_BLAST_BUILD_STATIC ${ZLIB_BUILD_STATIC} CACHE BOOL "")
13 set(ZLIB_BLAST_BUILD_TESTING ${ZLIB_BUILD_TESTING} CACHE BOOL "")
14 set(ZLIB_BLAST_INSTALL ${ZLIB_INSTALL} CACHE BOOL "")
15 endif(ZLIB_BUILD_BLAST)
16
17 option(ZLIB_BLAST_BUILD_SHARED "Enable building blast shared library" ON)
18 option(ZLIB_BLAST_BUILD_STATIC "Enable building blast static library" ON)
19 option(ZLIB_BLAST_BUILD_TESTING "Enable building tests for blast" ON)
20 option(ZLIB_BLAST_INSTALL "Enable installation of blast" ON)
21
22 include(GNUInstallDirs)
23 include(CMakePackageConfigHelpers)
24
25 if(WIN32 OR CYGWIN)
26 set(${ZLIB_CONTRIB_PREFIX}blast_static_suffix "s")
27 set(CMAKE_DEBUG_POSTFIX "d")
28 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
29 endif(WIN32 OR CYGWIN)
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31 if(ZLIB_BLAST_BUILD_SHARED)
32 add_library(${ZLIB_CONTRIB_PREFIX}blast_blast SHARED
33 blast.c
34 blast.h)
35
36 add_library(BLAST::BLAST ALIAS ${ZLIB_CONTRIB_PREFIX}blast_blast)
37
38 if(NOT CYGWIN)
39 set_target_properties(${ZLIB_CONTRIB_PREFIX}blast_blast
40 PROPERTIES
41 SOVERSION ${blast_VERSION_MAJOR}
42 VERSION ${blast_VERSION})
43 endif(NOT CYGWIN)
44
45 set_target_properties(${ZLIB_CONTRIB_PREFIX}blast_blast
46 PROPERTIES
47 EXPORT_NAME BLAST
48 OUTPUT_NAME blast)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49 endif(ZLIB_BLAST_BUILD_SHARED)
50
51 if(ZLIB_BLAST_BUILD_STATIC)
52 add_library(${ZLIB_CONTRIB_PREFIX}blast_blastStatic STATIC
53 blast.c
54 blast.h)
55
56 add_library(BLAST::BLASTSTATIC ALIAS ${ZLIB_CONTRIB_PREFIX}blast_blastStatic)
57
58 set_target_properties(${ZLIB_CONTRIB_PREFIX}blast_blastStatic
59 PROPERTIES
60 EXPORT_NAME BLASTSTATIC
61 OUTPUT_NAME blast${${ZLIB_CONTRIB_PREFIX}blast_static_suffix})
 
 
 
 
 
 
 
 
 
 
 
 
 
62 endif(ZLIB_BLAST_BUILD_STATIC)
63
64 if(ZLIB_BLAST_BUILD_TESTING)
65 enable_testing()
66 add_subdirectory(test)
67 endif(ZLIB_BLAST_BUILD_TESTING)
68
69 if(ZLIB_BLAST_INSTALL)
70 if(ZLIB_BLAST_BUILD_SHARED)
71 install(
72 TARGETS ${ZLIB_CONTRIB_PREFIX}blast_blast
73 COMPONENT Runtime
74 EXPORT blastSharedExport
75 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
76 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
77 install(
78 EXPORT blastSharedExport
79 FILE blast-shared.cmake
80 NAMESPACE BLAST::
81 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
82
83 if(MSVC)
84 install(
85 FILES $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}blast_blast>
86 COMPONENT Development
87 DESTINATION ${CMAKE_INSTALL_BINDIR}
88 CONFIGURATIONS Debug OR RelWithDebInfo
89 OPTIONAL)
90 endif(MSVC)
91 endif(ZLIB_BLAST_BUILD_SHARED)
92
93 if(ZLIB_BLAST_BUILD_STATIC)
94 install(
95 TARGETS ${ZLIB_CONTRIB_PREFIX}blast_blastStatic
96 COMPONENT Development
97 EXPORT blastStaticExport
98 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
99 install(
100 EXPORT blastStaticExport
101 FILE blast-static.cmake
102 NAMESPACE BLAST::
103 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/blast)
104 endif(ZLIB_BLAST_BUILD_STATIC)
105
106
--- compat/zlib/contrib/blast/blastConfig.cmake.in
+++ compat/zlib/contrib/blast/blastConfig.cmake.in
@@ -1,18 +1,40 @@
1
-@PACKAGE_INIT@
2
-
31
set(_blast_supported_components "shared" "static")
42
53
if(blast_FIND_COMPONENTS)
64
foreach(_comp ${blast_FIND_COMPONENTS})
75
if(NOT _comp IN_LIST _blast_supported_components)
86
set(blast_FOUND False)
97
set(blast_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
108
endif(NOT _comp IN_LIST _blast_supported_components)
119
12
- include("${CMAKE_CURRENT_LIST_DIR}/blast-${_comp}.cmake")
10
+ include("${CMAKE_CURRENT_LIST_DIR}/blast-${_comp}.cmake"
11
+ OPTIONAL
12
+ RESULT_VARIABLE _comp_loaded)
13
+
14
+ if(NOT _comp_loaded)
15
+ set(blast_FOUND False)
16
+ set(blast_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
17
+ else(NOT _comp_loaded)
18
+ set(blast_${_comp}_FOUND TRUE)
19
+ endif(NOT _comp_loaded)
1320
endforeach(_comp ${blast_FIND_COMPONENTS})
1421
else(blast_FIND_COMPONENTS)
1522
foreach(_component_config IN LISTS _blast_supported_components)
16
- include("${CMAKE_CURRENT_LIST_DIR}/blast-${_component_config}.cmake")
23
+ include("${CMAKE_CURRENT_LIST_DIR}/blast-${_component_config}.cmake"
24
+ OPTIONAL)
1725
endforeach(_component_config IN LISTS _blast_supported_components)
26
+
27
+ if(NOT TARGET BLAST::BLAST)
28
+ set(blast_FOUND False)
29
+ set(blast_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
30
+ string(APPEND blast_NOT_FOUND_MESSAGE "build blast with support for shared libs or\n")
31
+ string(APPEND blast_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
32
+ endif(NOT TARGET BLAST::BLAST)
33
+
34
+ if(NOT TARGET BLAST::BLASTSTATIC)
35
+ set(blast_FOUND False)
36
+ set(blast_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
37
+ string(APPEND blast_NOT_FOUND_MESSAGE "build blast with support for static libs or\n")
38
+ string(APPEND blast_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
39
+ endif(NOT TARGET BLAST::BLASTSTATIC)
1840
endif(blast_FIND_COMPONENTS)
1941
2042
DELETED compat/zlib/contrib/blast/test.pk
2143
DELETED compat/zlib/contrib/blast/test.txt
--- compat/zlib/contrib/blast/blastConfig.cmake.in
+++ compat/zlib/contrib/blast/blastConfig.cmake.in
@@ -1,18 +1,40 @@
1 @PACKAGE_INIT@
2
3 set(_blast_supported_components "shared" "static")
4
5 if(blast_FIND_COMPONENTS)
6 foreach(_comp ${blast_FIND_COMPONENTS})
7 if(NOT _comp IN_LIST _blast_supported_components)
8 set(blast_FOUND False)
9 set(blast_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
10 endif(NOT _comp IN_LIST _blast_supported_components)
11
12 include("${CMAKE_CURRENT_LIST_DIR}/blast-${_comp}.cmake")
 
 
 
 
 
 
 
 
 
13 endforeach(_comp ${blast_FIND_COMPONENTS})
14 else(blast_FIND_COMPONENTS)
15 foreach(_component_config IN LISTS _blast_supported_components)
16 include("${CMAKE_CURRENT_LIST_DIR}/blast-${_component_config}.cmake")
 
17 endforeach(_component_config IN LISTS _blast_supported_components)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18 endif(blast_FIND_COMPONENTS)
19
20 ELETED compat/zlib/contrib/blast/test.pk
21 ELETED compat/zlib/contrib/blast/test.txt
--- compat/zlib/contrib/blast/blastConfig.cmake.in
+++ compat/zlib/contrib/blast/blastConfig.cmake.in
@@ -1,18 +1,40 @@
 
 
1 set(_blast_supported_components "shared" "static")
2
3 if(blast_FIND_COMPONENTS)
4 foreach(_comp ${blast_FIND_COMPONENTS})
5 if(NOT _comp IN_LIST _blast_supported_components)
6 set(blast_FOUND False)
7 set(blast_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
8 endif(NOT _comp IN_LIST _blast_supported_components)
9
10 include("${CMAKE_CURRENT_LIST_DIR}/blast-${_comp}.cmake"
11 OPTIONAL
12 RESULT_VARIABLE _comp_loaded)
13
14 if(NOT _comp_loaded)
15 set(blast_FOUND False)
16 set(blast_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
17 else(NOT _comp_loaded)
18 set(blast_${_comp}_FOUND TRUE)
19 endif(NOT _comp_loaded)
20 endforeach(_comp ${blast_FIND_COMPONENTS})
21 else(blast_FIND_COMPONENTS)
22 foreach(_component_config IN LISTS _blast_supported_components)
23 include("${CMAKE_CURRENT_LIST_DIR}/blast-${_component_config}.cmake"
24 OPTIONAL)
25 endforeach(_component_config IN LISTS _blast_supported_components)
26
27 if(NOT TARGET BLAST::BLAST)
28 set(blast_FOUND False)
29 set(blast_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
30 string(APPEND blast_NOT_FOUND_MESSAGE "build blast with support for shared libs or\n")
31 string(APPEND blast_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
32 endif(NOT TARGET BLAST::BLAST)
33
34 if(NOT TARGET BLAST::BLASTSTATIC)
35 set(blast_FOUND False)
36 set(blast_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
37 string(APPEND blast_NOT_FOUND_MESSAGE "build blast with support for static libs or\n")
38 string(APPEND blast_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
39 endif(NOT TARGET BLAST::BLASTSTATIC)
40 endif(blast_FIND_COMPONENTS)
41
42 ELETED compat/zlib/contrib/blast/test.pk
43 ELETED compat/zlib/contrib/blast/test.txt
D compat/zlib/contrib/blast/test.pk

Binary file

D compat/zlib/contrib/blast/test.txt
-1
--- a/compat/zlib/contrib/blast/test.txt
+++ b/compat/zlib/contrib/blast/test.txt
@@ -1 +0,0 @@
1
-AIAIAIAIAIAIA
--- a/compat/zlib/contrib/blast/test.txt
+++ b/compat/zlib/contrib/blast/test.txt
@@ -1 +0,0 @@
1 AIAIAIAIAIAIA
--- a/compat/zlib/contrib/blast/test.txt
+++ b/compat/zlib/contrib/blast/test.txt
@@ -1 +0,0 @@
 
--- compat/zlib/contrib/blast/test/CMakeLists.txt
+++ compat/zlib/contrib/blast/test/CMakeLists.txt
@@ -1,50 +1,45 @@
11
# if we are built from with zlib, use this path's)
2
-if(DEFINED ZLIB_BUILD_BLAST)
3
- set(WORK_DIR ${zlib_BINARY_DIR})
4
- set(inst_setup zlib_install)
5
-else(DEFINED ZLIB_BUILD_BLAST)
6
- set(WORK_DIR ${blast_BINARY_DIR})
2
+if(NOT DEFINED ZLIB_BUILD_BLAST)
3
+ set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
74
set(inst_setup zlib_blast_install)
85
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
96
107
add_test(
118
NAME zlib_blast_install
12
- COMMAND ${CMAKE_COMMAND} --install ${blast_BINARY_DIR} --prefix
13
- ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
14
- WORKING_DIRECTORY ${blast_BINARY_DIR})
9
+ COMMAND ${CMAKE_COMMAND}
10
+ --install ${blast_BINARY_DIR}
11
+ --prefix ${WORK_DIR}/test_install
12
+ --config $<CONFIG>
13
+ WORKING_DIRECTORY ${WORK_DIR})
1514
1615
set_tests_properties(zlib_blast_install
1716
PROPERTIES
1817
FIXTURES_SETUP zlib_blast_install)
19
-endif(DEFINED ZLIB_BUILD_BLAST)
20
-
21
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
22
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
23
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
18
+endif(NOT DEFINED ZLIB_BUILD_BLAST)
2419
2520
configure_file(
2621
${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
27
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
22
+ ${WORK_DIR}/blast_find_package_test/CMakeLists.txt @ONLY)
2823
2924
configure_file(
3025
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
31
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
26
+ ${WORK_DIR}/blast_add_subdirectory_test/CMakeLists.txt @ONLY)
3227
3328
configure_file(
3429
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
35
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
30
+ ${WORK_DIR}/blast_add_subdirectory_exclude_test/CMakeLists.txt
3631
@ONLY)
3732
3833
configure_file(
3934
${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
40
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
35
+ ${WORK_DIR}/blast_find_package_no_components_test/CMakeLists.txt
4136
@ONLY)
4237
4338
configure_file(
4439
${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
45
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
40
+ ${WORK_DIR}/blast_find_package_wrong_components_test/CMakeLists.txt
4641
@ONLY)
4742
4843
# CMAKE_GENERATOR_PLATFORM doesn't work in the if
4944
set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
5045
@@ -51,35 +46,38 @@
5146
if(GENERATOR)
5247
set(PLATFORM "-A ${GENERATOR}")
5348
endif(GENERATOR)
5449
5550
#
56
-# findpackage_test
51
+# find_package_test
5752
#
5853
add_test(
5954
NAME zlib_blast_find_package_configure
6055
COMMAND
61
- ${CMAKE_COMMAND} ${PLATFORM}
62
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
56
+ ${CMAKE_COMMAND}
57
+ ${PLATFORM}
58
+ -B${WORK_DIR}/blast_find_package_test_build
6359
-DCMAKE_BUILD_TYPE=$<CONFIG>
6460
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
6561
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
66
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
67
- --fresh
62
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
63
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
64
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
65
+ ${ZLIB_ARG}
66
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
6867
-G "${CMAKE_GENERATOR}"
69
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
68
+ -S${WORK_DIR}/blast_find_package_test)
7069
7170
add_test(
7271
NAME zlib_blast_find_package_build
7372
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
74
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
73
+ WORKING_DIRECTORY ${WORK_DIR}/blast_find_package_test_build)
7574
76
-set_tests_properties(
77
- zlib_blast_find_package_configure
78
- PROPERTIES
79
- FIXTURES_REQUIRED ${inst_setup}
80
- FIXTURES_SETUP blast_fp_config)
75
+set_tests_properties(zlib_blast_find_package_configure
76
+ PROPERTIES
77
+ FIXTURES_REQUIRED ${inst_setup}
78
+ FIXTURES_SETUP blast_fp_config)
8179
8280
set_tests_properties(zlib_blast_find_package_build
8381
PROPERTIES
8482
FIXTURES_REQUIRED blast_fp_config)
8583
@@ -87,27 +85,30 @@
8785
# add_subdirectory_test
8886
#
8987
add_test(
9088
NAME zlib_blast_add_subdirectory_configure
9189
COMMAND
92
- ${CMAKE_COMMAND} ${PLATFORM}
93
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
90
+ ${CMAKE_COMMAND}
91
+ ${PLATFORM}
92
+ -B${WORK_DIR}/blast_add_subdirectory_test_build
9493
-DCMAKE_BUILD_TYPE=$<CONFIG>
9594
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
9695
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
97
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
98
- --fresh
96
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
97
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
98
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
99
+ ${ZLIB_ARG}
100
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
99101
-G "${CMAKE_GENERATOR}"
100
- -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
102
+ -S${WORK_DIR}/blast_add_subdirectory_test)
101103
102104
add_test(
103105
NAME zlib_blast_add_subdirectory_build
104106
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
105
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
107
+ WORKING_DIRECTORY ${WORK_DIR}/blast_add_subdirectory_test_build)
106108
107
-set_tests_properties(
108
- zlib_blast_add_subdirectory_configure
109
+set_tests_properties(zlib_blast_add_subdirectory_configure
109110
PROPERTIES
110111
FIXTURES_REQUIRED ${inst_setup}
111112
FIXTURES_SETUP blast_as_config)
112113
113114
set_tests_properties(zlib_blast_add_subdirectory_build
@@ -118,25 +119,29 @@
118119
# add_subdirectory_exclude_test
119120
#
120121
add_test(
121122
NAME zlib_blast_add_subdirectory_exclude_configure
122123
COMMAND
123
- ${CMAKE_COMMAND} ${PLATFORM}
124
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
124
+ ${CMAKE_COMMAND}
125
+ ${PLATFORM}
126
+ -B${WORK_DIR}/blast_add_subdirectory_exclude_test_build
125127
-DCMAKE_BUILD_TYPE=$<CONFIG>
126128
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
127129
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
128
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
129
- --fresh
130
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
131
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
132
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
133
+ ${ZLIB_ARG}
134
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
130135
-G "${CMAKE_GENERATOR}"
131
- -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
136
+ -S${WORK_DIR}/blast_add_subdirectory_exclude_test)
132137
133138
add_test(
134139
NAME zlib_blast_add_subdirectory_exclude_build
135140
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
136141
WORKING_DIRECTORY
137
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
142
+ ${WORK_DIR}/blast_add_subdirectory_exclude_test_build)
138143
139144
set_tests_properties(zlib_blast_add_subdirectory_exclude_configure
140145
PROPERTIES
141146
FIXTURES_REQUIRED ${inst_setup}
142147
FIXTURES_SETUP blast_asx_config)
@@ -149,45 +154,53 @@
149154
# findpackage_no_components_test
150155
#
151156
add_test(
152157
NAME zlib_blast_find_package_no_components_configure
153158
COMMAND
154
- ${CMAKE_COMMAND} ${PLATFORM}
155
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
156
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
159
+ ${CMAKE_COMMAND}
160
+ ${PLATFORM}
161
+ -B${WORK_DIR}/blast_find_package_no_components_test_build
162
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
163
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
157164
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
158
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
159
- --fresh
160
- -G "${CMAKE_GENERATOR}"
161
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
162
-
163
-set_tests_properties(
164
- zlib_blast_find_package_no_components_configure
165
- PROPERTIES
166
- FIXTURES_REQUIRED ${inst_setup})
165
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
166
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
167
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
168
+ ${ZLIB_ARG}
169
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
170
+ -G "${CMAKE_GENERATOR}"
171
+ -S${WORK_DIR}/blast_find_package_no_components_test)
172
+
173
+set_tests_properties(zlib_blast_find_package_no_components_configure
174
+ PROPERTIES
175
+ FIXTURES_REQUIRED ${inst_setup})
167176
168177
if(NOT ZLIB_BLAST_BUILD_SHARED OR NOT ZLIB_BLAST_BUILD_STATIC)
169178
set_tests_properties(zlib_blast_find_package_no_components_configure
170179
PROPERTIES
171180
WILL_FAIL TRUE)
172181
endif(NOT ZLIB_BLAST_BUILD_SHARED OR NOT ZLIB_BLAST_BUILD_STATIC)
173182
174183
#
175
-# findpackage_wrong_components_test
184
+# find_package_wrong_components_test
176185
#
177186
add_test(
178187
NAME zlib_blast_find_package_wrong_components_configure
179188
COMMAND
180
- ${CMAKE_COMMAND} ${PLATFORM}
181
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
182
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
189
+ ${CMAKE_COMMAND}
190
+ ${PLATFORM}
191
+ -B${WORK_DIR}/blast_find_package_wrong_components_test_build
192
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
193
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
183194
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
184
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
185
- --fresh
195
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
196
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
197
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
198
+ ${ZLIB_ARG}
199
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
186200
-G "${CMAKE_GENERATOR}"
187
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
201
+ -S${WORK_DIR}/blast_find_package_wrong_components_test)
188202
189203
set_tests_properties(zlib_blast_find_package_wrong_components_configure
190204
PROPERTIES
191205
FIXTURES_REQUIRED ${inst_setup}
192206
WILL_FAIL TRUE)
193
-
194207
--- compat/zlib/contrib/blast/test/CMakeLists.txt
+++ compat/zlib/contrib/blast/test/CMakeLists.txt
@@ -1,50 +1,45 @@
1 # if we are built from with zlib, use this path's)
2 if(DEFINED ZLIB_BUILD_BLAST)
3 set(WORK_DIR ${zlib_BINARY_DIR})
4 set(inst_setup zlib_install)
5 else(DEFINED ZLIB_BUILD_BLAST)
6 set(WORK_DIR ${blast_BINARY_DIR})
7 set(inst_setup zlib_blast_install)
8 set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
9
10 add_test(
11 NAME zlib_blast_install
12 COMMAND ${CMAKE_COMMAND} --install ${blast_BINARY_DIR} --prefix
13 ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
14 WORKING_DIRECTORY ${blast_BINARY_DIR})
 
 
15
16 set_tests_properties(zlib_blast_install
17 PROPERTIES
18 FIXTURES_SETUP zlib_blast_install)
19 endif(DEFINED ZLIB_BUILD_BLAST)
20
21 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
22 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
23 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
24
25 configure_file(
26 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
27 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
28
29 configure_file(
30 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
31 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
32
33 configure_file(
34 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
35 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
36 @ONLY)
37
38 configure_file(
39 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
40 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
41 @ONLY)
42
43 configure_file(
44 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
45 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
46 @ONLY)
47
48 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
49 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
50
@@ -51,35 +46,38 @@
51 if(GENERATOR)
52 set(PLATFORM "-A ${GENERATOR}")
53 endif(GENERATOR)
54
55 #
56 # findpackage_test
57 #
58 add_test(
59 NAME zlib_blast_find_package_configure
60 COMMAND
61 ${CMAKE_COMMAND} ${PLATFORM}
62 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
 
63 -DCMAKE_BUILD_TYPE=$<CONFIG>
64 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
65 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
66 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
67 --fresh
 
 
 
68 -G "${CMAKE_GENERATOR}"
69 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
70
71 add_test(
72 NAME zlib_blast_find_package_build
73 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
74 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
75
76 set_tests_properties(
77 zlib_blast_find_package_configure
78 PROPERTIES
79 FIXTURES_REQUIRED ${inst_setup}
80 FIXTURES_SETUP blast_fp_config)
81
82 set_tests_properties(zlib_blast_find_package_build
83 PROPERTIES
84 FIXTURES_REQUIRED blast_fp_config)
85
@@ -87,27 +85,30 @@
87 # add_subdirectory_test
88 #
89 add_test(
90 NAME zlib_blast_add_subdirectory_configure
91 COMMAND
92 ${CMAKE_COMMAND} ${PLATFORM}
93 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
 
94 -DCMAKE_BUILD_TYPE=$<CONFIG>
95 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
96 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
97 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
98 --fresh
 
 
 
99 -G "${CMAKE_GENERATOR}"
100 -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
101
102 add_test(
103 NAME zlib_blast_add_subdirectory_build
104 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
105 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
106
107 set_tests_properties(
108 zlib_blast_add_subdirectory_configure
109 PROPERTIES
110 FIXTURES_REQUIRED ${inst_setup}
111 FIXTURES_SETUP blast_as_config)
112
113 set_tests_properties(zlib_blast_add_subdirectory_build
@@ -118,25 +119,29 @@
118 # add_subdirectory_exclude_test
119 #
120 add_test(
121 NAME zlib_blast_add_subdirectory_exclude_configure
122 COMMAND
123 ${CMAKE_COMMAND} ${PLATFORM}
124 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
 
125 -DCMAKE_BUILD_TYPE=$<CONFIG>
126 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
127 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
128 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
129 --fresh
 
 
 
130 -G "${CMAKE_GENERATOR}"
131 -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
132
133 add_test(
134 NAME zlib_blast_add_subdirectory_exclude_build
135 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
136 WORKING_DIRECTORY
137 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
138
139 set_tests_properties(zlib_blast_add_subdirectory_exclude_configure
140 PROPERTIES
141 FIXTURES_REQUIRED ${inst_setup}
142 FIXTURES_SETUP blast_asx_config)
@@ -149,45 +154,53 @@
149 # findpackage_no_components_test
150 #
151 add_test(
152 NAME zlib_blast_find_package_no_components_configure
153 COMMAND
154 ${CMAKE_COMMAND} ${PLATFORM}
155 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
156 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
157 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
158 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
159 --fresh
160 -G "${CMAKE_GENERATOR}"
161 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
162
163 set_tests_properties(
164 zlib_blast_find_package_no_components_configure
165 PROPERTIES
166 FIXTURES_REQUIRED ${inst_setup})
 
 
167
168 if(NOT ZLIB_BLAST_BUILD_SHARED OR NOT ZLIB_BLAST_BUILD_STATIC)
169 set_tests_properties(zlib_blast_find_package_no_components_configure
170 PROPERTIES
171 WILL_FAIL TRUE)
172 endif(NOT ZLIB_BLAST_BUILD_SHARED OR NOT ZLIB_BLAST_BUILD_STATIC)
173
174 #
175 # findpackage_wrong_components_test
176 #
177 add_test(
178 NAME zlib_blast_find_package_wrong_components_configure
179 COMMAND
180 ${CMAKE_COMMAND} ${PLATFORM}
181 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
182 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
183 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
184 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
185 --fresh
 
 
 
186 -G "${CMAKE_GENERATOR}"
187 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
188
189 set_tests_properties(zlib_blast_find_package_wrong_components_configure
190 PROPERTIES
191 FIXTURES_REQUIRED ${inst_setup}
192 WILL_FAIL TRUE)
193
194
--- compat/zlib/contrib/blast/test/CMakeLists.txt
+++ compat/zlib/contrib/blast/test/CMakeLists.txt
@@ -1,50 +1,45 @@
1 # if we are built from with zlib, use this path's)
2 if(NOT DEFINED ZLIB_BUILD_BLAST)
3 set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
 
 
4 set(inst_setup zlib_blast_install)
5 set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
6
7 add_test(
8 NAME zlib_blast_install
9 COMMAND ${CMAKE_COMMAND}
10 --install ${blast_BINARY_DIR}
11 --prefix ${WORK_DIR}/test_install
12 --config $<CONFIG>
13 WORKING_DIRECTORY ${WORK_DIR})
14
15 set_tests_properties(zlib_blast_install
16 PROPERTIES
17 FIXTURES_SETUP zlib_blast_install)
18 endif(NOT DEFINED ZLIB_BUILD_BLAST)
 
 
 
 
19
20 configure_file(
21 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
22 ${WORK_DIR}/blast_find_package_test/CMakeLists.txt @ONLY)
23
24 configure_file(
25 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
26 ${WORK_DIR}/blast_add_subdirectory_test/CMakeLists.txt @ONLY)
27
28 configure_file(
29 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
30 ${WORK_DIR}/blast_add_subdirectory_exclude_test/CMakeLists.txt
31 @ONLY)
32
33 configure_file(
34 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
35 ${WORK_DIR}/blast_find_package_no_components_test/CMakeLists.txt
36 @ONLY)
37
38 configure_file(
39 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
40 ${WORK_DIR}/blast_find_package_wrong_components_test/CMakeLists.txt
41 @ONLY)
42
43 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
44 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
45
@@ -51,35 +46,38 @@
46 if(GENERATOR)
47 set(PLATFORM "-A ${GENERATOR}")
48 endif(GENERATOR)
49
50 #
51 # find_package_test
52 #
53 add_test(
54 NAME zlib_blast_find_package_configure
55 COMMAND
56 ${CMAKE_COMMAND}
57 ${PLATFORM}
58 -B${WORK_DIR}/blast_find_package_test_build
59 -DCMAKE_BUILD_TYPE=$<CONFIG>
60 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
61 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
62 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
63 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
64 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
65 ${ZLIB_ARG}
66 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
67 -G "${CMAKE_GENERATOR}"
68 -S${WORK_DIR}/blast_find_package_test)
69
70 add_test(
71 NAME zlib_blast_find_package_build
72 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
73 WORKING_DIRECTORY ${WORK_DIR}/blast_find_package_test_build)
74
75 set_tests_properties(zlib_blast_find_package_configure
76 PROPERTIES
77 FIXTURES_REQUIRED ${inst_setup}
78 FIXTURES_SETUP blast_fp_config)
 
79
80 set_tests_properties(zlib_blast_find_package_build
81 PROPERTIES
82 FIXTURES_REQUIRED blast_fp_config)
83
@@ -87,27 +85,30 @@
85 # add_subdirectory_test
86 #
87 add_test(
88 NAME zlib_blast_add_subdirectory_configure
89 COMMAND
90 ${CMAKE_COMMAND}
91 ${PLATFORM}
92 -B${WORK_DIR}/blast_add_subdirectory_test_build
93 -DCMAKE_BUILD_TYPE=$<CONFIG>
94 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
95 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
96 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
97 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
98 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
99 ${ZLIB_ARG}
100 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
101 -G "${CMAKE_GENERATOR}"
102 -S${WORK_DIR}/blast_add_subdirectory_test)
103
104 add_test(
105 NAME zlib_blast_add_subdirectory_build
106 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
107 WORKING_DIRECTORY ${WORK_DIR}/blast_add_subdirectory_test_build)
108
109 set_tests_properties(zlib_blast_add_subdirectory_configure
 
110 PROPERTIES
111 FIXTURES_REQUIRED ${inst_setup}
112 FIXTURES_SETUP blast_as_config)
113
114 set_tests_properties(zlib_blast_add_subdirectory_build
@@ -118,25 +119,29 @@
119 # add_subdirectory_exclude_test
120 #
121 add_test(
122 NAME zlib_blast_add_subdirectory_exclude_configure
123 COMMAND
124 ${CMAKE_COMMAND}
125 ${PLATFORM}
126 -B${WORK_DIR}/blast_add_subdirectory_exclude_test_build
127 -DCMAKE_BUILD_TYPE=$<CONFIG>
128 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
129 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
130 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
131 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
132 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
133 ${ZLIB_ARG}
134 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
135 -G "${CMAKE_GENERATOR}"
136 -S${WORK_DIR}/blast_add_subdirectory_exclude_test)
137
138 add_test(
139 NAME zlib_blast_add_subdirectory_exclude_build
140 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
141 WORKING_DIRECTORY
142 ${WORK_DIR}/blast_add_subdirectory_exclude_test_build)
143
144 set_tests_properties(zlib_blast_add_subdirectory_exclude_configure
145 PROPERTIES
146 FIXTURES_REQUIRED ${inst_setup}
147 FIXTURES_SETUP blast_asx_config)
@@ -149,45 +154,53 @@
154 # findpackage_no_components_test
155 #
156 add_test(
157 NAME zlib_blast_find_package_no_components_configure
158 COMMAND
159 ${CMAKE_COMMAND}
160 ${PLATFORM}
161 -B${WORK_DIR}/blast_find_package_no_components_test_build
162 -DCMAKE_BUILD_TYPE=$<CONFIG>
163 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
164 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
165 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
166 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
167 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
168 ${ZLIB_ARG}
169 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
170 -G "${CMAKE_GENERATOR}"
171 -S${WORK_DIR}/blast_find_package_no_components_test)
172
173 set_tests_properties(zlib_blast_find_package_no_components_configure
174 PROPERTIES
175 FIXTURES_REQUIRED ${inst_setup})
176
177 if(NOT ZLIB_BLAST_BUILD_SHARED OR NOT ZLIB_BLAST_BUILD_STATIC)
178 set_tests_properties(zlib_blast_find_package_no_components_configure
179 PROPERTIES
180 WILL_FAIL TRUE)
181 endif(NOT ZLIB_BLAST_BUILD_SHARED OR NOT ZLIB_BLAST_BUILD_STATIC)
182
183 #
184 # find_package_wrong_components_test
185 #
186 add_test(
187 NAME zlib_blast_find_package_wrong_components_configure
188 COMMAND
189 ${CMAKE_COMMAND}
190 ${PLATFORM}
191 -B${WORK_DIR}/blast_find_package_wrong_components_test_build
192 -DCMAKE_BUILD_TYPE=$<CONFIG>
193 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
194 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
195 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
196 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
197 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
198 ${ZLIB_ARG}
199 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
200 -G "${CMAKE_GENERATOR}"
201 -S${WORK_DIR}/blast_find_package_wrong_components_test)
202
203 set_tests_properties(zlib_blast_find_package_wrong_components_configure
204 PROPERTIES
205 FIXTURES_REQUIRED ${inst_setup}
206 WILL_FAIL TRUE)
 
207
--- compat/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
blast_find_package
55
LANGUAGES C
66
VERSION @blast_VERSION@)
77
--- compat/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
--- compat/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
--- compat/zlib/contrib/blast/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/blast/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
blast_find_package
55
LANGUAGES C
66
VERSION @blast_VERSION@)
77
--- compat/zlib/contrib/blast/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/blast/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
--- compat/zlib/contrib/blast/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/blast/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
--- compat/zlib/contrib/blast/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
blast_find_package
55
LANGUAGES C
66
VERSION @blast_VERSION@)
77
--- compat/zlib/contrib/blast/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
--- compat/zlib/contrib/blast/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
--- compat/zlib/contrib/blast/test/find_package_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
blast_find_package
55
LANGUAGES C
66
VERSION @blast_VERSION@)
77
--- compat/zlib/contrib/blast/test/find_package_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
--- compat/zlib/contrib/blast/test/find_package_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
--- compat/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
blast_find_package
55
LANGUAGES C
66
VERSION @blast_VERSION@)
77
88
DELETED compat/zlib/contrib/blast/tester.cmake
--- compat/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
8 ELETED compat/zlib/contrib/blast/tester.cmake
--- compat/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 blast_find_package
5 LANGUAGES C
6 VERSION @blast_VERSION@)
7
8 ELETED compat/zlib/contrib/blast/tester.cmake
D compat/zlib/contrib/blast/tester.cmake
-28
--- a/compat/zlib/contrib/blast/tester.cmake
+++ b/compat/zlib/contrib/blast/tester.cmake
@@ -1,28 +0,0 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
2
-
3
-#CMAKE_ARGV0 = ${CMAKE_COMMAND}
4
-#CMAKE_ARGV1 = -P
5
-#CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
6
-#CMAKE_ARGV3 = "$<TARGET_FILE:blast-test>"
7
-#CMAKE_ARGV4 = "${CMAKE_CURRENT_SOURCE_DIR}"
8
-#CMAKE_ARGV5 = "${CMAKE_CURRENT_BINARY_DIR}")
9
-
10
-execute_process(COMMAND ${CMAKE_ARGV3}
11
- INPUT_FILE "${CMAKE_ARGV4}/test.pk"
12
- OUTPUT_FILE "${CMAKE_ARGV5}/output.txt"
13
- RESULT_VARIABLE RESULT)
14
-
15
-if(RESULT)
16
- message(FATAL_ERROR "Command exitited with: ${RESULT}")
17
-endif(RESULT)
18
-
19
-execute_process(COMMAND ${CMAKE_ARGV0} -E compare_files
20
- "${CMAKE_ARGV4}/test.txt"
21
- "${CMAKE_ARGV5}/output.txt"
22
- RESULT_VARIABLE RESULT)
23
-
24
-file(REMOVE "${CMAKE_ARGV5}/output.txt")
25
-
26
-if(RESULT)
27
- message(FATAL_ERROR "Files differ")
28
-endif(RESULT)
--- a/compat/zlib/contrib/blast/tester.cmake
+++ b/compat/zlib/contrib/blast/tester.cmake
@@ -1,28 +0,0 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 #CMAKE_ARGV0 = ${CMAKE_COMMAND}
4 #CMAKE_ARGV1 = -P
5 #CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
6 #CMAKE_ARGV3 = "$<TARGET_FILE:blast-test>"
7 #CMAKE_ARGV4 = "${CMAKE_CURRENT_SOURCE_DIR}"
8 #CMAKE_ARGV5 = "${CMAKE_CURRENT_BINARY_DIR}")
9
10 execute_process(COMMAND ${CMAKE_ARGV3}
11 INPUT_FILE "${CMAKE_ARGV4}/test.pk"
12 OUTPUT_FILE "${CMAKE_ARGV5}/output.txt"
13 RESULT_VARIABLE RESULT)
14
15 if(RESULT)
16 message(FATAL_ERROR "Command exitited with: ${RESULT}")
17 endif(RESULT)
18
19 execute_process(COMMAND ${CMAKE_ARGV0} -E compare_files
20 "${CMAKE_ARGV4}/test.txt"
21 "${CMAKE_ARGV5}/output.txt"
22 RESULT_VARIABLE RESULT)
23
24 file(REMOVE "${CMAKE_ARGV5}/output.txt")
25
26 if(RESULT)
27 message(FATAL_ERROR "Files differ")
28 endif(RESULT)
--- a/compat/zlib/contrib/blast/tester.cmake
+++ b/compat/zlib/contrib/blast/tester.cmake
@@ -1,28 +0,0 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- compat/zlib/contrib/crc32vx/crc32_vx.c
+++ compat/zlib/contrib/crc32vx/crc32_vx.c
@@ -77,25 +77,25 @@
7777
*/
7878
uv2di v0 = {0, 0};
7979
v0 = (uv2di)vec_insert(crc, (uv4si)v0, 3);
8080
8181
/* Load a 64-byte data chunk and XOR with CRC */
82
- uv2di v1 = vec_perm(((uv2di *)buf)[0], ((uv2di *)buf)[0], perm_le2be);
83
- uv2di v2 = vec_perm(((uv2di *)buf)[1], ((uv2di *)buf)[1], perm_le2be);
84
- uv2di v3 = vec_perm(((uv2di *)buf)[2], ((uv2di *)buf)[2], perm_le2be);
85
- uv2di v4 = vec_perm(((uv2di *)buf)[3], ((uv2di *)buf)[3], perm_le2be);
82
+ uv2di v1 = vec_perm(((const uv2di *)buf)[0], ((const uv2di *)buf)[0], perm_le2be);
83
+ uv2di v2 = vec_perm(((const uv2di *)buf)[1], ((const uv2di *)buf)[1], perm_le2be);
84
+ uv2di v3 = vec_perm(((const uv2di *)buf)[2], ((const uv2di *)buf)[2], perm_le2be);
85
+ uv2di v4 = vec_perm(((const uv2di *)buf)[3], ((const uv2di *)buf)[3], perm_le2be);
8686
8787
v1 ^= v0;
8888
buf += 64;
8989
len -= 64;
9090
9191
while (len >= 64) {
9292
/* Load the next 64-byte data chunk */
93
- uv16qi part1 = vec_perm(((uv16qi *)buf)[0], ((uv16qi *)buf)[0], perm_le2be);
94
- uv16qi part2 = vec_perm(((uv16qi *)buf)[1], ((uv16qi *)buf)[1], perm_le2be);
95
- uv16qi part3 = vec_perm(((uv16qi *)buf)[2], ((uv16qi *)buf)[2], perm_le2be);
96
- uv16qi part4 = vec_perm(((uv16qi *)buf)[3], ((uv16qi *)buf)[3], perm_le2be);
93
+ uv16qi part1 = vec_perm(((const uv16qi *)buf)[0], ((const uv16qi *)buf)[0], perm_le2be);
94
+ uv16qi part2 = vec_perm(((const uv16qi *)buf)[1], ((const uv16qi *)buf)[1], perm_le2be);
95
+ uv16qi part3 = vec_perm(((const uv16qi *)buf)[2], ((const uv16qi *)buf)[2], perm_le2be);
96
+ uv16qi part4 = vec_perm(((const uv16qi *)buf)[3], ((const uv16qi *)buf)[3], perm_le2be);
9797
9898
/*
9999
* Perform a GF(2) multiplication of the doublewords in V1 with
100100
* the R1 and R2 reduction constants in V0. The intermediate result
101101
* is then folded (accumulated) with the next data chunk in PART1 and
@@ -120,11 +120,11 @@
120120
v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v3);
121121
v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v4);
122122
123123
while (len >= 16) {
124124
/* Load next data chunk */
125
- v2 = vec_perm(*(uv2di *)buf, *(uv2di *)buf, perm_le2be);
125
+ v2 = vec_perm(*(const uv2di *)buf, *(const uv2di *)buf, perm_le2be);
126126
127127
/* Fold next data chunk */
128128
v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v2);
129129
130130
buf += 16;
131131
--- compat/zlib/contrib/crc32vx/crc32_vx.c
+++ compat/zlib/contrib/crc32vx/crc32_vx.c
@@ -77,25 +77,25 @@
77 */
78 uv2di v0 = {0, 0};
79 v0 = (uv2di)vec_insert(crc, (uv4si)v0, 3);
80
81 /* Load a 64-byte data chunk and XOR with CRC */
82 uv2di v1 = vec_perm(((uv2di *)buf)[0], ((uv2di *)buf)[0], perm_le2be);
83 uv2di v2 = vec_perm(((uv2di *)buf)[1], ((uv2di *)buf)[1], perm_le2be);
84 uv2di v3 = vec_perm(((uv2di *)buf)[2], ((uv2di *)buf)[2], perm_le2be);
85 uv2di v4 = vec_perm(((uv2di *)buf)[3], ((uv2di *)buf)[3], perm_le2be);
86
87 v1 ^= v0;
88 buf += 64;
89 len -= 64;
90
91 while (len >= 64) {
92 /* Load the next 64-byte data chunk */
93 uv16qi part1 = vec_perm(((uv16qi *)buf)[0], ((uv16qi *)buf)[0], perm_le2be);
94 uv16qi part2 = vec_perm(((uv16qi *)buf)[1], ((uv16qi *)buf)[1], perm_le2be);
95 uv16qi part3 = vec_perm(((uv16qi *)buf)[2], ((uv16qi *)buf)[2], perm_le2be);
96 uv16qi part4 = vec_perm(((uv16qi *)buf)[3], ((uv16qi *)buf)[3], perm_le2be);
97
98 /*
99 * Perform a GF(2) multiplication of the doublewords in V1 with
100 * the R1 and R2 reduction constants in V0. The intermediate result
101 * is then folded (accumulated) with the next data chunk in PART1 and
@@ -120,11 +120,11 @@
120 v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v3);
121 v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v4);
122
123 while (len >= 16) {
124 /* Load next data chunk */
125 v2 = vec_perm(*(uv2di *)buf, *(uv2di *)buf, perm_le2be);
126
127 /* Fold next data chunk */
128 v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v2);
129
130 buf += 16;
131
--- compat/zlib/contrib/crc32vx/crc32_vx.c
+++ compat/zlib/contrib/crc32vx/crc32_vx.c
@@ -77,25 +77,25 @@
77 */
78 uv2di v0 = {0, 0};
79 v0 = (uv2di)vec_insert(crc, (uv4si)v0, 3);
80
81 /* Load a 64-byte data chunk and XOR with CRC */
82 uv2di v1 = vec_perm(((const uv2di *)buf)[0], ((const uv2di *)buf)[0], perm_le2be);
83 uv2di v2 = vec_perm(((const uv2di *)buf)[1], ((const uv2di *)buf)[1], perm_le2be);
84 uv2di v3 = vec_perm(((const uv2di *)buf)[2], ((const uv2di *)buf)[2], perm_le2be);
85 uv2di v4 = vec_perm(((const uv2di *)buf)[3], ((const uv2di *)buf)[3], perm_le2be);
86
87 v1 ^= v0;
88 buf += 64;
89 len -= 64;
90
91 while (len >= 64) {
92 /* Load the next 64-byte data chunk */
93 uv16qi part1 = vec_perm(((const uv16qi *)buf)[0], ((const uv16qi *)buf)[0], perm_le2be);
94 uv16qi part2 = vec_perm(((const uv16qi *)buf)[1], ((const uv16qi *)buf)[1], perm_le2be);
95 uv16qi part3 = vec_perm(((const uv16qi *)buf)[2], ((const uv16qi *)buf)[2], perm_le2be);
96 uv16qi part4 = vec_perm(((const uv16qi *)buf)[3], ((const uv16qi *)buf)[3], perm_le2be);
97
98 /*
99 * Perform a GF(2) multiplication of the doublewords in V1 with
100 * the R1 and R2 reduction constants in V0. The intermediate result
101 * is then folded (accumulated) with the next data chunk in PART1 and
@@ -120,11 +120,11 @@
120 v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v3);
121 v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v4);
122
123 while (len >= 16) {
124 /* Load next data chunk */
125 v2 = vec_perm(*(const uv2di *)buf, *(const uv2di *)buf, perm_le2be);
126
127 /* Fold next data chunk */
128 v1 = (uv2di)vec_gfmsum_accum_128(r4r3, v1, (uv16qi)v2);
129
130 buf += 16;
131
--- compat/zlib/contrib/delphi/ZLib.pas
+++ compat/zlib/contrib/delphi/ZLib.pas
@@ -150,11 +150,11 @@
150150
BufSize = number of bytes in OutBuf }
151151
procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152152
const OutBuf: Pointer; BufSize: Integer);
153153
154154
const
155
- zlib_version = '1.3.2';
155
+ zlib_version = '1.4';
156156
157157
type
158158
EZlibError = class(Exception);
159159
ECompressionError = class(EZlibError);
160160
EDecompressionError = class(EZlibError);
161161
--- compat/zlib/contrib/delphi/ZLib.pas
+++ compat/zlib/contrib/delphi/ZLib.pas
@@ -150,11 +150,11 @@
150 BufSize = number of bytes in OutBuf }
151 procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152 const OutBuf: Pointer; BufSize: Integer);
153
154 const
155 zlib_version = '1.3.2';
156
157 type
158 EZlibError = class(Exception);
159 ECompressionError = class(EZlibError);
160 EDecompressionError = class(EZlibError);
161
--- compat/zlib/contrib/delphi/ZLib.pas
+++ compat/zlib/contrib/delphi/ZLib.pas
@@ -150,11 +150,11 @@
150 BufSize = number of bytes in OutBuf }
151 procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152 const OutBuf: Pointer; BufSize: Integer);
153
154 const
155 zlib_version = '1.4';
156
157 type
158 EZlibError = class(Exception);
159 ECompressionError = class(EZlibError);
160 EDecompressionError = class(EZlibError);
161
--- compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -154,11 +154,11 @@
154154
#region Info tests
155155
[Test]
156156
public void Info_Version()
157157
{
158158
Info info = new Info();
159
- Assert.AreEqual("1.3.2", Info.Version);
159
+ Assert.AreEqual("1.4", Info.Version);
160160
Assert.AreEqual(32, info.SizeOfUInt);
161161
Assert.AreEqual(32, info.SizeOfULong);
162162
Assert.AreEqual(32, info.SizeOfPointer);
163163
Assert.AreEqual(32, info.SizeOfOffset);
164164
}
165165
--- compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -154,11 +154,11 @@
154 #region Info tests
155 [Test]
156 public void Info_Version()
157 {
158 Info info = new Info();
159 Assert.AreEqual("1.3.2", Info.Version);
160 Assert.AreEqual(32, info.SizeOfUInt);
161 Assert.AreEqual(32, info.SizeOfULong);
162 Assert.AreEqual(32, info.SizeOfPointer);
163 Assert.AreEqual(32, info.SizeOfOffset);
164 }
165
--- compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
+++ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -154,11 +154,11 @@
154 #region Info tests
155 [Test]
156 public void Info_Version()
157 {
158 Info info = new Info();
159 Assert.AreEqual("1.4", Info.Version);
160 Assert.AreEqual(32, info.SizeOfUInt);
161 Assert.AreEqual(32, info.SizeOfULong);
162 Assert.AreEqual(32, info.SizeOfPointer);
163 Assert.AreEqual(32, info.SizeOfOffset);
164 }
165
--- compat/zlib/contrib/gcc_gvmat64/CMakeLists.txt
+++ compat/zlib/contrib/gcc_gvmat64/CMakeLists.txt
@@ -1,19 +1,20 @@
1
-enable_language(ASM)
2
-
3
-# Need to push CMAKE_ASM_COMPILE_OBJECT to cache as otherwise it's not
4
-# available in top-level
5
-
6
-set(CMAKE_ASM_COMPILE_OBJECT ${CMAKE_ASM_COMPILE_OBJECT} CACHE INTERNAL "" FORCE)
7
-
8
-if(MSVC)
9
- #cmake 4.1 doesn't consider cl an asm compiler
10
- cmake_policy(SET CMP0194 NEW)
1
+if(MSVC)
2
+ if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.1)
3
+ cmake_policy(SET CMP0194 NEW)
4
+ endif(CMAKE_VERSION VERSION_GREATER_EQUAL 4.1)
5
+
6
+ enable_language(ASM_MASM)
7
+else(MSVC)
8
+ enable_language(ASM)
119
endif(MSVC)
1210
11
+add_library(zlib_gvmat64 OBJECT gvmat64.S)
12
+set_target_properties(zlib_gvmat64 PROPERTIES LINKER_LANGUAGE C)
13
+
1314
if(ZLIB_BUILD_SHARED)
14
- target_sources(zlib PRIVATE gvmat64.S)
15
+ target_sources(zlib PRIVATE $<TARGET_OBJECTS:zlib_gvmat64>)
1516
endif(ZLIB_BUILD_SHARED)
1617
1718
if(ZLIB_BUILD_STATIC)
18
- target_sources(zlibstatic PRIVATE gvmat64.S)
19
+ target_sources(zlibstatic PRIVATE $<TARGET_OBJECTS:zlib_gvmat64>)
1920
endif(ZLIB_BUILD_STATIC)
2021
--- compat/zlib/contrib/gcc_gvmat64/CMakeLists.txt
+++ compat/zlib/contrib/gcc_gvmat64/CMakeLists.txt
@@ -1,19 +1,20 @@
1 enable_language(ASM)
2
3 # Need to push CMAKE_ASM_COMPILE_OBJECT to cache as otherwise it's not
4 # available in top-level
5
6 set(CMAKE_ASM_COMPILE_OBJECT ${CMAKE_ASM_COMPILE_OBJECT} CACHE INTERNAL "" FORCE)
7
8 if(MSVC)
9 #cmake 4.1 doesn't consider cl an asm compiler
10 cmake_policy(SET CMP0194 NEW)
11 endif(MSVC)
12
 
 
 
13 if(ZLIB_BUILD_SHARED)
14 target_sources(zlib PRIVATE gvmat64.S)
15 endif(ZLIB_BUILD_SHARED)
16
17 if(ZLIB_BUILD_STATIC)
18 target_sources(zlibstatic PRIVATE gvmat64.S)
19 endif(ZLIB_BUILD_STATIC)
20
--- compat/zlib/contrib/gcc_gvmat64/CMakeLists.txt
+++ compat/zlib/contrib/gcc_gvmat64/CMakeLists.txt
@@ -1,19 +1,20 @@
1 if(MSVC)
2 if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.1)
3 cmake_policy(SET CMP0194 NEW)
4 endif(CMAKE_VERSION VERSION_GREATER_EQUAL 4.1)
5
6 enable_language(ASM_MASM)
7 else(MSVC)
8 enable_language(ASM)
 
 
9 endif(MSVC)
10
11 add_library(zlib_gvmat64 OBJECT gvmat64.S)
12 set_target_properties(zlib_gvmat64 PROPERTIES LINKER_LANGUAGE C)
13
14 if(ZLIB_BUILD_SHARED)
15 target_sources(zlib PRIVATE $<TARGET_OBJECTS:zlib_gvmat64>)
16 endif(ZLIB_BUILD_SHARED)
17
18 if(ZLIB_BUILD_STATIC)
19 target_sources(zlibstatic PRIVATE $<TARGET_OBJECTS:zlib_gvmat64>)
20 endif(ZLIB_BUILD_STATIC)
21
--- compat/zlib/contrib/infback9/inftree9.c
+++ compat/zlib/contrib/infback9/inftree9.c
@@ -7,11 +7,11 @@
77
#include "inftree9.h"
88
99
#define MAXBITS 15
1010
1111
const char inflate9_copyright[] =
12
- " inflate9 1.3.2 Copyright 1995-2026 Mark Adler ";
12
+ " inflate9 1.4 Copyright 1995-2026 Mark Adler ";
1313
/*
1414
If you use the zlib library in a product, an acknowledgment is welcome
1515
in the documentation of your product. If for some reason you cannot
1616
include such an acknowledgment, I would appreciate that you keep this
1717
copyright string in the executable of your product.
@@ -47,21 +47,21 @@
4747
unsigned mask; /* mask for low root bits */
4848
code this; /* table entry for duplication */
4949
code FAR *next; /* next available space in table */
5050
const unsigned short FAR *base; /* base value table to use */
5151
const unsigned short FAR *extra; /* extra bits table to use */
52
- int end; /* use base and extra for symbol > end */
52
+ unsigned match; /* use base and extra for symbol >= match */
5353
unsigned short count[MAXBITS+1]; /* number of codes of each length */
5454
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
5555
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
5656
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17,
5757
19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
5858
131, 163, 195, 227, 3, 0, 0};
5959
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
6060
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
6161
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
62
- 133, 133, 133, 133, 144, 199, 75};
62
+ 133, 133, 133, 133, 144, 71, 77};
6363
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
6464
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
6565
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
6666
4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
6767
static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
@@ -168,23 +168,21 @@
168168
169169
/* set up for code type */
170170
switch (type) {
171171
case CODES:
172172
base = extra = work; /* dummy value--not used */
173
- end = 19;
173
+ match = 20;
174174
break;
175175
case LENS:
176176
base = lbase;
177
- base -= 257;
178177
extra = lext;
179
- extra -= 257;
180
- end = 256;
178
+ match = 257;
181179
break;
182180
default: /* DISTS */
183181
base = dbase;
184182
extra = dext;
185
- end = -1;
183
+ match = 0;
186184
}
187185
188186
/* initialize state for loop */
189187
huff = 0; /* starting code */
190188
sym = 0; /* starting code symbol */
@@ -203,17 +201,17 @@
203201
204202
/* process all codes and make table entries */
205203
for (;;) {
206204
/* create table entry */
207205
this.bits = (unsigned char)(len - drop);
208
- if ((int)(work[sym]) < end) {
206
+ if ((unsigned)(work[sym]) + 1 < match) {
209207
this.op = (unsigned char)0;
210208
this.val = work[sym];
211209
}
212
- else if ((int)(work[sym]) > end) {
213
- this.op = (unsigned char)(extra[work[sym]]);
214
- this.val = base[work[sym]];
210
+ else if ((work[sym]) >= match) {
211
+ this.op = (unsigned char)(extra[work[sym]- match]);
212
+ this.val = base[work[sym]- match];
215213
}
216214
else {
217215
this.op = (unsigned char)(32 + 64); /* end of block */
218216
this.val = 0;
219217
}
220218
--- compat/zlib/contrib/infback9/inftree9.c
+++ compat/zlib/contrib/infback9/inftree9.c
@@ -7,11 +7,11 @@
7 #include "inftree9.h"
8
9 #define MAXBITS 15
10
11 const char inflate9_copyright[] =
12 " inflate9 1.3.2 Copyright 1995-2026 Mark Adler ";
13 /*
14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot
16 include such an acknowledgment, I would appreciate that you keep this
17 copyright string in the executable of your product.
@@ -47,21 +47,21 @@
47 unsigned mask; /* mask for low root bits */
48 code this; /* table entry for duplication */
49 code FAR *next; /* next available space in table */
50 const unsigned short FAR *base; /* base value table to use */
51 const unsigned short FAR *extra; /* extra bits table to use */
52 int end; /* use base and extra for symbol > end */
53 unsigned short count[MAXBITS+1]; /* number of codes of each length */
54 unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
55 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
56 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17,
57 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
58 131, 163, 195, 227, 3, 0, 0};
59 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
60 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
61 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
62 133, 133, 133, 133, 144, 199, 75};
63 static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
64 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
65 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
66 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
67 static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
@@ -168,23 +168,21 @@
168
169 /* set up for code type */
170 switch (type) {
171 case CODES:
172 base = extra = work; /* dummy value--not used */
173 end = 19;
174 break;
175 case LENS:
176 base = lbase;
177 base -= 257;
178 extra = lext;
179 extra -= 257;
180 end = 256;
181 break;
182 default: /* DISTS */
183 base = dbase;
184 extra = dext;
185 end = -1;
186 }
187
188 /* initialize state for loop */
189 huff = 0; /* starting code */
190 sym = 0; /* starting code symbol */
@@ -203,17 +201,17 @@
203
204 /* process all codes and make table entries */
205 for (;;) {
206 /* create table entry */
207 this.bits = (unsigned char)(len - drop);
208 if ((int)(work[sym]) < end) {
209 this.op = (unsigned char)0;
210 this.val = work[sym];
211 }
212 else if ((int)(work[sym]) > end) {
213 this.op = (unsigned char)(extra[work[sym]]);
214 this.val = base[work[sym]];
215 }
216 else {
217 this.op = (unsigned char)(32 + 64); /* end of block */
218 this.val = 0;
219 }
220
--- compat/zlib/contrib/infback9/inftree9.c
+++ compat/zlib/contrib/infback9/inftree9.c
@@ -7,11 +7,11 @@
7 #include "inftree9.h"
8
9 #define MAXBITS 15
10
11 const char inflate9_copyright[] =
12 " inflate9 1.4 Copyright 1995-2026 Mark Adler ";
13 /*
14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot
16 include such an acknowledgment, I would appreciate that you keep this
17 copyright string in the executable of your product.
@@ -47,21 +47,21 @@
47 unsigned mask; /* mask for low root bits */
48 code this; /* table entry for duplication */
49 code FAR *next; /* next available space in table */
50 const unsigned short FAR *base; /* base value table to use */
51 const unsigned short FAR *extra; /* extra bits table to use */
52 unsigned match; /* use base and extra for symbol >= match */
53 unsigned short count[MAXBITS+1]; /* number of codes of each length */
54 unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
55 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
56 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17,
57 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
58 131, 163, 195, 227, 3, 0, 0};
59 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
60 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
61 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
62 133, 133, 133, 133, 144, 71, 77};
63 static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
64 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
65 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
66 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
67 static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
@@ -168,23 +168,21 @@
168
169 /* set up for code type */
170 switch (type) {
171 case CODES:
172 base = extra = work; /* dummy value--not used */
173 match = 20;
174 break;
175 case LENS:
176 base = lbase;
 
177 extra = lext;
178 match = 257;
 
179 break;
180 default: /* DISTS */
181 base = dbase;
182 extra = dext;
183 match = 0;
184 }
185
186 /* initialize state for loop */
187 huff = 0; /* starting code */
188 sym = 0; /* starting code symbol */
@@ -203,17 +201,17 @@
201
202 /* process all codes and make table entries */
203 for (;;) {
204 /* create table entry */
205 this.bits = (unsigned char)(len - drop);
206 if ((unsigned)(work[sym]) + 1 < match) {
207 this.op = (unsigned char)0;
208 this.val = work[sym];
209 }
210 else if ((work[sym]) >= match) {
211 this.op = (unsigned char)(extra[work[sym]- match]);
212 this.val = base[work[sym]- match];
213 }
214 else {
215 this.op = (unsigned char)(32 + 64); /* end of block */
216 this.val = 0;
217 }
218
--- compat/zlib/contrib/iostream3/CMakeLists.txt
+++ compat/zlib/contrib/iostream3/CMakeLists.txt
@@ -1,14 +1,21 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
iostreamV3
55
VERSION 1.0.0
66
LANGUAGES CXX
77
DESCRIPTION "A library for using C++ IOStreams with zlib V3"
88
HOMEPAGE_URL "https://www.zlib.net")
99
10
+if(ZLIB_BUILD_IOSTREAM3)
11
+ set(ZLIB_IOSTREAM3_BUILD_SHARED ${ZLIB_BUILD_SHARED} CACHE BOOL "")
12
+ set(ZLIB_IOSTREAM3_BUILD_STATIC ${ZLIB_BUILD_STATIC} CACHE BOOL "")
13
+ set(ZLIB_IOSTREAM3_BUILD_TESTING ${ZLIB_BUILD_TESTING} CACHE BOOL "")
14
+ set(ZLIB_IOSTREAM3_INSTALL ${ZLIB_INSTALL} CACHE BOOL "")
15
+endif(ZLIB_BUILD_IOSTREAM3)
16
+
1017
option(ZLIB_IOSTREAM3_BUILD_SHARED "Enable building blast shared library" ON)
1118
option(ZLIB_IOSTREAM3_BUILD_STATIC "Enable building blast static library" ON)
1219
option(ZLIB_IOSTREAM3_BUILD_TESTING "Enable building tests for blast" ON)
1320
option(ZLIB_IOSTREAM3_INSTALL "Enable installation of iostream" ON)
1421
@@ -26,152 +33,84 @@
2633
2734
find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
2835
endif(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
2936
3037
if(WIN32 OR CYGWIN)
31
- set(zlibIOStream3_static_suffix "s")
38
+ set(${ZLIB_CONTRIB_PREFIX}IOStream3_static_suffix "s")
3239
set(CMAKE_DEBUG_POSTFIX "d")
40
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
3341
endif(WIN32 OR CYGWIN)
3442
35
-
36
-function(iostreamv3_findTestEnv testName)
37
- set(testEnv "PATH=")
38
-
39
- if(MSVC OR MINGW)
40
- set(separator "\\\;")
41
- else()
42
- set(separator ":")
43
- endif()
44
-
45
- string(APPEND testEnv "$<TARGET_FILE_DIR:zlib_iostream3_iostreamv3>${separator}")
46
- string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
47
- string(APPEND testEnv "$ENV{PATH}")
48
-
49
- set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
50
-endfunction(iostreamv3_findTestEnv testName)
51
-
5243
if(ZLIB_IOSTREAM3_BUILD_SHARED)
53
- add_library(zlib_iostream3_iostreamv3 SHARED
44
+ add_library(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3 SHARED
5445
zfstream.cc
5546
zfstream.h)
5647
57
- add_library(IOSTREAMV3::IOSTREAMV3 ALIAS zlib_iostream3_iostreamv3)
48
+ add_library(IOSTREAMV3::IOSTREAMV3 ALIAS
49
+ ${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3)
5850
5951
if(NOT CYGWIN)
60
- set_target_properties(zlib_iostream3_iostreamv3
52
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
6153
PROPERTIES
6254
SOVERSION ${iostreamV3_VERSION_MAJOR}
6355
VERSION ${iostreamV3_VERSION})
6456
endif(NOT CYGWIN)
6557
66
- set_target_properties(zlib_iostream3_iostreamv3
58
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
6759
PROPERTIES
6860
EXPORT_NAME IOSTREAMV3
6961
OUTPUT_NAME iostream3)
7062
71
- target_link_libraries(zlib_iostream3_iostreamv3
63
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
7264
PUBLIC ZLIB::ZLIB)
73
-
74
- if(ZLIB_IOSTREAM3_BUILD_TESTING)
75
- enable_testing()
76
-
77
- add_executable(zlib_iostream3_test test.cc zfstream.h)
78
-
79
- target_link_libraries(zlib_iostream3_test
80
- PRIVATE zlib_iostream3_iostreamv3)
81
-
82
- add_test(NAME zlib_iostream3_test COMMAND zlib_iostream3_test)
83
-
84
- set_tests_properties(zlib_iostream3_test
85
- PROPERTIES
86
- FIXTURES_REQUIRED zlib_iostream3_cleanup)
87
-
88
- if(MSVC
89
- OR MSYS
90
- OR MINGW
91
- OR CYGWIN)
92
- iostreamv3_findtestenv(zlib_iostream3_test)
93
- endif(
94
- MSVC
95
- OR MSYS
96
- OR MINGW
97
- OR CYGWIN)
98
- endif(ZLIB_IOSTREAM3_BUILD_TESTING)
9965
endif(ZLIB_IOSTREAM3_BUILD_SHARED)
10066
10167
if(ZLIB_IOSTREAM3_BUILD_STATIC)
102
- add_library(zlib_iostream3_iostreamv3Static STATIC
68
+ add_library(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static STATIC
10369
zfstream.cc
10470
zfstream.h)
10571
10672
add_library(IOSTREAMV3::IOSTREAMV3STATIC
107
- ALIAS zlib_iostream3_iostreamv3Static)
73
+ ALIAS ${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static)
10874
109
- target_link_libraries(zlib_iostream3_iostreamv3Static
75
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static
11076
PUBLIC ZLIB::ZLIBSTATIC)
11177
112
- set_target_properties(zlib_iostream3_iostreamv3Static
78
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static
11379
PROPERTIES
11480
EXPORT_NAME IOSTREAMV3STATIC
115
- OUTPUT_NAME iostream3${zlib_IOStream3_static_suffix})
116
-
117
- if(ZLIB_IOSTREAM3_BUILD_TESTING)
118
- enable_testing()
119
-
120
- add_executable(zlib_iostream3_testStatic test.cc zfstream.h)
121
-
122
- target_link_libraries(zlib_iostream3_testStatic
123
- PRIVATE zlib_iostream3_iostreamv3Static)
124
-
125
- add_test(NAME zlib_iostream3_testStatic
126
- COMMAND zlib_iostream3_testStatic)
127
-
128
- set_tests_properties(zlib_iostream3_testStatic
129
- PROPERTIES
130
- FIXTURES_REQUIRED zlib_iostream3_cleanup)
131
- endif(ZLIB_IOSTREAM3_BUILD_TESTING)
81
+ OUTPUT_NAME
82
+ iostream3${${ZLIB_CONTRIB_PREFIX}IOStream3_static_suffix})
13283
endif(ZLIB_IOSTREAM3_BUILD_STATIC)
133
-
134
-if(ZLIB_IOSTREAM3_BUILD_TESTING)
135
- add_test(NAME zlib_iostream3_cleanup COMMAND ${CMAKE_COMMAND} -E rm
136
- ${CMAKE_CURRENT_BINARY_DIR}/test1.txt.gz
137
- ${CMAKE_CURRENT_BINARY_DIR}/test2.txt.gz)
138
-
139
- set_tests_properties(zlib_iostream3_cleanup
140
- PROPERTIES
141
- FIXTURES_CLEANUP zlib_iostream3_cleanup)
142
-
143
- add_subdirectory(test)
144
-endif(ZLIB_IOSTREAM3_BUILD_TESTING)
145
-
14684
if(ZLIB_IOSTREAM3_INSTALL)
14785
if(ZLIB_IOSTREAM3_BUILD_SHARED)
14886
install(
149
- TARGETS zlib_iostream3_iostreamv3
87
+ TARGETS ${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
15088
COMPONENT Runtime
151
- EXPORT zlibiostream3SharedExport
89
+ EXPORT iostream3SharedExport
15290
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
15391
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
15492
install(
155
- EXPORT zlibiostream3SharedExport
93
+ EXPORT iostream3SharedExport
15694
FILE iostreamv3-shared.cmake
15795
NAMESPACE IOSTREAMV3::
15896
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/iostreamv3)
15997
16098
if(MSVC)
16199
install(
162
- FILES $<TARGET_PDB_FILE:zlib_iostream3_iostreamv3>
100
+ FILES
101
+ $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3>
163102
COMPONENT Development
164103
DESTINATION ${CMAKE_INSTALL_BINDIR}
165104
CONFIGURATIONS Debug OR RelWithDebInfo
166105
OPTIONAL)
167106
endif(MSVC)
168107
endif(ZLIB_IOSTREAM3_BUILD_SHARED)
169108
170109
if(ZLIB_IOSTREAM3_BUILD_STATIC)
171110
install(
172
- TARGETS zlib_iostream3_iostreamv3Static
111
+ TARGETS ${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static
173112
COMPONENT Development
174113
EXPORT iostream3StaticExport
175114
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
176115
install(
177116
EXPORT iostream3StaticExport
@@ -196,5 +135,10 @@
196135
install(
197136
FILES zfstream.h
198137
COMPONENT Development
199138
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
200139
endif(ZLIB_IOSTREAM3_INSTALL)
140
+
141
+if(ZLIB_IOSTREAM3_BUILD_TESTING)
142
+ enable_testing()
143
+ add_subdirectory(test/)
144
+endif(ZLIB_IOSTREAM3_BUILD_TESTING)
201145
--- compat/zlib/contrib/iostream3/CMakeLists.txt
+++ compat/zlib/contrib/iostream3/CMakeLists.txt
@@ -1,14 +1,21 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 iostreamV3
5 VERSION 1.0.0
6 LANGUAGES CXX
7 DESCRIPTION "A library for using C++ IOStreams with zlib V3"
8 HOMEPAGE_URL "https://www.zlib.net")
9
 
 
 
 
 
 
 
10 option(ZLIB_IOSTREAM3_BUILD_SHARED "Enable building blast shared library" ON)
11 option(ZLIB_IOSTREAM3_BUILD_STATIC "Enable building blast static library" ON)
12 option(ZLIB_IOSTREAM3_BUILD_TESTING "Enable building tests for blast" ON)
13 option(ZLIB_IOSTREAM3_INSTALL "Enable installation of iostream" ON)
14
@@ -26,152 +33,84 @@
26
27 find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
28 endif(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
29
30 if(WIN32 OR CYGWIN)
31 set(zlibIOStream3_static_suffix "s")
32 set(CMAKE_DEBUG_POSTFIX "d")
 
33 endif(WIN32 OR CYGWIN)
34
35
36 function(iostreamv3_findTestEnv testName)
37 set(testEnv "PATH=")
38
39 if(MSVC OR MINGW)
40 set(separator "\\\;")
41 else()
42 set(separator ":")
43 endif()
44
45 string(APPEND testEnv "$<TARGET_FILE_DIR:zlib_iostream3_iostreamv3>${separator}")
46 string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
47 string(APPEND testEnv "$ENV{PATH}")
48
49 set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
50 endfunction(iostreamv3_findTestEnv testName)
51
52 if(ZLIB_IOSTREAM3_BUILD_SHARED)
53 add_library(zlib_iostream3_iostreamv3 SHARED
54 zfstream.cc
55 zfstream.h)
56
57 add_library(IOSTREAMV3::IOSTREAMV3 ALIAS zlib_iostream3_iostreamv3)
 
58
59 if(NOT CYGWIN)
60 set_target_properties(zlib_iostream3_iostreamv3
61 PROPERTIES
62 SOVERSION ${iostreamV3_VERSION_MAJOR}
63 VERSION ${iostreamV3_VERSION})
64 endif(NOT CYGWIN)
65
66 set_target_properties(zlib_iostream3_iostreamv3
67 PROPERTIES
68 EXPORT_NAME IOSTREAMV3
69 OUTPUT_NAME iostream3)
70
71 target_link_libraries(zlib_iostream3_iostreamv3
72 PUBLIC ZLIB::ZLIB)
73
74 if(ZLIB_IOSTREAM3_BUILD_TESTING)
75 enable_testing()
76
77 add_executable(zlib_iostream3_test test.cc zfstream.h)
78
79 target_link_libraries(zlib_iostream3_test
80 PRIVATE zlib_iostream3_iostreamv3)
81
82 add_test(NAME zlib_iostream3_test COMMAND zlib_iostream3_test)
83
84 set_tests_properties(zlib_iostream3_test
85 PROPERTIES
86 FIXTURES_REQUIRED zlib_iostream3_cleanup)
87
88 if(MSVC
89 OR MSYS
90 OR MINGW
91 OR CYGWIN)
92 iostreamv3_findtestenv(zlib_iostream3_test)
93 endif(
94 MSVC
95 OR MSYS
96 OR MINGW
97 OR CYGWIN)
98 endif(ZLIB_IOSTREAM3_BUILD_TESTING)
99 endif(ZLIB_IOSTREAM3_BUILD_SHARED)
100
101 if(ZLIB_IOSTREAM3_BUILD_STATIC)
102 add_library(zlib_iostream3_iostreamv3Static STATIC
103 zfstream.cc
104 zfstream.h)
105
106 add_library(IOSTREAMV3::IOSTREAMV3STATIC
107 ALIAS zlib_iostream3_iostreamv3Static)
108
109 target_link_libraries(zlib_iostream3_iostreamv3Static
110 PUBLIC ZLIB::ZLIBSTATIC)
111
112 set_target_properties(zlib_iostream3_iostreamv3Static
113 PROPERTIES
114 EXPORT_NAME IOSTREAMV3STATIC
115 OUTPUT_NAME iostream3${zlib_IOStream3_static_suffix})
116
117 if(ZLIB_IOSTREAM3_BUILD_TESTING)
118 enable_testing()
119
120 add_executable(zlib_iostream3_testStatic test.cc zfstream.h)
121
122 target_link_libraries(zlib_iostream3_testStatic
123 PRIVATE zlib_iostream3_iostreamv3Static)
124
125 add_test(NAME zlib_iostream3_testStatic
126 COMMAND zlib_iostream3_testStatic)
127
128 set_tests_properties(zlib_iostream3_testStatic
129 PROPERTIES
130 FIXTURES_REQUIRED zlib_iostream3_cleanup)
131 endif(ZLIB_IOSTREAM3_BUILD_TESTING)
132 endif(ZLIB_IOSTREAM3_BUILD_STATIC)
133
134 if(ZLIB_IOSTREAM3_BUILD_TESTING)
135 add_test(NAME zlib_iostream3_cleanup COMMAND ${CMAKE_COMMAND} -E rm
136 ${CMAKE_CURRENT_BINARY_DIR}/test1.txt.gz
137 ${CMAKE_CURRENT_BINARY_DIR}/test2.txt.gz)
138
139 set_tests_properties(zlib_iostream3_cleanup
140 PROPERTIES
141 FIXTURES_CLEANUP zlib_iostream3_cleanup)
142
143 add_subdirectory(test)
144 endif(ZLIB_IOSTREAM3_BUILD_TESTING)
145
146 if(ZLIB_IOSTREAM3_INSTALL)
147 if(ZLIB_IOSTREAM3_BUILD_SHARED)
148 install(
149 TARGETS zlib_iostream3_iostreamv3
150 COMPONENT Runtime
151 EXPORT zlibiostream3SharedExport
152 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
153 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
154 install(
155 EXPORT zlibiostream3SharedExport
156 FILE iostreamv3-shared.cmake
157 NAMESPACE IOSTREAMV3::
158 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/iostreamv3)
159
160 if(MSVC)
161 install(
162 FILES $<TARGET_PDB_FILE:zlib_iostream3_iostreamv3>
 
163 COMPONENT Development
164 DESTINATION ${CMAKE_INSTALL_BINDIR}
165 CONFIGURATIONS Debug OR RelWithDebInfo
166 OPTIONAL)
167 endif(MSVC)
168 endif(ZLIB_IOSTREAM3_BUILD_SHARED)
169
170 if(ZLIB_IOSTREAM3_BUILD_STATIC)
171 install(
172 TARGETS zlib_iostream3_iostreamv3Static
173 COMPONENT Development
174 EXPORT iostream3StaticExport
175 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
176 install(
177 EXPORT iostream3StaticExport
@@ -196,5 +135,10 @@
196 install(
197 FILES zfstream.h
198 COMPONENT Development
199 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
200 endif(ZLIB_IOSTREAM3_INSTALL)
 
 
 
 
 
201
--- compat/zlib/contrib/iostream3/CMakeLists.txt
+++ compat/zlib/contrib/iostream3/CMakeLists.txt
@@ -1,14 +1,21 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 iostreamV3
5 VERSION 1.0.0
6 LANGUAGES CXX
7 DESCRIPTION "A library for using C++ IOStreams with zlib V3"
8 HOMEPAGE_URL "https://www.zlib.net")
9
10 if(ZLIB_BUILD_IOSTREAM3)
11 set(ZLIB_IOSTREAM3_BUILD_SHARED ${ZLIB_BUILD_SHARED} CACHE BOOL "")
12 set(ZLIB_IOSTREAM3_BUILD_STATIC ${ZLIB_BUILD_STATIC} CACHE BOOL "")
13 set(ZLIB_IOSTREAM3_BUILD_TESTING ${ZLIB_BUILD_TESTING} CACHE BOOL "")
14 set(ZLIB_IOSTREAM3_INSTALL ${ZLIB_INSTALL} CACHE BOOL "")
15 endif(ZLIB_BUILD_IOSTREAM3)
16
17 option(ZLIB_IOSTREAM3_BUILD_SHARED "Enable building blast shared library" ON)
18 option(ZLIB_IOSTREAM3_BUILD_STATIC "Enable building blast static library" ON)
19 option(ZLIB_IOSTREAM3_BUILD_TESTING "Enable building tests for blast" ON)
20 option(ZLIB_IOSTREAM3_INSTALL "Enable installation of iostream" ON)
21
@@ -26,152 +33,84 @@
33
34 find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
35 endif(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
36
37 if(WIN32 OR CYGWIN)
38 set(${ZLIB_CONTRIB_PREFIX}IOStream3_static_suffix "s")
39 set(CMAKE_DEBUG_POSTFIX "d")
40 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
41 endif(WIN32 OR CYGWIN)
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43 if(ZLIB_IOSTREAM3_BUILD_SHARED)
44 add_library(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3 SHARED
45 zfstream.cc
46 zfstream.h)
47
48 add_library(IOSTREAMV3::IOSTREAMV3 ALIAS
49 ${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3)
50
51 if(NOT CYGWIN)
52 set_target_properties(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
53 PROPERTIES
54 SOVERSION ${iostreamV3_VERSION_MAJOR}
55 VERSION ${iostreamV3_VERSION})
56 endif(NOT CYGWIN)
57
58 set_target_properties(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
59 PROPERTIES
60 EXPORT_NAME IOSTREAMV3
61 OUTPUT_NAME iostream3)
62
63 target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
64 PUBLIC ZLIB::ZLIB)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65 endif(ZLIB_IOSTREAM3_BUILD_SHARED)
66
67 if(ZLIB_IOSTREAM3_BUILD_STATIC)
68 add_library(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static STATIC
69 zfstream.cc
70 zfstream.h)
71
72 add_library(IOSTREAMV3::IOSTREAMV3STATIC
73 ALIAS ${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static)
74
75 target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static
76 PUBLIC ZLIB::ZLIBSTATIC)
77
78 set_target_properties(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static
79 PROPERTIES
80 EXPORT_NAME IOSTREAMV3STATIC
81 OUTPUT_NAME
82 iostream3${${ZLIB_CONTRIB_PREFIX}IOStream3_static_suffix})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83 endif(ZLIB_IOSTREAM3_BUILD_STATIC)
 
 
 
 
 
 
 
 
 
 
 
 
 
84 if(ZLIB_IOSTREAM3_INSTALL)
85 if(ZLIB_IOSTREAM3_BUILD_SHARED)
86 install(
87 TARGETS ${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
88 COMPONENT Runtime
89 EXPORT iostream3SharedExport
90 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
91 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
92 install(
93 EXPORT iostream3SharedExport
94 FILE iostreamv3-shared.cmake
95 NAMESPACE IOSTREAMV3::
96 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/iostreamv3)
97
98 if(MSVC)
99 install(
100 FILES
101 $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3>
102 COMPONENT Development
103 DESTINATION ${CMAKE_INSTALL_BINDIR}
104 CONFIGURATIONS Debug OR RelWithDebInfo
105 OPTIONAL)
106 endif(MSVC)
107 endif(ZLIB_IOSTREAM3_BUILD_SHARED)
108
109 if(ZLIB_IOSTREAM3_BUILD_STATIC)
110 install(
111 TARGETS ${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3Static
112 COMPONENT Development
113 EXPORT iostream3StaticExport
114 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
115 install(
116 EXPORT iostream3StaticExport
@@ -196,5 +135,10 @@
135 install(
136 FILES zfstream.h
137 COMPONENT Development
138 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
139 endif(ZLIB_IOSTREAM3_INSTALL)
140
141 if(ZLIB_IOSTREAM3_BUILD_TESTING)
142 enable_testing()
143 add_subdirectory(test/)
144 endif(ZLIB_IOSTREAM3_BUILD_TESTING)
145
--- compat/zlib/contrib/iostream3/iostream3Config.cmake.in
+++ compat/zlib/contrib/iostream3/iostream3Config.cmake.in
@@ -1,7 +1,5 @@
1
-@PACKAGE_INIT@
2
-
31
set(_iostreamv3_supported_components "shared" "static")
42
include(CMakeFindDependencyMacro)
53
64
if(iostreamv3_FIND_COMPONENTS)
75
find_dependency(ZLIB CONFIG COMPONENTS ${iostreamv3_FIND_COMPONENTS})
@@ -10,14 +8,38 @@
108
if(NOT _comp IN_LIST _iostreamv3_supported_components)
119
set(iostreamv3_FOUND False)
1210
set(iostreamv3_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
1311
endif(NOT _comp IN_LIST _iostreamv3_supported_components)
1412
15
- include("${CMAKE_CURRENT_LIST_DIR}/iostreamv3-${_comp}.cmake")
13
+ include("${CMAKE_CURRENT_LIST_DIR}/iostreamv3-${_comp}.cmake"
14
+ OPTIONAL
15
+ RESULT_VARIABLE _comp_loaded)
16
+
17
+ if(NOT _comp_loaded)
18
+ set(iostreamv3_FOUND False)
19
+ set(iostreamv3_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
20
+ else(NOT _comp_loaded)
21
+ set(iostreamv3_${_comp}_FOUND TRUE)
22
+ endif(NOT _comp_loaded)
1623
endforeach(_comp ${iostreamv3_FIND_COMPONENTS})
1724
else(iostream3_FIND_COMPONENTS)
1825
find_dependency(ZLIB CONFIG)
1926
2027
foreach(_component_config IN LISTS _iostreamv3_supported_components)
21
- include("${CMAKE_CURRENT_LIST_DIR}/iostreamv3-${_component_config}.cmake")
28
+ include("${CMAKE_CURRENT_LIST_DIR}/iostreamv3-${_component_config}.cmake"
29
+ OPTIONAL)
2230
endforeach(_component_config IN LISTS _iostreamv3_supported_components)
31
+
32
+ if(NOT TARGET IOSTREAMV3::IOSTREAMV3)
33
+ set(iostreamv3_FOUND False)
34
+ set(iostreamv3_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
35
+ string(APPEND iostreamv3_NOT_FOUND_MESSAGE "build iostreamv3 with support for shared libs or\n")
36
+ string(APPEND iostreamv3_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
37
+ endif(NOT TARGET IOSTREAMV3::IOSTREAMV3)
38
+
39
+ if(NOT TARGET IOSTREAMV3::IOSTREAMV3STATIC)
40
+ set(iostreamv3_FOUND False)
41
+ set(iostreamv3_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
42
+ string(APPEND iostreamv3_NOT_FOUND_MESSAGE "build iostreamv3 with support for static libs or\n")
43
+ string(APPEND iostreamv3_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
44
+ endif(NOT TARGET IOSTREAMV3::IOSTREAMV3STATIC)
2345
endif(iostreamv3_FIND_COMPONENTS)
2446
--- compat/zlib/contrib/iostream3/iostream3Config.cmake.in
+++ compat/zlib/contrib/iostream3/iostream3Config.cmake.in
@@ -1,7 +1,5 @@
1 @PACKAGE_INIT@
2
3 set(_iostreamv3_supported_components "shared" "static")
4 include(CMakeFindDependencyMacro)
5
6 if(iostreamv3_FIND_COMPONENTS)
7 find_dependency(ZLIB CONFIG COMPONENTS ${iostreamv3_FIND_COMPONENTS})
@@ -10,14 +8,38 @@
10 if(NOT _comp IN_LIST _iostreamv3_supported_components)
11 set(iostreamv3_FOUND False)
12 set(iostreamv3_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
13 endif(NOT _comp IN_LIST _iostreamv3_supported_components)
14
15 include("${CMAKE_CURRENT_LIST_DIR}/iostreamv3-${_comp}.cmake")
 
 
 
 
 
 
 
 
 
16 endforeach(_comp ${iostreamv3_FIND_COMPONENTS})
17 else(iostream3_FIND_COMPONENTS)
18 find_dependency(ZLIB CONFIG)
19
20 foreach(_component_config IN LISTS _iostreamv3_supported_components)
21 include("${CMAKE_CURRENT_LIST_DIR}/iostreamv3-${_component_config}.cmake")
 
22 endforeach(_component_config IN LISTS _iostreamv3_supported_components)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23 endif(iostreamv3_FIND_COMPONENTS)
24
--- compat/zlib/contrib/iostream3/iostream3Config.cmake.in
+++ compat/zlib/contrib/iostream3/iostream3Config.cmake.in
@@ -1,7 +1,5 @@
 
 
1 set(_iostreamv3_supported_components "shared" "static")
2 include(CMakeFindDependencyMacro)
3
4 if(iostreamv3_FIND_COMPONENTS)
5 find_dependency(ZLIB CONFIG COMPONENTS ${iostreamv3_FIND_COMPONENTS})
@@ -10,14 +8,38 @@
8 if(NOT _comp IN_LIST _iostreamv3_supported_components)
9 set(iostreamv3_FOUND False)
10 set(iostreamv3_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
11 endif(NOT _comp IN_LIST _iostreamv3_supported_components)
12
13 include("${CMAKE_CURRENT_LIST_DIR}/iostreamv3-${_comp}.cmake"
14 OPTIONAL
15 RESULT_VARIABLE _comp_loaded)
16
17 if(NOT _comp_loaded)
18 set(iostreamv3_FOUND False)
19 set(iostreamv3_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
20 else(NOT _comp_loaded)
21 set(iostreamv3_${_comp}_FOUND TRUE)
22 endif(NOT _comp_loaded)
23 endforeach(_comp ${iostreamv3_FIND_COMPONENTS})
24 else(iostream3_FIND_COMPONENTS)
25 find_dependency(ZLIB CONFIG)
26
27 foreach(_component_config IN LISTS _iostreamv3_supported_components)
28 include("${CMAKE_CURRENT_LIST_DIR}/iostreamv3-${_component_config}.cmake"
29 OPTIONAL)
30 endforeach(_component_config IN LISTS _iostreamv3_supported_components)
31
32 if(NOT TARGET IOSTREAMV3::IOSTREAMV3)
33 set(iostreamv3_FOUND False)
34 set(iostreamv3_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
35 string(APPEND iostreamv3_NOT_FOUND_MESSAGE "build iostreamv3 with support for shared libs or\n")
36 string(APPEND iostreamv3_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
37 endif(NOT TARGET IOSTREAMV3::IOSTREAMV3)
38
39 if(NOT TARGET IOSTREAMV3::IOSTREAMV3STATIC)
40 set(iostreamv3_FOUND False)
41 set(iostreamv3_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
42 string(APPEND iostreamv3_NOT_FOUND_MESSAGE "build iostreamv3 with support for static libs or\n")
43 string(APPEND iostreamv3_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
44 endif(NOT TARGET IOSTREAMV3::IOSTREAMV3STATIC)
45 endif(iostreamv3_FIND_COMPONENTS)
46
--- compat/zlib/contrib/iostream3/test/CMakeLists.txt
+++ compat/zlib/contrib/iostream3/test/CMakeLists.txt
@@ -1,50 +1,45 @@
11
# if we are built from with zlib, use this path's)
2
-if(DEFINED ZLIB_BUILD_IOSTREAM3)
3
- set(WORK_DIR ${zlib_BINARY_DIR})
4
- set(inst_setup zlib_install)
5
-else(DEFINED ZLIB_BUILD_IOSTREAM3)
6
- set(WORK_DIR ${iostreamV3_BINARY_DIR})
2
+if(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
3
+ set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
74
set(inst_setup zlib_iostream3_install)
85
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
96
107
add_test(
118
NAME zlib_iostream3_install
12
- COMMAND ${CMAKE_COMMAND} --install ${iostreamV3_BINARY_DIR} --prefix
13
- ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
14
- WORKING_DIRECTORY ${iostreamV3_BINARY_DIR})
9
+ COMMAND ${CMAKE_COMMAND}
10
+ --install ${iostreamV3_BINARY_DIR}
11
+ --prefix ${WORK_DIR}/test_install
12
+ --config $<CONFIG>
13
+ WORKING_DIRECTORY ${WORK_DIR})
1514
1615
set_tests_properties(zlib_iostream3_install
1716
PROPERTIES
1817
FIXTURES_SETUP zlib_iostream3_install)
19
-endif(DEFINED ZLIB_BUILD_IOSTREAM3)
20
-
21
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
22
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
23
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
18
+endif(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
2419
2520
configure_file(
2621
${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
27
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
22
+ ${WORK_DIR}/iostream3_find_package_test/CMakeLists.txt @ONLY)
2823
2924
configure_file(
3025
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
31
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
26
+ ${WORK_DIR}/iostream3_add_subdirectory_test/CMakeLists.txt @ONLY)
3227
3328
configure_file(
3429
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
35
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
30
+ ${WORK_DIR}/iostream3_add_subdirectory_exclude_test/CMakeLists.txt
3631
@ONLY)
3732
3833
configure_file(
3934
${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
40
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
35
+ ${WORK_DIR}/iostream3_find_package_no_components_test/CMakeLists.txt
4136
@ONLY)
4237
4338
configure_file(
4439
${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
45
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
40
+ ${WORK_DIR}/iostream3_find_package_wrong_components_test/CMakeLists.txt
4641
@ONLY)
4742
4843
# CMAKE_GENERATOR_PLATFORM doesn't work in the if
4944
set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
5045
@@ -58,23 +53,26 @@
5853
add_test(
5954
NAME zlib_iostream3_find_package_configure
6055
COMMAND
6156
${CMAKE_COMMAND}
6257
${PLATFORM}
63
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
58
+ -B${WORK_DIR}/iostream3_find_package_test_build
6459
-DCMAKE_BUILD_TYPE=$<CONFIG>
6560
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
6661
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
67
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
68
- --fresh
62
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
63
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
64
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
65
+ ${ZLIB_ARG}
66
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
6967
-G "${CMAKE_GENERATOR}"
70
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
68
+ -S${WORK_DIR}/iostream3_find_package_test)
7169
7270
add_test(
7371
NAME zlib_iostream3_find_package_build
7472
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
75
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
73
+ WORKING_DIRECTORY ${WORK_DIR}/iostream3_find_package_test_build)
7674
7775
set_tests_properties(zlib_iostream3_find_package_configure
7876
PROPERTIES
7977
FIXTURES_REQUIRED ${inst_setup}
8078
FIXTURES_SETUP iostream3_fp_config)
@@ -89,29 +87,31 @@
8987
add_test(
9088
NAME zlib_iostream3_add_subdirectory_configure
9189
COMMAND
9290
${CMAKE_COMMAND}
9391
${PLATFORM}
94
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
92
+ -B${WORK_DIR}/iostream3_add_subdirectory_test_build
9593
-DCMAKE_BUILD_TYPE=$<CONFIG>
9694
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
9795
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
98
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install
96
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
97
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
98
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
9999
${ZLIB_ARG}
100
- --fresh
100
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
101101
-G "${CMAKE_GENERATOR}"
102
- -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
102
+ -S${WORK_DIR}/iostream3_add_subdirectory_test)
103103
104104
add_test(
105105
NAME zlib_iostream3_add_subdirectory_build
106106
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
107
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
107
+ WORKING_DIRECTORY ${WORK_DIR}/iostream3_add_subdirectory_test_build)
108108
109109
set_tests_properties(zlib_iostream3_add_subdirectory_configure
110110
PROPERTIES
111111
FIXTURES_REQUIRED ${inst_setup}
112
- FIXTURES_SETUP iostream3as_config)
112
+ FIXTURES_SETUP iostream3_as_config)
113113
114114
set_tests_properties(zlib_iostream3_add_subdirectory_build
115115
PROPERTIES
116116
FIXTURES_REQUIRED iostream3_as_config)
117117
@@ -119,24 +119,29 @@
119119
# add_subdirectory_exclude_test
120120
#
121121
add_test(
122122
NAME zlib_iostream3_add_subdirectory_exclude_configure
123123
COMMAND
124
- ${CMAKE_COMMAND} ${PLATFORM}
125
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
126
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
124
+ ${CMAKE_COMMAND}
125
+ ${PLATFORM}
126
+ -B${WORK_DIR}/iostream3_add_subdirectory_exclude_test_build
127
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
128
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
127129
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
128
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
129
- --fresh
130
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
131
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
132
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
133
+ ${ZLIB_ARG}
134
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
130135
-G "${CMAKE_GENERATOR}"
131
- -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
136
+ -S${WORK_DIR}/iostream3_add_subdirectory_exclude_test)
132137
133138
add_test(
134139
NAME zlib_iostream3_add_subdirectory_exclude_build
135140
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
136141
WORKING_DIRECTORY
137
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
142
+ ${WORK_DIR}/iostream3_add_subdirectory_exclude_test_build)
138143
139144
set_tests_properties(zlib_iostream3_add_subdirectory_exclude_configure
140145
PROPERTIES
141146
FIXTURES_REQUIRED ${inst_setup}
142147
FIXTURES_SETUP iostream3_asx_config)
@@ -144,23 +149,28 @@
144149
set_tests_properties(zlib_iostream3_add_subdirectory_exclude_build
145150
PROPERTIES
146151
FIXTURES_REQUIRED iostream3_asx_config)
147152
148153
#
149
-# findpackage_no_components_test
154
+# find_package_no_components_test
150155
#
151156
add_test(
152157
NAME zlib_iostream3_find_package_no_components_configure
153158
COMMAND
154
- ${CMAKE_COMMAND} ${PLATFORM}
155
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
156
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
159
+ ${CMAKE_COMMAND}
160
+ ${PLATFORM}
161
+ -B${WORK_DIR}/iostream3_find_package_no_components_test_build
162
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
163
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
157164
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
158
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
159
- --fresh
165
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
166
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
167
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
168
+ ${ZLIB_ARG}
169
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
160170
-G "${CMAKE_GENERATOR}"
161
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
171
+ -S${WORK_DIR}/iostream3_find_package_no_components_test)
162172
163173
set_tests_properties(zlib_iostream3_find_package_no_components_configure
164174
PROPERTIES
165175
FIXTURES_REQUIRED ${inst_setup})
166176
@@ -169,23 +179,28 @@
169179
PROPERTIES
170180
WILL_FAIL TRUE)
171181
endif(NOT ZLIB_IOSTREAM3_BUILD_SHARED OR NOT ZLIB_IOSTREAM3_BUILD_STATIC)
172182
173183
#
174
-# findpackage_no_components_test
184
+# find_package_no_components_test
175185
#
176186
add_test(
177187
NAME zlib_iostream3_find_package_wrong_components_configure
178188
COMMAND
179
- ${CMAKE_COMMAND} ${PLATFORM}
180
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
181
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
189
+ ${CMAKE_COMMAND}
190
+ ${PLATFORM}
191
+ -B${WORK_DIR}/iostream3_find_package_wrong_components_test_build
192
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
193
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
182194
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
183
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
184
- --fresh
195
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
196
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
197
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
198
+ ${ZLIB_ARG}
199
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
185200
-G "${CMAKE_GENERATOR}"
186
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
201
+ -S${WORK_DIR}/iostream3_find_package_wrong_components_test)
187202
188203
set_tests_properties(zlib_iostream3_find_package_wrong_components_configure
189204
PROPERTIES
190205
FIXTURES_REQUIRED ${inst_setup}
191206
WILL_FAIL TRUE)
192207
--- compat/zlib/contrib/iostream3/test/CMakeLists.txt
+++ compat/zlib/contrib/iostream3/test/CMakeLists.txt
@@ -1,50 +1,45 @@
1 # if we are built from with zlib, use this path's)
2 if(DEFINED ZLIB_BUILD_IOSTREAM3)
3 set(WORK_DIR ${zlib_BINARY_DIR})
4 set(inst_setup zlib_install)
5 else(DEFINED ZLIB_BUILD_IOSTREAM3)
6 set(WORK_DIR ${iostreamV3_BINARY_DIR})
7 set(inst_setup zlib_iostream3_install)
8 set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
9
10 add_test(
11 NAME zlib_iostream3_install
12 COMMAND ${CMAKE_COMMAND} --install ${iostreamV3_BINARY_DIR} --prefix
13 ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
14 WORKING_DIRECTORY ${iostreamV3_BINARY_DIR})
 
 
15
16 set_tests_properties(zlib_iostream3_install
17 PROPERTIES
18 FIXTURES_SETUP zlib_iostream3_install)
19 endif(DEFINED ZLIB_BUILD_IOSTREAM3)
20
21 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
22 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
23 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
24
25 configure_file(
26 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
27 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
28
29 configure_file(
30 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
31 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
32
33 configure_file(
34 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
35 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
36 @ONLY)
37
38 configure_file(
39 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
40 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
41 @ONLY)
42
43 configure_file(
44 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
45 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
46 @ONLY)
47
48 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
49 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
50
@@ -58,23 +53,26 @@
58 add_test(
59 NAME zlib_iostream3_find_package_configure
60 COMMAND
61 ${CMAKE_COMMAND}
62 ${PLATFORM}
63 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
64 -DCMAKE_BUILD_TYPE=$<CONFIG>
65 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
66 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
67 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
68 --fresh
 
 
 
69 -G "${CMAKE_GENERATOR}"
70 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
71
72 add_test(
73 NAME zlib_iostream3_find_package_build
74 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
75 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
76
77 set_tests_properties(zlib_iostream3_find_package_configure
78 PROPERTIES
79 FIXTURES_REQUIRED ${inst_setup}
80 FIXTURES_SETUP iostream3_fp_config)
@@ -89,29 +87,31 @@
89 add_test(
90 NAME zlib_iostream3_add_subdirectory_configure
91 COMMAND
92 ${CMAKE_COMMAND}
93 ${PLATFORM}
94 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
95 -DCMAKE_BUILD_TYPE=$<CONFIG>
96 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
97 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
98 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install
 
 
99 ${ZLIB_ARG}
100 --fresh
101 -G "${CMAKE_GENERATOR}"
102 -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
103
104 add_test(
105 NAME zlib_iostream3_add_subdirectory_build
106 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
107 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
108
109 set_tests_properties(zlib_iostream3_add_subdirectory_configure
110 PROPERTIES
111 FIXTURES_REQUIRED ${inst_setup}
112 FIXTURES_SETUP iostream3as_config)
113
114 set_tests_properties(zlib_iostream3_add_subdirectory_build
115 PROPERTIES
116 FIXTURES_REQUIRED iostream3_as_config)
117
@@ -119,24 +119,29 @@
119 # add_subdirectory_exclude_test
120 #
121 add_test(
122 NAME zlib_iostream3_add_subdirectory_exclude_configure
123 COMMAND
124 ${CMAKE_COMMAND} ${PLATFORM}
125 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
126 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
127 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
128 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
129 --fresh
 
 
 
130 -G "${CMAKE_GENERATOR}"
131 -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
132
133 add_test(
134 NAME zlib_iostream3_add_subdirectory_exclude_build
135 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
136 WORKING_DIRECTORY
137 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
138
139 set_tests_properties(zlib_iostream3_add_subdirectory_exclude_configure
140 PROPERTIES
141 FIXTURES_REQUIRED ${inst_setup}
142 FIXTURES_SETUP iostream3_asx_config)
@@ -144,23 +149,28 @@
144 set_tests_properties(zlib_iostream3_add_subdirectory_exclude_build
145 PROPERTIES
146 FIXTURES_REQUIRED iostream3_asx_config)
147
148 #
149 # findpackage_no_components_test
150 #
151 add_test(
152 NAME zlib_iostream3_find_package_no_components_configure
153 COMMAND
154 ${CMAKE_COMMAND} ${PLATFORM}
155 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
156 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
157 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
158 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
159 --fresh
 
 
 
160 -G "${CMAKE_GENERATOR}"
161 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
162
163 set_tests_properties(zlib_iostream3_find_package_no_components_configure
164 PROPERTIES
165 FIXTURES_REQUIRED ${inst_setup})
166
@@ -169,23 +179,28 @@
169 PROPERTIES
170 WILL_FAIL TRUE)
171 endif(NOT ZLIB_IOSTREAM3_BUILD_SHARED OR NOT ZLIB_IOSTREAM3_BUILD_STATIC)
172
173 #
174 # findpackage_no_components_test
175 #
176 add_test(
177 NAME zlib_iostream3_find_package_wrong_components_configure
178 COMMAND
179 ${CMAKE_COMMAND} ${PLATFORM}
180 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
181 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
182 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
183 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
184 --fresh
 
 
 
185 -G "${CMAKE_GENERATOR}"
186 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
187
188 set_tests_properties(zlib_iostream3_find_package_wrong_components_configure
189 PROPERTIES
190 FIXTURES_REQUIRED ${inst_setup}
191 WILL_FAIL TRUE)
192
--- compat/zlib/contrib/iostream3/test/CMakeLists.txt
+++ compat/zlib/contrib/iostream3/test/CMakeLists.txt
@@ -1,50 +1,45 @@
1 # if we are built from with zlib, use this path's)
2 if(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
3 set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
 
 
4 set(inst_setup zlib_iostream3_install)
5 set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
6
7 add_test(
8 NAME zlib_iostream3_install
9 COMMAND ${CMAKE_COMMAND}
10 --install ${iostreamV3_BINARY_DIR}
11 --prefix ${WORK_DIR}/test_install
12 --config $<CONFIG>
13 WORKING_DIRECTORY ${WORK_DIR})
14
15 set_tests_properties(zlib_iostream3_install
16 PROPERTIES
17 FIXTURES_SETUP zlib_iostream3_install)
18 endif(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
 
 
 
 
19
20 configure_file(
21 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
22 ${WORK_DIR}/iostream3_find_package_test/CMakeLists.txt @ONLY)
23
24 configure_file(
25 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
26 ${WORK_DIR}/iostream3_add_subdirectory_test/CMakeLists.txt @ONLY)
27
28 configure_file(
29 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
30 ${WORK_DIR}/iostream3_add_subdirectory_exclude_test/CMakeLists.txt
31 @ONLY)
32
33 configure_file(
34 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
35 ${WORK_DIR}/iostream3_find_package_no_components_test/CMakeLists.txt
36 @ONLY)
37
38 configure_file(
39 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
40 ${WORK_DIR}/iostream3_find_package_wrong_components_test/CMakeLists.txt
41 @ONLY)
42
43 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
44 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
45
@@ -58,23 +53,26 @@
53 add_test(
54 NAME zlib_iostream3_find_package_configure
55 COMMAND
56 ${CMAKE_COMMAND}
57 ${PLATFORM}
58 -B${WORK_DIR}/iostream3_find_package_test_build
59 -DCMAKE_BUILD_TYPE=$<CONFIG>
60 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
61 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
62 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
63 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
64 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
65 ${ZLIB_ARG}
66 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
67 -G "${CMAKE_GENERATOR}"
68 -S${WORK_DIR}/iostream3_find_package_test)
69
70 add_test(
71 NAME zlib_iostream3_find_package_build
72 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
73 WORKING_DIRECTORY ${WORK_DIR}/iostream3_find_package_test_build)
74
75 set_tests_properties(zlib_iostream3_find_package_configure
76 PROPERTIES
77 FIXTURES_REQUIRED ${inst_setup}
78 FIXTURES_SETUP iostream3_fp_config)
@@ -89,29 +87,31 @@
87 add_test(
88 NAME zlib_iostream3_add_subdirectory_configure
89 COMMAND
90 ${CMAKE_COMMAND}
91 ${PLATFORM}
92 -B${WORK_DIR}/iostream3_add_subdirectory_test_build
93 -DCMAKE_BUILD_TYPE=$<CONFIG>
94 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
95 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
96 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
97 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
98 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
99 ${ZLIB_ARG}
100 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
101 -G "${CMAKE_GENERATOR}"
102 -S${WORK_DIR}/iostream3_add_subdirectory_test)
103
104 add_test(
105 NAME zlib_iostream3_add_subdirectory_build
106 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
107 WORKING_DIRECTORY ${WORK_DIR}/iostream3_add_subdirectory_test_build)
108
109 set_tests_properties(zlib_iostream3_add_subdirectory_configure
110 PROPERTIES
111 FIXTURES_REQUIRED ${inst_setup}
112 FIXTURES_SETUP iostream3_as_config)
113
114 set_tests_properties(zlib_iostream3_add_subdirectory_build
115 PROPERTIES
116 FIXTURES_REQUIRED iostream3_as_config)
117
@@ -119,24 +119,29 @@
119 # add_subdirectory_exclude_test
120 #
121 add_test(
122 NAME zlib_iostream3_add_subdirectory_exclude_configure
123 COMMAND
124 ${CMAKE_COMMAND}
125 ${PLATFORM}
126 -B${WORK_DIR}/iostream3_add_subdirectory_exclude_test_build
127 -DCMAKE_BUILD_TYPE=$<CONFIG>
128 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
129 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
130 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
131 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
132 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
133 ${ZLIB_ARG}
134 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
135 -G "${CMAKE_GENERATOR}"
136 -S${WORK_DIR}/iostream3_add_subdirectory_exclude_test)
137
138 add_test(
139 NAME zlib_iostream3_add_subdirectory_exclude_build
140 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
141 WORKING_DIRECTORY
142 ${WORK_DIR}/iostream3_add_subdirectory_exclude_test_build)
143
144 set_tests_properties(zlib_iostream3_add_subdirectory_exclude_configure
145 PROPERTIES
146 FIXTURES_REQUIRED ${inst_setup}
147 FIXTURES_SETUP iostream3_asx_config)
@@ -144,23 +149,28 @@
149 set_tests_properties(zlib_iostream3_add_subdirectory_exclude_build
150 PROPERTIES
151 FIXTURES_REQUIRED iostream3_asx_config)
152
153 #
154 # find_package_no_components_test
155 #
156 add_test(
157 NAME zlib_iostream3_find_package_no_components_configure
158 COMMAND
159 ${CMAKE_COMMAND}
160 ${PLATFORM}
161 -B${WORK_DIR}/iostream3_find_package_no_components_test_build
162 -DCMAKE_BUILD_TYPE=$<CONFIG>
163 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
164 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
165 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
166 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
167 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
168 ${ZLIB_ARG}
169 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
170 -G "${CMAKE_GENERATOR}"
171 -S${WORK_DIR}/iostream3_find_package_no_components_test)
172
173 set_tests_properties(zlib_iostream3_find_package_no_components_configure
174 PROPERTIES
175 FIXTURES_REQUIRED ${inst_setup})
176
@@ -169,23 +179,28 @@
179 PROPERTIES
180 WILL_FAIL TRUE)
181 endif(NOT ZLIB_IOSTREAM3_BUILD_SHARED OR NOT ZLIB_IOSTREAM3_BUILD_STATIC)
182
183 #
184 # find_package_no_components_test
185 #
186 add_test(
187 NAME zlib_iostream3_find_package_wrong_components_configure
188 COMMAND
189 ${CMAKE_COMMAND}
190 ${PLATFORM}
191 -B${WORK_DIR}/iostream3_find_package_wrong_components_test_build
192 -DCMAKE_BUILD_TYPE=$<CONFIG>
193 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
194 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
195 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
196 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
197 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
198 ${ZLIB_ARG}
199 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
200 -G "${CMAKE_GENERATOR}"
201 -S${WORK_DIR}/iostream3_find_package_wrong_components_test)
202
203 set_tests_properties(zlib_iostream3_find_package_wrong_components_configure
204 PROPERTIES
205 FIXTURES_REQUIRED ${inst_setup}
206 WILL_FAIL TRUE)
207
--- compat/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
iostream_add_subdirectory_exclude
55
LANGUAGES CXX
66
VERSION @iostreamV3_VERSION@)
77
--- compat/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 iostream_add_subdirectory_exclude
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 iostream_add_subdirectory_exclude
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
iostream_add_subdirectory
55
LANGUAGES CXX
66
VERSION @iostreamV3_VERSION@)
77
--- compat/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 iostream_add_subdirectory
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 iostream_add_subdirectory
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
iostream_find_package_no_components
55
LANGUAGES CXX
66
VERSION @iostreamV3_VERSION@)
77
--- compat/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 iostream_find_package_no_components
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 iostream_find_package_no_components
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/find_package_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
iostream_find_package
55
LANGUAGES CXX
66
VERSION @iostreamV3_VERSION@)
77
--- compat/zlib/contrib/iostream3/test/find_package_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 iostream_find_package
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/find_package_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 iostream_find_package
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
iostream_find_package
55
LANGUAGES CXX
66
VERSION @iostreamV3_VERSION@)
77
--- compat/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 iostream_find_package
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 iostream_find_package
5 LANGUAGES CXX
6 VERSION @iostreamV3_VERSION@)
7
--- compat/zlib/contrib/minizip/CMakeLists.txt
+++ compat/zlib/contrib/minizip/CMakeLists.txt
@@ -1,19 +1,14 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
minizip
55
VERSION 1.0.0
66
LANGUAGES C
77
DESCRIPTION "A library for creating zipfiles based in zlib"
88
HOMEPAGE_URL "https://www.winimage.com/zLibDll/minizip.html")
99
10
-if(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
11
- message(WARNING "libminizip needs 64bit - stopping here")
12
- return()
13
-endif(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
14
-
1510
# ============================================================================
1611
# CPack
1712
# ============================================================================
1813
set(CPACK_PACKAGE_VENDOR "zlib-Project")
1914
set(CPACK_PACKAGE_DESCRIPTION_FILE ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
@@ -24,11 +19,11 @@
2419
# set options if build from zlib
2520
# ============================================================================
2621
if(ZLIB_BUILD_MINIZIP)
2722
set(MINIZIP_BUILD_SHARED ${ZLIB_MINIZIP_BUILD_SHARED} CACHE BOOL "")
2823
set(MINIZIP_BUILD_STATIC ${ZLIB_MINIZIP_BUILD_STATIC} CACHE BOOL "")
29
- set(MINIZIP_BUILD_TESTING ${ZLIB_MINIZIP_INSTALL} CACHE BOOL "")
24
+ set(MINIZIP_BUILD_TESTING ${ZLIB_MINIZIP_BUILD_TESTING} CACHE BOOL "")
3025
set(MINIZIP_INSTALL ${ZLIB_MINIZIP_INSTALL} CACHE BOOL "")
3126
endif(ZLIB_BUILD_MINIZIP)
3227
3328
# ============================================================================
3429
# configuration
@@ -38,11 +33,11 @@
3833
option(MINIZIP_BUILD_TESTING "Enable testing of minizip" ON)
3934
option(MINIZIP_ENABLE_BZIP2 "Build minizip with bzip2 support" OFF)
4035
option(MINIZIP_INSTALL "Enable installation of minizip" ON)
4136
4237
include(CheckCSourceCompiles)
43
-include(CheckFunctionExists)
38
+include(CheckSymbolExists)
4439
include(CheckIncludeFile)
4540
include(CMakePackageConfigHelpers)
4641
include(CheckTypeSize)
4742
include(GNUInstallDirs)
4843
@@ -67,16 +62,16 @@
6762
endif(MINIZIP_ENABLE_BZIP2)
6863
6964
#
7065
# Check for fopen64
7166
#
72
-check_function_exists(fopen64 HAVE_FOPEN64)
67
+check_symbol_exists(fopen64 stdio.h HAVE_FOPEN64)
7368
7469
#
7570
# Check for fseeko
7671
#
77
-check_function_exists(fseeko HAVE_FSEEKO)
72
+check_symbol_exists(fseeko stdio.h HAVE_FSEEKO)
7873
7974
#
8075
# Check for unistd.h
8176
#
8277
check_include_file(unistd.h HAVE_UNISTD_H)
@@ -105,155 +100,262 @@
105100
"
106101
HAVE___ATTR__VIS_HIDDEN)
107102
108103
unset(CMAKE_REQUIRED_FLAGS)
109104
110
-set(LIBMINIZIP_SRCS ioapi.c mztools.c unzip.c zip.c)
111
-
112
-set(LIBMINIZIP_HDRS crypt.h ints.h ioapi.h mztools.h unzip.h zip.h)
113
-
114
-set(MINIZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> minizip.c zip.c)
115
-
116
-set(MINIZIP_HDRS crypt.h ints.h ioapi.h $<$<BOOL:${WIN32}>:iowin32.h> skipset.h
117
- zip.h)
118
-
119
-set(MINIUNZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> miniunz.c unzip.c
120
- zip.c)
105
+set(LIBMINIZIP_SRCS
106
+ ioapi.c
107
+ mztools.c
108
+ unzip.c
109
+ zip.c
110
+ $<$<BOOL:${WIN32}>:iowin32.c>)
111
+
112
+set(LIBMINIZIP_HDRS
113
+ crypt.h
114
+ ints.h
115
+ ioapi.h
116
+ mztools.h
117
+ unzip.h
118
+ zip.h
119
+ $<$<BOOL:${WIN32}>:${minizip_SOURCE_DIR}/iowin32.h>)
120
+
121
+set(MINIZIP_SRCS
122
+ ioapi.c
123
+ minizip.c
124
+ zip.c)
125
+
126
+set(MINIZIP_HDRS
127
+ crypt.h
128
+ ints.h
129
+ ioapi.h
130
+ skipset.h
131
+ zip.h)
132
+
133
+set(MINIUNZIP_SRCS
134
+ ioapi.c
135
+ miniunz.c
136
+ unzip.c
137
+ zip.c)
121138
122139
set(MINIUNZIP_HDRS
123140
crypt.h
124141
ints.h
125142
ioapi.h
126
- $<$<BOOL:${WIN32}>:iowin32.h>
127143
skipset.h
128144
unzip.h
129145
zip.h)
130146
147
+set(LIBMINIZIP_PC ${minizip_BINARY_DIR}/minizip.pc)
148
+configure_file(${minizip_SOURCE_DIR}/minizip.pc.txt ${LIBMINIZIP_PC} @ONLY)
149
+
131150
if(WIN32 OR CYGWIN)
132151
set(minizip_static_suffix "s")
133152
set(CMAKE_DEBUG_POSTFIX "d")
153
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
134154
endif(WIN32 OR CYGWIN)
135155
136156
if(MINIZIP_BUILD_SHARED)
137
- set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
138
- add_library(libminizip SHARED ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS})
139
- add_library(MINIZIP::minizip ALIAS libminizip)
140
- target_include_directories(
141
- libminizip PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
142
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
143
- target_compile_definitions(
144
- libminizip
145
- PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
146
- $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
147
- $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
148
- PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
149
- $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
150
- $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
151
-
152
- if(NOT CYGWIN)
153
- set_target_properties(libminizip PROPERTIES SOVERSION
154
- ${minizip_VERSION_MAJOR})
155
- endif(NOT CYGWIN)
156
-
157
- set_target_properties(
158
- libminizip
159
- PROPERTIES EXPORT_NAME minizip
160
- OUTPUT_NAME minizip
161
- VERSION ${minizip_VERSION}
162
- SOVERSION ${minizip_VERSION_MAJOR})
163
-
164
- target_link_libraries(libminizip
165
- PUBLIC ZLIB::ZLIB
157
+ add_library(${ZLIB_CONTRIB_PREFIX}libminizip SHARED
158
+ ${LIBMINIZIP_SRCS}
159
+ ${LIBMINIZIP_HDRS})
160
+ add_library(MINIZIP::minizip ALIAS ${ZLIB_CONTRIB_PREFIX}libminizip)
161
+ target_include_directories(${ZLIB_CONTRIB_PREFIX}libminizip
162
+ PUBLIC
163
+ $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
164
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
165
+ target_compile_definitions(${ZLIB_CONTRIB_PREFIX}libminizip
166
+ PRIVATE
167
+ $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
168
+ $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
169
+ $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
170
+ PUBLIC
171
+ $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
172
+ $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
173
+ $<$<AND:$<NOT:$<BOOL:${HAVE_FOPEN64}>>,$<NOT:$<BOOL:${MSVC}>>>:USE_FILE32API=1>)
174
+
175
+ if(CYGWIN)
176
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
177
+ PROPERTIES
178
+ PREFIX "lib")
179
+ else(CYGWIN)
180
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
181
+ PROPERTIES
182
+ SOVERSION ${zlib_VERSION_MAJOR}
183
+ VERSION ${INSTALL_VERSION})
184
+ endif(CYGWIN)
185
+
186
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
187
+ PROPERTIES
188
+ EXPORT_NAME minizip
189
+ PUBLIC_HEADER "${LIBMINIZIP_HDRS}")
190
+
191
+ if(MSVC)
192
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
193
+ PROPERTIES
194
+ OUTPUT_NAME libminizip)
195
+ else(MSVC)
196
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
197
+ PROPERTIES
198
+ OUTPUT_NAME minizip)
199
+ endif(MSVC)
200
+
201
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}libminizip
202
+ PUBLIC
203
+ ZLIB::ZLIB
166204
$<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
167205
168
- add_executable(minizip ${MINIZIP_SRCS} ${MINIZIP_HDRS})
169
- set_target_properties(minizip PROPERTIES EXPORT_NAME minizip_executable)
170
- target_compile_definitions(
171
- minizip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
172
- target_link_libraries(minizip PRIVATE MINIZIP::minizip)
173
- add_executable(miniunzip ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS})
174
- set_target_properties(miniunzip PROPERTIES EXPORT_NAME miniunzip_executable)
175
- target_compile_definitions(
176
- miniunzip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
177
- target_link_libraries(miniunzip PRIVATE MINIZIP::minizip)
206
+ add_executable(${ZLIB_CONTRIB_PREFIX}minizip
207
+ ${MINIZIP_SRCS}
208
+ ${MINIZIP_HDRS}
209
+ $<$<BOOL:${WIN32}>:iowin32.h>)
210
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}minizip
211
+ PROPERTIES
212
+ EXPORT_NAME minizip_executable
213
+ OUTPUT_NAME minizip)
214
+ target_compile_definitions(${ZLIB_CONTRIB_PREFIX}minizip
215
+ PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
216
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}minizip
217
+ PRIVATE MINIZIP::minizip)
218
+ add_executable(${ZLIB_CONTRIB_PREFIX}miniunzip
219
+ ${MINIUNZIP_SRCS}
220
+ ${MINIUNZIP_HDRS}
221
+ $<$<BOOL:${WIN32}>:iowin32.c>
222
+ $<$<BOOL:${WIN32}>:iowin32.h>)
223
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}miniunzip
224
+ PROPERTIES
225
+ EXPORT_NAME miniunzip_executable
226
+ OUTPUT_NAME miniunzip)
227
+ target_compile_definitions(${ZLIB_CONTRIB_PREFIX}miniunzip
228
+ PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
229
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}miniunzip
230
+ PRIVATE MINIZIP::minizip)
178231
endif(MINIZIP_BUILD_SHARED)
179232
180233
if(MINIZIP_BUILD_STATIC)
181
- add_library(libminizipstatic STATIC ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS})
182
- add_library(MINIZIP::minizipstatic ALIAS libminizipstatic)
183
- target_include_directories(
184
- libminizipstatic
185
- PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
186
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
187
- target_compile_definitions(
188
- libminizipstatic
189
- PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
190
- $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
191
- $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
192
- PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
193
- $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
194
- $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
195
- set_target_properties(
196
- libminizipstatic PROPERTIES EXPORT_NAME minizipstatic
197
- OUTPUT_NAME minizip${minizip_static_suffix})
234
+ add_library(${ZLIB_CONTRIB_PREFIX}libminizipstatic
235
+ STATIC
236
+ ${LIBMINIZIP_SRCS}
237
+ ${LIBMINIZIP_HDRS})
238
+ add_library(MINIZIP::minizipstatic ALIAS
239
+ ${ZLIB_CONTRIB_PREFIX}libminizipstatic)
240
+ target_include_directories(${ZLIB_CONTRIB_PREFIX}libminizipstatic
241
+ PUBLIC
242
+ $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
243
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
244
+ target_compile_definitions(${ZLIB_CONTRIB_PREFIX}libminizipstatic
245
+ PRIVATE
246
+ $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
247
+ $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
248
+ $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
249
+ PUBLIC
250
+ $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
251
+ $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
252
+ $<$<AND:$<NOT:$<BOOL:${HAVE_FOPEN64}>>,$<NOT:$<BOOL:${MSVC}>>>:USE_FILE32API=1>)
253
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
254
+ PROPERTIES
255
+ EXPORT_NAME minizipstatic
256
+ PUBLIC_HEADER "${LIBMINIZIP_HDRS}")
257
+
258
+ if(CYGWIN)
259
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
260
+ PROPERTIES
261
+ PREFIX "lib")
262
+ endif(CYGWIN)
263
+
264
+ if(MSVC)
265
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
266
+ PROPERTIES
267
+ ARCHIVE_OUTPUT_NAME libminizip${minizip_static_suffix})
268
+ else(MSVC)
269
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
270
+ PROPERTIES
271
+ ARCHIVE_OUTPUT_NAME minizip${minizip_static_suffix})
272
+ endif(MSVC)
198273
199274
if(CYGWIN)
200
- set_target_properties(libminizipstatic PROPERTIES SUFFIX ".dll.a")
275
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
276
+ PROPERTIES
277
+ SUFFIX ".dll.a")
201278
endif(CYGWIN)
202279
203
- target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC
204
- $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
205
-
206
- add_executable(minizipstatic ${MINIZIP_SRCS} ${MINIZIP_HDRS})
207
- set_target_properties(minizipstatic PROPERTIES EXPORT_NAME
208
- minizip_static_executable)
209
- target_compile_definitions(
210
- minizipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
211
- target_link_libraries(minizipstatic PRIVATE MINIZIP::minizipstatic)
212
- add_executable(miniunzipstatic ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS})
213
- set_target_properties(miniunzipstatic
214
- PROPERTIES EXPORT_NAME miniunzip_static_executable)
215
- target_compile_definitions(
216
- miniunzipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
217
- target_link_libraries(miniunzipstatic PRIVATE MINIZIP::minizipstatic)
280
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}libminizipstatic
281
+ PUBLIC
282
+ ZLIB::ZLIBSTATIC
283
+ $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
284
+
285
+ add_executable(${ZLIB_CONTRIB_PREFIX}minizipstatic
286
+ ${MINIZIP_SRCS}
287
+ ${MINIZIP_HDRS}
288
+ $<$<BOOL:${WIN32}>:iowin32.h>)
289
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}minizipstatic
290
+ PROPERTIES
291
+ EXPORT_NAME minizip_static_executable
292
+ OUTPUT_NAME minizipstatic)
293
+ target_compile_definitions(${ZLIB_CONTRIB_PREFIX}minizipstatic
294
+ PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
295
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}minizipstatic
296
+ PRIVATE MINIZIP::minizipstatic)
297
+ add_executable(${ZLIB_CONTRIB_PREFIX}miniunzipstatic
298
+ ${MINIUNZIP_SRCS}
299
+ ${MINIUNZIP_HDRS}
300
+ $<$<BOOL:${WIN32}>:iowin32.c>
301
+ $<$<BOOL:${WIN32}>:iowin32.h>)
302
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}miniunzipstatic
303
+ PROPERTIES
304
+ EXPORT_NAME miniunzip_static_executable
305
+ OUTPUT_NAME miniunzipstatic)
306
+ target_compile_definitions(${ZLIB_CONTRIB_PREFIX}miniunzipstatic
307
+ PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
308
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}miniunzipstatic
309
+ PRIVATE MINIZIP::minizipstatic)
218310
endif(MINIZIP_BUILD_STATIC)
219311
220312
if(MINIZIP_INSTALL)
221313
if(MINIZIP_BUILD_SHARED)
222314
install(
223
- TARGETS libminizip minizip miniunzip
315
+ TARGETS
316
+ ${ZLIB_CONTRIB_PREFIX}libminizip
317
+ ${ZLIB_CONTRIB_PREFIX}minizip
318
+ ${ZLIB_CONTRIB_PREFIX}miniunzip
224319
COMPONENT Runtime
225320
EXPORT minizipSharedExport
226321
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
227322
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
228
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
323
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
324
+ PUBLIC_HEADER
325
+ COMPONENT Development
326
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/minizip")
229327
install(
230328
EXPORT minizipSharedExport
231329
FILE minizip-shared.cmake
232330
NAMESPACE MINIZIP::
233331
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
234332
235333
if(MSVC)
236334
install(
237
- FILES $<TARGET_PDB_FILE:libminizip>
335
+ FILES $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}libminizip>
238336
COMPONENT Runtime
239337
DESTINATION ${CMAKE_INSTALL_BINDIR}
240338
CONFIGURATIONS Debug OR RelWithDebInfo
241339
OPTIONAL)
242340
endif(MSVC)
243341
endif(MINIZIP_BUILD_SHARED)
244342
245343
if(MINIZIP_BUILD_STATIC)
246344
install(
247
- TARGETS libminizipstatic
345
+ TARGETS
346
+ ${ZLIB_CONTRIB_PREFIX}libminizipstatic
347
+ ${ZLIB_CONTRIB_PREFIX}minizipstatic
348
+ ${ZLIB_CONTRIB_PREFIX}miniunzipstatic
248349
COMPONENT Development
249
- TARGETS minizipstatic miniunzipstatic
250
- COMPONENT Runtime
251350
EXPORT minizipStaticExport
252
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
351
+ RUNTIME
352
+ DESTINATION "${CMAKE_INSTALL_BINDIR}"
353
+ COMPONENT Runtime
253354
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
254
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
355
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
356
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/minizip")
255357
install(
256358
EXPORT minizipStaticExport
257359
FILE minizip-static.cmake
258360
NAMESPACE MINIZIP::
259361
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
@@ -269,119 +371,14 @@
269371
COMPATIBILITY AnyNewerVersion)
270372
install(FILES ${minizip_BINARY_DIR}/minizipConfig.cmake
271373
${minizip_BINARY_DIR}/minizipConfigVersion.cmake
272374
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
273375
install(
274
- FILES ${LIBMINIZIP_HDRS}
376
+ FILES ${LIBMINIZIP_PC}
275377
COMPONENT Development
276
- DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
378
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
277379
endif(MINIZIP_INSTALL)
278380
279381
if(MINIZIP_BUILD_TESTING)
280382
enable_testing()
281
-
282
- if(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL
283
- ".dll")
284
- add_test(
285
- NAME minizip_prepare_shared_zip
286
- COMMAND ${CMAKE_COMMAND} -DCREATE_SHARED=ON -P
287
- ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
288
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
289
- add_test(
290
- NAME minizip_zipping_test_file_shared
291
- COMMAND minizip test_file_shared.zip test_file_shared.txt
292
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
293
- add_test(
294
- NAME minizip_prepare_shared_unzip
295
- COMMAND ${CMAKE_COMMAND} -DMOVE_SHARED=ON -P
296
- ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
297
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
298
- add_test(
299
- NAME minizip_miniunzipping_test_file_shared.zip
300
- COMMAND miniunzip test_file_shared.zip
301
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
302
- add_test(
303
- NAME minizip_compare_shared
304
- COMMAND ${CMAKE_COMMAND} -E compare_files test_file_shared.txt
305
- test_file_shared.orig
306
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
307
- add_test(
308
- NAME minizip_clean_shared_zip
309
- COMMAND ${CMAKE_COMMAND} -DDELETE_SHARED=ON -P
310
- ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
311
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
312
- set_tests_properties(minizip_prepare_shared_zip
313
- PROPERTIES FIXTURES_SETUP prepare_shared)
314
- set_tests_properties(
315
- minizip_zipping_test_file_shared
316
- PROPERTIES FIXTURES_REQUIRED prepare_shared FIXTURES_SETUP
317
- zip_shared)
318
- set_tests_properties(
319
- minizip_prepare_shared_unzip
320
- PROPERTIES FIXTURES_REQUIRED zip_shared FIXTURES_SETUP
321
- prepare_unzip_shared)
322
- set_tests_properties(
323
- minizip_miniunzipping_test_file_shared.zip
324
- PROPERTIES FIXTURES_REQUIRED prepare_unzip_shared FIXTURES_SETUP
325
- prepare_compare_shared)
326
- set_tests_properties(
327
- minizip_compare_shared
328
- PROPERTIES FIXTURES_REQUIRED prepare_compare_shared FIXTURES_SETUP
329
- compared_shared)
330
- set_tests_properties(minizip_clean_shared_zip
331
- PROPERTIES FIXTURES_CLEANUP compared_shared)
332
- endif(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL
333
- ".dll")
334
-
335
- if(MINIZIP_BUILD_STATIC)
336
- add_test(
337
- NAME minizip_prepare_static_zip
338
- COMMAND ${CMAKE_COMMAND} -DCREATE_STATIC=ON -P
339
- ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
340
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
341
- add_test(
342
- NAME minizip_zipping_test_file_static
343
- COMMAND minizipstatic test_file_static.zip test_file_static.txt
344
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
345
- add_test(
346
- NAME minizip_prepare_static_unzip
347
- COMMAND ${CMAKE_COMMAND} -DMOVE_STATIC=ON -P
348
- ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
349
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
350
- add_test(
351
- NAME minizip_miniunzipping_test_file_static.zip
352
- COMMAND miniunzipstatic test_file_static.zip
353
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
354
- add_test(
355
- NAME minizip_compare_static
356
- COMMAND ${CMAKE_COMMAND} -E compare_files test_file_static.txt
357
- test_file_static.orig
358
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
359
- add_test(
360
- NAME minizip_clean_static_zip
361
- COMMAND ${CMAKE_COMMAND} -DDELETE_STATIC=ON -P
362
- ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
363
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
364
- set_tests_properties(minizip_prepare_static_zip
365
- PROPERTIES FIXTURES_SETUP prepare_static)
366
- set_tests_properties(
367
- minizip_zipping_test_file_static
368
- PROPERTIES FIXTURES_REQUIRED prepare_static FIXTURES_SETUP
369
- zip_static)
370
- set_tests_properties(
371
- minizip_prepare_static_unzip
372
- PROPERTIES FIXTURES_REQUIRED zip_static FIXTURES_SETUP
373
- prepare_unzip_static)
374
- set_tests_properties(
375
- minizip_miniunzipping_test_file_static.zip
376
- PROPERTIES FIXTURES_REQUIRED prepare_unzip_static FIXTURES_SETUP
377
- prepare_compare_static)
378
- set_tests_properties(
379
- minizip_compare_static
380
- PROPERTIES FIXTURES_REQUIRED prepare_compare_static FIXTURES_SETUP
381
- compared_static)
382
- set_tests_properties(minizip_clean_static_zip
383
- PROPERTIES FIXTURES_CLEANUP compared_static)
384
- endif(MINIZIP_BUILD_STATIC)
385
-
386383
add_subdirectory(test)
387384
endif(MINIZIP_BUILD_TESTING)
388385
--- compat/zlib/contrib/minizip/CMakeLists.txt
+++ compat/zlib/contrib/minizip/CMakeLists.txt
@@ -1,19 +1,14 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 minizip
5 VERSION 1.0.0
6 LANGUAGES C
7 DESCRIPTION "A library for creating zipfiles based in zlib"
8 HOMEPAGE_URL "https://www.winimage.com/zLibDll/minizip.html")
9
10 if(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
11 message(WARNING "libminizip needs 64bit - stopping here")
12 return()
13 endif(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
14
15 # ============================================================================
16 # CPack
17 # ============================================================================
18 set(CPACK_PACKAGE_VENDOR "zlib-Project")
19 set(CPACK_PACKAGE_DESCRIPTION_FILE ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
@@ -24,11 +19,11 @@
24 # set options if build from zlib
25 # ============================================================================
26 if(ZLIB_BUILD_MINIZIP)
27 set(MINIZIP_BUILD_SHARED ${ZLIB_MINIZIP_BUILD_SHARED} CACHE BOOL "")
28 set(MINIZIP_BUILD_STATIC ${ZLIB_MINIZIP_BUILD_STATIC} CACHE BOOL "")
29 set(MINIZIP_BUILD_TESTING ${ZLIB_MINIZIP_INSTALL} CACHE BOOL "")
30 set(MINIZIP_INSTALL ${ZLIB_MINIZIP_INSTALL} CACHE BOOL "")
31 endif(ZLIB_BUILD_MINIZIP)
32
33 # ============================================================================
34 # configuration
@@ -38,11 +33,11 @@
38 option(MINIZIP_BUILD_TESTING "Enable testing of minizip" ON)
39 option(MINIZIP_ENABLE_BZIP2 "Build minizip with bzip2 support" OFF)
40 option(MINIZIP_INSTALL "Enable installation of minizip" ON)
41
42 include(CheckCSourceCompiles)
43 include(CheckFunctionExists)
44 include(CheckIncludeFile)
45 include(CMakePackageConfigHelpers)
46 include(CheckTypeSize)
47 include(GNUInstallDirs)
48
@@ -67,16 +62,16 @@
67 endif(MINIZIP_ENABLE_BZIP2)
68
69 #
70 # Check for fopen64
71 #
72 check_function_exists(fopen64 HAVE_FOPEN64)
73
74 #
75 # Check for fseeko
76 #
77 check_function_exists(fseeko HAVE_FSEEKO)
78
79 #
80 # Check for unistd.h
81 #
82 check_include_file(unistd.h HAVE_UNISTD_H)
@@ -105,155 +100,262 @@
105 "
106 HAVE___ATTR__VIS_HIDDEN)
107
108 unset(CMAKE_REQUIRED_FLAGS)
109
110 set(LIBMINIZIP_SRCS ioapi.c mztools.c unzip.c zip.c)
111
112 set(LIBMINIZIP_HDRS crypt.h ints.h ioapi.h mztools.h unzip.h zip.h)
113
114 set(MINIZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> minizip.c zip.c)
115
116 set(MINIZIP_HDRS crypt.h ints.h ioapi.h $<$<BOOL:${WIN32}>:iowin32.h> skipset.h
117 zip.h)
118
119 set(MINIUNZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> miniunz.c unzip.c
120 zip.c)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
122 set(MINIUNZIP_HDRS
123 crypt.h
124 ints.h
125 ioapi.h
126 $<$<BOOL:${WIN32}>:iowin32.h>
127 skipset.h
128 unzip.h
129 zip.h)
130
 
 
 
131 if(WIN32 OR CYGWIN)
132 set(minizip_static_suffix "s")
133 set(CMAKE_DEBUG_POSTFIX "d")
 
134 endif(WIN32 OR CYGWIN)
135
136 if(MINIZIP_BUILD_SHARED)
137 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
138 add_library(libminizip SHARED ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS})
139 add_library(MINIZIP::minizip ALIAS libminizip)
140 target_include_directories(
141 libminizip PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
142 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
143 target_compile_definitions(
144 libminizip
145 PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
146 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
147 $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
148 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
149 $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
150 $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
151
152 if(NOT CYGWIN)
153 set_target_properties(libminizip PROPERTIES SOVERSION
154 ${minizip_VERSION_MAJOR})
155 endif(NOT CYGWIN)
156
157 set_target_properties(
158 libminizip
159 PROPERTIES EXPORT_NAME minizip
160 OUTPUT_NAME minizip
161 VERSION ${minizip_VERSION}
162 SOVERSION ${minizip_VERSION_MAJOR})
163
164 target_link_libraries(libminizip
165 PUBLIC ZLIB::ZLIB
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166 $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
167
168 add_executable(minizip ${MINIZIP_SRCS} ${MINIZIP_HDRS})
169 set_target_properties(minizip PROPERTIES EXPORT_NAME minizip_executable)
170 target_compile_definitions(
171 minizip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
172 target_link_libraries(minizip PRIVATE MINIZIP::minizip)
173 add_executable(miniunzip ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS})
174 set_target_properties(miniunzip PROPERTIES EXPORT_NAME miniunzip_executable)
175 target_compile_definitions(
176 miniunzip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
177 target_link_libraries(miniunzip PRIVATE MINIZIP::minizip)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178 endif(MINIZIP_BUILD_SHARED)
179
180 if(MINIZIP_BUILD_STATIC)
181 add_library(libminizipstatic STATIC ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS})
182 add_library(MINIZIP::minizipstatic ALIAS libminizipstatic)
183 target_include_directories(
184 libminizipstatic
185 PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
186 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
187 target_compile_definitions(
188 libminizipstatic
189 PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
190 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
191 $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
192 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
193 $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
194 $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
195 set_target_properties(
196 libminizipstatic PROPERTIES EXPORT_NAME minizipstatic
197 OUTPUT_NAME minizip${minizip_static_suffix})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
199 if(CYGWIN)
200 set_target_properties(libminizipstatic PROPERTIES SUFFIX ".dll.a")
 
 
201 endif(CYGWIN)
202
203 target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC
204 $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
205
206 add_executable(minizipstatic ${MINIZIP_SRCS} ${MINIZIP_HDRS})
207 set_target_properties(minizipstatic PROPERTIES EXPORT_NAME
208 minizip_static_executable)
209 target_compile_definitions(
210 minizipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
211 target_link_libraries(minizipstatic PRIVATE MINIZIP::minizipstatic)
212 add_executable(miniunzipstatic ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS})
213 set_target_properties(miniunzipstatic
214 PROPERTIES EXPORT_NAME miniunzip_static_executable)
215 target_compile_definitions(
216 miniunzipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
217 target_link_libraries(miniunzipstatic PRIVATE MINIZIP::minizipstatic)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218 endif(MINIZIP_BUILD_STATIC)
219
220 if(MINIZIP_INSTALL)
221 if(MINIZIP_BUILD_SHARED)
222 install(
223 TARGETS libminizip minizip miniunzip
 
 
 
224 COMPONENT Runtime
225 EXPORT minizipSharedExport
226 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
227 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
228 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
 
 
 
229 install(
230 EXPORT minizipSharedExport
231 FILE minizip-shared.cmake
232 NAMESPACE MINIZIP::
233 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
234
235 if(MSVC)
236 install(
237 FILES $<TARGET_PDB_FILE:libminizip>
238 COMPONENT Runtime
239 DESTINATION ${CMAKE_INSTALL_BINDIR}
240 CONFIGURATIONS Debug OR RelWithDebInfo
241 OPTIONAL)
242 endif(MSVC)
243 endif(MINIZIP_BUILD_SHARED)
244
245 if(MINIZIP_BUILD_STATIC)
246 install(
247 TARGETS libminizipstatic
 
 
 
248 COMPONENT Development
249 TARGETS minizipstatic miniunzipstatic
250 COMPONENT Runtime
251 EXPORT minizipStaticExport
252 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
 
 
253 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
254 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
 
255 install(
256 EXPORT minizipStaticExport
257 FILE minizip-static.cmake
258 NAMESPACE MINIZIP::
259 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
@@ -269,119 +371,14 @@
269 COMPATIBILITY AnyNewerVersion)
270 install(FILES ${minizip_BINARY_DIR}/minizipConfig.cmake
271 ${minizip_BINARY_DIR}/minizipConfigVersion.cmake
272 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
273 install(
274 FILES ${LIBMINIZIP_HDRS}
275 COMPONENT Development
276 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
277 endif(MINIZIP_INSTALL)
278
279 if(MINIZIP_BUILD_TESTING)
280 enable_testing()
281
282 if(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL
283 ".dll")
284 add_test(
285 NAME minizip_prepare_shared_zip
286 COMMAND ${CMAKE_COMMAND} -DCREATE_SHARED=ON -P
287 ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
288 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
289 add_test(
290 NAME minizip_zipping_test_file_shared
291 COMMAND minizip test_file_shared.zip test_file_shared.txt
292 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
293 add_test(
294 NAME minizip_prepare_shared_unzip
295 COMMAND ${CMAKE_COMMAND} -DMOVE_SHARED=ON -P
296 ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
297 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
298 add_test(
299 NAME minizip_miniunzipping_test_file_shared.zip
300 COMMAND miniunzip test_file_shared.zip
301 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
302 add_test(
303 NAME minizip_compare_shared
304 COMMAND ${CMAKE_COMMAND} -E compare_files test_file_shared.txt
305 test_file_shared.orig
306 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
307 add_test(
308 NAME minizip_clean_shared_zip
309 COMMAND ${CMAKE_COMMAND} -DDELETE_SHARED=ON -P
310 ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
311 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
312 set_tests_properties(minizip_prepare_shared_zip
313 PROPERTIES FIXTURES_SETUP prepare_shared)
314 set_tests_properties(
315 minizip_zipping_test_file_shared
316 PROPERTIES FIXTURES_REQUIRED prepare_shared FIXTURES_SETUP
317 zip_shared)
318 set_tests_properties(
319 minizip_prepare_shared_unzip
320 PROPERTIES FIXTURES_REQUIRED zip_shared FIXTURES_SETUP
321 prepare_unzip_shared)
322 set_tests_properties(
323 minizip_miniunzipping_test_file_shared.zip
324 PROPERTIES FIXTURES_REQUIRED prepare_unzip_shared FIXTURES_SETUP
325 prepare_compare_shared)
326 set_tests_properties(
327 minizip_compare_shared
328 PROPERTIES FIXTURES_REQUIRED prepare_compare_shared FIXTURES_SETUP
329 compared_shared)
330 set_tests_properties(minizip_clean_shared_zip
331 PROPERTIES FIXTURES_CLEANUP compared_shared)
332 endif(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL
333 ".dll")
334
335 if(MINIZIP_BUILD_STATIC)
336 add_test(
337 NAME minizip_prepare_static_zip
338 COMMAND ${CMAKE_COMMAND} -DCREATE_STATIC=ON -P
339 ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
340 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
341 add_test(
342 NAME minizip_zipping_test_file_static
343 COMMAND minizipstatic test_file_static.zip test_file_static.txt
344 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
345 add_test(
346 NAME minizip_prepare_static_unzip
347 COMMAND ${CMAKE_COMMAND} -DMOVE_STATIC=ON -P
348 ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
349 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
350 add_test(
351 NAME minizip_miniunzipping_test_file_static.zip
352 COMMAND miniunzipstatic test_file_static.zip
353 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
354 add_test(
355 NAME minizip_compare_static
356 COMMAND ${CMAKE_COMMAND} -E compare_files test_file_static.txt
357 test_file_static.orig
358 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
359 add_test(
360 NAME minizip_clean_static_zip
361 COMMAND ${CMAKE_COMMAND} -DDELETE_STATIC=ON -P
362 ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
363 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
364 set_tests_properties(minizip_prepare_static_zip
365 PROPERTIES FIXTURES_SETUP prepare_static)
366 set_tests_properties(
367 minizip_zipping_test_file_static
368 PROPERTIES FIXTURES_REQUIRED prepare_static FIXTURES_SETUP
369 zip_static)
370 set_tests_properties(
371 minizip_prepare_static_unzip
372 PROPERTIES FIXTURES_REQUIRED zip_static FIXTURES_SETUP
373 prepare_unzip_static)
374 set_tests_properties(
375 minizip_miniunzipping_test_file_static.zip
376 PROPERTIES FIXTURES_REQUIRED prepare_unzip_static FIXTURES_SETUP
377 prepare_compare_static)
378 set_tests_properties(
379 minizip_compare_static
380 PROPERTIES FIXTURES_REQUIRED prepare_compare_static FIXTURES_SETUP
381 compared_static)
382 set_tests_properties(minizip_clean_static_zip
383 PROPERTIES FIXTURES_CLEANUP compared_static)
384 endif(MINIZIP_BUILD_STATIC)
385
386 add_subdirectory(test)
387 endif(MINIZIP_BUILD_TESTING)
388
--- compat/zlib/contrib/minizip/CMakeLists.txt
+++ compat/zlib/contrib/minizip/CMakeLists.txt
@@ -1,19 +1,14 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 minizip
5 VERSION 1.0.0
6 LANGUAGES C
7 DESCRIPTION "A library for creating zipfiles based in zlib"
8 HOMEPAGE_URL "https://www.winimage.com/zLibDll/minizip.html")
9
 
 
 
 
 
10 # ============================================================================
11 # CPack
12 # ============================================================================
13 set(CPACK_PACKAGE_VENDOR "zlib-Project")
14 set(CPACK_PACKAGE_DESCRIPTION_FILE ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
@@ -24,11 +19,11 @@
19 # set options if build from zlib
20 # ============================================================================
21 if(ZLIB_BUILD_MINIZIP)
22 set(MINIZIP_BUILD_SHARED ${ZLIB_MINIZIP_BUILD_SHARED} CACHE BOOL "")
23 set(MINIZIP_BUILD_STATIC ${ZLIB_MINIZIP_BUILD_STATIC} CACHE BOOL "")
24 set(MINIZIP_BUILD_TESTING ${ZLIB_MINIZIP_BUILD_TESTING} CACHE BOOL "")
25 set(MINIZIP_INSTALL ${ZLIB_MINIZIP_INSTALL} CACHE BOOL "")
26 endif(ZLIB_BUILD_MINIZIP)
27
28 # ============================================================================
29 # configuration
@@ -38,11 +33,11 @@
33 option(MINIZIP_BUILD_TESTING "Enable testing of minizip" ON)
34 option(MINIZIP_ENABLE_BZIP2 "Build minizip with bzip2 support" OFF)
35 option(MINIZIP_INSTALL "Enable installation of minizip" ON)
36
37 include(CheckCSourceCompiles)
38 include(CheckSymbolExists)
39 include(CheckIncludeFile)
40 include(CMakePackageConfigHelpers)
41 include(CheckTypeSize)
42 include(GNUInstallDirs)
43
@@ -67,16 +62,16 @@
62 endif(MINIZIP_ENABLE_BZIP2)
63
64 #
65 # Check for fopen64
66 #
67 check_symbol_exists(fopen64 stdio.h HAVE_FOPEN64)
68
69 #
70 # Check for fseeko
71 #
72 check_symbol_exists(fseeko stdio.h HAVE_FSEEKO)
73
74 #
75 # Check for unistd.h
76 #
77 check_include_file(unistd.h HAVE_UNISTD_H)
@@ -105,155 +100,262 @@
100 "
101 HAVE___ATTR__VIS_HIDDEN)
102
103 unset(CMAKE_REQUIRED_FLAGS)
104
105 set(LIBMINIZIP_SRCS
106 ioapi.c
107 mztools.c
108 unzip.c
109 zip.c
110 $<$<BOOL:${WIN32}>:iowin32.c>)
111
112 set(LIBMINIZIP_HDRS
113 crypt.h
114 ints.h
115 ioapi.h
116 mztools.h
117 unzip.h
118 zip.h
119 $<$<BOOL:${WIN32}>:${minizip_SOURCE_DIR}/iowin32.h>)
120
121 set(MINIZIP_SRCS
122 ioapi.c
123 minizip.c
124 zip.c)
125
126 set(MINIZIP_HDRS
127 crypt.h
128 ints.h
129 ioapi.h
130 skipset.h
131 zip.h)
132
133 set(MINIUNZIP_SRCS
134 ioapi.c
135 miniunz.c
136 unzip.c
137 zip.c)
138
139 set(MINIUNZIP_HDRS
140 crypt.h
141 ints.h
142 ioapi.h
 
143 skipset.h
144 unzip.h
145 zip.h)
146
147 set(LIBMINIZIP_PC ${minizip_BINARY_DIR}/minizip.pc)
148 configure_file(${minizip_SOURCE_DIR}/minizip.pc.txt ${LIBMINIZIP_PC} @ONLY)
149
150 if(WIN32 OR CYGWIN)
151 set(minizip_static_suffix "s")
152 set(CMAKE_DEBUG_POSTFIX "d")
153 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
154 endif(WIN32 OR CYGWIN)
155
156 if(MINIZIP_BUILD_SHARED)
157 add_library(${ZLIB_CONTRIB_PREFIX}libminizip SHARED
158 ${LIBMINIZIP_SRCS}
159 ${LIBMINIZIP_HDRS})
160 add_library(MINIZIP::minizip ALIAS ${ZLIB_CONTRIB_PREFIX}libminizip)
161 target_include_directories(${ZLIB_CONTRIB_PREFIX}libminizip
162 PUBLIC
163 $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
164 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
165 target_compile_definitions(${ZLIB_CONTRIB_PREFIX}libminizip
166 PRIVATE
167 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
168 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
169 $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
170 PUBLIC
171 $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
172 $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
173 $<$<AND:$<NOT:$<BOOL:${HAVE_FOPEN64}>>,$<NOT:$<BOOL:${MSVC}>>>:USE_FILE32API=1>)
174
175 if(CYGWIN)
176 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
177 PROPERTIES
178 PREFIX "lib")
179 else(CYGWIN)
180 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
181 PROPERTIES
182 SOVERSION ${zlib_VERSION_MAJOR}
183 VERSION ${INSTALL_VERSION})
184 endif(CYGWIN)
185
186 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
187 PROPERTIES
188 EXPORT_NAME minizip
189 PUBLIC_HEADER "${LIBMINIZIP_HDRS}")
190
191 if(MSVC)
192 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
193 PROPERTIES
194 OUTPUT_NAME libminizip)
195 else(MSVC)
196 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizip
197 PROPERTIES
198 OUTPUT_NAME minizip)
199 endif(MSVC)
200
201 target_link_libraries(${ZLIB_CONTRIB_PREFIX}libminizip
202 PUBLIC
203 ZLIB::ZLIB
204 $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
205
206 add_executable(${ZLIB_CONTRIB_PREFIX}minizip
207 ${MINIZIP_SRCS}
208 ${MINIZIP_HDRS}
209 $<$<BOOL:${WIN32}>:iowin32.h>)
210 set_target_properties(${ZLIB_CONTRIB_PREFIX}minizip
211 PROPERTIES
212 EXPORT_NAME minizip_executable
213 OUTPUT_NAME minizip)
214 target_compile_definitions(${ZLIB_CONTRIB_PREFIX}minizip
215 PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
216 target_link_libraries(${ZLIB_CONTRIB_PREFIX}minizip
217 PRIVATE MINIZIP::minizip)
218 add_executable(${ZLIB_CONTRIB_PREFIX}miniunzip
219 ${MINIUNZIP_SRCS}
220 ${MINIUNZIP_HDRS}
221 $<$<BOOL:${WIN32}>:iowin32.c>
222 $<$<BOOL:${WIN32}>:iowin32.h>)
223 set_target_properties(${ZLIB_CONTRIB_PREFIX}miniunzip
224 PROPERTIES
225 EXPORT_NAME miniunzip_executable
226 OUTPUT_NAME miniunzip)
227 target_compile_definitions(${ZLIB_CONTRIB_PREFIX}miniunzip
228 PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
229 target_link_libraries(${ZLIB_CONTRIB_PREFIX}miniunzip
230 PRIVATE MINIZIP::minizip)
231 endif(MINIZIP_BUILD_SHARED)
232
233 if(MINIZIP_BUILD_STATIC)
234 add_library(${ZLIB_CONTRIB_PREFIX}libminizipstatic
235 STATIC
236 ${LIBMINIZIP_SRCS}
237 ${LIBMINIZIP_HDRS})
238 add_library(MINIZIP::minizipstatic ALIAS
239 ${ZLIB_CONTRIB_PREFIX}libminizipstatic)
240 target_include_directories(${ZLIB_CONTRIB_PREFIX}libminizipstatic
241 PUBLIC
242 $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
243 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
244 target_compile_definitions(${ZLIB_CONTRIB_PREFIX}libminizipstatic
245 PRIVATE
246 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
247 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
248 $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
249 PUBLIC
250 $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
251 $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
252 $<$<AND:$<NOT:$<BOOL:${HAVE_FOPEN64}>>,$<NOT:$<BOOL:${MSVC}>>>:USE_FILE32API=1>)
253 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
254 PROPERTIES
255 EXPORT_NAME minizipstatic
256 PUBLIC_HEADER "${LIBMINIZIP_HDRS}")
257
258 if(CYGWIN)
259 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
260 PROPERTIES
261 PREFIX "lib")
262 endif(CYGWIN)
263
264 if(MSVC)
265 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
266 PROPERTIES
267 ARCHIVE_OUTPUT_NAME libminizip${minizip_static_suffix})
268 else(MSVC)
269 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
270 PROPERTIES
271 ARCHIVE_OUTPUT_NAME minizip${minizip_static_suffix})
272 endif(MSVC)
273
274 if(CYGWIN)
275 set_target_properties(${ZLIB_CONTRIB_PREFIX}libminizipstatic
276 PROPERTIES
277 SUFFIX ".dll.a")
278 endif(CYGWIN)
279
280 target_link_libraries(${ZLIB_CONTRIB_PREFIX}libminizipstatic
281 PUBLIC
282 ZLIB::ZLIBSTATIC
283 $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
284
285 add_executable(${ZLIB_CONTRIB_PREFIX}minizipstatic
286 ${MINIZIP_SRCS}
287 ${MINIZIP_HDRS}
288 $<$<BOOL:${WIN32}>:iowin32.h>)
289 set_target_properties(${ZLIB_CONTRIB_PREFIX}minizipstatic
290 PROPERTIES
291 EXPORT_NAME minizip_static_executable
292 OUTPUT_NAME minizipstatic)
293 target_compile_definitions(${ZLIB_CONTRIB_PREFIX}minizipstatic
294 PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
295 target_link_libraries(${ZLIB_CONTRIB_PREFIX}minizipstatic
296 PRIVATE MINIZIP::minizipstatic)
297 add_executable(${ZLIB_CONTRIB_PREFIX}miniunzipstatic
298 ${MINIUNZIP_SRCS}
299 ${MINIUNZIP_HDRS}
300 $<$<BOOL:${WIN32}>:iowin32.c>
301 $<$<BOOL:${WIN32}>:iowin32.h>)
302 set_target_properties(${ZLIB_CONTRIB_PREFIX}miniunzipstatic
303 PROPERTIES
304 EXPORT_NAME miniunzip_static_executable
305 OUTPUT_NAME miniunzipstatic)
306 target_compile_definitions(${ZLIB_CONTRIB_PREFIX}miniunzipstatic
307 PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
308 target_link_libraries(${ZLIB_CONTRIB_PREFIX}miniunzipstatic
309 PRIVATE MINIZIP::minizipstatic)
310 endif(MINIZIP_BUILD_STATIC)
311
312 if(MINIZIP_INSTALL)
313 if(MINIZIP_BUILD_SHARED)
314 install(
315 TARGETS
316 ${ZLIB_CONTRIB_PREFIX}libminizip
317 ${ZLIB_CONTRIB_PREFIX}minizip
318 ${ZLIB_CONTRIB_PREFIX}miniunzip
319 COMPONENT Runtime
320 EXPORT minizipSharedExport
321 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
322 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
323 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
324 PUBLIC_HEADER
325 COMPONENT Development
326 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/minizip")
327 install(
328 EXPORT minizipSharedExport
329 FILE minizip-shared.cmake
330 NAMESPACE MINIZIP::
331 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
332
333 if(MSVC)
334 install(
335 FILES $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}libminizip>
336 COMPONENT Runtime
337 DESTINATION ${CMAKE_INSTALL_BINDIR}
338 CONFIGURATIONS Debug OR RelWithDebInfo
339 OPTIONAL)
340 endif(MSVC)
341 endif(MINIZIP_BUILD_SHARED)
342
343 if(MINIZIP_BUILD_STATIC)
344 install(
345 TARGETS
346 ${ZLIB_CONTRIB_PREFIX}libminizipstatic
347 ${ZLIB_CONTRIB_PREFIX}minizipstatic
348 ${ZLIB_CONTRIB_PREFIX}miniunzipstatic
349 COMPONENT Development
 
 
350 EXPORT minizipStaticExport
351 RUNTIME
352 DESTINATION "${CMAKE_INSTALL_BINDIR}"
353 COMPONENT Runtime
354 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
355 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
356 PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/minizip")
357 install(
358 EXPORT minizipStaticExport
359 FILE minizip-static.cmake
360 NAMESPACE MINIZIP::
361 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
@@ -269,119 +371,14 @@
371 COMPATIBILITY AnyNewerVersion)
372 install(FILES ${minizip_BINARY_DIR}/minizipConfig.cmake
373 ${minizip_BINARY_DIR}/minizipConfigVersion.cmake
374 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
375 install(
376 FILES ${LIBMINIZIP_PC}
377 COMPONENT Development
378 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
379 endif(MINIZIP_INSTALL)
380
381 if(MINIZIP_BUILD_TESTING)
382 enable_testing()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383 add_subdirectory(test)
384 endif(MINIZIP_BUILD_TESTING)
385
--- compat/zlib/contrib/minizip/Makefile.am
+++ compat/zlib/contrib/minizip/Makefile.am
@@ -25,10 +25,11 @@
2525
libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
2626
2727
minizip_includedir = $(includedir)/minizip
2828
minizip_include_HEADERS = \
2929
crypt.h \
30
+ ints.h \
3031
ioapi.h \
3132
mztools.h \
3233
unzip.h \
3334
zip.h \
3435
${iowin32_h}
@@ -37,9 +38,9 @@
3738
pkgconfig_DATA = minizip.pc
3839
3940
EXTRA_PROGRAMS = miniunzip minizip
4041
4142
miniunzip_SOURCES = miniunz.c
42
-miniunzip_LDADD = libminizip.la
43
+miniunzip_LDADD = libminizip.la -lz
4344
4445
minizip_SOURCES = minizip.c
4546
minizip_LDADD = libminizip.la -lz
4647
--- compat/zlib/contrib/minizip/Makefile.am
+++ compat/zlib/contrib/minizip/Makefile.am
@@ -25,10 +25,11 @@
25 libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
26
27 minizip_includedir = $(includedir)/minizip
28 minizip_include_HEADERS = \
29 crypt.h \
 
30 ioapi.h \
31 mztools.h \
32 unzip.h \
33 zip.h \
34 ${iowin32_h}
@@ -37,9 +38,9 @@
37 pkgconfig_DATA = minizip.pc
38
39 EXTRA_PROGRAMS = miniunzip minizip
40
41 miniunzip_SOURCES = miniunz.c
42 miniunzip_LDADD = libminizip.la
43
44 minizip_SOURCES = minizip.c
45 minizip_LDADD = libminizip.la -lz
46
--- compat/zlib/contrib/minizip/Makefile.am
+++ compat/zlib/contrib/minizip/Makefile.am
@@ -25,10 +25,11 @@
25 libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
26
27 minizip_includedir = $(includedir)/minizip
28 minizip_include_HEADERS = \
29 crypt.h \
30 ints.h \
31 ioapi.h \
32 mztools.h \
33 unzip.h \
34 zip.h \
35 ${iowin32_h}
@@ -37,9 +38,9 @@
38 pkgconfig_DATA = minizip.pc
39
40 EXTRA_PROGRAMS = miniunzip minizip
41
42 miniunzip_SOURCES = miniunz.c
43 miniunzip_LDADD = libminizip.la -lz
44
45 minizip_SOURCES = minizip.c
46 minizip_LDADD = libminizip.la -lz
47
--- compat/zlib/contrib/minizip/configure.ac
+++ compat/zlib/contrib/minizip/configure.ac
@@ -1,9 +1,9 @@
11
# -*- Autoconf -*-
22
# Process this file with autoconf to produce a configure script.
33
4
-AC_INIT([minizip], [1.3.2], [bugzilla.redhat.com])
4
+AC_INIT([minizip], [1.4], [bugzilla.redhat.com])
55
AC_CONFIG_SRCDIR([minizip.c])
66
AM_INIT_AUTOMAKE([foreign])
77
LT_INIT
88
99
AC_MSG_CHECKING([whether to build example programs])
1010
--- compat/zlib/contrib/minizip/configure.ac
+++ compat/zlib/contrib/minizip/configure.ac
@@ -1,9 +1,9 @@
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_INIT([minizip], [1.3.2], [bugzilla.redhat.com])
5 AC_CONFIG_SRCDIR([minizip.c])
6 AM_INIT_AUTOMAKE([foreign])
7 LT_INIT
8
9 AC_MSG_CHECKING([whether to build example programs])
10
--- compat/zlib/contrib/minizip/configure.ac
+++ compat/zlib/contrib/minizip/configure.ac
@@ -1,9 +1,9 @@
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_INIT([minizip], [1.4], [bugzilla.redhat.com])
5 AC_CONFIG_SRCDIR([minizip.c])
6 AM_INIT_AUTOMAKE([foreign])
7 LT_INIT
8
9 AC_MSG_CHECKING([whether to build example programs])
10
--- compat/zlib/contrib/minizip/crypt.h
+++ compat/zlib/contrib/minizip/crypt.h
@@ -75,15 +75,14 @@
7575
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
7676
7777
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
7878
7979
#define RAND_HEAD_LEN 12
80
- /* "last resort" source for second part of crypt seed pattern */
81
-# ifndef ZCR_SEED2
82
-# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
83
-# endif
8480
81
+/* The random header bytes come from the PCG32 generator in skipset.h, which
82
+ must be included before this file when INCLUDECRYPTINGCODE_IFCRYPTALLOWED is
83
+ defined. */
8584
static unsigned crypthead(const char* passwd, /* password string */
8685
unsigned char* buf, /* where to write header */
8786
int bufSize,
8887
unsigned long* pkeys,
8988
const z_crc_t* pcrc_32_tab,
@@ -90,27 +89,29 @@
9089
unsigned long crcForCrypting) {
9190
unsigned n; /* index in random header */
9291
int t; /* temporary */
9392
int c; /* random byte */
9493
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
95
- static unsigned calls = 0; /* ensure different random header each time */
94
+ static int seeded = 0; /* true once gen has been seeded */
95
+ static set_rand_t gen; /* random header generator, persists so that
96
+ each header is different */
9697
9798
if (bufSize<RAND_HEAD_LEN)
9899
return 0;
99100
100
- /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
101
- * output of rand() to get less predictability, since rand() is
102
- * often poorly implemented.
101
+ /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the random
102
+ * bytes to get less predictability.
103103
*/
104
- if (++calls == 1)
104
+ if (!seeded)
105105
{
106
- srand((unsigned)time(NULL) ^ ZCR_SEED2);
106
+ set_uniq(&gen, &gen);
107
+ seeded = 1;
107108
}
108109
init_keys(passwd, pkeys, pcrc_32_tab);
109110
for (n = 0; n < RAND_HEAD_LEN-2; n++)
110111
{
111
- c = (rand() >> 7) & 0xff;
112
+ c = (int)(set_rand(&gen) >> 24);
112113
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
113114
}
114115
/* Encrypt random header (last two bytes is high word of crc) */
115116
init_keys(passwd, pkeys, pcrc_32_tab);
116117
for (n = 0; n < RAND_HEAD_LEN-2; n++)
117118
--- compat/zlib/contrib/minizip/crypt.h
+++ compat/zlib/contrib/minizip/crypt.h
@@ -75,15 +75,14 @@
75 (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
76
77 #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
78
79 #define RAND_HEAD_LEN 12
80 /* "last resort" source for second part of crypt seed pattern */
81 # ifndef ZCR_SEED2
82 # define ZCR_SEED2 3141592654UL /* use PI as default pattern */
83 # endif
84
 
 
 
85 static unsigned crypthead(const char* passwd, /* password string */
86 unsigned char* buf, /* where to write header */
87 int bufSize,
88 unsigned long* pkeys,
89 const z_crc_t* pcrc_32_tab,
@@ -90,27 +89,29 @@
90 unsigned long crcForCrypting) {
91 unsigned n; /* index in random header */
92 int t; /* temporary */
93 int c; /* random byte */
94 unsigned char header[RAND_HEAD_LEN-2]; /* random header */
95 static unsigned calls = 0; /* ensure different random header each time */
 
 
96
97 if (bufSize<RAND_HEAD_LEN)
98 return 0;
99
100 /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
101 * output of rand() to get less predictability, since rand() is
102 * often poorly implemented.
103 */
104 if (++calls == 1)
105 {
106 srand((unsigned)time(NULL) ^ ZCR_SEED2);
 
107 }
108 init_keys(passwd, pkeys, pcrc_32_tab);
109 for (n = 0; n < RAND_HEAD_LEN-2; n++)
110 {
111 c = (rand() >> 7) & 0xff;
112 header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
113 }
114 /* Encrypt random header (last two bytes is high word of crc) */
115 init_keys(passwd, pkeys, pcrc_32_tab);
116 for (n = 0; n < RAND_HEAD_LEN-2; n++)
117
--- compat/zlib/contrib/minizip/crypt.h
+++ compat/zlib/contrib/minizip/crypt.h
@@ -75,15 +75,14 @@
75 (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
76
77 #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
78
79 #define RAND_HEAD_LEN 12
 
 
 
 
80
81 /* The random header bytes come from the PCG32 generator in skipset.h, which
82 must be included before this file when INCLUDECRYPTINGCODE_IFCRYPTALLOWED is
83 defined. */
84 static unsigned crypthead(const char* passwd, /* password string */
85 unsigned char* buf, /* where to write header */
86 int bufSize,
87 unsigned long* pkeys,
88 const z_crc_t* pcrc_32_tab,
@@ -90,27 +89,29 @@
89 unsigned long crcForCrypting) {
90 unsigned n; /* index in random header */
91 int t; /* temporary */
92 int c; /* random byte */
93 unsigned char header[RAND_HEAD_LEN-2]; /* random header */
94 static int seeded = 0; /* true once gen has been seeded */
95 static set_rand_t gen; /* random header generator, persists so that
96 each header is different */
97
98 if (bufSize<RAND_HEAD_LEN)
99 return 0;
100
101 /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the random
102 * bytes to get less predictability.
 
103 */
104 if (!seeded)
105 {
106 set_uniq(&gen, &gen);
107 seeded = 1;
108 }
109 init_keys(passwd, pkeys, pcrc_32_tab);
110 for (n = 0; n < RAND_HEAD_LEN-2; n++)
111 {
112 c = (int)(set_rand(&gen) >> 24);
113 header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
114 }
115 /* Encrypt random header (last two bytes is high word of crc) */
116 init_keys(passwd, pkeys, pcrc_32_tab);
117 for (n = 0; n < RAND_HEAD_LEN-2; n++)
118
--- compat/zlib/contrib/minizip/ioapi.h
+++ compat/zlib/contrib/minizip/ioapi.h
@@ -19,11 +19,11 @@
1919
*/
2020
2121
#ifndef ZLIBIOAPI64_H
2222
#define ZLIBIOAPI64_H
2323
24
-#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!(defined(__ANDROID_API__) || __ANDROID_API__ >= 24))
24
+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!defined(__ANDROID_API__) || __ANDROID_API__ >= 24)
2525
2626
/* Linux needs this to support file operation on files larger then 4+GB */
2727
/* But might need better if/def to select just the platforms that needs them.*/
2828
2929
#ifndef __USE_FILE_OFFSET64
3030
--- compat/zlib/contrib/minizip/ioapi.h
+++ compat/zlib/contrib/minizip/ioapi.h
@@ -19,11 +19,11 @@
19 */
20
21 #ifndef ZLIBIOAPI64_H
22 #define ZLIBIOAPI64_H
23
24 #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!(defined(__ANDROID_API__) || __ANDROID_API__ >= 24))
25
26 /* Linux needs this to support file operation on files larger then 4+GB */
27 /* But might need better if/def to select just the platforms that needs them.*/
28
29 #ifndef __USE_FILE_OFFSET64
30
--- compat/zlib/contrib/minizip/ioapi.h
+++ compat/zlib/contrib/minizip/ioapi.h
@@ -19,11 +19,11 @@
19 */
20
21 #ifndef ZLIBIOAPI64_H
22 #define ZLIBIOAPI64_H
23
24 #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!defined(__ANDROID_API__) || __ANDROID_API__ >= 24)
25
26 /* Linux needs this to support file operation on files larger then 4+GB */
27 /* But might need better if/def to select just the platforms that needs them.*/
28
29 #ifndef __USE_FILE_OFFSET64
30
--- compat/zlib/contrib/minizip/miniunz.c
+++ compat/zlib/contrib/minizip/miniunz.c
@@ -181,10 +181,63 @@
181181
*p++ = hold;
182182
}
183183
free(buffer);
184184
return 1;
185185
}
186
+
187
+/* Copy to out a version of the path name that can only be created under the
188
+ extraction directory. Both '/' and '\\' are taken as separators. Empty and
189
+ "." path components are removed, and a ".." component is removed along with
190
+ the component before it, if any. On Windows, drive specifiers at the start
191
+ and components of only dots and spaces are also removed. The result is
192
+ always a relative path, and is no longer than name. out must have room for
193
+ strlen(name) + 1 characters. */
194
+static void safe_path(char* out, const char* name) {
195
+ char* start = out;
196
+ while (*name != '\0')
197
+ {
198
+ const char* comp = name;
199
+ size_t len;
200
+ while (*name != '\0' && *name != '/' && *name != '\\')
201
+ name++;
202
+ len = (size_t)(name - comp);
203
+#ifdef _WIN32
204
+ while (out == start && len >= 2 && comp[1] == ':')
205
+ {
206
+ comp += 2; /* remove drive specifiers, e.g. "C:" */
207
+ len -= 2;
208
+ }
209
+ {
210
+ /* Windows drops trailing dots and spaces from a name, so remove
211
+ any other component made of only those, such as "..." */
212
+ size_t i = 0;
213
+ while (i < len && (comp[i] == '.' || comp[i] == ' '))
214
+ i++;
215
+ if (i == len && !(len == 2 && comp[0] == '.' && comp[1] == '.'))
216
+ len = 0;
217
+ }
218
+#endif
219
+ if (len == 2 && comp[0] == '.' && comp[1] == '.')
220
+ {
221
+ /* remove the previous component and its separator, if any */
222
+ if (out > start)
223
+ out--;
224
+ while (out > start && out[-1] != '/' && out[-1] != '\\')
225
+ out--;
226
+ }
227
+ else if (len != 0 && !(len == 1 && comp[0] == '.'))
228
+ {
229
+ memcpy(out, comp, len);
230
+ out += len;
231
+ if (*name != '\0')
232
+ *out++ = *name; /* keep the separator */
233
+ }
234
+ if (*name != '\0')
235
+ name++;
236
+ }
237
+ *out = '\0';
238
+}
186239
187240
static void do_banner(void) {
188241
printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n");
189242
printf("more info at https://www.winimage.com/zLibDll/unzip.html\n\n");
190243
}
@@ -265,11 +318,11 @@
265318
uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
266319
if (iLevel==0)
267320
string_method="Defl:N";
268321
else if (iLevel==1)
269322
string_method="Defl:X";
270
- else if ((iLevel==2) || (iLevel==3))
323
+ else /* iLevel==2 || iLevel==3 */
271324
string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
272325
}
273326
else
274327
if (file_info.compression_method==Z_BZIP2ED)
275328
{
@@ -303,10 +356,11 @@
303356
}
304357
305358
306359
static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
307360
char filename_inzip[65536+1];
361
+ char write_name[65536+1];
308362
char* filename_withoutpath;
309363
char* p;
310364
int err=UNZ_OK;
311365
FILE *fout=NULL;
312366
void* buf;
@@ -337,39 +391,31 @@
337391
p++;
338392
}
339393
340394
if ((*filename_withoutpath)=='\0')
341395
{
342
- if ((*popt_extract_without_path)==0)
343
- {
344
- printf("creating directory: %s\n",filename_inzip);
345
- mymkdir(filename_inzip);
346
- }
347
- }
348
- else
349
- {
350
- const char* write_filename;
351
- int skip=0;
352
-
353
- if ((*popt_extract_without_path)==0)
354
- write_filename = filename_inzip;
355
- else
356
- write_filename = filename_withoutpath;
357
-
358
- if (write_filename[0]!='\0')
359
- {
360
- const char* relative_check = write_filename;
361
- while (relative_check[1]!='\0')
362
- {
363
- if (relative_check[0]=='.' && relative_check[1]=='.')
364
- write_filename = relative_check;
365
- relative_check++;
366
- }
367
- }
368
-
369
- while (write_filename[0]=='/' || write_filename[0]=='.')
370
- write_filename++;
396
+ safe_path(write_name, filename_inzip);
397
+ if (((*popt_extract_without_path)==0) && (write_name[0]!='\0'))
398
+ {
399
+ printf("creating directory: %s\n",write_name);
400
+ mymkdir(write_name);
401
+ }
402
+ }
403
+ else
404
+ {
405
+ const char* write_filename = write_name;
406
+ int skip=0;
407
+
408
+ if ((*popt_extract_without_path)==0)
409
+ safe_path(write_name, filename_inzip);
410
+ else
411
+ safe_path(write_name, filename_withoutpath);
412
+ if (write_name[0]=='\0')
413
+ {
414
+ printf("skipping %s: no name left to extract to\n",filename_inzip);
415
+ skip = 1;
416
+ }
371417
372418
err = unzOpenCurrentFilePassword(uf,password);
373419
if (err!=UNZ_OK)
374420
{
375421
printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
@@ -410,18 +456,26 @@
410456
411457
if ((skip==0) && (err==UNZ_OK))
412458
{
413459
fout=FOPEN_FUNC(write_filename,"wb");
414460
/* some zipfile don't contain directory alone before file */
415
- if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
416
- (filename_withoutpath!=(char*)filename_inzip))
417
- {
418
- char c=*(filename_withoutpath-1);
419
- *(filename_withoutpath-1)='\0';
420
- makedir(write_filename);
421
- *(filename_withoutpath-1)=c;
422
- fout=FOPEN_FUNC(write_filename,"wb");
461
+ if ((fout==NULL) && ((*popt_extract_without_path)==0))
462
+ {
463
+ /* make the directories leading up to the file */
464
+ char* sep = NULL;
465
+ char* q;
466
+ for (q = write_name; *q != '\0'; q++)
467
+ if (*q == '/' || *q == '\\')
468
+ sep = q;
469
+ if (sep != NULL)
470
+ {
471
+ char c = *sep;
472
+ *sep = '\0';
473
+ makedir(write_name);
474
+ *sep = c;
475
+ fout=FOPEN_FUNC(write_filename,"wb");
476
+ }
423477
}
424478
425479
if (fout==NULL)
426480
{
427481
printf("error opening %s\n",write_filename);
428482
--- compat/zlib/contrib/minizip/miniunz.c
+++ compat/zlib/contrib/minizip/miniunz.c
@@ -181,10 +181,63 @@
181 *p++ = hold;
182 }
183 free(buffer);
184 return 1;
185 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
187 static void do_banner(void) {
188 printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n");
189 printf("more info at https://www.winimage.com/zLibDll/unzip.html\n\n");
190 }
@@ -265,11 +318,11 @@
265 uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
266 if (iLevel==0)
267 string_method="Defl:N";
268 else if (iLevel==1)
269 string_method="Defl:X";
270 else if ((iLevel==2) || (iLevel==3))
271 string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
272 }
273 else
274 if (file_info.compression_method==Z_BZIP2ED)
275 {
@@ -303,10 +356,11 @@
303 }
304
305
306 static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
307 char filename_inzip[65536+1];
 
308 char* filename_withoutpath;
309 char* p;
310 int err=UNZ_OK;
311 FILE *fout=NULL;
312 void* buf;
@@ -337,39 +391,31 @@
337 p++;
338 }
339
340 if ((*filename_withoutpath)=='\0')
341 {
342 if ((*popt_extract_without_path)==0)
343 {
344 printf("creating directory: %s\n",filename_inzip);
345 mymkdir(filename_inzip);
346 }
347 }
348 else
349 {
350 const char* write_filename;
351 int skip=0;
352
353 if ((*popt_extract_without_path)==0)
354 write_filename = filename_inzip;
355 else
356 write_filename = filename_withoutpath;
357
358 if (write_filename[0]!='\0')
359 {
360 const char* relative_check = write_filename;
361 while (relative_check[1]!='\0')
362 {
363 if (relative_check[0]=='.' && relative_check[1]=='.')
364 write_filename = relative_check;
365 relative_check++;
366 }
367 }
368
369 while (write_filename[0]=='/' || write_filename[0]=='.')
370 write_filename++;
371
372 err = unzOpenCurrentFilePassword(uf,password);
373 if (err!=UNZ_OK)
374 {
375 printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
@@ -410,18 +456,26 @@
410
411 if ((skip==0) && (err==UNZ_OK))
412 {
413 fout=FOPEN_FUNC(write_filename,"wb");
414 /* some zipfile don't contain directory alone before file */
415 if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
416 (filename_withoutpath!=(char*)filename_inzip))
417 {
418 char c=*(filename_withoutpath-1);
419 *(filename_withoutpath-1)='\0';
420 makedir(write_filename);
421 *(filename_withoutpath-1)=c;
422 fout=FOPEN_FUNC(write_filename,"wb");
 
 
 
 
 
 
 
 
423 }
424
425 if (fout==NULL)
426 {
427 printf("error opening %s\n",write_filename);
428
--- compat/zlib/contrib/minizip/miniunz.c
+++ compat/zlib/contrib/minizip/miniunz.c
@@ -181,10 +181,63 @@
181 *p++ = hold;
182 }
183 free(buffer);
184 return 1;
185 }
186
187 /* Copy to out a version of the path name that can only be created under the
188 extraction directory. Both '/' and '\\' are taken as separators. Empty and
189 "." path components are removed, and a ".." component is removed along with
190 the component before it, if any. On Windows, drive specifiers at the start
191 and components of only dots and spaces are also removed. The result is
192 always a relative path, and is no longer than name. out must have room for
193 strlen(name) + 1 characters. */
194 static void safe_path(char* out, const char* name) {
195 char* start = out;
196 while (*name != '\0')
197 {
198 const char* comp = name;
199 size_t len;
200 while (*name != '\0' && *name != '/' && *name != '\\')
201 name++;
202 len = (size_t)(name - comp);
203 #ifdef _WIN32
204 while (out == start && len >= 2 && comp[1] == ':')
205 {
206 comp += 2; /* remove drive specifiers, e.g. "C:" */
207 len -= 2;
208 }
209 {
210 /* Windows drops trailing dots and spaces from a name, so remove
211 any other component made of only those, such as "..." */
212 size_t i = 0;
213 while (i < len && (comp[i] == '.' || comp[i] == ' '))
214 i++;
215 if (i == len && !(len == 2 && comp[0] == '.' && comp[1] == '.'))
216 len = 0;
217 }
218 #endif
219 if (len == 2 && comp[0] == '.' && comp[1] == '.')
220 {
221 /* remove the previous component and its separator, if any */
222 if (out > start)
223 out--;
224 while (out > start && out[-1] != '/' && out[-1] != '\\')
225 out--;
226 }
227 else if (len != 0 && !(len == 1 && comp[0] == '.'))
228 {
229 memcpy(out, comp, len);
230 out += len;
231 if (*name != '\0')
232 *out++ = *name; /* keep the separator */
233 }
234 if (*name != '\0')
235 name++;
236 }
237 *out = '\0';
238 }
239
240 static void do_banner(void) {
241 printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n");
242 printf("more info at https://www.winimage.com/zLibDll/unzip.html\n\n");
243 }
@@ -265,11 +318,11 @@
318 uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
319 if (iLevel==0)
320 string_method="Defl:N";
321 else if (iLevel==1)
322 string_method="Defl:X";
323 else /* iLevel==2 || iLevel==3 */
324 string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
325 }
326 else
327 if (file_info.compression_method==Z_BZIP2ED)
328 {
@@ -303,10 +356,11 @@
356 }
357
358
359 static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
360 char filename_inzip[65536+1];
361 char write_name[65536+1];
362 char* filename_withoutpath;
363 char* p;
364 int err=UNZ_OK;
365 FILE *fout=NULL;
366 void* buf;
@@ -337,39 +391,31 @@
391 p++;
392 }
393
394 if ((*filename_withoutpath)=='\0')
395 {
396 safe_path(write_name, filename_inzip);
397 if (((*popt_extract_without_path)==0) && (write_name[0]!='\0'))
398 {
399 printf("creating directory: %s\n",write_name);
400 mymkdir(write_name);
401 }
402 }
403 else
404 {
405 const char* write_filename = write_name;
406 int skip=0;
407
408 if ((*popt_extract_without_path)==0)
409 safe_path(write_name, filename_inzip);
410 else
411 safe_path(write_name, filename_withoutpath);
412 if (write_name[0]=='\0')
413 {
414 printf("skipping %s: no name left to extract to\n",filename_inzip);
415 skip = 1;
416 }
 
 
 
 
 
 
 
 
417
418 err = unzOpenCurrentFilePassword(uf,password);
419 if (err!=UNZ_OK)
420 {
421 printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
@@ -410,18 +456,26 @@
456
457 if ((skip==0) && (err==UNZ_OK))
458 {
459 fout=FOPEN_FUNC(write_filename,"wb");
460 /* some zipfile don't contain directory alone before file */
461 if ((fout==NULL) && ((*popt_extract_without_path)==0))
462 {
463 /* make the directories leading up to the file */
464 char* sep = NULL;
465 char* q;
466 for (q = write_name; *q != '\0'; q++)
467 if (*q == '/' || *q == '\\')
468 sep = q;
469 if (sep != NULL)
470 {
471 char c = *sep;
472 *sep = '\0';
473 makedir(write_name);
474 *sep = c;
475 fout=FOPEN_FUNC(write_filename,"wb");
476 }
477 }
478
479 if (fout==NULL)
480 {
481 printf("error opening %s\n",write_filename);
482
--- compat/zlib/contrib/minizip/minizipConfig.cmake.in
+++ compat/zlib/contrib/minizip/minizipConfig.cmake.in
@@ -1,13 +1,17 @@
1
-@PACKAGE_INIT@
2
-
31
set(_MINIZIP_supported_components "shared" "static")
42
include(CMakeFindDependencyMacro)
53
6
-if(@MINIZIP_ENABLE_BZIP2@)
4
+set(minizip_HAS_BZIP2
5
+ "@MINIZIP_ENABLE_BZIP2@"
6
+ CACHE
7
+ BOOL
8
+ "Indicates if minizip was compiled with bzip2 support")
9
+
10
+if(minizip_HAS_BZIP2)
711
find_dependency(BZip2)
8
-endif(@MINIZIP_ENABLE_BZIP2@)
12
+endif(minizip_HAS_BZIP2)
913
1014
if(minizip_FIND_COMPONENTS)
1115
find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS})
1216
1317
foreach(_comp ${minizip_FIND_COMPONENTS})
@@ -14,14 +18,38 @@
1418
if(NOT _comp IN_LIST _MINIZIP_supported_components)
1519
set(minizip_FOUND False)
1620
set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
1721
endif(NOT _comp IN_LIST _MINIZIP_supported_components)
1822
19
- include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_comp}.cmake")
20
- endforeach(_comp ${ZLIB_FIND_COMPONENTS})
23
+ include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_comp}.cmake"
24
+ OPTIONAL
25
+ RESULT_VARIABLE _comp_loaded)
26
+
27
+ if(NOT _comp_loaded)
28
+ set(minizip_FOUND False)
29
+ set(minizip_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
30
+ else(NOT _comp_loaded)
31
+ set(minizip_${_comp}_FOUND TRUE)
32
+ endif(NOT _comp_loaded)
33
+ endforeach(_comp ${minizip_FIND_COMPONENTS})
2134
else(minizip_FIND_COMPONENTS)
2235
find_dependency(ZLIB CONFIG)
2336
2437
foreach(_component_config IN LISTS _MINIZIP_supported_components)
25
- include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_component_config}.cmake")
38
+ include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_component_config}.cmake"
39
+ OPTIONAL)
2640
endforeach(_component_config IN LISTS _MINIZIP_supported_components)
41
+
42
+ if(NOT TARGET MINIZIP::minizip)
43
+ set(minizip_FOUND False)
44
+ set(minizip_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
45
+ string(APPEND minizip_NOT_FOUND_MESSAGE "build minizip with support for shared libs or\n")
46
+ string(APPEND minizip_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
47
+ endif(NOT TARGET MINIZIP::minizip)
48
+
49
+ if(NOT TARGET MINIZIP::minizipstatic)
50
+ set(minizip_FOUND False)
51
+ set(minizip_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
52
+ string(APPEND minizip_NOT_FOUND_MESSAGE "build minizip with support for static libs or\n")
53
+ string(APPEND minizip_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
54
+ endif(NOT TARGET MINIZIP::minizipstatic)
2755
endif(minizip_FIND_COMPONENTS)
2856
--- compat/zlib/contrib/minizip/minizipConfig.cmake.in
+++ compat/zlib/contrib/minizip/minizipConfig.cmake.in
@@ -1,13 +1,17 @@
1 @PACKAGE_INIT@
2
3 set(_MINIZIP_supported_components "shared" "static")
4 include(CMakeFindDependencyMacro)
5
6 if(@MINIZIP_ENABLE_BZIP2@)
 
 
 
 
 
 
7 find_dependency(BZip2)
8 endif(@MINIZIP_ENABLE_BZIP2@)
9
10 if(minizip_FIND_COMPONENTS)
11 find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS})
12
13 foreach(_comp ${minizip_FIND_COMPONENTS})
@@ -14,14 +18,38 @@
14 if(NOT _comp IN_LIST _MINIZIP_supported_components)
15 set(minizip_FOUND False)
16 set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
17 endif(NOT _comp IN_LIST _MINIZIP_supported_components)
18
19 include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_comp}.cmake")
20 endforeach(_comp ${ZLIB_FIND_COMPONENTS})
 
 
 
 
 
 
 
 
 
21 else(minizip_FIND_COMPONENTS)
22 find_dependency(ZLIB CONFIG)
23
24 foreach(_component_config IN LISTS _MINIZIP_supported_components)
25 include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_component_config}.cmake")
 
26 endforeach(_component_config IN LISTS _MINIZIP_supported_components)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27 endif(minizip_FIND_COMPONENTS)
28
--- compat/zlib/contrib/minizip/minizipConfig.cmake.in
+++ compat/zlib/contrib/minizip/minizipConfig.cmake.in
@@ -1,13 +1,17 @@
 
 
1 set(_MINIZIP_supported_components "shared" "static")
2 include(CMakeFindDependencyMacro)
3
4 set(minizip_HAS_BZIP2
5 "@MINIZIP_ENABLE_BZIP2@"
6 CACHE
7 BOOL
8 "Indicates if minizip was compiled with bzip2 support")
9
10 if(minizip_HAS_BZIP2)
11 find_dependency(BZip2)
12 endif(minizip_HAS_BZIP2)
13
14 if(minizip_FIND_COMPONENTS)
15 find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS})
16
17 foreach(_comp ${minizip_FIND_COMPONENTS})
@@ -14,14 +18,38 @@
18 if(NOT _comp IN_LIST _MINIZIP_supported_components)
19 set(minizip_FOUND False)
20 set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
21 endif(NOT _comp IN_LIST _MINIZIP_supported_components)
22
23 include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_comp}.cmake"
24 OPTIONAL
25 RESULT_VARIABLE _comp_loaded)
26
27 if(NOT _comp_loaded)
28 set(minizip_FOUND False)
29 set(minizip_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
30 else(NOT _comp_loaded)
31 set(minizip_${_comp}_FOUND TRUE)
32 endif(NOT _comp_loaded)
33 endforeach(_comp ${minizip_FIND_COMPONENTS})
34 else(minizip_FIND_COMPONENTS)
35 find_dependency(ZLIB CONFIG)
36
37 foreach(_component_config IN LISTS _MINIZIP_supported_components)
38 include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_component_config}.cmake"
39 OPTIONAL)
40 endforeach(_component_config IN LISTS _MINIZIP_supported_components)
41
42 if(NOT TARGET MINIZIP::minizip)
43 set(minizip_FOUND False)
44 set(minizip_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
45 string(APPEND minizip_NOT_FOUND_MESSAGE "build minizip with support for shared libs or\n")
46 string(APPEND minizip_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
47 endif(NOT TARGET MINIZIP::minizip)
48
49 if(NOT TARGET MINIZIP::minizipstatic)
50 set(minizip_FOUND False)
51 set(minizip_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
52 string(APPEND minizip_NOT_FOUND_MESSAGE "build minizip with support for static libs or\n")
53 string(APPEND minizip_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
54 endif(NOT TARGET MINIZIP::minizipstatic)
55 endif(minizip_FIND_COMPONENTS)
56
--- compat/zlib/contrib/minizip/mztools.c
+++ compat/zlib/contrib/minizip/mztools.c
@@ -14,11 +14,11 @@
1414
#include "zlib.h"
1515
#include "unzip.h"
1616
1717
#define READ_8(adr) ((unsigned char)*(adr))
1818
#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
19
-#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
19
+#define READ_32(adr) ( (uLong)READ_16(adr) | ((uLong)READ_16((adr)+2) << 16) )
2020
2121
#define WRITE_8(buff, n) do { \
2222
*((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
2323
} while(0)
2424
#define WRITE_16(buff, n) do { \
2525
--- compat/zlib/contrib/minizip/mztools.c
+++ compat/zlib/contrib/minizip/mztools.c
@@ -14,11 +14,11 @@
14 #include "zlib.h"
15 #include "unzip.h"
16
17 #define READ_8(adr) ((unsigned char)*(adr))
18 #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
19 #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
20
21 #define WRITE_8(buff, n) do { \
22 *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
23 } while(0)
24 #define WRITE_16(buff, n) do { \
25
--- compat/zlib/contrib/minizip/mztools.c
+++ compat/zlib/contrib/minizip/mztools.c
@@ -14,11 +14,11 @@
14 #include "zlib.h"
15 #include "unzip.h"
16
17 #define READ_8(adr) ((unsigned char)*(adr))
18 #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
19 #define READ_32(adr) ( (uLong)READ_16(adr) | ((uLong)READ_16((adr)+2) << 16) )
20
21 #define WRITE_8(buff, n) do { \
22 *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
23 } while(0)
24 #define WRITE_16(buff, n) do { \
25
--- compat/zlib/contrib/minizip/skipset.h
+++ compat/zlib/contrib/minizip/skipset.h
@@ -1,58 +1,61 @@
11
/* skipset.h -- set operations using a skiplist
2
-// Copyright (C) 2024-2026 Mark Adler
3
-// See MiniZip_info.txt for the license.
4
-
5
-// This implements a skiplist set, i.e. just keys, no data, with ~O(log n) time
6
-// insert and search operations. The application defines the type of a key, and
7
-// provides a function to compare two keys.
8
-
9
-// This header is not definitions of functions found in another source file --
10
-// it creates the set functions, with the application's key type, right where
11
-// the #include is. Before this header is #included, these must be defined:
12
-//
13
-// 1. A macro or typedef for set_key_t, the type of a key.
14
-// 2. A macro or function set_cmp(a, b) to compare two keys. The return values
15
-// are < 0 for a < b, 0 for a == b, and > 0 for a > b.
16
-// 3. A macro or function set_drop(s, k) to release the key k's resources, if
17
-// any, when doing a set_end() or set_clear(). s is a pointer to the set
18
-// that key is in, for use with set_free() if desired.
19
-//
20
-// Example usage:
21
-//
22
-// typedef int set_key_t;
23
-// #define set_cmp(a, b) ((a) < (b) ? -1 : (a) == (b) ? 0 : 1)
24
-// #define set_drop(s, k)
25
-// #include "skipset.h"
26
-//
27
-// int test(void) { // return 0: good, 1: bad, -1: out of memory
28
-// set_t set;
29
-// if (setjmp(set.env))
30
-// return -1;
31
-// set_start(&set);
32
-// set_insert(&set, 2);
33
-// set_insert(&set, 1);
34
-// set_insert(&set, 7);
35
-// int bad = !set_found(&set, 2);
36
-// bad = bad || set_found(&set, 5);
37
-// set_end(&set);
38
-// return bad;
39
-// }
40
-//
41
-// Interface summary (see more details below):
42
-// - set_t is the type of the set being operated on (a set_t pointer is passed)
43
-// - set_start() initializes a new, empty set (initialize set.env first)
44
-// - set_insert() inserts a new key into the set, or not if it's already there
45
-// - set_found() determines whether or not a key is in the set
46
-// - set_end() ends the use of the set, freeing all memory
47
-// - set_clear() empties the set, equivalent to set_end() and then set_start()
48
-// - set_ok() checks if set appears to be usable, i.e. started and not ended
49
-//
50
-// Auxiliary functions available to the application:
51
-// - set_alloc() allocates memory with optional tracking (#define SET_TRACK)
52
-// - set_free() deallocates memory allocated by set_alloc()
53
-// - set_rand() returns 32 random bits (seeded by set_start()) */
2
+ Copyright (C) 2024-2026 Mark Adler
3
+ See MiniZip_info.txt for the license.
4
+ */
5
+
6
+/*
7
+ This implements a skiplist set, i.e. just keys, no data, with ~O(log n) time
8
+ insert and search operations. The application defines the type of a key, and
9
+ provides a function to compare two keys.
10
+
11
+ This header is not definitions of functions found in another source file --
12
+ it creates the set functions, with the application's key type, right where
13
+ the #include is. Before this header is #included, these must be defined:
14
+
15
+ 1. A macro or typedef for set_key_t, the type of a key.
16
+ 2. A macro or function set_cmp(a, b) to compare two keys. The return values
17
+ are < 0 for a < b, 0 for a == b, and > 0 for a > b.
18
+ 3. A macro or function set_drop(s, k) to release the key k's resources, if
19
+ any, when doing a set_end() or set_clear(). s is a pointer to the set
20
+ that key is in, for use with set_free() if desired.
21
+
22
+ Example usage:
23
+
24
+ typedef int set_key_t;
25
+ #define set_cmp(a, b) ((a) < (b) ? -1 : (a) == (b) ? 0 : 1)
26
+ #define set_drop(s, k)
27
+ #include "skipset.h"
28
+
29
+ int test(void) { // return 0: good, 1: bad, -1: out of memory
30
+ set_t set;
31
+ if (setjmp(set.env))
32
+ return -1;
33
+ set_start(&set);
34
+ set_insert(&set, 2);
35
+ set_insert(&set, 1);
36
+ set_insert(&set, 7);
37
+ int bad = !set_found(&set, 2);
38
+ bad = bad || set_found(&set, 5);
39
+ set_end(&set);
40
+ return bad;
41
+ }
42
+
43
+ Interface summary (see more details below):
44
+ - set_t is the type of the set being operated on (a set_t pointer is passed)
45
+ - set_start() initializes a new, empty set (initialize set.env first)
46
+ - set_insert() inserts a new key into the set, or not if it's already there
47
+ - set_found() determines whether or not a key is in the set
48
+ - set_end() ends the use of the set, freeing all memory
49
+ - set_clear() empties the set, equivalent to set_end() and then set_start()
50
+ - set_ok() checks if set appears to be usable, i.e. started and not ended
51
+
52
+ Auxiliary functions available to the application:
53
+ - set_alloc() allocates memory with optional tracking (#define SET_TRACK)
54
+ - set_free() deallocates memory allocated by set_alloc()
55
+ - set_rand() returns 32 random bits (seeded by set_start())
56
+ */
5457
5558
#ifndef SKIPSET_H
5659
#define SKIPSET_H
5760
5861
#include <stdlib.h> /* realloc(), free(), NULL, size_t */
@@ -61,42 +64,48 @@
6164
#include <errno.h> /* ENOMEM */
6265
#include <time.h> /* time(), clock() */
6366
#include <assert.h> /* assert.h */
6467
#include "ints.h" /* i16_t, ui32_t, ui64_t */
6568
66
-/* Structures and functions below noted as "--private--" should not be used by
67
-// the application. set_t is partially private and partially public -- see the
68
-// comments there.
69
-
70
-// There is no POSIX random() in MSVC, and rand() is awful. For portability, we
71
-// cannot rely on a library function for random numbers. Instead we use the
72
-// fast and effective algorithm below, invented by Melissa O'Neill.
73
-
74
-// *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / www.pcg-random.org
75
-// Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
76
-// --private-- Random number generator state. */
69
+/*
70
+ Structures and functions below noted as "--private--" should not be used by
71
+ the application. set_t is partially private and partially public -- see the
72
+ comments there.
73
+
74
+ There is no POSIX random() in MSVC, and rand() is awful. For portability, we
75
+ cannot rely on a library function for random numbers. Instead we use the
76
+ fast and effective algorithm below, invented by Melissa O'Neill.
77
+ */
78
+
79
+/*
80
+ *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / www.pcg-random.org
81
+ Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
82
+ --private-- Random number generator state.
83
+ */
7784
typedef struct {
7885
ui64_t state; /* 64-bit generator state */
7986
ui64_t inc; /* 63-bit sequence id */
8087
} set_rand_t;
8188
/* --private-- Initialize the state *gen using seed and seq. seed seeds the
82
-// advancing 64-bit state. seq is a sequence selection constant. */
83
-void set_seed(set_rand_t *gen, ui64_t seed, ui64_t seq) {
89
+ advancing 64-bit state. seq is a sequence selection constant. */
90
+static void set_seed(set_rand_t *gen, ui64_t seed, ui64_t seq) {
8491
gen->inc = (seq << 1) | 1;
8592
gen->state = (seed + gen->inc) * 6364136223846793005ULL + gen->inc;
8693
}
8794
/* Start a unique random number sequence using bits from noise sources. */
88
-void set_uniq(set_rand_t *gen, const void *ptr) {
95
+static void set_uniq(set_rand_t *gen, const void *ptr) {
8996
set_seed(gen, ((ui64_t)(ptrdiff_t)ptr << 32) ^
9097
((ui64_t)time(NULL) << 12) ^ clock(), 0);
9198
}
9299
/* Return 32 random bits, advancing the state *gen. */
93
-ui32_t set_rand(set_rand_t *gen) {
100
+static ui32_t set_rand(set_rand_t *gen) {
101
+ ui32_t mix;
102
+ int rot;
94103
ui64_t state = gen->state;
95104
gen->state = state * 6364136223846793005ULL + gen->inc;
96
- ui32_t mix = (ui32_t)(((state >> 18) ^ state) >> 27);
97
- int rot = state >> 59;
105
+ mix = (ui32_t)(((state >> 18) ^ state) >> 27);
106
+ rot = state >> 59;
98107
return (mix >> rot) | (mix << ((-rot) & 31));
99108
}
100109
/* End of PCG32 code. */
101110
102111
/* --private-- Linked-list node. */
@@ -107,11 +116,11 @@
107116
i16_t fill; /* number of pointers in right[] filled in */
108117
set_node_t **right; /* pointer for each level, each to the right */
109118
};
110119
111120
/* A set. The application sets env, may use gen with set_rand(), and may read
112
-// allocs and memory. The remaining variables are --private-- . */
121
+ allocs and memory. The remaining variables are --private-- . */
113122
typedef struct set_s {
114123
set_node_t *head; /* skiplist head -- no key, just links */
115124
set_node_t *path; /* right[] is path to key from set_found() */
116125
set_node_t *node; /* node under construction, in case of longjmp() */
117126
i16_t depth; /* maximum depth of the skiplist */
@@ -118,19 +127,19 @@
118127
ui64_t ran; /* a precious trove of random bits */
119128
set_rand_t gen; /* random number generator state */
120129
jmp_buf env; /* setjmp() environment for allocation errors */
121130
#ifdef SET_TRACK
122131
size_t allocs; /* number of allocations */
123
- size_t memory; /* total amount of allocated memory (>= requests) */
132
+ size_t memory; /* total size of allocated memory (>= requests) */
124133
#endif
125134
} set_t;
126135
127136
/* Memory allocation and deallocation. set_alloc(set, ptr, size) returns a
128
-// pointer to an allocation of size bytes if ptr is NULL, or the previous
129
-// allocation ptr resized to size bytes. set_alloc() will never return NULL.
130
-// set_free(set, ptr) frees an allocation created by set_alloc(). These may be
131
-// used by the application. e.g. if allocation tracking is desired. */
137
+ pointer to an allocation of size bytes if ptr is NULL, or the previous
138
+ allocation ptr resized to size bytes. set_alloc() will never return NULL.
139
+ set_free(set, ptr) frees an allocation created by set_alloc(). These may be
140
+ used by the application. e.g. if allocation tracking is desired. */
132141
#ifdef SET_TRACK
133142
/* Track the number of allocations and the total backing memory size. */
134143
# if defined(_WIN32)
135144
# include <malloc.h>
136145
# define SET_ALLOC_SIZE(ptr) _msize(ptr)
@@ -144,75 +153,75 @@
144153
# include <malloc_np.h>
145154
# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
146155
# elif defined(__NetBSD__)
147156
# include <jemalloc/jemalloc.h>
148157
# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
149
-# else // e.g. OpenBSD
158
+# else /* e.g. OpenBSD */
150159
# define SET_ALLOC_SIZE(ptr) 0
151160
# endif
152
-// With tracking.
153
-void *set_alloc(set_t *set, void *ptr, size_t size) {
161
+/* With tracking. */
162
+static void *set_alloc(set_t *set, void *ptr, size_t size) {
154163
size_t had = ptr == NULL ? 0 : SET_ALLOC_SIZE(ptr);
155164
void *mem = realloc(ptr, size);
156165
if (mem == NULL)
157166
longjmp(set->env, ENOMEM);
158167
set->allocs += ptr == NULL;
159168
set->memory += SET_ALLOC_SIZE(mem) - had;
160169
return mem;
161170
}
162
-void set_free(set_t *set, void *ptr) {
171
+static void set_free(set_t *set, void *ptr) {
163172
if (ptr != NULL) {
164173
set->allocs--;
165174
set->memory -= SET_ALLOC_SIZE(ptr);
166175
free(ptr);
167176
}
168177
}
169178
#else
170179
/* Without tracking. */
171
-void *set_alloc(set_t *set, void *ptr, size_t size) {
180
+static void *set_alloc(set_t *set, void *ptr, size_t size) {
172181
void *mem = realloc(ptr, size);
173182
if (mem == NULL)
174183
longjmp(set->env, ENOMEM);
175184
return mem;
176185
}
177
-void set_free(set_t *set, void *ptr) {
186
+static void set_free(set_t *set, void *ptr) {
178187
(void)set;
179188
free(ptr);
180189
}
181190
#endif
182191
183192
/* --private-- Grow node's array right[] as needed to be able to hold at least
184
-// want links. If fill is true, assure that the first want links are filled in,
185
-// setting them to set->head if not previously filled in. Otherwise it is
186
-// assumed that the first want links are about to be filled in. */
187
-void set_grow(set_t *set, set_node_t *node, int want, int fill) {
193
+ want links. If fill is true, assure that the first want links are filled in,
194
+ setting them to set->head if not previously filled in. Otherwise it is
195
+ assumed that the first want links are about to be filled in. */
196
+static void set_grow(set_t *set, set_node_t *node, int want, int fill) {
197
+ int i;
188198
if (node->size < want) {
189199
int more = node->size ? node->size : 1;
190200
while (more < want)
191201
more <<= 1;
192202
node->right = set_alloc(set, node->right,
193203
(size_t)more * sizeof(set_node_t *));
194204
node->size = (i16_t)more;
195205
}
196
- int i;
197206
if (fill)
198207
for (i = node->fill; i < want; i++)
199208
node->right[i] = set->head;
200209
node->fill = (i16_t)want;
201210
}
202211
203212
/* --private-- Return a new node. key is left uninitialized. */
204
-set_node_t *set_node(set_t *set) {
213
+static set_node_t *set_node(set_t *set) {
205214
set_node_t *node = set_alloc(set, NULL, sizeof(set_node_t));
206215
node->size = 0;
207216
node->fill = 0;
208217
node->right = NULL;
209218
return node;
210219
}
211220
212221
/* --private-- Free the list linked from head, along with the keys. */
213
-void set_sweep(set_t *set) {
222
+static void set_sweep(set_t *set) {
214223
set_node_t *step = set->head->right[0];
215224
while (step != set->head) {
216225
set_node_t *next = step->right[0]; /* save link to next node */
217226
set_drop(set, step->key);
218227
set_free(set, step->right);
@@ -220,59 +229,61 @@
220229
step = next;
221230
}
222231
}
223232
224233
/* Initialize a new set. set->env must be initialized using setjmp() before
225
-// set_start() is called. A longjmp(set->env, ENOMEM) will be used to handle a
226
-// memory allocation failure during any of the operations. (See setjmp.h and
227
-// errno.h.) The set can still be used if this happens, assuming that it didn't
228
-// happen during set_start(). Whether set_start() completed or not, set_end()
229
-// can be used to free the set's memory after a longjmp(). */
230
-void set_start(set_t *set) {
234
+ set_start() is called. A longjmp(set->env, ENOMEM) will be used to handle a
235
+ memory allocation failure during any of the operations. (See setjmp.h and
236
+ errno.h.) The set can still be used if this happens, assuming that it didn't
237
+ happen during set_start(). Whether set_start() completed or not, set_end()
238
+ can be used to free the set's memory after a longjmp(). */
239
+SKIPSET_EXPORT void set_start(set_t *set) {
231240
#ifdef SET_TRACK
232241
set->allocs = 0;
233242
set->memory = 0;
234243
#endif
235244
set->head = set->path = set->node = NULL; /* in case set_node() fails */
236245
set->path = set_node(set);
237246
set->head = set_node(set);
238
- set_grow(set, set->head, 1, 1); /* one link back to head for an empty set */
247
+ set_grow(set, set->head, 1, 1); /* one link back to head for empty set */
239248
*(unsigned char *)&set->head->key = 137; /* set id */
240249
set->depth = 0;
241250
set_uniq(&set->gen, set);
242251
set->ran = 1;
243252
}
244253
245254
/* Return true if *set appears to be in a usable state. If *set has been zeroed
246
-// out, then set_ok(set) will be false and set_end(set) will be safe. */
247
-int set_ok(set_t *set) {
255
+ out, then set_ok(set) will be false and set_end(set) will be safe. */
256
+SKIPSET_EXPORT int set_ok(set_t *set) {
248257
return set->head != NULL &&
249258
set->head->right != NULL &&
250259
*(unsigned char *)&set->head->key == 137;
251260
}
252261
262
+#if 0 /* not used in minizip */
253263
/* Empty the set. This frees the memory used for the previous set contents.
254
-// After set_clear(), *set is ready for use, as if after a set_start(). */
255
-void set_clear(set_t *set) {
264
+ After set_clear(), *set is ready for use, as if after a set_start(). */
265
+SKIPSET_EXPORT void set_clear(set_t *set) {
256266
assert(set_ok(set) && "improper use");
257267
258268
/* Free all the keys and their nodes. */
259269
set_sweep(set);
260270
261271
/* Leave the head and path allocations as is. Clear their contents, with
262
- // head pointing to itself and setting depth to zero, for an empty set. */
272
+ head pointing to itself and setting depth to zero, for an empty set. */
263273
set->head->right[0] = set->head;
264274
set->head->fill = 1;
265275
set->path->fill = 0;
266276
set->depth = 0;
267277
}
278
+#endif
268279
269280
/* Done using the set -- free all allocations. The only operation on *set
270
-// permitted after this is set_start(). Though another set_end() would do no
271
-// harm. This can be done at any time after a set_start(), or after a longjmp()
272
-// on any allocation failure, including during a set_start(). */
273
-void set_end(set_t *set) {
281
+ permitted after this is set_start(). Though another set_end() would do no
282
+ harm. This can be done at any time after a set_start(), or after a longjmp()
283
+ on any allocation failure, including during a set_start(). */
284
+SKIPSET_EXPORT void set_end(set_t *set) {
274285
if (set->head != NULL) {
275286
/* Empty the set and free the head node. */
276287
if (set->head->right != NULL) {
277288
set_sweep(set);
278289
set_free(set, set->head->right);
@@ -294,17 +305,20 @@
294305
set->node = NULL;
295306
}
296307
}
297308
298309
/* Look for key. Return 1 if found or 0 if not. This also puts the path to get
299
-// there in set->path, for use by set_insert(). */
300
-int set_found(set_t *set, set_key_t key) {
310
+ there in set->path, for use by set_insert(). */
311
+SKIPSET_EXPORT int set_found(set_t *set, set_key_t key) {
312
+ set_node_t *head, *here;
313
+ int i;
301314
assert(set_ok(set) && "improper use");
302315
303
- /* Start at depth and work down and right as determined by key comparisons. */
304
- set_node_t *head = set->head, *here = head;
305
- int i = set->depth;
316
+ /* Start at depth. Work down and right as determined by key comparisons. */
317
+ head = set->head;
318
+ here = head;
319
+ i = set->depth;
306320
set_grow(set, set->path, i + 1, 0);
307321
do {
308322
while (here->right[i] != head &&
309323
set_cmp(here->right[i]->key, key) < 0)
310324
here = here->right[i];
@@ -314,26 +328,28 @@
314328
/* See if the key matches. */
315329
here = here->right[0];
316330
return here != head && set_cmp(here->key, key) == 0;
317331
}
318332
319
-/* Insert the key key. Return 0 on success, or 1 if key is already in the set. */
320
-int set_insert(set_t *set, set_key_t key) {
333
+/* Insert the key key. Return 0 on success, or 1 if it's already in the set. */
334
+SKIPSET_EXPORT int set_insert(set_t *set, set_key_t key) {
335
+ int level = 0;
336
+ int bit;
337
+ int i;
321338
assert(set_ok(set) && "improper use");
322339
323340
if (set_found(set, key))
324341
/* That key is already in the set. */
325342
return 1;
326343
327344
/* Randomly generate a new level-- level 0 with probability 1/2, 1 with
328
- // probability 1/4, 2 with probability 1/8, etc. */
329
- int level = 0;
345
+ probability 1/4, 2 with probability 1/8, etc. */
330346
for (;;) {
331347
if (set->ran == 1)
332348
/* Ran out. Get another 32 random bits. */
333349
set->ran = set_rand(&set->gen) | (1ULL << 32);
334
- int bit = set->ran & 1;
350
+ bit = set->ran & 1;
335351
set->ran >>= 1;
336352
if (bit)
337353
break;
338354
assert(level < 32767 &&
339355
"Overhead, without any fuss, the stars were going out.");
@@ -345,15 +361,14 @@
345361
set_grow(set, set->head, level + 1, 1);
346362
set->depth = (i16_t)level;
347363
}
348364
349365
/* Make a new node for the provided key, and insert it in the lists up to
350
- // and including level. */
366
+ and including level. */
351367
set->node = set_node(set);
352368
set->node->key = key;
353369
set_grow(set, set->node, level + 1, 0);
354
- int i;
355370
for (i = 0; i <= level; i++) {
356371
set->node->right[i] = set->path->right[i]->right[i];
357372
set->path->right[i]->right[i] = set->node;
358373
}
359374
set->node = NULL;
360375
--- compat/zlib/contrib/minizip/skipset.h
+++ compat/zlib/contrib/minizip/skipset.h
@@ -1,58 +1,61 @@
1 /* skipset.h -- set operations using a skiplist
2 // Copyright (C) 2024-2026 Mark Adler
3 // See MiniZip_info.txt for the license.
4
5 // This implements a skiplist set, i.e. just keys, no data, with ~O(log n) time
6 // insert and search operations. The application defines the type of a key, and
7 // provides a function to compare two keys.
8
9 // This header is not definitions of functions found in another source file --
10 // it creates the set functions, with the application's key type, right where
11 // the #include is. Before this header is #included, these must be defined:
12 //
13 // 1. A macro or typedef for set_key_t, the type of a key.
14 // 2. A macro or function set_cmp(a, b) to compare two keys. The return values
15 // are < 0 for a < b, 0 for a == b, and > 0 for a > b.
16 // 3. A macro or function set_drop(s, k) to release the key k's resources, if
17 // any, when doing a set_end() or set_clear(). s is a pointer to the set
18 // that key is in, for use with set_free() if desired.
19 //
20 // Example usage:
21 //
22 // typedef int set_key_t;
23 // #define set_cmp(a, b) ((a) < (b) ? -1 : (a) == (b) ? 0 : 1)
24 // #define set_drop(s, k)
25 // #include "skipset.h"
26 //
27 // int test(void) { // return 0: good, 1: bad, -1: out of memory
28 // set_t set;
29 // if (setjmp(set.env))
30 // return -1;
31 // set_start(&set);
32 // set_insert(&set, 2);
33 // set_insert(&set, 1);
34 // set_insert(&set, 7);
35 // int bad = !set_found(&set, 2);
36 // bad = bad || set_found(&set, 5);
37 // set_end(&set);
38 // return bad;
39 // }
40 //
41 // Interface summary (see more details below):
42 // - set_t is the type of the set being operated on (a set_t pointer is passed)
43 // - set_start() initializes a new, empty set (initialize set.env first)
44 // - set_insert() inserts a new key into the set, or not if it's already there
45 // - set_found() determines whether or not a key is in the set
46 // - set_end() ends the use of the set, freeing all memory
47 // - set_clear() empties the set, equivalent to set_end() and then set_start()
48 // - set_ok() checks if set appears to be usable, i.e. started and not ended
49 //
50 // Auxiliary functions available to the application:
51 // - set_alloc() allocates memory with optional tracking (#define SET_TRACK)
52 // - set_free() deallocates memory allocated by set_alloc()
53 // - set_rand() returns 32 random bits (seeded by set_start()) */
 
 
 
54
55 #ifndef SKIPSET_H
56 #define SKIPSET_H
57
58 #include <stdlib.h> /* realloc(), free(), NULL, size_t */
@@ -61,42 +64,48 @@
61 #include <errno.h> /* ENOMEM */
62 #include <time.h> /* time(), clock() */
63 #include <assert.h> /* assert.h */
64 #include "ints.h" /* i16_t, ui32_t, ui64_t */
65
66 /* Structures and functions below noted as "--private--" should not be used by
67 // the application. set_t is partially private and partially public -- see the
68 // comments there.
69
70 // There is no POSIX random() in MSVC, and rand() is awful. For portability, we
71 // cannot rely on a library function for random numbers. Instead we use the
72 // fast and effective algorithm below, invented by Melissa O'Neill.
73
74 // *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / www.pcg-random.org
75 // Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
76 // --private-- Random number generator state. */
 
 
 
 
77 typedef struct {
78 ui64_t state; /* 64-bit generator state */
79 ui64_t inc; /* 63-bit sequence id */
80 } set_rand_t;
81 /* --private-- Initialize the state *gen using seed and seq. seed seeds the
82 // advancing 64-bit state. seq is a sequence selection constant. */
83 void set_seed(set_rand_t *gen, ui64_t seed, ui64_t seq) {
84 gen->inc = (seq << 1) | 1;
85 gen->state = (seed + gen->inc) * 6364136223846793005ULL + gen->inc;
86 }
87 /* Start a unique random number sequence using bits from noise sources. */
88 void set_uniq(set_rand_t *gen, const void *ptr) {
89 set_seed(gen, ((ui64_t)(ptrdiff_t)ptr << 32) ^
90 ((ui64_t)time(NULL) << 12) ^ clock(), 0);
91 }
92 /* Return 32 random bits, advancing the state *gen. */
93 ui32_t set_rand(set_rand_t *gen) {
 
 
94 ui64_t state = gen->state;
95 gen->state = state * 6364136223846793005ULL + gen->inc;
96 ui32_t mix = (ui32_t)(((state >> 18) ^ state) >> 27);
97 int rot = state >> 59;
98 return (mix >> rot) | (mix << ((-rot) & 31));
99 }
100 /* End of PCG32 code. */
101
102 /* --private-- Linked-list node. */
@@ -107,11 +116,11 @@
107 i16_t fill; /* number of pointers in right[] filled in */
108 set_node_t **right; /* pointer for each level, each to the right */
109 };
110
111 /* A set. The application sets env, may use gen with set_rand(), and may read
112 // allocs and memory. The remaining variables are --private-- . */
113 typedef struct set_s {
114 set_node_t *head; /* skiplist head -- no key, just links */
115 set_node_t *path; /* right[] is path to key from set_found() */
116 set_node_t *node; /* node under construction, in case of longjmp() */
117 i16_t depth; /* maximum depth of the skiplist */
@@ -118,19 +127,19 @@
118 ui64_t ran; /* a precious trove of random bits */
119 set_rand_t gen; /* random number generator state */
120 jmp_buf env; /* setjmp() environment for allocation errors */
121 #ifdef SET_TRACK
122 size_t allocs; /* number of allocations */
123 size_t memory; /* total amount of allocated memory (>= requests) */
124 #endif
125 } set_t;
126
127 /* Memory allocation and deallocation. set_alloc(set, ptr, size) returns a
128 // pointer to an allocation of size bytes if ptr is NULL, or the previous
129 // allocation ptr resized to size bytes. set_alloc() will never return NULL.
130 // set_free(set, ptr) frees an allocation created by set_alloc(). These may be
131 // used by the application. e.g. if allocation tracking is desired. */
132 #ifdef SET_TRACK
133 /* Track the number of allocations and the total backing memory size. */
134 # if defined(_WIN32)
135 # include <malloc.h>
136 # define SET_ALLOC_SIZE(ptr) _msize(ptr)
@@ -144,75 +153,75 @@
144 # include <malloc_np.h>
145 # define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
146 # elif defined(__NetBSD__)
147 # include <jemalloc/jemalloc.h>
148 # define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
149 # else // e.g. OpenBSD
150 # define SET_ALLOC_SIZE(ptr) 0
151 # endif
152 // With tracking.
153 void *set_alloc(set_t *set, void *ptr, size_t size) {
154 size_t had = ptr == NULL ? 0 : SET_ALLOC_SIZE(ptr);
155 void *mem = realloc(ptr, size);
156 if (mem == NULL)
157 longjmp(set->env, ENOMEM);
158 set->allocs += ptr == NULL;
159 set->memory += SET_ALLOC_SIZE(mem) - had;
160 return mem;
161 }
162 void set_free(set_t *set, void *ptr) {
163 if (ptr != NULL) {
164 set->allocs--;
165 set->memory -= SET_ALLOC_SIZE(ptr);
166 free(ptr);
167 }
168 }
169 #else
170 /* Without tracking. */
171 void *set_alloc(set_t *set, void *ptr, size_t size) {
172 void *mem = realloc(ptr, size);
173 if (mem == NULL)
174 longjmp(set->env, ENOMEM);
175 return mem;
176 }
177 void set_free(set_t *set, void *ptr) {
178 (void)set;
179 free(ptr);
180 }
181 #endif
182
183 /* --private-- Grow node's array right[] as needed to be able to hold at least
184 // want links. If fill is true, assure that the first want links are filled in,
185 // setting them to set->head if not previously filled in. Otherwise it is
186 // assumed that the first want links are about to be filled in. */
187 void set_grow(set_t *set, set_node_t *node, int want, int fill) {
 
188 if (node->size < want) {
189 int more = node->size ? node->size : 1;
190 while (more < want)
191 more <<= 1;
192 node->right = set_alloc(set, node->right,
193 (size_t)more * sizeof(set_node_t *));
194 node->size = (i16_t)more;
195 }
196 int i;
197 if (fill)
198 for (i = node->fill; i < want; i++)
199 node->right[i] = set->head;
200 node->fill = (i16_t)want;
201 }
202
203 /* --private-- Return a new node. key is left uninitialized. */
204 set_node_t *set_node(set_t *set) {
205 set_node_t *node = set_alloc(set, NULL, sizeof(set_node_t));
206 node->size = 0;
207 node->fill = 0;
208 node->right = NULL;
209 return node;
210 }
211
212 /* --private-- Free the list linked from head, along with the keys. */
213 void set_sweep(set_t *set) {
214 set_node_t *step = set->head->right[0];
215 while (step != set->head) {
216 set_node_t *next = step->right[0]; /* save link to next node */
217 set_drop(set, step->key);
218 set_free(set, step->right);
@@ -220,59 +229,61 @@
220 step = next;
221 }
222 }
223
224 /* Initialize a new set. set->env must be initialized using setjmp() before
225 // set_start() is called. A longjmp(set->env, ENOMEM) will be used to handle a
226 // memory allocation failure during any of the operations. (See setjmp.h and
227 // errno.h.) The set can still be used if this happens, assuming that it didn't
228 // happen during set_start(). Whether set_start() completed or not, set_end()
229 // can be used to free the set's memory after a longjmp(). */
230 void set_start(set_t *set) {
231 #ifdef SET_TRACK
232 set->allocs = 0;
233 set->memory = 0;
234 #endif
235 set->head = set->path = set->node = NULL; /* in case set_node() fails */
236 set->path = set_node(set);
237 set->head = set_node(set);
238 set_grow(set, set->head, 1, 1); /* one link back to head for an empty set */
239 *(unsigned char *)&set->head->key = 137; /* set id */
240 set->depth = 0;
241 set_uniq(&set->gen, set);
242 set->ran = 1;
243 }
244
245 /* Return true if *set appears to be in a usable state. If *set has been zeroed
246 // out, then set_ok(set) will be false and set_end(set) will be safe. */
247 int set_ok(set_t *set) {
248 return set->head != NULL &&
249 set->head->right != NULL &&
250 *(unsigned char *)&set->head->key == 137;
251 }
252
 
253 /* Empty the set. This frees the memory used for the previous set contents.
254 // After set_clear(), *set is ready for use, as if after a set_start(). */
255 void set_clear(set_t *set) {
256 assert(set_ok(set) && "improper use");
257
258 /* Free all the keys and their nodes. */
259 set_sweep(set);
260
261 /* Leave the head and path allocations as is. Clear their contents, with
262 // head pointing to itself and setting depth to zero, for an empty set. */
263 set->head->right[0] = set->head;
264 set->head->fill = 1;
265 set->path->fill = 0;
266 set->depth = 0;
267 }
 
268
269 /* Done using the set -- free all allocations. The only operation on *set
270 // permitted after this is set_start(). Though another set_end() would do no
271 // harm. This can be done at any time after a set_start(), or after a longjmp()
272 // on any allocation failure, including during a set_start(). */
273 void set_end(set_t *set) {
274 if (set->head != NULL) {
275 /* Empty the set and free the head node. */
276 if (set->head->right != NULL) {
277 set_sweep(set);
278 set_free(set, set->head->right);
@@ -294,17 +305,20 @@
294 set->node = NULL;
295 }
296 }
297
298 /* Look for key. Return 1 if found or 0 if not. This also puts the path to get
299 // there in set->path, for use by set_insert(). */
300 int set_found(set_t *set, set_key_t key) {
 
 
301 assert(set_ok(set) && "improper use");
302
303 /* Start at depth and work down and right as determined by key comparisons. */
304 set_node_t *head = set->head, *here = head;
305 int i = set->depth;
 
306 set_grow(set, set->path, i + 1, 0);
307 do {
308 while (here->right[i] != head &&
309 set_cmp(here->right[i]->key, key) < 0)
310 here = here->right[i];
@@ -314,26 +328,28 @@
314 /* See if the key matches. */
315 here = here->right[0];
316 return here != head && set_cmp(here->key, key) == 0;
317 }
318
319 /* Insert the key key. Return 0 on success, or 1 if key is already in the set. */
320 int set_insert(set_t *set, set_key_t key) {
 
 
 
321 assert(set_ok(set) && "improper use");
322
323 if (set_found(set, key))
324 /* That key is already in the set. */
325 return 1;
326
327 /* Randomly generate a new level-- level 0 with probability 1/2, 1 with
328 // probability 1/4, 2 with probability 1/8, etc. */
329 int level = 0;
330 for (;;) {
331 if (set->ran == 1)
332 /* Ran out. Get another 32 random bits. */
333 set->ran = set_rand(&set->gen) | (1ULL << 32);
334 int bit = set->ran & 1;
335 set->ran >>= 1;
336 if (bit)
337 break;
338 assert(level < 32767 &&
339 "Overhead, without any fuss, the stars were going out.");
@@ -345,15 +361,14 @@
345 set_grow(set, set->head, level + 1, 1);
346 set->depth = (i16_t)level;
347 }
348
349 /* Make a new node for the provided key, and insert it in the lists up to
350 // and including level. */
351 set->node = set_node(set);
352 set->node->key = key;
353 set_grow(set, set->node, level + 1, 0);
354 int i;
355 for (i = 0; i <= level; i++) {
356 set->node->right[i] = set->path->right[i]->right[i];
357 set->path->right[i]->right[i] = set->node;
358 }
359 set->node = NULL;
360
--- compat/zlib/contrib/minizip/skipset.h
+++ compat/zlib/contrib/minizip/skipset.h
@@ -1,58 +1,61 @@
1 /* skipset.h -- set operations using a skiplist
2 Copyright (C) 2024-2026 Mark Adler
3 See MiniZip_info.txt for the license.
4 */
5
6 /*
7 This implements a skiplist set, i.e. just keys, no data, with ~O(log n) time
8 insert and search operations. The application defines the type of a key, and
9 provides a function to compare two keys.
10
11 This header is not definitions of functions found in another source file --
12 it creates the set functions, with the application's key type, right where
13 the #include is. Before this header is #included, these must be defined:
14
15 1. A macro or typedef for set_key_t, the type of a key.
16 2. A macro or function set_cmp(a, b) to compare two keys. The return values
17 are < 0 for a < b, 0 for a == b, and > 0 for a > b.
18 3. A macro or function set_drop(s, k) to release the key k's resources, if
19 any, when doing a set_end() or set_clear(). s is a pointer to the set
20 that key is in, for use with set_free() if desired.
21
22 Example usage:
23
24 typedef int set_key_t;
25 #define set_cmp(a, b) ((a) < (b) ? -1 : (a) == (b) ? 0 : 1)
26 #define set_drop(s, k)
27 #include "skipset.h"
28
29 int test(void) { // return 0: good, 1: bad, -1: out of memory
30 set_t set;
31 if (setjmp(set.env))
32 return -1;
33 set_start(&set);
34 set_insert(&set, 2);
35 set_insert(&set, 1);
36 set_insert(&set, 7);
37 int bad = !set_found(&set, 2);
38 bad = bad || set_found(&set, 5);
39 set_end(&set);
40 return bad;
41 }
42
43 Interface summary (see more details below):
44 - set_t is the type of the set being operated on (a set_t pointer is passed)
45 - set_start() initializes a new, empty set (initialize set.env first)
46 - set_insert() inserts a new key into the set, or not if it's already there
47 - set_found() determines whether or not a key is in the set
48 - set_end() ends the use of the set, freeing all memory
49 - set_clear() empties the set, equivalent to set_end() and then set_start()
50 - set_ok() checks if set appears to be usable, i.e. started and not ended
51
52 Auxiliary functions available to the application:
53 - set_alloc() allocates memory with optional tracking (#define SET_TRACK)
54 - set_free() deallocates memory allocated by set_alloc()
55 - set_rand() returns 32 random bits (seeded by set_start())
56 */
57
58 #ifndef SKIPSET_H
59 #define SKIPSET_H
60
61 #include <stdlib.h> /* realloc(), free(), NULL, size_t */
@@ -61,42 +64,48 @@
64 #include <errno.h> /* ENOMEM */
65 #include <time.h> /* time(), clock() */
66 #include <assert.h> /* assert.h */
67 #include "ints.h" /* i16_t, ui32_t, ui64_t */
68
69 /*
70 Structures and functions below noted as "--private--" should not be used by
71 the application. set_t is partially private and partially public -- see the
72 comments there.
73
74 There is no POSIX random() in MSVC, and rand() is awful. For portability, we
75 cannot rely on a library function for random numbers. Instead we use the
76 fast and effective algorithm below, invented by Melissa O'Neill.
77 */
78
79 /*
80 *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / www.pcg-random.org
81 Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
82 --private-- Random number generator state.
83 */
84 typedef struct {
85 ui64_t state; /* 64-bit generator state */
86 ui64_t inc; /* 63-bit sequence id */
87 } set_rand_t;
88 /* --private-- Initialize the state *gen using seed and seq. seed seeds the
89 advancing 64-bit state. seq is a sequence selection constant. */
90 static void set_seed(set_rand_t *gen, ui64_t seed, ui64_t seq) {
91 gen->inc = (seq << 1) | 1;
92 gen->state = (seed + gen->inc) * 6364136223846793005ULL + gen->inc;
93 }
94 /* Start a unique random number sequence using bits from noise sources. */
95 static void set_uniq(set_rand_t *gen, const void *ptr) {
96 set_seed(gen, ((ui64_t)(ptrdiff_t)ptr << 32) ^
97 ((ui64_t)time(NULL) << 12) ^ clock(), 0);
98 }
99 /* Return 32 random bits, advancing the state *gen. */
100 static ui32_t set_rand(set_rand_t *gen) {
101 ui32_t mix;
102 int rot;
103 ui64_t state = gen->state;
104 gen->state = state * 6364136223846793005ULL + gen->inc;
105 mix = (ui32_t)(((state >> 18) ^ state) >> 27);
106 rot = state >> 59;
107 return (mix >> rot) | (mix << ((-rot) & 31));
108 }
109 /* End of PCG32 code. */
110
111 /* --private-- Linked-list node. */
@@ -107,11 +116,11 @@
116 i16_t fill; /* number of pointers in right[] filled in */
117 set_node_t **right; /* pointer for each level, each to the right */
118 };
119
120 /* A set. The application sets env, may use gen with set_rand(), and may read
121 allocs and memory. The remaining variables are --private-- . */
122 typedef struct set_s {
123 set_node_t *head; /* skiplist head -- no key, just links */
124 set_node_t *path; /* right[] is path to key from set_found() */
125 set_node_t *node; /* node under construction, in case of longjmp() */
126 i16_t depth; /* maximum depth of the skiplist */
@@ -118,19 +127,19 @@
127 ui64_t ran; /* a precious trove of random bits */
128 set_rand_t gen; /* random number generator state */
129 jmp_buf env; /* setjmp() environment for allocation errors */
130 #ifdef SET_TRACK
131 size_t allocs; /* number of allocations */
132 size_t memory; /* total size of allocated memory (>= requests) */
133 #endif
134 } set_t;
135
136 /* Memory allocation and deallocation. set_alloc(set, ptr, size) returns a
137 pointer to an allocation of size bytes if ptr is NULL, or the previous
138 allocation ptr resized to size bytes. set_alloc() will never return NULL.
139 set_free(set, ptr) frees an allocation created by set_alloc(). These may be
140 used by the application. e.g. if allocation tracking is desired. */
141 #ifdef SET_TRACK
142 /* Track the number of allocations and the total backing memory size. */
143 # if defined(_WIN32)
144 # include <malloc.h>
145 # define SET_ALLOC_SIZE(ptr) _msize(ptr)
@@ -144,75 +153,75 @@
153 # include <malloc_np.h>
154 # define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
155 # elif defined(__NetBSD__)
156 # include <jemalloc/jemalloc.h>
157 # define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
158 # else /* e.g. OpenBSD */
159 # define SET_ALLOC_SIZE(ptr) 0
160 # endif
161 /* With tracking. */
162 static void *set_alloc(set_t *set, void *ptr, size_t size) {
163 size_t had = ptr == NULL ? 0 : SET_ALLOC_SIZE(ptr);
164 void *mem = realloc(ptr, size);
165 if (mem == NULL)
166 longjmp(set->env, ENOMEM);
167 set->allocs += ptr == NULL;
168 set->memory += SET_ALLOC_SIZE(mem) - had;
169 return mem;
170 }
171 static void set_free(set_t *set, void *ptr) {
172 if (ptr != NULL) {
173 set->allocs--;
174 set->memory -= SET_ALLOC_SIZE(ptr);
175 free(ptr);
176 }
177 }
178 #else
179 /* Without tracking. */
180 static void *set_alloc(set_t *set, void *ptr, size_t size) {
181 void *mem = realloc(ptr, size);
182 if (mem == NULL)
183 longjmp(set->env, ENOMEM);
184 return mem;
185 }
186 static void set_free(set_t *set, void *ptr) {
187 (void)set;
188 free(ptr);
189 }
190 #endif
191
192 /* --private-- Grow node's array right[] as needed to be able to hold at least
193 want links. If fill is true, assure that the first want links are filled in,
194 setting them to set->head if not previously filled in. Otherwise it is
195 assumed that the first want links are about to be filled in. */
196 static void set_grow(set_t *set, set_node_t *node, int want, int fill) {
197 int i;
198 if (node->size < want) {
199 int more = node->size ? node->size : 1;
200 while (more < want)
201 more <<= 1;
202 node->right = set_alloc(set, node->right,
203 (size_t)more * sizeof(set_node_t *));
204 node->size = (i16_t)more;
205 }
 
206 if (fill)
207 for (i = node->fill; i < want; i++)
208 node->right[i] = set->head;
209 node->fill = (i16_t)want;
210 }
211
212 /* --private-- Return a new node. key is left uninitialized. */
213 static set_node_t *set_node(set_t *set) {
214 set_node_t *node = set_alloc(set, NULL, sizeof(set_node_t));
215 node->size = 0;
216 node->fill = 0;
217 node->right = NULL;
218 return node;
219 }
220
221 /* --private-- Free the list linked from head, along with the keys. */
222 static void set_sweep(set_t *set) {
223 set_node_t *step = set->head->right[0];
224 while (step != set->head) {
225 set_node_t *next = step->right[0]; /* save link to next node */
226 set_drop(set, step->key);
227 set_free(set, step->right);
@@ -220,59 +229,61 @@
229 step = next;
230 }
231 }
232
233 /* Initialize a new set. set->env must be initialized using setjmp() before
234 set_start() is called. A longjmp(set->env, ENOMEM) will be used to handle a
235 memory allocation failure during any of the operations. (See setjmp.h and
236 errno.h.) The set can still be used if this happens, assuming that it didn't
237 happen during set_start(). Whether set_start() completed or not, set_end()
238 can be used to free the set's memory after a longjmp(). */
239 SKIPSET_EXPORT void set_start(set_t *set) {
240 #ifdef SET_TRACK
241 set->allocs = 0;
242 set->memory = 0;
243 #endif
244 set->head = set->path = set->node = NULL; /* in case set_node() fails */
245 set->path = set_node(set);
246 set->head = set_node(set);
247 set_grow(set, set->head, 1, 1); /* one link back to head for empty set */
248 *(unsigned char *)&set->head->key = 137; /* set id */
249 set->depth = 0;
250 set_uniq(&set->gen, set);
251 set->ran = 1;
252 }
253
254 /* Return true if *set appears to be in a usable state. If *set has been zeroed
255 out, then set_ok(set) will be false and set_end(set) will be safe. */
256 SKIPSET_EXPORT int set_ok(set_t *set) {
257 return set->head != NULL &&
258 set->head->right != NULL &&
259 *(unsigned char *)&set->head->key == 137;
260 }
261
262 #if 0 /* not used in minizip */
263 /* Empty the set. This frees the memory used for the previous set contents.
264 After set_clear(), *set is ready for use, as if after a set_start(). */
265 SKIPSET_EXPORT void set_clear(set_t *set) {
266 assert(set_ok(set) && "improper use");
267
268 /* Free all the keys and their nodes. */
269 set_sweep(set);
270
271 /* Leave the head and path allocations as is. Clear their contents, with
272 head pointing to itself and setting depth to zero, for an empty set. */
273 set->head->right[0] = set->head;
274 set->head->fill = 1;
275 set->path->fill = 0;
276 set->depth = 0;
277 }
278 #endif
279
280 /* Done using the set -- free all allocations. The only operation on *set
281 permitted after this is set_start(). Though another set_end() would do no
282 harm. This can be done at any time after a set_start(), or after a longjmp()
283 on any allocation failure, including during a set_start(). */
284 SKIPSET_EXPORT void set_end(set_t *set) {
285 if (set->head != NULL) {
286 /* Empty the set and free the head node. */
287 if (set->head->right != NULL) {
288 set_sweep(set);
289 set_free(set, set->head->right);
@@ -294,17 +305,20 @@
305 set->node = NULL;
306 }
307 }
308
309 /* Look for key. Return 1 if found or 0 if not. This also puts the path to get
310 there in set->path, for use by set_insert(). */
311 SKIPSET_EXPORT int set_found(set_t *set, set_key_t key) {
312 set_node_t *head, *here;
313 int i;
314 assert(set_ok(set) && "improper use");
315
316 /* Start at depth. Work down and right as determined by key comparisons. */
317 head = set->head;
318 here = head;
319 i = set->depth;
320 set_grow(set, set->path, i + 1, 0);
321 do {
322 while (here->right[i] != head &&
323 set_cmp(here->right[i]->key, key) < 0)
324 here = here->right[i];
@@ -314,26 +328,28 @@
328 /* See if the key matches. */
329 here = here->right[0];
330 return here != head && set_cmp(here->key, key) == 0;
331 }
332
333 /* Insert the key key. Return 0 on success, or 1 if it's already in the set. */
334 SKIPSET_EXPORT int set_insert(set_t *set, set_key_t key) {
335 int level = 0;
336 int bit;
337 int i;
338 assert(set_ok(set) && "improper use");
339
340 if (set_found(set, key))
341 /* That key is already in the set. */
342 return 1;
343
344 /* Randomly generate a new level-- level 0 with probability 1/2, 1 with
345 probability 1/4, 2 with probability 1/8, etc. */
 
346 for (;;) {
347 if (set->ran == 1)
348 /* Ran out. Get another 32 random bits. */
349 set->ran = set_rand(&set->gen) | (1ULL << 32);
350 bit = set->ran & 1;
351 set->ran >>= 1;
352 if (bit)
353 break;
354 assert(level < 32767 &&
355 "Overhead, without any fuss, the stars were going out.");
@@ -345,15 +361,14 @@
361 set_grow(set, set->head, level + 1, 1);
362 set->depth = (i16_t)level;
363 }
364
365 /* Make a new node for the provided key, and insert it in the lists up to
366 and including level. */
367 set->node = set_node(set);
368 set->node->key = key;
369 set_grow(set, set->node, level + 1, 0);
 
370 for (i = 0; i <= level; i++) {
371 set->node->right[i] = set->path->right[i]->right[i];
372 set->path->right[i]->right[i] = set->node;
373 }
374 set->node = NULL;
375
--- compat/zlib/contrib/minizip/test/CMakeLists.txt
+++ compat/zlib/contrib/minizip/test/CMakeLists.txt
@@ -1,52 +1,45 @@
11
# if we are built from with zlib, use this path's)
2
-if(DEFINED ZLIB_BUILD_MINIZIP)
3
- set(WORK_DIR ${zlib_BINARY_DIR})
4
- set(inst_setup zlib_install)
5
-else(DEFINED ZLIB_BUILD_MINIZIP)
6
- set(WORK_DIR ${minizip_BINARY_DIR})
2
+if(NOT DEFINED ZLIB_BUILD_MINIZIP)
3
+ set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
74
set(inst_setup minizip_install)
85
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
96
107
add_test(
118
NAME minizip_install
12
- COMMAND ${CMAKE_COMMAND} --install ${minizip_BINARY_DIR} --prefix
13
- ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
14
- WORKING_DIRECTORY ${minizip_BINARY_DIR})
9
+ COMMAND ${CMAKE_COMMAND}
10
+ --install ${minizip_BINARY_DIR}
11
+ --prefix ${WORK_DIR}/test_install
12
+ --config $<CONFIG>
13
+ WORKING_DIRECTORY ${WORK_DIR})
1514
1615
set_tests_properties(minizip_install
1716
PROPERTIES
1817
FIXTURES_SETUP minizip_install)
19
-endif(DEFINED ZLIB_BUILD_MINIZIP)
20
-
21
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
22
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_componentstest)
23
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
24
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
25
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
18
+endif(NOT DEFINED ZLIB_BUILD_MINIZIP)
2619
2720
configure_file(
2821
${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
29
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
22
+ ${WORK_DIR}/minizip_find_package_test/CMakeLists.txt @ONLY)
3023
3124
configure_file(
3225
${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
33
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
26
+ ${WORK_DIR}/minizip_find_package_no_components_test/CMakeLists.txt
3427
@ONLY)
3528
3629
configure_file(
3730
${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
38
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
31
+ ${WORK_DIR}/minizip_find_package_wrong_components_test/CMakeLists.txt
3932
@ONLY)
4033
4134
configure_file(
4235
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
43
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
36
+ ${WORK_DIR}/minizip_add_subdirectory_test/CMakeLists.txt @ONLY)
4437
4538
configure_file(
4639
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
47
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
40
+ ${WORK_DIR}/minizip_add_subdirectory_exclude_test/CMakeLists.txt
4841
@ONLY)
4942
5043
# CMAKE_GENERATOR_PLATFORM doesn't work in the if
5144
set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
5245
@@ -53,73 +46,94 @@
5346
if(GENERATOR)
5447
set(PLATFORM "-A ${GENERATOR}")
5548
endif(GENERATOR)
5649
5750
#
58
-# findpackage_test
51
+# find_package_test
5952
#
6053
add_test(
6154
NAME minizip_find_package_configure
6255
COMMAND
63
- ${CMAKE_COMMAND} ${PLATFORM}
64
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
65
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
56
+ ${CMAKE_COMMAND}
57
+ ${PLATFORM}
58
+ -B${WORK_DIR}/minizip_find_package_test_build
59
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
60
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
6661
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
67
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
68
- --fresh -G "${CMAKE_GENERATOR}"
69
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
62
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
63
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
64
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
65
+ ${ZLIB_ARG}
66
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
67
+ -G "${CMAKE_GENERATOR}"
68
+ -S${WORK_DIR}/minizip_find_package_test)
7069
7170
add_test(
7271
NAME minizip_find_package_build
7372
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
74
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
75
-
76
-set_tests_properties(
77
- minizip_find_package_configure PROPERTIES FIXTURES_REQUIRED ${inst_setup}
78
- FIXTURES_SETUP mzfp_config)
79
-
80
-set_tests_properties(minizip_find_package_build PROPERTIES FIXTURES_REQUIRED
81
- mzfp_config)
73
+ WORKING_DIRECTORY ${WORK_DIR}/minizip_find_package_test_build)
74
+
75
+set_tests_properties(minizip_find_package_configure
76
+ PROPERTIES
77
+ FIXTURES_REQUIRED ${inst_setup}
78
+ FIXTURES_SETUP mzfp_config)
79
+
80
+set_tests_properties(minizip_find_package_build
81
+ PROPERTIES
82
+ FIXTURES_REQUIRED mzfp_config)
8283
8384
#
84
-# findpackage_no_components_test
85
+# find_package_no_components_test
8586
#
8687
add_test(
8788
NAME minizip_find_package_no_components_configure
8889
COMMAND
89
- ${CMAKE_COMMAND} ${PLATFORM}
90
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
91
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
90
+ ${CMAKE_COMMAND}
91
+ ${PLATFORM}
92
+ -B${WORK_DIR}/minizip_find_package_no_components_test_build
93
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
94
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
9295
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
93
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
94
- --fresh -G "${CMAKE_GENERATOR}"
95
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
96
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
97
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
98
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
99
+ ${ZLIB_ARG}
100
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
101
+ -G "${CMAKE_GENERATOR}"
102
+ -S${WORK_DIR}/minizip_find_package_no_components_test)
96103
97
-set_tests_properties(
98
- minizip_find_package_no_components_configure PROPERTIES FIXTURES_REQUIRED ${inst_setup})
104
+set_tests_properties(minizip_find_package_no_components_configure
105
+ PROPERTIES
106
+ FIXTURES_REQUIRED ${inst_setup})
99107
100108
if(NOT MINIZIP_BUILD_SHARED OR NOT MINIZIP_BUILD_STATIC)
101
- set_tests_properties(
102
- minizip_find_package_no_components_configure PROPERTIES WILL_FAIL TRUE)
109
+ set_tests_properties(minizip_find_package_no_components_configure
110
+ PROPERTIES
111
+ WILL_FAIL TRUE)
103112
endif(NOT MINIZIP_BUILD_SHARED OR NOT MINIZIP_BUILD_STATIC)
104113
105114
#
106
-# findpackage_no_components_test
115
+# find_package_no_components_test
107116
#
108117
add_test(
109118
NAME minizip_find_package_wrong_components_configure
110119
COMMAND
111
- ${CMAKE_COMMAND} ${PLATFORM}
112
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
113
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
120
+ ${CMAKE_COMMAND}
121
+ ${PLATFORM}
122
+ -B${WORK_DIR}/minizip_find_package_wrong_components_test_build
123
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
124
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
114125
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
115
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
116
- --fresh -G "${CMAKE_GENERATOR}"
117
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
126
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
127
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
128
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
129
+ ${ZLIB_ARG}
130
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
131
+ -G "${CMAKE_GENERATOR}"
132
+ -S${WORK_DIR}/minizip_find_package_wrong_components_test)
118133
119
-set_tests_properties(
120
- minizip_find_package_wrong_components_configure
134
+set_tests_properties(minizip_find_package_wrong_components_configure
121135
PROPERTIES
122136
FIXTURES_REQUIRED ${inst_setup}
123137
WILL_FAIL TRUE)
124138
125139
#
@@ -126,51 +140,66 @@
126140
# add_subdirectory_test
127141
#
128142
add_test(
129143
NAME minizip_add_subdirectory_configure
130144
COMMAND
131
- ${CMAKE_COMMAND} ${PLATFORM}
132
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
133
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
145
+ ${CMAKE_COMMAND}
146
+ ${PLATFORM}
147
+ -B${WORK_DIR}/minizip_add_subdirectory_test_build
148
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
149
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
134150
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
135
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
136
- --fresh -G "${CMAKE_GENERATOR}"
137
- -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
151
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
152
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
153
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install ${ZLIB_ARG}
154
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
155
+ -G "${CMAKE_GENERATOR}"
156
+ -S${WORK_DIR}/minizip_add_subdirectory_test)
138157
139158
add_test(
140159
NAME minizip_add_subdirectory_build
141160
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
142
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
143
-
144
-set_tests_properties(
145
- minizip_add_subdirectory_configure
146
- PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzas_config)
147
-
148
-set_tests_properties(minizip_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED
149
- mzas_config)
161
+ WORKING_DIRECTORY ${WORK_DIR}/minizip_add_subdirectory_test_build)
162
+
163
+set_tests_properties(minizip_add_subdirectory_configure
164
+ PROPERTIES
165
+ FIXTURES_REQUIRED ${inst_setup}
166
+ FIXTURES_SETUP mzas_config)
167
+
168
+set_tests_properties(minizip_add_subdirectory_build
169
+ PROPERTIES
170
+ FIXTURES_REQUIRED mzas_config)
150171
151172
#
152173
# add_subdirectory_exclude_test
153174
#
154175
add_test(
155176
NAME minizip_add_subdirectory_exclude_configure
156177
COMMAND
157
- ${CMAKE_COMMAND} ${PLATFORM}
158
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
159
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
178
+ ${CMAKE_COMMAND}
179
+ ${PLATFORM}
180
+ -B${WORK_DIR}/minizip_add_subdirectory_exclude_test_build
181
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
182
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
160183
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
161
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
162
- --fresh -G "${CMAKE_GENERATOR}"
163
- -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
184
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
185
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
186
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
187
+ ${ZLIB_ARG}
188
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
189
+ -G "${CMAKE_GENERATOR}"
190
+ -S${WORK_DIR}/minizip_add_subdirectory_exclude_test)
164191
165192
add_test(
166193
NAME minizip_add_subdirectory_exclude_build
167194
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
168195
WORKING_DIRECTORY
169
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
196
+ ${WORK_DIR}/minizip_add_subdirectory_exclude_test_build)
170197
171
-set_tests_properties(
172
- minizip_add_subdirectory_exclude_configure
173
- PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzasx_config)
198
+set_tests_properties(minizip_add_subdirectory_exclude_configure
199
+ PROPERTIES
200
+ FIXTURES_REQUIRED ${inst_setup}
201
+ FIXTURES_SETUP mzasx_config)
174202
175203
set_tests_properties(minizip_add_subdirectory_exclude_build
176
- PROPERTIES FIXTURES_REQUIRED mzasx_config)
204
+ PROPERTIES
205
+ FIXTURES_REQUIRED mzasx_config)
177206
--- compat/zlib/contrib/minizip/test/CMakeLists.txt
+++ compat/zlib/contrib/minizip/test/CMakeLists.txt
@@ -1,52 +1,45 @@
1 # if we are built from with zlib, use this path's)
2 if(DEFINED ZLIB_BUILD_MINIZIP)
3 set(WORK_DIR ${zlib_BINARY_DIR})
4 set(inst_setup zlib_install)
5 else(DEFINED ZLIB_BUILD_MINIZIP)
6 set(WORK_DIR ${minizip_BINARY_DIR})
7 set(inst_setup minizip_install)
8 set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
9
10 add_test(
11 NAME minizip_install
12 COMMAND ${CMAKE_COMMAND} --install ${minizip_BINARY_DIR} --prefix
13 ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
14 WORKING_DIRECTORY ${minizip_BINARY_DIR})
 
 
15
16 set_tests_properties(minizip_install
17 PROPERTIES
18 FIXTURES_SETUP minizip_install)
19 endif(DEFINED ZLIB_BUILD_MINIZIP)
20
21 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
22 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_componentstest)
23 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
24 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
25 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
26
27 configure_file(
28 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
29 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
30
31 configure_file(
32 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
33 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
34 @ONLY)
35
36 configure_file(
37 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
38 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
39 @ONLY)
40
41 configure_file(
42 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
43 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
44
45 configure_file(
46 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
47 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
48 @ONLY)
49
50 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
51 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
52
@@ -53,73 +46,94 @@
53 if(GENERATOR)
54 set(PLATFORM "-A ${GENERATOR}")
55 endif(GENERATOR)
56
57 #
58 # findpackage_test
59 #
60 add_test(
61 NAME minizip_find_package_configure
62 COMMAND
63 ${CMAKE_COMMAND} ${PLATFORM}
64 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
65 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
66 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
67 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
68 --fresh -G "${CMAKE_GENERATOR}"
69 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
 
 
 
 
70
71 add_test(
72 NAME minizip_find_package_build
73 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
74 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
75
76 set_tests_properties(
77 minizip_find_package_configure PROPERTIES FIXTURES_REQUIRED ${inst_setup}
78 FIXTURES_SETUP mzfp_config)
79
80 set_tests_properties(minizip_find_package_build PROPERTIES FIXTURES_REQUIRED
81 mzfp_config)
 
 
82
83 #
84 # findpackage_no_components_test
85 #
86 add_test(
87 NAME minizip_find_package_no_components_configure
88 COMMAND
89 ${CMAKE_COMMAND} ${PLATFORM}
90 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
91 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
92 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
93 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
94 --fresh -G "${CMAKE_GENERATOR}"
95 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
 
 
 
 
96
97 set_tests_properties(
98 minizip_find_package_no_components_configure PROPERTIES FIXTURES_REQUIRED ${inst_setup})
 
99
100 if(NOT MINIZIP_BUILD_SHARED OR NOT MINIZIP_BUILD_STATIC)
101 set_tests_properties(
102 minizip_find_package_no_components_configure PROPERTIES WILL_FAIL TRUE)
 
103 endif(NOT MINIZIP_BUILD_SHARED OR NOT MINIZIP_BUILD_STATIC)
104
105 #
106 # findpackage_no_components_test
107 #
108 add_test(
109 NAME minizip_find_package_wrong_components_configure
110 COMMAND
111 ${CMAKE_COMMAND} ${PLATFORM}
112 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
113 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
114 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
115 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
116 --fresh -G "${CMAKE_GENERATOR}"
117 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
 
 
 
 
118
119 set_tests_properties(
120 minizip_find_package_wrong_components_configure
121 PROPERTIES
122 FIXTURES_REQUIRED ${inst_setup}
123 WILL_FAIL TRUE)
124
125 #
@@ -126,51 +140,66 @@
126 # add_subdirectory_test
127 #
128 add_test(
129 NAME minizip_add_subdirectory_configure
130 COMMAND
131 ${CMAKE_COMMAND} ${PLATFORM}
132 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
133 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
134 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
135 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
136 --fresh -G "${CMAKE_GENERATOR}"
137 -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
 
 
 
138
139 add_test(
140 NAME minizip_add_subdirectory_build
141 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
142 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
143
144 set_tests_properties(
145 minizip_add_subdirectory_configure
146 PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzas_config)
147
148 set_tests_properties(minizip_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED
149 mzas_config)
 
 
150
151 #
152 # add_subdirectory_exclude_test
153 #
154 add_test(
155 NAME minizip_add_subdirectory_exclude_configure
156 COMMAND
157 ${CMAKE_COMMAND} ${PLATFORM}
158 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
159 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
160 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
161 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
162 --fresh -G "${CMAKE_GENERATOR}"
163 -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
 
 
 
 
164
165 add_test(
166 NAME minizip_add_subdirectory_exclude_build
167 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
168 WORKING_DIRECTORY
169 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
170
171 set_tests_properties(
172 minizip_add_subdirectory_exclude_configure
173 PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzasx_config)
 
174
175 set_tests_properties(minizip_add_subdirectory_exclude_build
176 PROPERTIES FIXTURES_REQUIRED mzasx_config)
 
177
--- compat/zlib/contrib/minizip/test/CMakeLists.txt
+++ compat/zlib/contrib/minizip/test/CMakeLists.txt
@@ -1,52 +1,45 @@
1 # if we are built from with zlib, use this path's)
2 if(NOT DEFINED ZLIB_BUILD_MINIZIP)
3 set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
 
 
4 set(inst_setup minizip_install)
5 set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
6
7 add_test(
8 NAME minizip_install
9 COMMAND ${CMAKE_COMMAND}
10 --install ${minizip_BINARY_DIR}
11 --prefix ${WORK_DIR}/test_install
12 --config $<CONFIG>
13 WORKING_DIRECTORY ${WORK_DIR})
14
15 set_tests_properties(minizip_install
16 PROPERTIES
17 FIXTURES_SETUP minizip_install)
18 endif(NOT DEFINED ZLIB_BUILD_MINIZIP)
 
 
 
 
 
 
19
20 configure_file(
21 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
22 ${WORK_DIR}/minizip_find_package_test/CMakeLists.txt @ONLY)
23
24 configure_file(
25 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
26 ${WORK_DIR}/minizip_find_package_no_components_test/CMakeLists.txt
27 @ONLY)
28
29 configure_file(
30 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
31 ${WORK_DIR}/minizip_find_package_wrong_components_test/CMakeLists.txt
32 @ONLY)
33
34 configure_file(
35 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
36 ${WORK_DIR}/minizip_add_subdirectory_test/CMakeLists.txt @ONLY)
37
38 configure_file(
39 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
40 ${WORK_DIR}/minizip_add_subdirectory_exclude_test/CMakeLists.txt
41 @ONLY)
42
43 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
44 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
45
@@ -53,73 +46,94 @@
46 if(GENERATOR)
47 set(PLATFORM "-A ${GENERATOR}")
48 endif(GENERATOR)
49
50 #
51 # find_package_test
52 #
53 add_test(
54 NAME minizip_find_package_configure
55 COMMAND
56 ${CMAKE_COMMAND}
57 ${PLATFORM}
58 -B${WORK_DIR}/minizip_find_package_test_build
59 -DCMAKE_BUILD_TYPE=$<CONFIG>
60 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
61 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
62 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
63 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
64 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
65 ${ZLIB_ARG}
66 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
67 -G "${CMAKE_GENERATOR}"
68 -S${WORK_DIR}/minizip_find_package_test)
69
70 add_test(
71 NAME minizip_find_package_build
72 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
73 WORKING_DIRECTORY ${WORK_DIR}/minizip_find_package_test_build)
74
75 set_tests_properties(minizip_find_package_configure
76 PROPERTIES
77 FIXTURES_REQUIRED ${inst_setup}
78 FIXTURES_SETUP mzfp_config)
79
80 set_tests_properties(minizip_find_package_build
81 PROPERTIES
82 FIXTURES_REQUIRED mzfp_config)
83
84 #
85 # find_package_no_components_test
86 #
87 add_test(
88 NAME minizip_find_package_no_components_configure
89 COMMAND
90 ${CMAKE_COMMAND}
91 ${PLATFORM}
92 -B${WORK_DIR}/minizip_find_package_no_components_test_build
93 -DCMAKE_BUILD_TYPE=$<CONFIG>
94 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
95 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
96 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
97 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
98 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
99 ${ZLIB_ARG}
100 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
101 -G "${CMAKE_GENERATOR}"
102 -S${WORK_DIR}/minizip_find_package_no_components_test)
103
104 set_tests_properties(minizip_find_package_no_components_configure
105 PROPERTIES
106 FIXTURES_REQUIRED ${inst_setup})
107
108 if(NOT MINIZIP_BUILD_SHARED OR NOT MINIZIP_BUILD_STATIC)
109 set_tests_properties(minizip_find_package_no_components_configure
110 PROPERTIES
111 WILL_FAIL TRUE)
112 endif(NOT MINIZIP_BUILD_SHARED OR NOT MINIZIP_BUILD_STATIC)
113
114 #
115 # find_package_no_components_test
116 #
117 add_test(
118 NAME minizip_find_package_wrong_components_configure
119 COMMAND
120 ${CMAKE_COMMAND}
121 ${PLATFORM}
122 -B${WORK_DIR}/minizip_find_package_wrong_components_test_build
123 -DCMAKE_BUILD_TYPE=$<CONFIG>
124 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
125 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
126 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
127 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
128 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
129 ${ZLIB_ARG}
130 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
131 -G "${CMAKE_GENERATOR}"
132 -S${WORK_DIR}/minizip_find_package_wrong_components_test)
133
134 set_tests_properties(minizip_find_package_wrong_components_configure
 
135 PROPERTIES
136 FIXTURES_REQUIRED ${inst_setup}
137 WILL_FAIL TRUE)
138
139 #
@@ -126,51 +140,66 @@
140 # add_subdirectory_test
141 #
142 add_test(
143 NAME minizip_add_subdirectory_configure
144 COMMAND
145 ${CMAKE_COMMAND}
146 ${PLATFORM}
147 -B${WORK_DIR}/minizip_add_subdirectory_test_build
148 -DCMAKE_BUILD_TYPE=$<CONFIG>
149 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
150 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
151 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
152 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
153 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install ${ZLIB_ARG}
154 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
155 -G "${CMAKE_GENERATOR}"
156 -S${WORK_DIR}/minizip_add_subdirectory_test)
157
158 add_test(
159 NAME minizip_add_subdirectory_build
160 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
161 WORKING_DIRECTORY ${WORK_DIR}/minizip_add_subdirectory_test_build)
162
163 set_tests_properties(minizip_add_subdirectory_configure
164 PROPERTIES
165 FIXTURES_REQUIRED ${inst_setup}
166 FIXTURES_SETUP mzas_config)
167
168 set_tests_properties(minizip_add_subdirectory_build
169 PROPERTIES
170 FIXTURES_REQUIRED mzas_config)
171
172 #
173 # add_subdirectory_exclude_test
174 #
175 add_test(
176 NAME minizip_add_subdirectory_exclude_configure
177 COMMAND
178 ${CMAKE_COMMAND}
179 ${PLATFORM}
180 -B${WORK_DIR}/minizip_add_subdirectory_exclude_test_build
181 -DCMAKE_BUILD_TYPE=$<CONFIG>
182 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
183 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
184 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
185 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
186 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
187 ${ZLIB_ARG}
188 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
189 -G "${CMAKE_GENERATOR}"
190 -S${WORK_DIR}/minizip_add_subdirectory_exclude_test)
191
192 add_test(
193 NAME minizip_add_subdirectory_exclude_build
194 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
195 WORKING_DIRECTORY
196 ${WORK_DIR}/minizip_add_subdirectory_exclude_test_build)
197
198 set_tests_properties(minizip_add_subdirectory_exclude_configure
199 PROPERTIES
200 FIXTURES_REQUIRED ${inst_setup}
201 FIXTURES_SETUP mzasx_config)
202
203 set_tests_properties(minizip_add_subdirectory_exclude_build
204 PROPERTIES
205 FIXTURES_REQUIRED mzasx_config)
206
--- compat/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
minizip_add_subdirectory_exclude_from_all
55
LANGUAGES C
66
VERSION @minizip_VERSION@)
77
--- compat/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 minizip_add_subdirectory_exclude_from_all
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
7
--- compat/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 minizip_add_subdirectory_exclude_from_all
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
7
--- compat/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
minizip_add_subdirectory_exclude_from_all
55
LANGUAGES C
66
VERSION @minizip_VERSION@)
77
--- compat/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 minizip_add_subdirectory_exclude_from_all
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
7
--- compat/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 minizip_add_subdirectory_exclude_from_all
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
7
--- compat/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
minizip_find_package
55
LANGUAGES C
66
VERSION @minizip_VERSION@)
77
--- compat/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 minizip_find_package
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
7
--- compat/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 minizip_find_package
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
7
--- compat/zlib/contrib/minizip/test/find_package_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
minizip_find_package
55
LANGUAGES C
66
VERSION @minizip_VERSION@)
@@ -12,15 +12,21 @@
1212
@minizip_SOURCE_DIR@/ioapi.c
1313
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
1414
@minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
1515
1616
if(MINIZIP_BUILD_SHARED)
17
- find_package(minizip ${minizip_VERSION} CONFIG COMPONENTS shared REQUIRED)
17
+ find_package(minizip ${minizip_VERSION}
18
+ CONFIG
19
+ COMPONENTS shared
20
+ REQUIRED)
1821
add_executable(test_example ${MINIZIP_SRCS})
1922
target_link_libraries(test_example MINIZIP::minizip)
2023
endif(MINIZIP_BUILD_SHARED)
2124
2225
if(MINIZIP_BUILD_STATIC)
23
- find_package(minizip ${minizip_VERSION} CONFIG COMPONENTS static REQUIRED)
26
+ find_package(minizip ${minizip_VERSION}
27
+ CONFIG
28
+ COMPONENTS static
29
+ REQUIRED)
2430
add_executable(test_example_static ${MINIZIP_SRCS})
2531
target_link_libraries(test_example_static MINIZIP::minizipstatic)
2632
endif(MINIZIP_BUILD_STATIC)
2733
--- compat/zlib/contrib/minizip/test/find_package_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 minizip_find_package
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
@@ -12,15 +12,21 @@
12 @minizip_SOURCE_DIR@/ioapi.c
13 $<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
14 @minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
15
16 if(MINIZIP_BUILD_SHARED)
17 find_package(minizip ${minizip_VERSION} CONFIG COMPONENTS shared REQUIRED)
 
 
 
18 add_executable(test_example ${MINIZIP_SRCS})
19 target_link_libraries(test_example MINIZIP::minizip)
20 endif(MINIZIP_BUILD_SHARED)
21
22 if(MINIZIP_BUILD_STATIC)
23 find_package(minizip ${minizip_VERSION} CONFIG COMPONENTS static REQUIRED)
 
 
 
24 add_executable(test_example_static ${MINIZIP_SRCS})
25 target_link_libraries(test_example_static MINIZIP::minizipstatic)
26 endif(MINIZIP_BUILD_STATIC)
27
--- compat/zlib/contrib/minizip/test/find_package_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 minizip_find_package
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
@@ -12,15 +12,21 @@
12 @minizip_SOURCE_DIR@/ioapi.c
13 $<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
14 @minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
15
16 if(MINIZIP_BUILD_SHARED)
17 find_package(minizip ${minizip_VERSION}
18 CONFIG
19 COMPONENTS shared
20 REQUIRED)
21 add_executable(test_example ${MINIZIP_SRCS})
22 target_link_libraries(test_example MINIZIP::minizip)
23 endif(MINIZIP_BUILD_SHARED)
24
25 if(MINIZIP_BUILD_STATIC)
26 find_package(minizip ${minizip_VERSION}
27 CONFIG
28 COMPONENTS static
29 REQUIRED)
30 add_executable(test_example_static ${MINIZIP_SRCS})
31 target_link_libraries(test_example_static MINIZIP::minizipstatic)
32 endif(MINIZIP_BUILD_STATIC)
33
--- compat/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
minizip_find_package
55
LANGUAGES C
66
VERSION @minizip_VERSION@)
77
--- compat/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 minizip_find_package
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
7
--- compat/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 minizip_find_package
5 LANGUAGES C
6 VERSION @minizip_VERSION@)
7
--- compat/zlib/contrib/minizip/unzip.c
+++ compat/zlib/contrib/minizip/unzip.c
@@ -324,11 +324,11 @@
324324
*/
325325
local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
326326
unsigned char* buf;
327327
ZPOS64_T uSizeFile;
328328
ZPOS64_T uBackRead;
329
- ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
329
+ ZPOS64_T uMaxBack=0xffff+22; /* maximum comment and end-of-central-directory record */
330330
ZPOS64_T uPosFound=CENTRALDIRINVALID;
331331
332332
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
333333
return CENTRALDIRINVALID;
334334
@@ -360,11 +360,11 @@
360360
break;
361361
362362
if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
363363
break;
364364
365
- for (i=(int)uReadSize-3; (i--)>0;)
365
+ for (i=(int)uReadSize-4; i>=0; --i)
366366
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
367367
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
368368
{
369369
uPosFound = uReadPos+(unsigned)i;
370370
break;
@@ -377,79 +377,33 @@
377377
return uPosFound;
378378
}
379379
380380
381381
/*
382
- Locate the Central directory 64 of a zipfile (at the end, just before
383
- the global comment)
382
+ Locate the ZIP64 end of central directory record using the locator immediately
383
+ preceding the classic end of central directory record.
384384
*/
385385
local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
386
- voidpf filestream) {
387
- unsigned char* buf;
388
- ZPOS64_T uSizeFile;
389
- ZPOS64_T uBackRead;
390
- ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
391
- ZPOS64_T uPosFound=CENTRALDIRINVALID;
386
+ voidpf filestream,
387
+ ZPOS64_T centralDirPos) {
388
+ ZPOS64_T uPosFound;
392389
uLong uL;
393
- ZPOS64_T relativeOffset;
394
-
395
- if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
396
- return CENTRALDIRINVALID;
397
-
398
-
399
- uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
400
-
401
- if (uMaxBack>uSizeFile)
402
- uMaxBack = uSizeFile;
403
-
404
- buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
405
- if (buf==NULL)
406
- return CENTRALDIRINVALID;
407
-
408
- uBackRead = 4;
409
- while (uBackRead<uMaxBack)
410
- {
411
- uLong uReadSize;
412
- ZPOS64_T uReadPos;
413
- int i;
414
- if (uBackRead+BUFREADCOMMENT>uMaxBack)
415
- uBackRead = uMaxBack;
416
- else
417
- uBackRead+=BUFREADCOMMENT;
418
- uReadPos = uSizeFile-uBackRead ;
419
-
420
- uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
421
- (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
422
- if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
423
- break;
424
-
425
- if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
426
- break;
427
-
428
- for (i=(int)uReadSize-3; (i--)>0;)
429
- if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
430
- ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
431
- {
432
- uPosFound = uReadPos+(unsigned)i;
433
- break;
434
- }
435
-
436
- if (uPosFound!=CENTRALDIRINVALID)
437
- break;
438
- }
439
- free(buf);
440
- if (uPosFound == CENTRALDIRINVALID)
441
- return CENTRALDIRINVALID;
442
-
443
- /* Zip64 end of central directory locator */
390
+ ZPOS64_T relativeOffset;
391
+
392
+ /* The ZIP64 locator immediately precedes the classic EOCD. Checking only
393
+ this position prevents a locator signature in file data from overriding
394
+ the central directory referenced by the actual EOCD. */
395
+ if (centralDirPos == CENTRALDIRINVALID || centralDirPos < 20)
396
+ return CENTRALDIRINVALID;
397
+
398
+ uPosFound = centralDirPos - 20;
444399
if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
445400
return CENTRALDIRINVALID;
446401
447
- /* the signature, already checked */
448
- if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
402
+ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK ||
403
+ uL != 0x07064b50)
449404
return CENTRALDIRINVALID;
450
-
451405
/* number of the disk with the start of the zip64 end of central directory */
452406
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
453407
return CENTRALDIRINVALID;
454408
if (uL != 0)
455409
return CENTRALDIRINVALID;
@@ -491,10 +445,11 @@
491445
zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
492446
int is64bitOpenFunction) {
493447
unz64_s us;
494448
unz64_s *s;
495449
ZPOS64_T central_pos;
450
+ ZPOS64_T central_pos64;
496451
uLong uL;
497452
498453
uLong number_disk; /* number of the current disk, used for
499454
spanning ZIP, unsupported, always 0*/
500455
uLong number_disk_with_CD; /* number the disk with central dir, used
@@ -523,16 +478,20 @@
523478
ZLIB_FILEFUNC_MODE_READ |
524479
ZLIB_FILEFUNC_MODE_EXISTING);
525480
if (us.filestream==NULL)
526481
return NULL;
527482
528
- central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
529
- if (central_pos!=CENTRALDIRINVALID)
483
+ central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
484
+ central_pos64 = unz64local_SearchCentralDir64(&us.z_filefunc,
485
+ us.filestream,
486
+ central_pos);
487
+ if (central_pos64!=CENTRALDIRINVALID)
530488
{
531489
uLong uS;
532490
ZPOS64_T uL64;
533491
492
+ central_pos = central_pos64;
534493
us.isZip64 = 1;
535494
536495
if (ZSEEK64(us.z_filefunc, us.filestream,
537496
central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
538497
err=UNZ_ERRNO;
@@ -585,11 +544,10 @@
585544
586545
us.gi.size_comment = 0;
587546
}
588547
else
589548
{
590
- central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
591549
if (central_pos==CENTRALDIRINVALID)
592550
err=UNZ_ERRNO;
593551
594552
us.isZip64 = 0;
595553
@@ -778,10 +736,12 @@
778736
unz_file_info64_internal file_info_internal;
779737
int err=UNZ_OK;
780738
uLong uMagic;
781739
long lSeek=0;
782740
uLong uL;
741
+ unsigned zip64_required;
742
+ unsigned zip64_consumed = 0;
783743
784744
if (file==NULL)
785745
return UNZ_PARAMERROR;
786746
s=(unz64_s*)file;
787747
if (ZSEEK64(s->z_filefunc, s->filestream,
@@ -848,10 +808,21 @@
848808
/* relative offset of local header */
849809
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
850810
err=UNZ_ERRNO;
851811
file_info_internal.offset_curfile = uL;
852812
813
+
814
+ /* Remember ZIP64 requirements before replacing any values. */
815
+ if (err != UNZ_OK)
816
+ return err;
817
+
818
+ zip64_required =
819
+ (file_info.uncompressed_size == MAXU32 ? 1U : 0U) |
820
+ (file_info.compressed_size == MAXU32 ? 2U : 0U) |
821
+ (file_info_internal.offset_curfile == MAXU32 ? 4U : 0U) |
822
+ (file_info.disk_num_start == 0xffff ? 8U : 0U);
823
+
853824
lSeek+=file_info.size_filename;
854825
if ((err==UNZ_OK) && (szFileName!=NULL))
855826
{
856827
uLong uSizeRead ;
857828
if (file_info.size_filename<fileNameBufferSize)
@@ -911,55 +882,84 @@
911882
}
912883
913884
while(acc < file_info.size_file_extra)
914885
{
915886
uLong headerId;
916
- uLong dataSize;
917
-
918
- if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK)
919
- err=UNZ_ERRNO;
920
-
921
- if (unz64local_getShort(&s->z_filefunc, s->filestream,&dataSize) != UNZ_OK)
922
- err=UNZ_ERRNO;
923
-
924
- /* ZIP64 extra fields */
887
+ uLong dataSize;
888
+ uLong used = 0;
889
+ uLong remaining = file_info.size_file_extra - acc;
890
+
891
+ /* Every extra-field record starts with four bytes. */
892
+ if (remaining < 4)
893
+ return UNZ_BADZIPFILE;
894
+
895
+ if (unz64local_getShort(&s->z_filefunc, s->filestream,
896
+ &headerId) != UNZ_OK ||
897
+ unz64local_getShort(&s->z_filefunc, s->filestream,
898
+ &dataSize) != UNZ_OK)
899
+ return UNZ_ERRNO;
900
+
901
+ remaining -= 4;
902
+ if (dataSize > remaining)
903
+ return UNZ_BADZIPFILE;
904
+
905
+ /* ZIP64 values must fit within this record. */
925906
if (headerId == 0x0001)
926907
{
927
- if(file_info.uncompressed_size == MAXU32)
928
- {
929
- if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
930
- err=UNZ_ERRNO;
931
- }
932
-
933
- if(file_info.compressed_size == MAXU32)
934
- {
935
- if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
936
- err=UNZ_ERRNO;
937
- }
938
-
939
- if(file_info_internal.offset_curfile == MAXU32)
940
- {
941
- /* Relative Header offset */
942
- if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
943
- err=UNZ_ERRNO;
944
- }
945
-
946
- if(file_info.disk_num_start == 0xffff)
947
- {
948
- /* Disk Start Number */
949
- if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
950
- err=UNZ_ERRNO;
951
- }
952
-
953
- }
954
- else
955
- {
956
- if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)
957
- err=UNZ_ERRNO;
958
- }
959
-
960
- acc += 2 + 2 + dataSize;
908
+ if ((zip64_required & 1U) && !(zip64_consumed & 1U))
909
+ {
910
+ if (dataSize - used < 8)
911
+ return UNZ_BADZIPFILE;
912
+ if (unz64local_getLong64(&s->z_filefunc, s->filestream,
913
+ &file_info.uncompressed_size) != UNZ_OK)
914
+ return UNZ_ERRNO;
915
+ used += 8;
916
+ zip64_consumed |= 1U;
917
+ }
918
+
919
+ if ((zip64_required & 2U) && !(zip64_consumed & 2U))
920
+ {
921
+ if (dataSize - used < 8)
922
+ return UNZ_BADZIPFILE;
923
+ if (unz64local_getLong64(&s->z_filefunc, s->filestream,
924
+ &file_info.compressed_size) != UNZ_OK)
925
+ return UNZ_ERRNO;
926
+ used += 8;
927
+ zip64_consumed |= 2U;
928
+ }
929
+
930
+ if ((zip64_required & 4U) && !(zip64_consumed & 4U))
931
+ {
932
+ if (dataSize - used < 8)
933
+ return UNZ_BADZIPFILE;
934
+ if (unz64local_getLong64(&s->z_filefunc, s->filestream,
935
+ &file_info_internal.offset_curfile) != UNZ_OK)
936
+ return UNZ_ERRNO;
937
+ used += 8;
938
+ zip64_consumed |= 4U;
939
+ }
940
+
941
+ if ((zip64_required & 8U) && !(zip64_consumed & 8U))
942
+ {
943
+ if (dataSize - used < 4)
944
+ return UNZ_BADZIPFILE;
945
+ if (unz64local_getLong(&s->z_filefunc, s->filestream,
946
+ &file_info.disk_num_start) != UNZ_OK)
947
+ return UNZ_ERRNO;
948
+ used += 4;
949
+ zip64_consumed |= 8U;
950
+ }
951
+ }
952
+
953
+ /* Skip remaining bytes, but never leave this record. */
954
+ if (used < dataSize &&
955
+ ZSEEK64(s->z_filefunc, s->filestream,
956
+ dataSize - used,
957
+ ZLIB_FILEFUNC_SEEK_CUR) != 0)
958
+ return UNZ_ERRNO;
959
+
960
+ acc += 4 + dataSize;
961961
}
962962
}
963963
964964
if ((err==UNZ_OK) && (szComment!=NULL))
965965
{
@@ -1165,17 +1165,16 @@
11651165
return err;
11661166
}
11671167
11681168
11691169
/*
1170
-///////////////////////////////////////////
1171
-// Contributed by Ryan Haksi (mailto://[email protected])
1172
-// I need random access
1173
-//
1174
-// Further optimization could be realized by adding an ability
1175
-// to cache the directory in memory. The goal being a single
1176
-// comprehensive file read to put the file I need in a memory.
1170
+ Contributed by Ryan Haksi (mailto://[email protected])
1171
+ I need random access
1172
+
1173
+ Further optimization could be realized by adding an ability
1174
+ to cache the directory in memory. The goal being a single
1175
+ comprehensive file read to put the file I need in a memory.
11771176
*/
11781177
11791178
/*
11801179
typedef struct unz_file_pos_s
11811180
{
@@ -1240,12 +1239,11 @@
12401239
file_pos64.num_of_file = file_pos->num_of_file;
12411240
return unzGoToFilePos64(file,&file_pos64);
12421241
}
12431242
12441243
/*
1245
-// Unzip Helper Functions - should be here?
1246
-///////////////////////////////////////////
1244
+ Unzip Helper Functions - should be here?
12471245
*/
12481246
12491247
/*
12501248
Read the local header of the current zipfile
12511249
Check the coherency of the local header and info in the end of central
12521250
--- compat/zlib/contrib/minizip/unzip.c
+++ compat/zlib/contrib/minizip/unzip.c
@@ -324,11 +324,11 @@
324 */
325 local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
326 unsigned char* buf;
327 ZPOS64_T uSizeFile;
328 ZPOS64_T uBackRead;
329 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
330 ZPOS64_T uPosFound=CENTRALDIRINVALID;
331
332 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
333 return CENTRALDIRINVALID;
334
@@ -360,11 +360,11 @@
360 break;
361
362 if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
363 break;
364
365 for (i=(int)uReadSize-3; (i--)>0;)
366 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
367 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
368 {
369 uPosFound = uReadPos+(unsigned)i;
370 break;
@@ -377,79 +377,33 @@
377 return uPosFound;
378 }
379
380
381 /*
382 Locate the Central directory 64 of a zipfile (at the end, just before
383 the global comment)
384 */
385 local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
386 voidpf filestream) {
387 unsigned char* buf;
388 ZPOS64_T uSizeFile;
389 ZPOS64_T uBackRead;
390 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
391 ZPOS64_T uPosFound=CENTRALDIRINVALID;
392 uLong uL;
393 ZPOS64_T relativeOffset;
394
395 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
396 return CENTRALDIRINVALID;
397
398
399 uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
400
401 if (uMaxBack>uSizeFile)
402 uMaxBack = uSizeFile;
403
404 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
405 if (buf==NULL)
406 return CENTRALDIRINVALID;
407
408 uBackRead = 4;
409 while (uBackRead<uMaxBack)
410 {
411 uLong uReadSize;
412 ZPOS64_T uReadPos;
413 int i;
414 if (uBackRead+BUFREADCOMMENT>uMaxBack)
415 uBackRead = uMaxBack;
416 else
417 uBackRead+=BUFREADCOMMENT;
418 uReadPos = uSizeFile-uBackRead ;
419
420 uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
421 (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
422 if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
423 break;
424
425 if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
426 break;
427
428 for (i=(int)uReadSize-3; (i--)>0;)
429 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
430 ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
431 {
432 uPosFound = uReadPos+(unsigned)i;
433 break;
434 }
435
436 if (uPosFound!=CENTRALDIRINVALID)
437 break;
438 }
439 free(buf);
440 if (uPosFound == CENTRALDIRINVALID)
441 return CENTRALDIRINVALID;
442
443 /* Zip64 end of central directory locator */
444 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
445 return CENTRALDIRINVALID;
446
447 /* the signature, already checked */
448 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
449 return CENTRALDIRINVALID;
450
451 /* number of the disk with the start of the zip64 end of central directory */
452 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
453 return CENTRALDIRINVALID;
454 if (uL != 0)
455 return CENTRALDIRINVALID;
@@ -491,10 +445,11 @@
491 zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
492 int is64bitOpenFunction) {
493 unz64_s us;
494 unz64_s *s;
495 ZPOS64_T central_pos;
 
496 uLong uL;
497
498 uLong number_disk; /* number of the current disk, used for
499 spanning ZIP, unsupported, always 0*/
500 uLong number_disk_with_CD; /* number the disk with central dir, used
@@ -523,16 +478,20 @@
523 ZLIB_FILEFUNC_MODE_READ |
524 ZLIB_FILEFUNC_MODE_EXISTING);
525 if (us.filestream==NULL)
526 return NULL;
527
528 central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream);
529 if (central_pos!=CENTRALDIRINVALID)
 
 
 
530 {
531 uLong uS;
532 ZPOS64_T uL64;
533
 
534 us.isZip64 = 1;
535
536 if (ZSEEK64(us.z_filefunc, us.filestream,
537 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
538 err=UNZ_ERRNO;
@@ -585,11 +544,10 @@
585
586 us.gi.size_comment = 0;
587 }
588 else
589 {
590 central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
591 if (central_pos==CENTRALDIRINVALID)
592 err=UNZ_ERRNO;
593
594 us.isZip64 = 0;
595
@@ -778,10 +736,12 @@
778 unz_file_info64_internal file_info_internal;
779 int err=UNZ_OK;
780 uLong uMagic;
781 long lSeek=0;
782 uLong uL;
 
 
783
784 if (file==NULL)
785 return UNZ_PARAMERROR;
786 s=(unz64_s*)file;
787 if (ZSEEK64(s->z_filefunc, s->filestream,
@@ -848,10 +808,21 @@
848 /* relative offset of local header */
849 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
850 err=UNZ_ERRNO;
851 file_info_internal.offset_curfile = uL;
852
 
 
 
 
 
 
 
 
 
 
 
853 lSeek+=file_info.size_filename;
854 if ((err==UNZ_OK) && (szFileName!=NULL))
855 {
856 uLong uSizeRead ;
857 if (file_info.size_filename<fileNameBufferSize)
@@ -911,55 +882,84 @@
911 }
912
913 while(acc < file_info.size_file_extra)
914 {
915 uLong headerId;
916 uLong dataSize;
917
918 if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK)
919 err=UNZ_ERRNO;
920
921 if (unz64local_getShort(&s->z_filefunc, s->filestream,&dataSize) != UNZ_OK)
922 err=UNZ_ERRNO;
923
924 /* ZIP64 extra fields */
 
 
 
 
 
 
 
 
 
 
925 if (headerId == 0x0001)
926 {
927 if(file_info.uncompressed_size == MAXU32)
928 {
929 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
930 err=UNZ_ERRNO;
931 }
932
933 if(file_info.compressed_size == MAXU32)
934 {
935 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
936 err=UNZ_ERRNO;
937 }
938
939 if(file_info_internal.offset_curfile == MAXU32)
940 {
941 /* Relative Header offset */
942 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
943 err=UNZ_ERRNO;
944 }
945
946 if(file_info.disk_num_start == 0xffff)
947 {
948 /* Disk Start Number */
949 if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
950 err=UNZ_ERRNO;
951 }
952
953 }
954 else
955 {
956 if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0)
957 err=UNZ_ERRNO;
958 }
959
960 acc += 2 + 2 + dataSize;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
961 }
962 }
963
964 if ((err==UNZ_OK) && (szComment!=NULL))
965 {
@@ -1165,17 +1165,16 @@
1165 return err;
1166 }
1167
1168
1169 /*
1170 ///////////////////////////////////////////
1171 // Contributed by Ryan Haksi (mailto://[email protected])
1172 // I need random access
1173 //
1174 // Further optimization could be realized by adding an ability
1175 // to cache the directory in memory. The goal being a single
1176 // comprehensive file read to put the file I need in a memory.
1177 */
1178
1179 /*
1180 typedef struct unz_file_pos_s
1181 {
@@ -1240,12 +1239,11 @@
1240 file_pos64.num_of_file = file_pos->num_of_file;
1241 return unzGoToFilePos64(file,&file_pos64);
1242 }
1243
1244 /*
1245 // Unzip Helper Functions - should be here?
1246 ///////////////////////////////////////////
1247 */
1248
1249 /*
1250 Read the local header of the current zipfile
1251 Check the coherency of the local header and info in the end of central
1252
--- compat/zlib/contrib/minizip/unzip.c
+++ compat/zlib/contrib/minizip/unzip.c
@@ -324,11 +324,11 @@
324 */
325 local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
326 unsigned char* buf;
327 ZPOS64_T uSizeFile;
328 ZPOS64_T uBackRead;
329 ZPOS64_T uMaxBack=0xffff+22; /* maximum comment and end-of-central-directory record */
330 ZPOS64_T uPosFound=CENTRALDIRINVALID;
331
332 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
333 return CENTRALDIRINVALID;
334
@@ -360,11 +360,11 @@
360 break;
361
362 if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
363 break;
364
365 for (i=(int)uReadSize-4; i>=0; --i)
366 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
367 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
368 {
369 uPosFound = uReadPos+(unsigned)i;
370 break;
@@ -377,79 +377,33 @@
377 return uPosFound;
378 }
379
380
381 /*
382 Locate the ZIP64 end of central directory record using the locator immediately
383 preceding the classic end of central directory record.
384 */
385 local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
386 voidpf filestream,
387 ZPOS64_T centralDirPos) {
388 ZPOS64_T uPosFound;
 
 
 
389 uLong uL;
390 ZPOS64_T relativeOffset;
391
392 /* The ZIP64 locator immediately precedes the classic EOCD. Checking only
393 this position prevents a locator signature in file data from overriding
394 the central directory referenced by the actual EOCD. */
395 if (centralDirPos == CENTRALDIRINVALID || centralDirPos < 20)
396 return CENTRALDIRINVALID;
397
398 uPosFound = centralDirPos - 20;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
400 return CENTRALDIRINVALID;
401
402 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK ||
403 uL != 0x07064b50)
404 return CENTRALDIRINVALID;
 
405 /* number of the disk with the start of the zip64 end of central directory */
406 if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
407 return CENTRALDIRINVALID;
408 if (uL != 0)
409 return CENTRALDIRINVALID;
@@ -491,10 +445,11 @@
445 zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
446 int is64bitOpenFunction) {
447 unz64_s us;
448 unz64_s *s;
449 ZPOS64_T central_pos;
450 ZPOS64_T central_pos64;
451 uLong uL;
452
453 uLong number_disk; /* number of the current disk, used for
454 spanning ZIP, unsupported, always 0*/
455 uLong number_disk_with_CD; /* number the disk with central dir, used
@@ -523,16 +478,20 @@
478 ZLIB_FILEFUNC_MODE_READ |
479 ZLIB_FILEFUNC_MODE_EXISTING);
480 if (us.filestream==NULL)
481 return NULL;
482
483 central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream);
484 central_pos64 = unz64local_SearchCentralDir64(&us.z_filefunc,
485 us.filestream,
486 central_pos);
487 if (central_pos64!=CENTRALDIRINVALID)
488 {
489 uLong uS;
490 ZPOS64_T uL64;
491
492 central_pos = central_pos64;
493 us.isZip64 = 1;
494
495 if (ZSEEK64(us.z_filefunc, us.filestream,
496 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
497 err=UNZ_ERRNO;
@@ -585,11 +544,10 @@
544
545 us.gi.size_comment = 0;
546 }
547 else
548 {
 
549 if (central_pos==CENTRALDIRINVALID)
550 err=UNZ_ERRNO;
551
552 us.isZip64 = 0;
553
@@ -778,10 +736,12 @@
736 unz_file_info64_internal file_info_internal;
737 int err=UNZ_OK;
738 uLong uMagic;
739 long lSeek=0;
740 uLong uL;
741 unsigned zip64_required;
742 unsigned zip64_consumed = 0;
743
744 if (file==NULL)
745 return UNZ_PARAMERROR;
746 s=(unz64_s*)file;
747 if (ZSEEK64(s->z_filefunc, s->filestream,
@@ -848,10 +808,21 @@
808 /* relative offset of local header */
809 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
810 err=UNZ_ERRNO;
811 file_info_internal.offset_curfile = uL;
812
813
814 /* Remember ZIP64 requirements before replacing any values. */
815 if (err != UNZ_OK)
816 return err;
817
818 zip64_required =
819 (file_info.uncompressed_size == MAXU32 ? 1U : 0U) |
820 (file_info.compressed_size == MAXU32 ? 2U : 0U) |
821 (file_info_internal.offset_curfile == MAXU32 ? 4U : 0U) |
822 (file_info.disk_num_start == 0xffff ? 8U : 0U);
823
824 lSeek+=file_info.size_filename;
825 if ((err==UNZ_OK) && (szFileName!=NULL))
826 {
827 uLong uSizeRead ;
828 if (file_info.size_filename<fileNameBufferSize)
@@ -911,55 +882,84 @@
882 }
883
884 while(acc < file_info.size_file_extra)
885 {
886 uLong headerId;
887 uLong dataSize;
888 uLong used = 0;
889 uLong remaining = file_info.size_file_extra - acc;
890
891 /* Every extra-field record starts with four bytes. */
892 if (remaining < 4)
893 return UNZ_BADZIPFILE;
894
895 if (unz64local_getShort(&s->z_filefunc, s->filestream,
896 &headerId) != UNZ_OK ||
897 unz64local_getShort(&s->z_filefunc, s->filestream,
898 &dataSize) != UNZ_OK)
899 return UNZ_ERRNO;
900
901 remaining -= 4;
902 if (dataSize > remaining)
903 return UNZ_BADZIPFILE;
904
905 /* ZIP64 values must fit within this record. */
906 if (headerId == 0x0001)
907 {
908 if ((zip64_required & 1U) && !(zip64_consumed & 1U))
909 {
910 if (dataSize - used < 8)
911 return UNZ_BADZIPFILE;
912 if (unz64local_getLong64(&s->z_filefunc, s->filestream,
913 &file_info.uncompressed_size) != UNZ_OK)
914 return UNZ_ERRNO;
915 used += 8;
916 zip64_consumed |= 1U;
917 }
918
919 if ((zip64_required & 2U) && !(zip64_consumed & 2U))
920 {
921 if (dataSize - used < 8)
922 return UNZ_BADZIPFILE;
923 if (unz64local_getLong64(&s->z_filefunc, s->filestream,
924 &file_info.compressed_size) != UNZ_OK)
925 return UNZ_ERRNO;
926 used += 8;
927 zip64_consumed |= 2U;
928 }
929
930 if ((zip64_required & 4U) && !(zip64_consumed & 4U))
931 {
932 if (dataSize - used < 8)
933 return UNZ_BADZIPFILE;
934 if (unz64local_getLong64(&s->z_filefunc, s->filestream,
935 &file_info_internal.offset_curfile) != UNZ_OK)
936 return UNZ_ERRNO;
937 used += 8;
938 zip64_consumed |= 4U;
939 }
940
941 if ((zip64_required & 8U) && !(zip64_consumed & 8U))
942 {
943 if (dataSize - used < 4)
944 return UNZ_BADZIPFILE;
945 if (unz64local_getLong(&s->z_filefunc, s->filestream,
946 &file_info.disk_num_start) != UNZ_OK)
947 return UNZ_ERRNO;
948 used += 4;
949 zip64_consumed |= 8U;
950 }
951 }
952
953 /* Skip remaining bytes, but never leave this record. */
954 if (used < dataSize &&
955 ZSEEK64(s->z_filefunc, s->filestream,
956 dataSize - used,
957 ZLIB_FILEFUNC_SEEK_CUR) != 0)
958 return UNZ_ERRNO;
959
960 acc += 4 + dataSize;
961 }
962 }
963
964 if ((err==UNZ_OK) && (szComment!=NULL))
965 {
@@ -1165,17 +1165,16 @@
1165 return err;
1166 }
1167
1168
1169 /*
1170 Contributed by Ryan Haksi (mailto://[email protected])
1171 I need random access
1172
1173 Further optimization could be realized by adding an ability
1174 to cache the directory in memory. The goal being a single
1175 comprehensive file read to put the file I need in a memory.
 
1176 */
1177
1178 /*
1179 typedef struct unz_file_pos_s
1180 {
@@ -1240,12 +1239,11 @@
1239 file_pos64.num_of_file = file_pos->num_of_file;
1240 return unzGoToFilePos64(file,&file_pos64);
1241 }
1242
1243 /*
1244 Unzip Helper Functions - should be here?
 
1245 */
1246
1247 /*
1248 Read the local header of the current zipfile
1249 Check the coherency of the local header and info in the end of central
1250
--- compat/zlib/contrib/minizip/unzip.h
+++ compat/zlib/contrib/minizip/unzip.h
@@ -313,13 +313,14 @@
313313
(extraFieldBufferSize is the size of the buffer).
314314
This is the Central-header version of the extra field
315315
if szComment!=NULL, the comment string of the file will be copied in szComment
316316
(commentBufferSize is the size of the buffer)
317317
The file name and comment will be zero-terminated if there is room in the
318
- provided buffer. Otherwise the buffer will contain as much as will fit. If at
319
- least 65537 bytes of room is provided, then the result will always be
320
- complete and zero-terminated.
318
+ provided buffer. Otherwise the buffer will contain as much as will fit. It is
319
+ up to the application to zero-terminate the string in that case, if it plans
320
+ to use the truncated result. If at least 65537 bytes of room is provided, then
321
+ the result will always be complete and zero-terminated.
321322
*/
322323
323324
324325
/** Addition for GDAL : START */
325326
326327
--- compat/zlib/contrib/minizip/unzip.h
+++ compat/zlib/contrib/minizip/unzip.h
@@ -313,13 +313,14 @@
313 (extraFieldBufferSize is the size of the buffer).
314 This is the Central-header version of the extra field
315 if szComment!=NULL, the comment string of the file will be copied in szComment
316 (commentBufferSize is the size of the buffer)
317 The file name and comment will be zero-terminated if there is room in the
318 provided buffer. Otherwise the buffer will contain as much as will fit. If at
319 least 65537 bytes of room is provided, then the result will always be
320 complete and zero-terminated.
 
321 */
322
323
324 /** Addition for GDAL : START */
325
326
--- compat/zlib/contrib/minizip/unzip.h
+++ compat/zlib/contrib/minizip/unzip.h
@@ -313,13 +313,14 @@
313 (extraFieldBufferSize is the size of the buffer).
314 This is the Central-header version of the extra field
315 if szComment!=NULL, the comment string of the file will be copied in szComment
316 (commentBufferSize is the size of the buffer)
317 The file name and comment will be zero-terminated if there is room in the
318 provided buffer. Otherwise the buffer will contain as much as will fit. It is
319 up to the application to zero-terminate the string in that case, if it plans
320 to use the truncated result. If at least 65537 bytes of room is provided, then
321 the result will always be complete and zero-terminated.
322 */
323
324
325 /** Addition for GDAL : START */
326
327
--- compat/zlib/contrib/minizip/zip.c
+++ compat/zlib/contrib/minizip/zip.c
@@ -126,11 +126,12 @@
126126
linkedlist_datablock_internal* last_block;
127127
} linkedlist_data;
128128
129129
130130
/* zipAlreadyThere() set functions for a set of zero-terminated strings, and
131
-// a block_t type for reading the central directory datablocks. */
131
+ a block_t type for reading the central directory datablocks. */
132
+#define SKIPSET_EXPORT static
132133
typedef char *set_key_t;
133134
#define set_cmp(a, b) strcmp(a, b)
134135
#define set_drop(s, k) set_free(s, k)
135136
#include "skipset.h"
136137
typedef struct {
@@ -284,32 +285,33 @@
284285
}
285286
return ZIP_OK;
286287
}
287288
288289
/* zipAlreadyThere() operations. "set" in the zip internal structure keeps the
289
-// set of names that are in the under-construction central directory so far. A
290
-// skipset provides ~O(log n) time insertion and searching. Central directory
291
-// records, stored in a linked list of allocated memory datablocks, is read
292
-// through "block" in the zip internal structure.
293
-
294
-// The block_*() functions support extracting the central directory file names
295
-// from the datablocks. They are designed to support a growing directory by
296
-// automatically continuing once more data has been appended to the linked
297
-// datablocks.
298
-
299
-// Initialize *block to the head of list. This should only be called once the
300
-// list has at least some data in it, i.e. list->first_block is not NULL. */
290
+ set of names that are in the under-construction central directory so far. A
291
+ skipset provides ~O(log n) time insertion and searching. Central directory
292
+ records, stored in a linked list of allocated memory datablocks, is read
293
+ through "block" in the zip internal structure.
294
+
295
+ The block_*() functions support extracting the central directory file names
296
+ from the datablocks. They are designed to support a growing directory by
297
+ automatically continuing once more data has been appended to the linked
298
+ datablocks.
299
+
300
+ Initialize *block to the head of list. This should only be called once the
301
+ list has at least some data in it, i.e. list->first_block is not NULL. */
301302
local void block_init(block_t *block, linkedlist_data *list) {
302303
block->node = list->first_block;
303304
block->next = block->node->data;
304305
block->left = block->node->filled_in_this_block;
305306
}
306307
307308
/* Mark *block as bad, with all subsequent reads returning end, even if more
308
-// data is added to the datablocks. This is invoked if the central directory is
309
-// invalid, so there is no longer any point in attempting to interpret it. */
309
+ data is added to the datablocks. This is invoked if the central directory is
310
+ invalid, so there is no longer any point in attempting to interpret it. */
310311
local void block_stop(block_t *block) {
312
+ block->node = NULL;
311313
block->left = 0;
312314
block->next = NULL;
313315
}
314316
315317
/* Return true if *block has reached the end of the data in the datablocks. */
@@ -355,20 +357,21 @@
355357
block->left--;
356358
return *block->next++;
357359
}
358360
359361
/* Return a 16-bit unsigned little-endian value from block, or a negative value
360
-// if the end is reached. */
362
+ if the end is reached. */
361363
local long block_get2(block_t *block) {
362364
int low = block_get(block);
363365
int high = block_get(block);
364366
return low < 0 || high < 0 ? -1 : low | ((long)high << 8);
365367
}
366368
367369
/* Read up to len bytes from block into buf. Return the number of bytes read. */
368370
local size_t block_read(block_t *block, unsigned char *buf, size_t len) {
369371
size_t need = len;
372
+ size_t take;
370373
while (need) {
371374
if (block->left == 0) {
372375
/* Get a byte to update and step through the linked list as needed. */
373376
int got = block_get(block);
374377
if (got == -1)
@@ -376,11 +379,11 @@
376379
break;
377380
*buf++ = (unsigned char)got;
378381
need--;
379382
continue;
380383
}
381
- size_t take = need > block->left ? block->left : need;
384
+ take = need > block->left ? block->left : need;
382385
memcpy(buf, block->next, take);
383386
block->next += take;
384387
block->left -= take;
385388
buf += take;
386389
need -= take;
@@ -387,11 +390,11 @@
387390
}
388391
return len - need; /* return the number of bytes copied */
389392
}
390393
391394
/* Skip n bytes in block. Return 0 on success or -1 if there are less than n
392
-// bytes to the end. */
395
+ bytes to the end. */
393396
local int block_skip(block_t *block, size_t n) {
394397
while (n > block->left) {
395398
n -= block->left;
396399
block->next += block->left;
397400
block->left = 0;
@@ -403,13 +406,14 @@
403406
block->left -= n;
404407
return 0;
405408
}
406409
407410
/* Process the next central directory record at *block. Return the allocated,
408
-// zero-terminated file name, or NULL for end of input or invalid data. If
409
-// invalid, *block is marked bad. This uses *set for the allocation of memory. */
411
+ zero-terminated file name, or NULL for end of input or invalid data. If
412
+ invalid, *block is marked bad. This uses *set for the allocation of memory. */
410413
local char *block_central_name(block_t *block, set_t *set) {
414
+ unsigned flen, xlen, clen;
411415
char *name = NULL;
412416
for (;;) {
413417
if (block_end(block))
414418
/* At the end of the central directory (so far). */
415419
return NULL;
@@ -419,15 +423,15 @@
419423
block_get2(block) != (CENTRALHEADERMAGIC >> 16))
420424
/* Incorrect signature. */
421425
break;
422426
423427
/* Go through the remaining fixed-length portion of the record,
424
- // extracting the lengths of the three variable-length fields. */
428
+ extracting the lengths of the three variable-length fields. */
425429
block_skip(block, 24);
426
- unsigned flen = (unsigned)block_get2(block); /* file name length */
427
- unsigned xlen = (unsigned)block_get2(block); /* extra length */
428
- unsigned clen = (unsigned)block_get2(block); /* comment length */
430
+ flen = (unsigned)block_get2(block); /* file name length */
431
+ xlen = (unsigned)block_get2(block); /* extra length */
432
+ clen = (unsigned)block_get2(block); /* comment length */
429433
if (block_skip(block, 12) == -1)
430434
/* Premature end of the record. */
431435
break;
432436
433437
/* Extract the name and skip over the extra and comment fields. */
@@ -438,33 +442,37 @@
438442
break;
439443
440444
/* Check for embedded nuls in the name. */
441445
if (memchr(name, 0, flen) != NULL) {
442446
/* This name can never match the zero-terminated name provided to
443
- // zipAlreadyThere(), so we discard it and go back to get another
444
- // name. (Who the heck is putting nuls inside their zip file entry
445
- // names anyway?) */
447
+ zipAlreadyThere(), so we discard it and go back to get another
448
+ name. (Who the heck is putting nuls inside their zip file entry
449
+ names anyway?) */
446450
set_free(set, name);
451
+ name = NULL;
447452
continue;
448453
}
449454
450455
/* All good. Return the zero-terminated file name. */
451456
name[flen] = 0;
452457
return name;
453458
}
454459
455460
/* Invalid signature or premature end of the central directory record.
456
- // Abandon trying to process the central directory. */
461
+ Abandon trying to process the central directory. */
457462
set_free(set, name);
458463
block_stop(block);
459464
return NULL;
460465
}
461466
462467
/* Return 0 if name is not in the central directory so far, 1 if it is, -1 if
463
-// the central directory is invalid, -2 if out of memory, or ZIP_PARAMERROR if
464
-// file is NULL. */
468
+ the central directory is invalid, -2 if out of memory, or ZIP_PARAMERROR if
469
+ file is NULL. */
465470
extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) {
471
+ size_t len;
472
+ char *copy;
473
+ int found;
466474
zip64_internal *zip = file;
467475
if (zip == NULL)
468476
return ZIP_PARAMERROR;
469477
if (zip->central_dir.first_block == NULL)
470478
/* No central directory yet, so no, name isn't there. */
@@ -474,18 +482,18 @@
474482
set_end(&zip->set);
475483
return -2;
476484
}
477485
if (!set_ok(&zip->set)) {
478486
/* This is the first time here with some central directory content. We
479
- // construct this set of names only on demand. Prepare set and block. */
487
+ construct this set of names only on demand. Prepare set and block. */
480488
set_start(&zip->set);
481489
block_init(&zip->block, &zip->central_dir);
482490
}
483491
484492
/* Update the set of names from the current central directory contents.
485
- // This reads any new central directory records since the last time we were
486
- // here. */
493
+ This reads any new central directory records since the last time we were
494
+ here. */
487495
for (;;) {
488496
char *there = block_central_name(&zip->block, &zip->set);
489497
if (there == NULL) {
490498
if (zip->block.next == NULL)
491499
/* The central directory is invalid. */
@@ -494,27 +502,26 @@
494502
}
495503
496504
/* Add there to the set. */
497505
if (set_insert(&zip->set, there))
498506
/* There's already a duplicate in the central directory! We'll just
499
- // let this be and carry on. */
507
+ let this be and carry on. */
500508
set_free(&zip->set, there);
501509
}
502510
503511
/* Return true if name is in the central directory. */
504
- size_t len = strlen(name);
505
- char *copy = set_alloc(&zip->set, NULL, len + 1);
512
+ len = strlen(name);
513
+ copy = set_alloc(&zip->set, NULL, len + 1);
506514
memcpy(copy, name, len + 1);
507
- int found = set_found(&zip->set, copy);
515
+ found = set_found(&zip->set, copy);
508516
set_free(&zip->set, copy);
509517
return found;
510518
}
511519
512520
513521
/****************************************************************************/
514522
515
-#ifndef NO_ADDFILEINEXISTINGZIP
516523
/* ===========================================================================
517524
Inputs a long in LSB order to the given file
518525
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
519526
*/
520527
@@ -572,10 +579,11 @@
572579
}
573580
574581
575582
/****************************************************************************/
576583
584
+#ifndef NO_ADDFILEINEXISTINGZIP
577585
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
578586
unsigned char c;
579587
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
580588
if (err==1)
581589
{
@@ -695,11 +703,11 @@
695703
*/
696704
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
697705
unsigned char* buf;
698706
ZPOS64_T uSizeFile;
699707
ZPOS64_T uBackRead;
700
- ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
708
+ ZPOS64_T uMaxBack=0xffff+22; /* maximum comment and end-of-central-directory record */
701709
ZPOS64_T uPosFound=0;
702710
703711
if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
704712
return 0;
705713
@@ -731,11 +739,11 @@
731739
break;
732740
733741
if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
734742
break;
735743
736
- for (i=(int)uReadSize-3; (i--)>0;)
744
+ for (i=(int)uReadSize-4; i>=0; --i)
737745
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
738746
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
739747
{
740748
uPosFound = uReadPos+(unsigned)i;
741749
break;
@@ -747,78 +755,32 @@
747755
free(buf);
748756
return uPosFound;
749757
}
750758
751759
/*
752
-Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
753
-the global comment)
760
+ Locate the Zip64 end of central directory record using the locator
761
+ immediately preceding the end of central directory record at
762
+ centralDirPos.
754763
*/
755
-local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
756
- unsigned char* buf;
757
- ZPOS64_T uSizeFile;
758
- ZPOS64_T uBackRead;
759
- ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
760
- ZPOS64_T uPosFound=0;
764
+local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream,
765
+ ZPOS64_T centralDirPos) {
766
+ ZPOS64_T uPosFound;
761767
uLong uL;
762768
ZPOS64_T relativeOffset;
763769
764
- if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
765
- return 0;
766
-
767
- uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
768
-
769
- if (uMaxBack>uSizeFile)
770
- uMaxBack = uSizeFile;
771
-
772
- buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
773
- if (buf==NULL)
774
- return 0;
775
-
776
- uBackRead = 4;
777
- while (uBackRead<uMaxBack)
778
- {
779
- uLong uReadSize;
780
- ZPOS64_T uReadPos;
781
- int i;
782
- if (uBackRead+BUFREADCOMMENT>uMaxBack)
783
- uBackRead = uMaxBack;
784
- else
785
- uBackRead+=BUFREADCOMMENT;
786
- uReadPos = uSizeFile-uBackRead ;
787
-
788
- uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
789
- (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
790
- if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
791
- break;
792
-
793
- if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
794
- break;
795
-
796
- for (i=(int)uReadSize-3; (i--)>0;)
797
- {
798
- /* Signature "0x07064b50" Zip64 end of central directory locator */
799
- if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
800
- {
801
- uPosFound = uReadPos+(unsigned)i;
802
- break;
803
- }
804
- }
805
-
806
- if (uPosFound!=0)
807
- break;
808
- }
809
-
810
- free(buf);
811
- if (uPosFound == 0)
812
- return 0;
813
-
814
- /* Zip64 end of central directory locator */
770
+ /* The Zip64 locator immediately precedes the end of central directory
771
+ record. Checking only there prevents a locator signature in the file
772
+ data from overriding the central directory that record refers to. */
773
+ if (centralDirPos < 20)
774
+ return 0;
775
+
776
+ uPosFound = centralDirPos - 20;
815777
if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
816778
return 0;
817779
818
- /* the signature, already checked */
819
- if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
780
+ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK ||
781
+ uL != 0x07064b50)
820782
return 0;
821783
822784
/* number of the disk with the start of the zip64 end of central directory */
823785
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
824786
return 0;
@@ -854,10 +816,11 @@
854816
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
855817
856818
ZPOS64_T size_central_dir; /* size of the central directory */
857819
ZPOS64_T offset_central_dir; /* offset of start of central directory */
858820
ZPOS64_T central_pos;
821
+ ZPOS64_T central_pos64;
859822
uLong uL;
860823
861824
uLong number_disk; /* number of the current disk, used for
862825
spanning ZIP, unsupported, always 0*/
863826
uLong number_disk_with_CD; /* number of the disk with central dir, used
@@ -870,19 +833,19 @@
870833
uLong VersionNeeded;
871834
uLong size_comment;
872835
873836
int hasZIP64Record = 0;
874837
875
- /* check first if we find a ZIP64 record */
876
- central_pos = zip64local_SearchCentralDir64(&pziinit->z_filefunc,pziinit->filestream);
877
- if(central_pos > 0)
838
+ /* find the end of central directory record, and then a ZIP64 record if
839
+ there is one immediately before it */
840
+ central_pos = zip64local_SearchCentralDir(&pziinit->z_filefunc,pziinit->filestream);
841
+ central_pos64 = zip64local_SearchCentralDir64(&pziinit->z_filefunc,pziinit->filestream,
842
+ central_pos);
843
+ if (central_pos64 > 0)
878844
{
879845
hasZIP64Record = 1;
880
- }
881
- else if(central_pos == 0)
882
- {
883
- central_pos = zip64local_SearchCentralDir(&pziinit->z_filefunc,pziinit->filestream);
846
+ central_pos = central_pos64;
884847
}
885848
886849
/* disable to allow appending to empty ZIP archive
887850
if (central_pos==0)
888851
err=ZIP_ERRNO;
@@ -937,11 +900,11 @@
937900
starting disk number */
938901
if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&offset_central_dir)!=ZIP_OK)
939902
err=ZIP_ERRNO;
940903
941904
/* TODO..
942
- // read the comment from the standard central header. */
905
+ read the comment from the standard central header. */
943906
size_comment = 0;
944907
}
945908
else
946909
{
947910
/* Read End of central Directory info */
@@ -1022,11 +985,13 @@
1022985
1023986
{
1024987
ZPOS64_T size_central_dir_to_read = size_central_dir;
1025988
size_t buf_size = SIZEDATA_INDATABLOCK;
1026989
void* buf_read = (void*)ALLOC(buf_size);
1027
- if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0)
990
+ if (buf_read == NULL)
991
+ err=ZIP_INTERNALERROR;
992
+ else if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0)
1028993
err=ZIP_ERRNO;
1029994
1030995
while ((size_central_dir_to_read>0) && (err==ZIP_OK))
1031996
{
1032997
ZPOS64_T read_this = SIZEDATA_INDATABLOCK;
@@ -1046,10 +1011,15 @@
10461011
pziinit->begin_pos = byte_before_the_zipfile;
10471012
pziinit->number_entry = number_entry_CD;
10481013
10491014
if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0)
10501015
err=ZIP_ERRNO;
1016
+
1017
+ if (err != ZIP_OK)
1018
+ {
1019
+ ZCLOSE64(pziinit->z_filefunc, pziinit->filestream);
1020
+ }
10511021
10521022
return err;
10531023
}
10541024
10551025
@@ -1105,26 +1075,29 @@
11051075
{
11061076
/* Read and Cache Central Directory Records */
11071077
err = LoadCentralDirectoryRecord(&ziinit);
11081078
}
11091079
1110
- if (globalcomment)
1111
- {
1112
- *globalcomment = ziinit.globalcomment;
1113
- }
11141080
# endif /* !NO_ADDFILEINEXISTINGZIP*/
11151081
11161082
if (err != ZIP_OK)
11171083
{
11181084
# ifndef NO_ADDFILEINEXISTINGZIP
11191085
free(ziinit.globalcomment);
1086
+ free_linkedlist(&(ziinit.central_dir));
11201087
# endif /* !NO_ADDFILEINEXISTINGZIP*/
11211088
free(zi);
1089
+ if (globalcomment)
1090
+ *globalcomment = NULL;
11221091
return NULL;
11231092
}
11241093
else
11251094
{
1095
+# ifndef NO_ADDFILEINEXISTINGZIP
1096
+ if (globalcomment)
1097
+ *globalcomment = ziinit.globalcomment;
1098
+# endif /* !NO_ADDFILEINEXISTINGZIP*/
11261099
*zi = ziinit;
11271100
return (zipFile)zi;
11281101
}
11291102
}
11301103
@@ -1331,14 +1304,16 @@
13311304
/* The filename and comment length must fit in 16 bits. */
13321305
if ((filename!=NULL) && (strlen(filename)>0xffff))
13331306
return ZIP_PARAMERROR;
13341307
if ((comment!=NULL) && (strlen(comment)>0xffff))
13351308
return ZIP_PARAMERROR;
1336
- /* The extra field length must fit in 16 bits. If the member also requires
1337
- // a Zip64 extra block, that will also need to fit within that 16-bit
1338
- // length, but that will be checked for later. */
1339
- if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
1309
+ /* The extra field lengths must fit in 16 bits, including a 20-byte
1310
+ Zip64 sub-field in the local header if zip64 is true. There might
1311
+ be a Zip64 sub-field needed in the central directory header as
1312
+ well, but that won't be known until later. */
1313
+ if ((size_extrafield_local>(0xffffu-(zip64?20u:0u))) ||
1314
+ (size_extrafield_global>0xffffu))
13401315
return ZIP_PARAMERROR;
13411316
13421317
zi = (zip64_internal*)file;
13431318
13441319
if (zi->in_opened_file_inzip == 1)
@@ -1391,10 +1366,12 @@
13911366
13921367
zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + size_extrafield_global + size_comment;
13931368
zi->ci.size_centralExtraFree = 32; /* Extra space we have reserved in case we need to add ZIP64 extra info data */
13941369
13951370
zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader + zi->ci.size_centralExtraFree);
1371
+ if (zi->ci.central_header == NULL)
1372
+ return ZIP_INTERNALERROR;
13961373
13971374
zi->ci.size_centralExtra = size_extrafield_global;
13981375
zip64local_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
13991376
/* version info */
14001377
zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)versionMadeBy,2);
@@ -1433,12 +1410,10 @@
14331410
*(((const char*)extrafield_global)+i);
14341411
14351412
for (i=0;i<size_comment;i++)
14361413
*(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
14371414
size_extrafield_global+i) = *(comment+i);
1438
- if (zi->ci.central_header == NULL)
1439
- return ZIP_INTERNALERROR;
14401415
14411416
zi->ci.zip64 = zip64;
14421417
zi->ci.totalCompressedData = 0;
14431418
zi->ci.totalUncompressedData = 0;
14441419
zi->ci.pos_zip64extrainfo = 0;
@@ -1891,18 +1866,29 @@
18911866
datasize += 8;
18921867
18931868
if(datasize > 0)
18941869
{
18951870
char* p = NULL;
1871
+ uLong size_comment;
18961872
1897
- if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
1873
+ if (zi->ci.size_centralExtra + datasize + 4 > 0xffff)
18981874
{
1899
- /* we cannot write more data to the buffer that we have room for. */
1875
+ /* the extra field is now too big with the Zip64 sub-field -- leave
1876
+ this entry out of the central directory, so that the zip file can be
1877
+ completed with the remaining entries, if desired */
1878
+ free(zi->ci.central_header);
1879
+ zi->ci.central_header = NULL;
1880
+ zi->in_opened_file_inzip = 0;
19001881
return ZIP_BADZIPFILE;
19011882
}
19021883
1903
- p = zi->ci.central_header + zi->ci.size_centralheader;
1884
+ /* Insert the ZIP64 field at the end of the extra field, which is ahead
1885
+ of the file comment, so move the comment up to make room. */
1886
+ size_comment = (unsigned char)zi->ci.central_header[32] |
1887
+ ((uLong)(unsigned char)zi->ci.central_header[33] << 8);
1888
+ p = zi->ci.central_header + zi->ci.size_centralheader - size_comment;
1889
+ memmove(p + datasize + 4, p, size_comment);
19041890
19051891
/* Add Extra Information Header for 'ZIP64 information' */
19061892
zip64local_putValue_inmemory(p, 0x0001, 2); /* HeaderID */
19071893
p += 2;
19081894
zip64local_putValue_inmemory(p, datasize, 2); /* DataSize */
@@ -1925,12 +1911,12 @@
19251911
zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8);
19261912
p += 8;
19271913
}
19281914
19291915
/* Update how much extra free space we got in the memory buffer
1930
- // and increase the centralheader size so the new ZIP64 fields are included
1931
- // ( 4 below is the size of HeaderID and DataSize field ) */
1916
+ and increase the centralheader size so the new ZIP64 fields are included
1917
+ ( 4 below is the size of HeaderID and DataSize field ) */
19321918
zi->ci.size_centralExtraFree -= datasize + 4;
19331919
zi->ci.size_centralheader += datasize + 4;
19341920
19351921
/* Update the extra info size field */
19361922
zi->ci.size_centralExtra += datasize + 4;
@@ -2189,40 +2175,68 @@
21892175
}
21902176
21912177
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
21922178
char* p = pData;
21932179
int size = 0;
2180
+ int remaining;
21942181
char* pNewHeader;
21952182
char* pTmp;
2196
- short header;
2197
- short dataSize;
2183
+ unsigned header;
2184
+ unsigned dataSize;
2185
+ unsigned remove = (unsigned short)sHeader;
21982186
21992187
int retVal = ZIP_OK;
22002188
22012189
if(pData == NULL || dataLen == NULL || *dataLen < 4)
22022190
return ZIP_PARAMERROR;
22032191
2192
+ remaining = *dataLen;
22042193
pNewHeader = (char*)ALLOC((unsigned)*dataLen);
2194
+ if (pNewHeader == NULL)
2195
+ return ZIP_INTERNALERROR;
2196
+
22052197
pTmp = pNewHeader;
22062198
2207
- while(p < (pData + *dataLen))
2199
+ while(remaining > 0)
22082200
{
2209
- header = *(short*)p;
2210
- dataSize = *(((short*)p)+1);
2201
+ if(remaining < 4)
2202
+ {
2203
+ retVal = ZIP_BADZIPFILE;
2204
+ break;
2205
+ }
2206
+
2207
+ header = (unsigned)(unsigned char)p[0] |
2208
+ ((unsigned)(unsigned char)p[1] << 8);
2209
+ dataSize = (unsigned)(unsigned char)p[2] |
2210
+ ((unsigned)(unsigned char)p[3] << 8);
2211
+
2212
+ if((int)dataSize > remaining - 4)
2213
+ {
2214
+ retVal = ZIP_BADZIPFILE;
2215
+ break;
2216
+ }
22112217
2212
- if( header == sHeader ) /* Header found. */
2218
+ if( header == remove ) /* Header found. */
22132219
{
22142220
p += dataSize + 4; /* skip it. do not copy to temp buffer */
22152221
}
22162222
else
22172223
{
22182224
/* Extra Info block should not be removed, So copy it to the temp buffer. */
22192225
memcpy(pTmp, p, dataSize + 4);
2226
+ pTmp += dataSize + 4;
22202227
p += dataSize + 4;
22212228
size += dataSize + 4;
22222229
}
22232230
2231
+ remaining -= dataSize + 4;
2232
+ }
2233
+
2234
+ if(retVal != ZIP_OK)
2235
+ {
2236
+ free(pNewHeader);
2237
+ return retVal;
22242238
}
22252239
22262240
if(size < *dataLen)
22272241
{
22282242
/* clean old extra info block. */
22292243
--- compat/zlib/contrib/minizip/zip.c
+++ compat/zlib/contrib/minizip/zip.c
@@ -126,11 +126,12 @@
126 linkedlist_datablock_internal* last_block;
127 } linkedlist_data;
128
129
130 /* zipAlreadyThere() set functions for a set of zero-terminated strings, and
131 // a block_t type for reading the central directory datablocks. */
 
132 typedef char *set_key_t;
133 #define set_cmp(a, b) strcmp(a, b)
134 #define set_drop(s, k) set_free(s, k)
135 #include "skipset.h"
136 typedef struct {
@@ -284,32 +285,33 @@
284 }
285 return ZIP_OK;
286 }
287
288 /* zipAlreadyThere() operations. "set" in the zip internal structure keeps the
289 // set of names that are in the under-construction central directory so far. A
290 // skipset provides ~O(log n) time insertion and searching. Central directory
291 // records, stored in a linked list of allocated memory datablocks, is read
292 // through "block" in the zip internal structure.
293
294 // The block_*() functions support extracting the central directory file names
295 // from the datablocks. They are designed to support a growing directory by
296 // automatically continuing once more data has been appended to the linked
297 // datablocks.
298
299 // Initialize *block to the head of list. This should only be called once the
300 // list has at least some data in it, i.e. list->first_block is not NULL. */
301 local void block_init(block_t *block, linkedlist_data *list) {
302 block->node = list->first_block;
303 block->next = block->node->data;
304 block->left = block->node->filled_in_this_block;
305 }
306
307 /* Mark *block as bad, with all subsequent reads returning end, even if more
308 // data is added to the datablocks. This is invoked if the central directory is
309 // invalid, so there is no longer any point in attempting to interpret it. */
310 local void block_stop(block_t *block) {
 
311 block->left = 0;
312 block->next = NULL;
313 }
314
315 /* Return true if *block has reached the end of the data in the datablocks. */
@@ -355,20 +357,21 @@
355 block->left--;
356 return *block->next++;
357 }
358
359 /* Return a 16-bit unsigned little-endian value from block, or a negative value
360 // if the end is reached. */
361 local long block_get2(block_t *block) {
362 int low = block_get(block);
363 int high = block_get(block);
364 return low < 0 || high < 0 ? -1 : low | ((long)high << 8);
365 }
366
367 /* Read up to len bytes from block into buf. Return the number of bytes read. */
368 local size_t block_read(block_t *block, unsigned char *buf, size_t len) {
369 size_t need = len;
 
370 while (need) {
371 if (block->left == 0) {
372 /* Get a byte to update and step through the linked list as needed. */
373 int got = block_get(block);
374 if (got == -1)
@@ -376,11 +379,11 @@
376 break;
377 *buf++ = (unsigned char)got;
378 need--;
379 continue;
380 }
381 size_t take = need > block->left ? block->left : need;
382 memcpy(buf, block->next, take);
383 block->next += take;
384 block->left -= take;
385 buf += take;
386 need -= take;
@@ -387,11 +390,11 @@
387 }
388 return len - need; /* return the number of bytes copied */
389 }
390
391 /* Skip n bytes in block. Return 0 on success or -1 if there are less than n
392 // bytes to the end. */
393 local int block_skip(block_t *block, size_t n) {
394 while (n > block->left) {
395 n -= block->left;
396 block->next += block->left;
397 block->left = 0;
@@ -403,13 +406,14 @@
403 block->left -= n;
404 return 0;
405 }
406
407 /* Process the next central directory record at *block. Return the allocated,
408 // zero-terminated file name, or NULL for end of input or invalid data. If
409 // invalid, *block is marked bad. This uses *set for the allocation of memory. */
410 local char *block_central_name(block_t *block, set_t *set) {
 
411 char *name = NULL;
412 for (;;) {
413 if (block_end(block))
414 /* At the end of the central directory (so far). */
415 return NULL;
@@ -419,15 +423,15 @@
419 block_get2(block) != (CENTRALHEADERMAGIC >> 16))
420 /* Incorrect signature. */
421 break;
422
423 /* Go through the remaining fixed-length portion of the record,
424 // extracting the lengths of the three variable-length fields. */
425 block_skip(block, 24);
426 unsigned flen = (unsigned)block_get2(block); /* file name length */
427 unsigned xlen = (unsigned)block_get2(block); /* extra length */
428 unsigned clen = (unsigned)block_get2(block); /* comment length */
429 if (block_skip(block, 12) == -1)
430 /* Premature end of the record. */
431 break;
432
433 /* Extract the name and skip over the extra and comment fields. */
@@ -438,33 +442,37 @@
438 break;
439
440 /* Check for embedded nuls in the name. */
441 if (memchr(name, 0, flen) != NULL) {
442 /* This name can never match the zero-terminated name provided to
443 // zipAlreadyThere(), so we discard it and go back to get another
444 // name. (Who the heck is putting nuls inside their zip file entry
445 // names anyway?) */
446 set_free(set, name);
 
447 continue;
448 }
449
450 /* All good. Return the zero-terminated file name. */
451 name[flen] = 0;
452 return name;
453 }
454
455 /* Invalid signature or premature end of the central directory record.
456 // Abandon trying to process the central directory. */
457 set_free(set, name);
458 block_stop(block);
459 return NULL;
460 }
461
462 /* Return 0 if name is not in the central directory so far, 1 if it is, -1 if
463 // the central directory is invalid, -2 if out of memory, or ZIP_PARAMERROR if
464 // file is NULL. */
465 extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) {
 
 
 
466 zip64_internal *zip = file;
467 if (zip == NULL)
468 return ZIP_PARAMERROR;
469 if (zip->central_dir.first_block == NULL)
470 /* No central directory yet, so no, name isn't there. */
@@ -474,18 +482,18 @@
474 set_end(&zip->set);
475 return -2;
476 }
477 if (!set_ok(&zip->set)) {
478 /* This is the first time here with some central directory content. We
479 // construct this set of names only on demand. Prepare set and block. */
480 set_start(&zip->set);
481 block_init(&zip->block, &zip->central_dir);
482 }
483
484 /* Update the set of names from the current central directory contents.
485 // This reads any new central directory records since the last time we were
486 // here. */
487 for (;;) {
488 char *there = block_central_name(&zip->block, &zip->set);
489 if (there == NULL) {
490 if (zip->block.next == NULL)
491 /* The central directory is invalid. */
@@ -494,27 +502,26 @@
494 }
495
496 /* Add there to the set. */
497 if (set_insert(&zip->set, there))
498 /* There's already a duplicate in the central directory! We'll just
499 // let this be and carry on. */
500 set_free(&zip->set, there);
501 }
502
503 /* Return true if name is in the central directory. */
504 size_t len = strlen(name);
505 char *copy = set_alloc(&zip->set, NULL, len + 1);
506 memcpy(copy, name, len + 1);
507 int found = set_found(&zip->set, copy);
508 set_free(&zip->set, copy);
509 return found;
510 }
511
512
513 /****************************************************************************/
514
515 #ifndef NO_ADDFILEINEXISTINGZIP
516 /* ===========================================================================
517 Inputs a long in LSB order to the given file
518 nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
519 */
520
@@ -572,10 +579,11 @@
572 }
573
574
575 /****************************************************************************/
576
 
577 local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
578 unsigned char c;
579 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
580 if (err==1)
581 {
@@ -695,11 +703,11 @@
695 */
696 local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
697 unsigned char* buf;
698 ZPOS64_T uSizeFile;
699 ZPOS64_T uBackRead;
700 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
701 ZPOS64_T uPosFound=0;
702
703 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
704 return 0;
705
@@ -731,11 +739,11 @@
731 break;
732
733 if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
734 break;
735
736 for (i=(int)uReadSize-3; (i--)>0;)
737 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
738 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
739 {
740 uPosFound = uReadPos+(unsigned)i;
741 break;
@@ -747,78 +755,32 @@
747 free(buf);
748 return uPosFound;
749 }
750
751 /*
752 Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
753 the global comment)
 
754 */
755 local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
756 unsigned char* buf;
757 ZPOS64_T uSizeFile;
758 ZPOS64_T uBackRead;
759 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
760 ZPOS64_T uPosFound=0;
761 uLong uL;
762 ZPOS64_T relativeOffset;
763
764 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
765 return 0;
766
767 uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream);
768
769 if (uMaxBack>uSizeFile)
770 uMaxBack = uSizeFile;
771
772 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
773 if (buf==NULL)
774 return 0;
775
776 uBackRead = 4;
777 while (uBackRead<uMaxBack)
778 {
779 uLong uReadSize;
780 ZPOS64_T uReadPos;
781 int i;
782 if (uBackRead+BUFREADCOMMENT>uMaxBack)
783 uBackRead = uMaxBack;
784 else
785 uBackRead+=BUFREADCOMMENT;
786 uReadPos = uSizeFile-uBackRead ;
787
788 uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
789 (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos);
790 if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
791 break;
792
793 if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
794 break;
795
796 for (i=(int)uReadSize-3; (i--)>0;)
797 {
798 /* Signature "0x07064b50" Zip64 end of central directory locator */
799 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
800 {
801 uPosFound = uReadPos+(unsigned)i;
802 break;
803 }
804 }
805
806 if (uPosFound!=0)
807 break;
808 }
809
810 free(buf);
811 if (uPosFound == 0)
812 return 0;
813
814 /* Zip64 end of central directory locator */
815 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
816 return 0;
817
818 /* the signature, already checked */
819 if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
820 return 0;
821
822 /* number of the disk with the start of the zip64 end of central directory */
823 if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
824 return 0;
@@ -854,10 +816,11 @@
854 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
855
856 ZPOS64_T size_central_dir; /* size of the central directory */
857 ZPOS64_T offset_central_dir; /* offset of start of central directory */
858 ZPOS64_T central_pos;
 
859 uLong uL;
860
861 uLong number_disk; /* number of the current disk, used for
862 spanning ZIP, unsupported, always 0*/
863 uLong number_disk_with_CD; /* number of the disk with central dir, used
@@ -870,19 +833,19 @@
870 uLong VersionNeeded;
871 uLong size_comment;
872
873 int hasZIP64Record = 0;
874
875 /* check first if we find a ZIP64 record */
876 central_pos = zip64local_SearchCentralDir64(&pziinit->z_filefunc,pziinit->filestream);
877 if(central_pos > 0)
 
 
 
878 {
879 hasZIP64Record = 1;
880 }
881 else if(central_pos == 0)
882 {
883 central_pos = zip64local_SearchCentralDir(&pziinit->z_filefunc,pziinit->filestream);
884 }
885
886 /* disable to allow appending to empty ZIP archive
887 if (central_pos==0)
888 err=ZIP_ERRNO;
@@ -937,11 +900,11 @@
937 starting disk number */
938 if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&offset_central_dir)!=ZIP_OK)
939 err=ZIP_ERRNO;
940
941 /* TODO..
942 // read the comment from the standard central header. */
943 size_comment = 0;
944 }
945 else
946 {
947 /* Read End of central Directory info */
@@ -1022,11 +985,13 @@
1022
1023 {
1024 ZPOS64_T size_central_dir_to_read = size_central_dir;
1025 size_t buf_size = SIZEDATA_INDATABLOCK;
1026 void* buf_read = (void*)ALLOC(buf_size);
1027 if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0)
 
 
1028 err=ZIP_ERRNO;
1029
1030 while ((size_central_dir_to_read>0) && (err==ZIP_OK))
1031 {
1032 ZPOS64_T read_this = SIZEDATA_INDATABLOCK;
@@ -1046,10 +1011,15 @@
1046 pziinit->begin_pos = byte_before_the_zipfile;
1047 pziinit->number_entry = number_entry_CD;
1048
1049 if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0)
1050 err=ZIP_ERRNO;
 
 
 
 
 
1051
1052 return err;
1053 }
1054
1055
@@ -1105,26 +1075,29 @@
1105 {
1106 /* Read and Cache Central Directory Records */
1107 err = LoadCentralDirectoryRecord(&ziinit);
1108 }
1109
1110 if (globalcomment)
1111 {
1112 *globalcomment = ziinit.globalcomment;
1113 }
1114 # endif /* !NO_ADDFILEINEXISTINGZIP*/
1115
1116 if (err != ZIP_OK)
1117 {
1118 # ifndef NO_ADDFILEINEXISTINGZIP
1119 free(ziinit.globalcomment);
 
1120 # endif /* !NO_ADDFILEINEXISTINGZIP*/
1121 free(zi);
 
 
1122 return NULL;
1123 }
1124 else
1125 {
 
 
 
 
1126 *zi = ziinit;
1127 return (zipFile)zi;
1128 }
1129 }
1130
@@ -1331,14 +1304,16 @@
1331 /* The filename and comment length must fit in 16 bits. */
1332 if ((filename!=NULL) && (strlen(filename)>0xffff))
1333 return ZIP_PARAMERROR;
1334 if ((comment!=NULL) && (strlen(comment)>0xffff))
1335 return ZIP_PARAMERROR;
1336 /* The extra field length must fit in 16 bits. If the member also requires
1337 // a Zip64 extra block, that will also need to fit within that 16-bit
1338 // length, but that will be checked for later. */
1339 if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff))
 
 
1340 return ZIP_PARAMERROR;
1341
1342 zi = (zip64_internal*)file;
1343
1344 if (zi->in_opened_file_inzip == 1)
@@ -1391,10 +1366,12 @@
1391
1392 zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + size_extrafield_global + size_comment;
1393 zi->ci.size_centralExtraFree = 32; /* Extra space we have reserved in case we need to add ZIP64 extra info data */
1394
1395 zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader + zi->ci.size_centralExtraFree);
 
 
1396
1397 zi->ci.size_centralExtra = size_extrafield_global;
1398 zip64local_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
1399 /* version info */
1400 zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)versionMadeBy,2);
@@ -1433,12 +1410,10 @@
1433 *(((const char*)extrafield_global)+i);
1434
1435 for (i=0;i<size_comment;i++)
1436 *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
1437 size_extrafield_global+i) = *(comment+i);
1438 if (zi->ci.central_header == NULL)
1439 return ZIP_INTERNALERROR;
1440
1441 zi->ci.zip64 = zip64;
1442 zi->ci.totalCompressedData = 0;
1443 zi->ci.totalUncompressedData = 0;
1444 zi->ci.pos_zip64extrainfo = 0;
@@ -1891,18 +1866,29 @@
1891 datasize += 8;
1892
1893 if(datasize > 0)
1894 {
1895 char* p = NULL;
 
1896
1897 if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
1898 {
1899 /* we cannot write more data to the buffer that we have room for. */
 
 
 
 
 
1900 return ZIP_BADZIPFILE;
1901 }
1902
1903 p = zi->ci.central_header + zi->ci.size_centralheader;
 
 
 
 
 
1904
1905 /* Add Extra Information Header for 'ZIP64 information' */
1906 zip64local_putValue_inmemory(p, 0x0001, 2); /* HeaderID */
1907 p += 2;
1908 zip64local_putValue_inmemory(p, datasize, 2); /* DataSize */
@@ -1925,12 +1911,12 @@
1925 zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8);
1926 p += 8;
1927 }
1928
1929 /* Update how much extra free space we got in the memory buffer
1930 // and increase the centralheader size so the new ZIP64 fields are included
1931 // ( 4 below is the size of HeaderID and DataSize field ) */
1932 zi->ci.size_centralExtraFree -= datasize + 4;
1933 zi->ci.size_centralheader += datasize + 4;
1934
1935 /* Update the extra info size field */
1936 zi->ci.size_centralExtra += datasize + 4;
@@ -2189,40 +2175,68 @@
2189 }
2190
2191 extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
2192 char* p = pData;
2193 int size = 0;
 
2194 char* pNewHeader;
2195 char* pTmp;
2196 short header;
2197 short dataSize;
 
2198
2199 int retVal = ZIP_OK;
2200
2201 if(pData == NULL || dataLen == NULL || *dataLen < 4)
2202 return ZIP_PARAMERROR;
2203
 
2204 pNewHeader = (char*)ALLOC((unsigned)*dataLen);
 
 
 
2205 pTmp = pNewHeader;
2206
2207 while(p < (pData + *dataLen))
2208 {
2209 header = *(short*)p;
2210 dataSize = *(((short*)p)+1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2211
2212 if( header == sHeader ) /* Header found. */
2213 {
2214 p += dataSize + 4; /* skip it. do not copy to temp buffer */
2215 }
2216 else
2217 {
2218 /* Extra Info block should not be removed, So copy it to the temp buffer. */
2219 memcpy(pTmp, p, dataSize + 4);
 
2220 p += dataSize + 4;
2221 size += dataSize + 4;
2222 }
2223
 
 
 
 
 
 
 
2224 }
2225
2226 if(size < *dataLen)
2227 {
2228 /* clean old extra info block. */
2229
--- compat/zlib/contrib/minizip/zip.c
+++ compat/zlib/contrib/minizip/zip.c
@@ -126,11 +126,12 @@
126 linkedlist_datablock_internal* last_block;
127 } linkedlist_data;
128
129
130 /* zipAlreadyThere() set functions for a set of zero-terminated strings, and
131 a block_t type for reading the central directory datablocks. */
132 #define SKIPSET_EXPORT static
133 typedef char *set_key_t;
134 #define set_cmp(a, b) strcmp(a, b)
135 #define set_drop(s, k) set_free(s, k)
136 #include "skipset.h"
137 typedef struct {
@@ -284,32 +285,33 @@
285 }
286 return ZIP_OK;
287 }
288
289 /* zipAlreadyThere() operations. "set" in the zip internal structure keeps the
290 set of names that are in the under-construction central directory so far. A
291 skipset provides ~O(log n) time insertion and searching. Central directory
292 records, stored in a linked list of allocated memory datablocks, is read
293 through "block" in the zip internal structure.
294
295 The block_*() functions support extracting the central directory file names
296 from the datablocks. They are designed to support a growing directory by
297 automatically continuing once more data has been appended to the linked
298 datablocks.
299
300 Initialize *block to the head of list. This should only be called once the
301 list has at least some data in it, i.e. list->first_block is not NULL. */
302 local void block_init(block_t *block, linkedlist_data *list) {
303 block->node = list->first_block;
304 block->next = block->node->data;
305 block->left = block->node->filled_in_this_block;
306 }
307
308 /* Mark *block as bad, with all subsequent reads returning end, even if more
309 data is added to the datablocks. This is invoked if the central directory is
310 invalid, so there is no longer any point in attempting to interpret it. */
311 local void block_stop(block_t *block) {
312 block->node = NULL;
313 block->left = 0;
314 block->next = NULL;
315 }
316
317 /* Return true if *block has reached the end of the data in the datablocks. */
@@ -355,20 +357,21 @@
357 block->left--;
358 return *block->next++;
359 }
360
361 /* Return a 16-bit unsigned little-endian value from block, or a negative value
362 if the end is reached. */
363 local long block_get2(block_t *block) {
364 int low = block_get(block);
365 int high = block_get(block);
366 return low < 0 || high < 0 ? -1 : low | ((long)high << 8);
367 }
368
369 /* Read up to len bytes from block into buf. Return the number of bytes read. */
370 local size_t block_read(block_t *block, unsigned char *buf, size_t len) {
371 size_t need = len;
372 size_t take;
373 while (need) {
374 if (block->left == 0) {
375 /* Get a byte to update and step through the linked list as needed. */
376 int got = block_get(block);
377 if (got == -1)
@@ -376,11 +379,11 @@
379 break;
380 *buf++ = (unsigned char)got;
381 need--;
382 continue;
383 }
384 take = need > block->left ? block->left : need;
385 memcpy(buf, block->next, take);
386 block->next += take;
387 block->left -= take;
388 buf += take;
389 need -= take;
@@ -387,11 +390,11 @@
390 }
391 return len - need; /* return the number of bytes copied */
392 }
393
394 /* Skip n bytes in block. Return 0 on success or -1 if there are less than n
395 bytes to the end. */
396 local int block_skip(block_t *block, size_t n) {
397 while (n > block->left) {
398 n -= block->left;
399 block->next += block->left;
400 block->left = 0;
@@ -403,13 +406,14 @@
406 block->left -= n;
407 return 0;
408 }
409
410 /* Process the next central directory record at *block. Return the allocated,
411 zero-terminated file name, or NULL for end of input or invalid data. If
412 invalid, *block is marked bad. This uses *set for the allocation of memory. */
413 local char *block_central_name(block_t *block, set_t *set) {
414 unsigned flen, xlen, clen;
415 char *name = NULL;
416 for (;;) {
417 if (block_end(block))
418 /* At the end of the central directory (so far). */
419 return NULL;
@@ -419,15 +423,15 @@
423 block_get2(block) != (CENTRALHEADERMAGIC >> 16))
424 /* Incorrect signature. */
425 break;
426
427 /* Go through the remaining fixed-length portion of the record,
428 extracting the lengths of the three variable-length fields. */
429 block_skip(block, 24);
430 flen = (unsigned)block_get2(block); /* file name length */
431 xlen = (unsigned)block_get2(block); /* extra length */
432 clen = (unsigned)block_get2(block); /* comment length */
433 if (block_skip(block, 12) == -1)
434 /* Premature end of the record. */
435 break;
436
437 /* Extract the name and skip over the extra and comment fields. */
@@ -438,33 +442,37 @@
442 break;
443
444 /* Check for embedded nuls in the name. */
445 if (memchr(name, 0, flen) != NULL) {
446 /* This name can never match the zero-terminated name provided to
447 zipAlreadyThere(), so we discard it and go back to get another
448 name. (Who the heck is putting nuls inside their zip file entry
449 names anyway?) */
450 set_free(set, name);
451 name = NULL;
452 continue;
453 }
454
455 /* All good. Return the zero-terminated file name. */
456 name[flen] = 0;
457 return name;
458 }
459
460 /* Invalid signature or premature end of the central directory record.
461 Abandon trying to process the central directory. */
462 set_free(set, name);
463 block_stop(block);
464 return NULL;
465 }
466
467 /* Return 0 if name is not in the central directory so far, 1 if it is, -1 if
468 the central directory is invalid, -2 if out of memory, or ZIP_PARAMERROR if
469 file is NULL. */
470 extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) {
471 size_t len;
472 char *copy;
473 int found;
474 zip64_internal *zip = file;
475 if (zip == NULL)
476 return ZIP_PARAMERROR;
477 if (zip->central_dir.first_block == NULL)
478 /* No central directory yet, so no, name isn't there. */
@@ -474,18 +482,18 @@
482 set_end(&zip->set);
483 return -2;
484 }
485 if (!set_ok(&zip->set)) {
486 /* This is the first time here with some central directory content. We
487 construct this set of names only on demand. Prepare set and block. */
488 set_start(&zip->set);
489 block_init(&zip->block, &zip->central_dir);
490 }
491
492 /* Update the set of names from the current central directory contents.
493 This reads any new central directory records since the last time we were
494 here. */
495 for (;;) {
496 char *there = block_central_name(&zip->block, &zip->set);
497 if (there == NULL) {
498 if (zip->block.next == NULL)
499 /* The central directory is invalid. */
@@ -494,27 +502,26 @@
502 }
503
504 /* Add there to the set. */
505 if (set_insert(&zip->set, there))
506 /* There's already a duplicate in the central directory! We'll just
507 let this be and carry on. */
508 set_free(&zip->set, there);
509 }
510
511 /* Return true if name is in the central directory. */
512 len = strlen(name);
513 copy = set_alloc(&zip->set, NULL, len + 1);
514 memcpy(copy, name, len + 1);
515 found = set_found(&zip->set, copy);
516 set_free(&zip->set, copy);
517 return found;
518 }
519
520
521 /****************************************************************************/
522
 
523 /* ===========================================================================
524 Inputs a long in LSB order to the given file
525 nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
526 */
527
@@ -572,10 +579,11 @@
579 }
580
581
582 /****************************************************************************/
583
584 #ifndef NO_ADDFILEINEXISTINGZIP
585 local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
586 unsigned char c;
587 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
588 if (err==1)
589 {
@@ -695,11 +703,11 @@
703 */
704 local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
705 unsigned char* buf;
706 ZPOS64_T uSizeFile;
707 ZPOS64_T uBackRead;
708 ZPOS64_T uMaxBack=0xffff+22; /* maximum comment and end-of-central-directory record */
709 ZPOS64_T uPosFound=0;
710
711 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
712 return 0;
713
@@ -731,11 +739,11 @@
739 break;
740
741 if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
742 break;
743
744 for (i=(int)uReadSize-4; i>=0; --i)
745 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
746 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
747 {
748 uPosFound = uReadPos+(unsigned)i;
749 break;
@@ -747,78 +755,32 @@
755 free(buf);
756 return uPosFound;
757 }
758
759 /*
760 Locate the Zip64 end of central directory record using the locator
761 immediately preceding the end of central directory record at
762 centralDirPos.
763 */
764 local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream,
765 ZPOS64_T centralDirPos) {
766 ZPOS64_T uPosFound;
 
 
 
767 uLong uL;
768 ZPOS64_T relativeOffset;
769
770 /* The Zip64 locator immediately precedes the end of central directory
771 record. Checking only there prevents a locator signature in the file
772 data from overriding the central directory that record refers to. */
773 if (centralDirPos < 20)
774 return 0;
775
776 uPosFound = centralDirPos - 20;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
777 if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0)
778 return 0;
779
780 if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK ||
781 uL != 0x07064b50)
782 return 0;
783
784 /* number of the disk with the start of the zip64 end of central directory */
785 if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
786 return 0;
@@ -854,10 +816,11 @@
816 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
817
818 ZPOS64_T size_central_dir; /* size of the central directory */
819 ZPOS64_T offset_central_dir; /* offset of start of central directory */
820 ZPOS64_T central_pos;
821 ZPOS64_T central_pos64;
822 uLong uL;
823
824 uLong number_disk; /* number of the current disk, used for
825 spanning ZIP, unsupported, always 0*/
826 uLong number_disk_with_CD; /* number of the disk with central dir, used
@@ -870,19 +833,19 @@
833 uLong VersionNeeded;
834 uLong size_comment;
835
836 int hasZIP64Record = 0;
837
838 /* find the end of central directory record, and then a ZIP64 record if
839 there is one immediately before it */
840 central_pos = zip64local_SearchCentralDir(&pziinit->z_filefunc,pziinit->filestream);
841 central_pos64 = zip64local_SearchCentralDir64(&pziinit->z_filefunc,pziinit->filestream,
842 central_pos);
843 if (central_pos64 > 0)
844 {
845 hasZIP64Record = 1;
846 central_pos = central_pos64;
 
 
 
847 }
848
849 /* disable to allow appending to empty ZIP archive
850 if (central_pos==0)
851 err=ZIP_ERRNO;
@@ -937,11 +900,11 @@
900 starting disk number */
901 if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&offset_central_dir)!=ZIP_OK)
902 err=ZIP_ERRNO;
903
904 /* TODO..
905 read the comment from the standard central header. */
906 size_comment = 0;
907 }
908 else
909 {
910 /* Read End of central Directory info */
@@ -1022,11 +985,13 @@
985
986 {
987 ZPOS64_T size_central_dir_to_read = size_central_dir;
988 size_t buf_size = SIZEDATA_INDATABLOCK;
989 void* buf_read = (void*)ALLOC(buf_size);
990 if (buf_read == NULL)
991 err=ZIP_INTERNALERROR;
992 else if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0)
993 err=ZIP_ERRNO;
994
995 while ((size_central_dir_to_read>0) && (err==ZIP_OK))
996 {
997 ZPOS64_T read_this = SIZEDATA_INDATABLOCK;
@@ -1046,10 +1011,15 @@
1011 pziinit->begin_pos = byte_before_the_zipfile;
1012 pziinit->number_entry = number_entry_CD;
1013
1014 if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0)
1015 err=ZIP_ERRNO;
1016
1017 if (err != ZIP_OK)
1018 {
1019 ZCLOSE64(pziinit->z_filefunc, pziinit->filestream);
1020 }
1021
1022 return err;
1023 }
1024
1025
@@ -1105,26 +1075,29 @@
1075 {
1076 /* Read and Cache Central Directory Records */
1077 err = LoadCentralDirectoryRecord(&ziinit);
1078 }
1079
 
 
 
 
1080 # endif /* !NO_ADDFILEINEXISTINGZIP*/
1081
1082 if (err != ZIP_OK)
1083 {
1084 # ifndef NO_ADDFILEINEXISTINGZIP
1085 free(ziinit.globalcomment);
1086 free_linkedlist(&(ziinit.central_dir));
1087 # endif /* !NO_ADDFILEINEXISTINGZIP*/
1088 free(zi);
1089 if (globalcomment)
1090 *globalcomment = NULL;
1091 return NULL;
1092 }
1093 else
1094 {
1095 # ifndef NO_ADDFILEINEXISTINGZIP
1096 if (globalcomment)
1097 *globalcomment = ziinit.globalcomment;
1098 # endif /* !NO_ADDFILEINEXISTINGZIP*/
1099 *zi = ziinit;
1100 return (zipFile)zi;
1101 }
1102 }
1103
@@ -1331,14 +1304,16 @@
1304 /* The filename and comment length must fit in 16 bits. */
1305 if ((filename!=NULL) && (strlen(filename)>0xffff))
1306 return ZIP_PARAMERROR;
1307 if ((comment!=NULL) && (strlen(comment)>0xffff))
1308 return ZIP_PARAMERROR;
1309 /* The extra field lengths must fit in 16 bits, including a 20-byte
1310 Zip64 sub-field in the local header if zip64 is true. There might
1311 be a Zip64 sub-field needed in the central directory header as
1312 well, but that won't be known until later. */
1313 if ((size_extrafield_local>(0xffffu-(zip64?20u:0u))) ||
1314 (size_extrafield_global>0xffffu))
1315 return ZIP_PARAMERROR;
1316
1317 zi = (zip64_internal*)file;
1318
1319 if (zi->in_opened_file_inzip == 1)
@@ -1391,10 +1366,12 @@
1366
1367 zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + size_extrafield_global + size_comment;
1368 zi->ci.size_centralExtraFree = 32; /* Extra space we have reserved in case we need to add ZIP64 extra info data */
1369
1370 zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader + zi->ci.size_centralExtraFree);
1371 if (zi->ci.central_header == NULL)
1372 return ZIP_INTERNALERROR;
1373
1374 zi->ci.size_centralExtra = size_extrafield_global;
1375 zip64local_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
1376 /* version info */
1377 zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)versionMadeBy,2);
@@ -1433,12 +1410,10 @@
1410 *(((const char*)extrafield_global)+i);
1411
1412 for (i=0;i<size_comment;i++)
1413 *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
1414 size_extrafield_global+i) = *(comment+i);
 
 
1415
1416 zi->ci.zip64 = zip64;
1417 zi->ci.totalCompressedData = 0;
1418 zi->ci.totalUncompressedData = 0;
1419 zi->ci.pos_zip64extrainfo = 0;
@@ -1891,18 +1866,29 @@
1866 datasize += 8;
1867
1868 if(datasize > 0)
1869 {
1870 char* p = NULL;
1871 uLong size_comment;
1872
1873 if (zi->ci.size_centralExtra + datasize + 4 > 0xffff)
1874 {
1875 /* the extra field is now too big with the Zip64 sub-field -- leave
1876 this entry out of the central directory, so that the zip file can be
1877 completed with the remaining entries, if desired */
1878 free(zi->ci.central_header);
1879 zi->ci.central_header = NULL;
1880 zi->in_opened_file_inzip = 0;
1881 return ZIP_BADZIPFILE;
1882 }
1883
1884 /* Insert the ZIP64 field at the end of the extra field, which is ahead
1885 of the file comment, so move the comment up to make room. */
1886 size_comment = (unsigned char)zi->ci.central_header[32] |
1887 ((uLong)(unsigned char)zi->ci.central_header[33] << 8);
1888 p = zi->ci.central_header + zi->ci.size_centralheader - size_comment;
1889 memmove(p + datasize + 4, p, size_comment);
1890
1891 /* Add Extra Information Header for 'ZIP64 information' */
1892 zip64local_putValue_inmemory(p, 0x0001, 2); /* HeaderID */
1893 p += 2;
1894 zip64local_putValue_inmemory(p, datasize, 2); /* DataSize */
@@ -1925,12 +1911,12 @@
1911 zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8);
1912 p += 8;
1913 }
1914
1915 /* Update how much extra free space we got in the memory buffer
1916 and increase the centralheader size so the new ZIP64 fields are included
1917 ( 4 below is the size of HeaderID and DataSize field ) */
1918 zi->ci.size_centralExtraFree -= datasize + 4;
1919 zi->ci.size_centralheader += datasize + 4;
1920
1921 /* Update the extra info size field */
1922 zi->ci.size_centralExtra += datasize + 4;
@@ -2189,40 +2175,68 @@
2175 }
2176
2177 extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
2178 char* p = pData;
2179 int size = 0;
2180 int remaining;
2181 char* pNewHeader;
2182 char* pTmp;
2183 unsigned header;
2184 unsigned dataSize;
2185 unsigned remove = (unsigned short)sHeader;
2186
2187 int retVal = ZIP_OK;
2188
2189 if(pData == NULL || dataLen == NULL || *dataLen < 4)
2190 return ZIP_PARAMERROR;
2191
2192 remaining = *dataLen;
2193 pNewHeader = (char*)ALLOC((unsigned)*dataLen);
2194 if (pNewHeader == NULL)
2195 return ZIP_INTERNALERROR;
2196
2197 pTmp = pNewHeader;
2198
2199 while(remaining > 0)
2200 {
2201 if(remaining < 4)
2202 {
2203 retVal = ZIP_BADZIPFILE;
2204 break;
2205 }
2206
2207 header = (unsigned)(unsigned char)p[0] |
2208 ((unsigned)(unsigned char)p[1] << 8);
2209 dataSize = (unsigned)(unsigned char)p[2] |
2210 ((unsigned)(unsigned char)p[3] << 8);
2211
2212 if((int)dataSize > remaining - 4)
2213 {
2214 retVal = ZIP_BADZIPFILE;
2215 break;
2216 }
2217
2218 if( header == remove ) /* Header found. */
2219 {
2220 p += dataSize + 4; /* skip it. do not copy to temp buffer */
2221 }
2222 else
2223 {
2224 /* Extra Info block should not be removed, So copy it to the temp buffer. */
2225 memcpy(pTmp, p, dataSize + 4);
2226 pTmp += dataSize + 4;
2227 p += dataSize + 4;
2228 size += dataSize + 4;
2229 }
2230
2231 remaining -= dataSize + 4;
2232 }
2233
2234 if(retVal != ZIP_OK)
2235 {
2236 free(pNewHeader);
2237 return retVal;
2238 }
2239
2240 if(size < *dataLen)
2241 {
2242 /* clean old extra info block. */
2243
--- compat/zlib/contrib/minizip/zip.h
+++ compat/zlib/contrib/minizip/zip.h
@@ -179,13 +179,18 @@
179179
*zipfi contain supplemental information
180180
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
181181
contains the extrafield data for the local header
182182
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
183183
contains the extrafield data for the global header
184
- if comment != NULL, comment contain the comment string
185
- method contain the compression method (0 for store, Z_DEFLATED for deflate)
186
- level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
184
+ size_extrafield_local and size_extrafield_global are limited to 65535 by
185
+ the format, or less depending on the presence of Zip64 subfields --
186
+ size_extrafield_local needs to leave room for a 20-byte Zip64 subfield if
187
+ zip64 is true, and size_extrafield_global needs to leave room for a 12 to
188
+ 28 byte Zip64 subfield in case the offset or length exceeds 2^32-1
189
+ if comment != NULL, comment contains the comment string
190
+ method contains the compression method (0 for store, Z_DEFLATED for deflate)
191
+ level contains the level of compression (can be Z_DEFAULT_COMPRESSION)
187192
zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
188193
this MUST be '1' if the uncompressed size is >= 0xffffffff.
189194
190195
*/
191196
192197
--- compat/zlib/contrib/minizip/zip.h
+++ compat/zlib/contrib/minizip/zip.h
@@ -179,13 +179,18 @@
179 *zipfi contain supplemental information
180 if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
181 contains the extrafield data for the local header
182 if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
183 contains the extrafield data for the global header
184 if comment != NULL, comment contain the comment string
185 method contain the compression method (0 for store, Z_DEFLATED for deflate)
186 level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
 
 
 
 
 
187 zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
188 this MUST be '1' if the uncompressed size is >= 0xffffffff.
189
190 */
191
192
--- compat/zlib/contrib/minizip/zip.h
+++ compat/zlib/contrib/minizip/zip.h
@@ -179,13 +179,18 @@
179 *zipfi contain supplemental information
180 if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
181 contains the extrafield data for the local header
182 if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
183 contains the extrafield data for the global header
184 size_extrafield_local and size_extrafield_global are limited to 65535 by
185 the format, or less depending on the presence of Zip64 subfields --
186 size_extrafield_local needs to leave room for a 20-byte Zip64 subfield if
187 zip64 is true, and size_extrafield_global needs to leave room for a 12 to
188 28 byte Zip64 subfield in case the offset or length exceeds 2^32-1
189 if comment != NULL, comment contains the comment string
190 method contains the compression method (0 for store, Z_DEFLATED for deflate)
191 level contains the level of compression (can be Z_DEFAULT_COMPRESSION)
192 zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
193 this MUST be '1' if the uncompressed size is >= 0xffffffff.
194
195 */
196
197
--- compat/zlib/contrib/nuget/nuget.csproj
+++ compat/zlib/contrib/nuget/nuget.csproj
@@ -5,11 +5,11 @@
55
<PackageId>madler.zlib.redist</PackageId>
66
<PackageId Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(PackageId).win</PackageId>
77
<PackageId Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(PackageId).linux</PackageId>
88
<PackageId Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(PackageId).osx</PackageId>
99
<Copyright>(C) 1995-2026 Jean-loup Gailly and Mark Adler</Copyright>
10
- <version>1.3.2</version>
10
+ <version>1.4</version>
1111
<PackageDescription>NuGet Package for consuming native builds of zlib into .NET without complexity.</PackageDescription>
1212
<PackageReadmeFile>README</PackageReadmeFile>
1313
<!--
1414
Warns about not having any lib or ref assemblies (.NET Assemblies) in those directories.
1515
Native only packages that is to be consumed in .NET should not require these.
1616
--- compat/zlib/contrib/nuget/nuget.csproj
+++ compat/zlib/contrib/nuget/nuget.csproj
@@ -5,11 +5,11 @@
5 <PackageId>madler.zlib.redist</PackageId>
6 <PackageId Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(PackageId).win</PackageId>
7 <PackageId Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(PackageId).linux</PackageId>
8 <PackageId Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(PackageId).osx</PackageId>
9 <Copyright>(C) 1995-2026 Jean-loup Gailly and Mark Adler</Copyright>
10 <version>1.3.2</version>
11 <PackageDescription>NuGet Package for consuming native builds of zlib into .NET without complexity.</PackageDescription>
12 <PackageReadmeFile>README</PackageReadmeFile>
13 <!--
14 Warns about not having any lib or ref assemblies (.NET Assemblies) in those directories.
15 Native only packages that is to be consumed in .NET should not require these.
16
--- compat/zlib/contrib/nuget/nuget.csproj
+++ compat/zlib/contrib/nuget/nuget.csproj
@@ -5,11 +5,11 @@
5 <PackageId>madler.zlib.redist</PackageId>
6 <PackageId Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(PackageId).win</PackageId>
7 <PackageId Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(PackageId).linux</PackageId>
8 <PackageId Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(PackageId).osx</PackageId>
9 <Copyright>(C) 1995-2026 Jean-loup Gailly and Mark Adler</Copyright>
10 <version>1.4</version>
11 <PackageDescription>NuGet Package for consuming native builds of zlib into .NET without complexity.</PackageDescription>
12 <PackageReadmeFile>README</PackageReadmeFile>
13 <!--
14 Warns about not having any lib or ref assemblies (.NET Assemblies) in those directories.
15 Native only packages that is to be consumed in .NET should not require these.
16
--- compat/zlib/contrib/pascal/zlibpas.pas
+++ compat/zlib/contrib/pascal/zlibpas.pas
@@ -8,12 +8,12 @@
88
unit zlibpas;
99
1010
interface
1111
1212
const
13
- ZLIB_VERSION = '1.3.2';
14
- ZLIB_VERNUM = $12a0;
13
+ ZLIB_VERSION = '1.4';
14
+ ZLIB_VERNUM = $1400;
1515
1616
type
1717
alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
1818
cdecl;
1919
free_func = procedure(opaque, address: Pointer);
2020
--- compat/zlib/contrib/pascal/zlibpas.pas
+++ compat/zlib/contrib/pascal/zlibpas.pas
@@ -8,12 +8,12 @@
8 unit zlibpas;
9
10 interface
11
12 const
13 ZLIB_VERSION = '1.3.2';
14 ZLIB_VERNUM = $12a0;
15
16 type
17 alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
18 cdecl;
19 free_func = procedure(opaque, address: Pointer);
20
--- compat/zlib/contrib/pascal/zlibpas.pas
+++ compat/zlib/contrib/pascal/zlibpas.pas
@@ -8,12 +8,12 @@
8 unit zlibpas;
9
10 interface
11
12 const
13 ZLIB_VERSION = '1.4';
14 ZLIB_VERNUM = $1400;
15
16 type
17 alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
18 cdecl;
19 free_func = procedure(opaque, address: Pointer);
20
--- compat/zlib/contrib/puff/CMakeLists.txt
+++ compat/zlib/contrib/puff/CMakeLists.txt
@@ -1,14 +1,22 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
puff
55
VERSION 2.3.0
66
LANGUAGES C
77
DESCRIPTION "A library for decompressing deflate with very little footprint"
88
HOMEPAGE_URL "https://www.zlib.net")
99
10
+
11
+if(ZLIB_BUILD_PUFF)
12
+ set(ZLIB_PUFF_BUILD_SHARED ${ZLIB_BUILD_SHARED} CACHE BOOL "")
13
+ set(ZLIB_PUFF_BUILD_STATIC ${ZLIB_BUILD_STATIC} CACHE BOOL "")
14
+ set(ZLIB_PUFF_BUILD_TESTING ${ZLIB_BUILD_TESTING} CACHE BOOL "")
15
+ set(ZLIB_PUFF_INSTALL ${ZLIB_INSTALL} CACHE BOOL "")
16
+endif(ZLIB_BUILD_PUFF)
17
+
1018
option(ZLIB_PUFF_BUILD_SHARED "Enable building blast shared library" ON)
1119
option(ZLIB_PUFF_BUILD_STATIC "Enable building blast static library" ON)
1220
option(ZLIB_PUFF_BUILD_TESTING "Enable building tests for blast" ON)
1321
option(ZLIB_PUFF_INSTALL "Enable installation of puff" ON)
1422
@@ -26,16 +34,18 @@
2634
2735
find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
2836
endif(NOT DEFINED ZLIB_BUILD_PUFF)
2937
3038
if(WIN32 OR CYGWIN)
31
- set(zlibpuff_static_suffix "s")
39
+ set(puff_static_suffix "s")
3240
set(CMAKE_DEBUG_POSTFIX "d")
41
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
3342
endif(WIN32 OR CYGWIN)
3443
3544
if(ZLIB_PUFF_BUILD_TESTING)
36
- add_executable(zlib_puff_bin-writer bin-writer.c)
45
+ enable_testing()
46
+ add_executable(${ZLIB_CONTRIB_PREFIX}puff_bin-writer bin-writer.c)
3747
3848
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
3949
${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
4050
set(CFLAGS_OLD ${CMAKE_C_FLAGS})
4151
set(CMAKE_C_FLAGS
@@ -44,65 +54,67 @@
4454
4555
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
4656
find_program(GCOV_EXECUTABLE gcov)
4757
endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
4858
49
- if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
59
+ if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
60
+ AND NOT CMAKE_CROSSCOMPILING)
5061
set(llvm_names llvm_cov)
5162
list(APPEND llvm_names llvm-cov)
5263
5364
foreach(ver RANGE 11 99)
5465
list(APPEND llvm_names llvm-cov-${ver})
5566
endforeach(ver RANGE 11 99)
5667
5768
find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
5869
set(llvm_option "gcov")
59
- endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
70
+ endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
71
+ AND NOT CMAKE_CROSSCOMPILING)
6072
endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
6173
${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
6274
63
- add_subdirectory(test)
75
+ add_subdirectory(test)
6476
endif(ZLIB_PUFF_BUILD_TESTING)
6577
6678
if(ZLIB_PUFF_BUILD_SHARED)
67
- add_library(zlib_puff_puff SHARED
79
+ add_library(${ZLIB_CONTRIB_PREFIX}puff_puff SHARED
6880
puff.c
6981
puff.h)
7082
71
- add_library(PUFF::PUFF ALIAS zlib_puff_puff)
83
+ add_library(PUFF::PUFF ALIAS ${ZLIB_CONTRIB_PREFIX}puff_puff)
7284
7385
if(NOT CYGWIN)
74
- set_target_properties(zlib_puff_puff
86
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}puff_puff
7587
PROPERTIES
7688
SOVERSION ${puff_VERSION_MAJOR}
7789
VERSION ${puff_VERSION})
7890
endif(NOT CYGWIN)
7991
8092
set_target_properties(
81
- zlib_puff_puff
93
+ ${ZLIB_CONTRIB_PREFIX}puff_puff
8294
PROPERTIES
8395
EXPORT_NAME PUFF
8496
OUTPUT_NAME puff)
8597
endif(ZLIB_PUFF_BUILD_SHARED)
8698
8799
if(ZLIB_PUFF_BUILD_STATIC)
88
- add_library(zlib_puff_puffStatic STATIC
100
+ add_library(${ZLIB_CONTRIB_PREFIX}puff_puffStatic STATIC
89101
puff.c
90102
puff.h)
91103
92
- add_library(PUFF::PUFFSTATIC ALIAS zlib_puff_puffStatic)
104
+ add_library(PUFF::PUFFSTATIC ALIAS ${ZLIB_CONTRIB_PREFIX}puff_puffStatic)
93105
94
- set_target_properties(zlib_puff_puffStatic
106
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}puff_puffStatic
95107
PROPERTIES
96108
EXPORT_NAME PUFFSTATIC
97
- OUTPUT_NAME puff${zlib_puff_static_suffix})
109
+ OUTPUT_NAME puff${puff_static_suffix})
98110
endif(ZLIB_PUFF_BUILD_STATIC)
99111
100112
if(ZLIB_PUFF_INSTALL)
101113
if(ZLIB_PUFF_BUILD_SHARED)
102114
install(
103
- TARGETS zlib_puff_puff
115
+ TARGETS ${ZLIB_CONTRIB_PREFIX}puff_puff
104116
COMPONENT Runtime
105117
EXPORT puffSharedExport
106118
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
107119
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
108120
install(
@@ -111,21 +123,21 @@
111123
NAMESPACE PUFF::
112124
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/puff)
113125
114126
if(MSVC)
115127
install(
116
- FILES $<TARGET_PDB_FILE:zlib_puff_puff>
128
+ FILES $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}puff_puff>
117129
COMPONENT Development
118130
DESTINATION ${CMAKE_INSTALL_BINDIR}
119131
CONFIGURATIONS Debug OR RelWithDebInfo
120132
OPTIONAL)
121133
endif(MSVC)
122134
endif(ZLIB_PUFF_BUILD_SHARED)
123135
124136
if(ZLIB_PUFF_BUILD_STATIC)
125137
install(
126
- TARGETS zlib_puff_puffStatic
138
+ TARGETS ${ZLIB_CONTRIB_PREFIX}puff_puffStatic
127139
COMPONENT Development
128140
EXPORT puffStaticExport
129141
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
130142
install(
131143
EXPORT puffStaticExport
132144
--- compat/zlib/contrib/puff/CMakeLists.txt
+++ compat/zlib/contrib/puff/CMakeLists.txt
@@ -1,14 +1,22 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 puff
5 VERSION 2.3.0
6 LANGUAGES C
7 DESCRIPTION "A library for decompressing deflate with very little footprint"
8 HOMEPAGE_URL "https://www.zlib.net")
9
 
 
 
 
 
 
 
 
10 option(ZLIB_PUFF_BUILD_SHARED "Enable building blast shared library" ON)
11 option(ZLIB_PUFF_BUILD_STATIC "Enable building blast static library" ON)
12 option(ZLIB_PUFF_BUILD_TESTING "Enable building tests for blast" ON)
13 option(ZLIB_PUFF_INSTALL "Enable installation of puff" ON)
14
@@ -26,16 +34,18 @@
26
27 find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
28 endif(NOT DEFINED ZLIB_BUILD_PUFF)
29
30 if(WIN32 OR CYGWIN)
31 set(zlibpuff_static_suffix "s")
32 set(CMAKE_DEBUG_POSTFIX "d")
 
33 endif(WIN32 OR CYGWIN)
34
35 if(ZLIB_PUFF_BUILD_TESTING)
36 add_executable(zlib_puff_bin-writer bin-writer.c)
 
37
38 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
39 ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
40 set(CFLAGS_OLD ${CMAKE_C_FLAGS})
41 set(CMAKE_C_FLAGS
@@ -44,65 +54,67 @@
44
45 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
46 find_program(GCOV_EXECUTABLE gcov)
47 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
48
49 if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
 
50 set(llvm_names llvm_cov)
51 list(APPEND llvm_names llvm-cov)
52
53 foreach(ver RANGE 11 99)
54 list(APPEND llvm_names llvm-cov-${ver})
55 endforeach(ver RANGE 11 99)
56
57 find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
58 set(llvm_option "gcov")
59 endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
 
60 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
61 ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
62
63 add_subdirectory(test)
64 endif(ZLIB_PUFF_BUILD_TESTING)
65
66 if(ZLIB_PUFF_BUILD_SHARED)
67 add_library(zlib_puff_puff SHARED
68 puff.c
69 puff.h)
70
71 add_library(PUFF::PUFF ALIAS zlib_puff_puff)
72
73 if(NOT CYGWIN)
74 set_target_properties(zlib_puff_puff
75 PROPERTIES
76 SOVERSION ${puff_VERSION_MAJOR}
77 VERSION ${puff_VERSION})
78 endif(NOT CYGWIN)
79
80 set_target_properties(
81 zlib_puff_puff
82 PROPERTIES
83 EXPORT_NAME PUFF
84 OUTPUT_NAME puff)
85 endif(ZLIB_PUFF_BUILD_SHARED)
86
87 if(ZLIB_PUFF_BUILD_STATIC)
88 add_library(zlib_puff_puffStatic STATIC
89 puff.c
90 puff.h)
91
92 add_library(PUFF::PUFFSTATIC ALIAS zlib_puff_puffStatic)
93
94 set_target_properties(zlib_puff_puffStatic
95 PROPERTIES
96 EXPORT_NAME PUFFSTATIC
97 OUTPUT_NAME puff${zlib_puff_static_suffix})
98 endif(ZLIB_PUFF_BUILD_STATIC)
99
100 if(ZLIB_PUFF_INSTALL)
101 if(ZLIB_PUFF_BUILD_SHARED)
102 install(
103 TARGETS zlib_puff_puff
104 COMPONENT Runtime
105 EXPORT puffSharedExport
106 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
107 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
108 install(
@@ -111,21 +123,21 @@
111 NAMESPACE PUFF::
112 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/puff)
113
114 if(MSVC)
115 install(
116 FILES $<TARGET_PDB_FILE:zlib_puff_puff>
117 COMPONENT Development
118 DESTINATION ${CMAKE_INSTALL_BINDIR}
119 CONFIGURATIONS Debug OR RelWithDebInfo
120 OPTIONAL)
121 endif(MSVC)
122 endif(ZLIB_PUFF_BUILD_SHARED)
123
124 if(ZLIB_PUFF_BUILD_STATIC)
125 install(
126 TARGETS zlib_puff_puffStatic
127 COMPONENT Development
128 EXPORT puffStaticExport
129 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
130 install(
131 EXPORT puffStaticExport
132
--- compat/zlib/contrib/puff/CMakeLists.txt
+++ compat/zlib/contrib/puff/CMakeLists.txt
@@ -1,14 +1,22 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 puff
5 VERSION 2.3.0
6 LANGUAGES C
7 DESCRIPTION "A library for decompressing deflate with very little footprint"
8 HOMEPAGE_URL "https://www.zlib.net")
9
10
11 if(ZLIB_BUILD_PUFF)
12 set(ZLIB_PUFF_BUILD_SHARED ${ZLIB_BUILD_SHARED} CACHE BOOL "")
13 set(ZLIB_PUFF_BUILD_STATIC ${ZLIB_BUILD_STATIC} CACHE BOOL "")
14 set(ZLIB_PUFF_BUILD_TESTING ${ZLIB_BUILD_TESTING} CACHE BOOL "")
15 set(ZLIB_PUFF_INSTALL ${ZLIB_INSTALL} CACHE BOOL "")
16 endif(ZLIB_BUILD_PUFF)
17
18 option(ZLIB_PUFF_BUILD_SHARED "Enable building blast shared library" ON)
19 option(ZLIB_PUFF_BUILD_STATIC "Enable building blast static library" ON)
20 option(ZLIB_PUFF_BUILD_TESTING "Enable building tests for blast" ON)
21 option(ZLIB_PUFF_INSTALL "Enable installation of puff" ON)
22
@@ -26,16 +34,18 @@
34
35 find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
36 endif(NOT DEFINED ZLIB_BUILD_PUFF)
37
38 if(WIN32 OR CYGWIN)
39 set(puff_static_suffix "s")
40 set(CMAKE_DEBUG_POSTFIX "d")
41 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
42 endif(WIN32 OR CYGWIN)
43
44 if(ZLIB_PUFF_BUILD_TESTING)
45 enable_testing()
46 add_executable(${ZLIB_CONTRIB_PREFIX}puff_bin-writer bin-writer.c)
47
48 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
49 ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
50 set(CFLAGS_OLD ${CMAKE_C_FLAGS})
51 set(CMAKE_C_FLAGS
@@ -44,65 +54,67 @@
54
55 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
56 find_program(GCOV_EXECUTABLE gcov)
57 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
58
59 if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
60 AND NOT CMAKE_CROSSCOMPILING)
61 set(llvm_names llvm_cov)
62 list(APPEND llvm_names llvm-cov)
63
64 foreach(ver RANGE 11 99)
65 list(APPEND llvm_names llvm-cov-${ver})
66 endforeach(ver RANGE 11 99)
67
68 find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
69 set(llvm_option "gcov")
70 endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
71 AND NOT CMAKE_CROSSCOMPILING)
72 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
73 ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
74
75 add_subdirectory(test)
76 endif(ZLIB_PUFF_BUILD_TESTING)
77
78 if(ZLIB_PUFF_BUILD_SHARED)
79 add_library(${ZLIB_CONTRIB_PREFIX}puff_puff SHARED
80 puff.c
81 puff.h)
82
83 add_library(PUFF::PUFF ALIAS ${ZLIB_CONTRIB_PREFIX}puff_puff)
84
85 if(NOT CYGWIN)
86 set_target_properties(${ZLIB_CONTRIB_PREFIX}puff_puff
87 PROPERTIES
88 SOVERSION ${puff_VERSION_MAJOR}
89 VERSION ${puff_VERSION})
90 endif(NOT CYGWIN)
91
92 set_target_properties(
93 ${ZLIB_CONTRIB_PREFIX}puff_puff
94 PROPERTIES
95 EXPORT_NAME PUFF
96 OUTPUT_NAME puff)
97 endif(ZLIB_PUFF_BUILD_SHARED)
98
99 if(ZLIB_PUFF_BUILD_STATIC)
100 add_library(${ZLIB_CONTRIB_PREFIX}puff_puffStatic STATIC
101 puff.c
102 puff.h)
103
104 add_library(PUFF::PUFFSTATIC ALIAS ${ZLIB_CONTRIB_PREFIX}puff_puffStatic)
105
106 set_target_properties(${ZLIB_CONTRIB_PREFIX}puff_puffStatic
107 PROPERTIES
108 EXPORT_NAME PUFFSTATIC
109 OUTPUT_NAME puff${puff_static_suffix})
110 endif(ZLIB_PUFF_BUILD_STATIC)
111
112 if(ZLIB_PUFF_INSTALL)
113 if(ZLIB_PUFF_BUILD_SHARED)
114 install(
115 TARGETS ${ZLIB_CONTRIB_PREFIX}puff_puff
116 COMPONENT Runtime
117 EXPORT puffSharedExport
118 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
119 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
120 install(
@@ -111,21 +123,21 @@
123 NAMESPACE PUFF::
124 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/puff)
125
126 if(MSVC)
127 install(
128 FILES $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}puff_puff>
129 COMPONENT Development
130 DESTINATION ${CMAKE_INSTALL_BINDIR}
131 CONFIGURATIONS Debug OR RelWithDebInfo
132 OPTIONAL)
133 endif(MSVC)
134 endif(ZLIB_PUFF_BUILD_SHARED)
135
136 if(ZLIB_PUFF_BUILD_STATIC)
137 install(
138 TARGETS ${ZLIB_CONTRIB_PREFIX}puff_puffStatic
139 COMPONENT Development
140 EXPORT puffStaticExport
141 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
142 install(
143 EXPORT puffStaticExport
144
--- compat/zlib/contrib/puff/puffConfig.cmake.in
+++ compat/zlib/contrib/puff/puffConfig.cmake.in
@@ -1,18 +1,40 @@
1
-@PACKAGE_INIT@
2
-
31
set(_puff_supported_components "shared" "static")
42
53
if(puff_FIND_COMPONENTS)
64
foreach(_comp ${puff_FIND_COMPONENTS})
75
if(NOT _comp IN_LIST _puff_supported_components)
86
set(puff_FOUND False)
97
set(puff_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
108
endif(NOT _comp IN_LIST _puff_supported_components)
119
12
- include("${CMAKE_CURRENT_LIST_DIR}/puff-${_comp}.cmake")
10
+ include("${CMAKE_CURRENT_LIST_DIR}/puff-${_comp}.cmake"
11
+ OPTIONAL
12
+ RESULT_VARIABLE _comp_loaded)
13
+
14
+ if(NOT _comp_loaded)
15
+ set(puff_FOUND False)
16
+ set(puff_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
17
+ else(NOT _comp_loaded)
18
+ set(puff_${_comp}_FOUND TRUE)
19
+ endif(NOT _comp_loaded)
1320
endforeach(_comp ${puff_FIND_COMPONENTS})
1421
else(puff_FIND_COMPONENTS)
1522
foreach(_component_config IN LISTS _puff_supported_components)
16
- include("${CMAKE_CURRENT_LIST_DIR}/puff-${_component_config}.cmake")
23
+ include("${CMAKE_CURRENT_LIST_DIR}/puff-${_component_config}.cmake"
24
+ OPTIONAL)
1725
endforeach(_component_config IN LISTS _puff_supported_components)
26
+
27
+ if(NOT TARGET PUFF::PUFF)
28
+ set(puff_FOUND False)
29
+ set(puff_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
30
+ string(APPEND puff_NOT_FOUND_MESSAGE "build puff with support for shared libs or\n")
31
+ string(APPEND puff_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
32
+ endif(NOT TARGET PUFF::PUFF)
33
+
34
+ if(NOT TARGET PUFF::PUFFSTATIC)
35
+ set(puff_FOUND False)
36
+ set(puff_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
37
+ string(APPEND puff_NOT_FOUND_MESSAGE "build puff with support for static libs or\n")
38
+ string(APPEND puff_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
39
+ endif(NOT TARGET PUFF::PUFFSTATIC)
1840
endif(puff_FIND_COMPONENTS)
1941
--- compat/zlib/contrib/puff/puffConfig.cmake.in
+++ compat/zlib/contrib/puff/puffConfig.cmake.in
@@ -1,18 +1,40 @@
1 @PACKAGE_INIT@
2
3 set(_puff_supported_components "shared" "static")
4
5 if(puff_FIND_COMPONENTS)
6 foreach(_comp ${puff_FIND_COMPONENTS})
7 if(NOT _comp IN_LIST _puff_supported_components)
8 set(puff_FOUND False)
9 set(puff_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
10 endif(NOT _comp IN_LIST _puff_supported_components)
11
12 include("${CMAKE_CURRENT_LIST_DIR}/puff-${_comp}.cmake")
 
 
 
 
 
 
 
 
 
13 endforeach(_comp ${puff_FIND_COMPONENTS})
14 else(puff_FIND_COMPONENTS)
15 foreach(_component_config IN LISTS _puff_supported_components)
16 include("${CMAKE_CURRENT_LIST_DIR}/puff-${_component_config}.cmake")
 
17 endforeach(_component_config IN LISTS _puff_supported_components)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18 endif(puff_FIND_COMPONENTS)
19
--- compat/zlib/contrib/puff/puffConfig.cmake.in
+++ compat/zlib/contrib/puff/puffConfig.cmake.in
@@ -1,18 +1,40 @@
 
 
1 set(_puff_supported_components "shared" "static")
2
3 if(puff_FIND_COMPONENTS)
4 foreach(_comp ${puff_FIND_COMPONENTS})
5 if(NOT _comp IN_LIST _puff_supported_components)
6 set(puff_FOUND False)
7 set(puff_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
8 endif(NOT _comp IN_LIST _puff_supported_components)
9
10 include("${CMAKE_CURRENT_LIST_DIR}/puff-${_comp}.cmake"
11 OPTIONAL
12 RESULT_VARIABLE _comp_loaded)
13
14 if(NOT _comp_loaded)
15 set(puff_FOUND False)
16 set(puff_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
17 else(NOT _comp_loaded)
18 set(puff_${_comp}_FOUND TRUE)
19 endif(NOT _comp_loaded)
20 endforeach(_comp ${puff_FIND_COMPONENTS})
21 else(puff_FIND_COMPONENTS)
22 foreach(_component_config IN LISTS _puff_supported_components)
23 include("${CMAKE_CURRENT_LIST_DIR}/puff-${_component_config}.cmake"
24 OPTIONAL)
25 endforeach(_component_config IN LISTS _puff_supported_components)
26
27 if(NOT TARGET PUFF::PUFF)
28 set(puff_FOUND False)
29 set(puff_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
30 string(APPEND puff_NOT_FOUND_MESSAGE "build puff with support for shared libs or\n")
31 string(APPEND puff_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
32 endif(NOT TARGET PUFF::PUFF)
33
34 if(NOT TARGET PUFF::PUFFSTATIC)
35 set(puff_FOUND False)
36 set(puff_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
37 string(APPEND puff_NOT_FOUND_MESSAGE "build puff with support for static libs or\n")
38 string(APPEND puff_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
39 endif(NOT TARGET PUFF::PUFFSTATIC)
40 endif(puff_FIND_COMPONENTS)
41
--- compat/zlib/contrib/puff/test/CMakeLists.txt
+++ compat/zlib/contrib/puff/test/CMakeLists.txt
@@ -1,121 +1,118 @@
11
# if we are built from with zlib, use this path's)
2
-if(DEFINED ZLIB_BUILD_PUFF)
3
- set(WORK_DIR ${zlib_BINARY_DIR})
4
- set(inst_setup zlib_install)
5
-else(DEFINED ZLIB_BUILD_PUFF)
6
- set(WORK_DIR ${puff_BINARY_DIR})
2
+if(NOT DEFINED ZLIB_BUILD_PUFF)
3
+ set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
74
set(inst_setup zlib_puff_install)
85
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
96
107
add_test(
118
NAME zlib_puff_install
12
- COMMAND ${CMAKE_COMMAND} --install ${puff_BINARY_DIR} --prefix
13
- ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
14
- WORKING_DIRECTORY ${puff_BINARY_DIR})
9
+ COMMAND ${CMAKE_COMMAND}
10
+ --install ${puff_BINARY_DIR}
11
+ --prefix ${WORK_DIR}/test_install
12
+ --config $<CONFIG>
13
+ WORKING_DIRECTORY ${WORK_DIR})
1514
1615
set_tests_properties(zlib_puff_install
1716
PROPERTIES
1817
FIXTURES_SETUP zlib_puff_install)
19
-endif(DEFINED ZLIB_BUILD_PUFF)
18
+endif(NOT DEFINED ZLIB_BUILD_PUFF)
2019
2120
if(ZLIB_PUFF_BUILD_SHARED AND NOT WIN32)
22
- add_executable(zlib_puff_test
21
+ add_executable(${ZLIB_CONTRIB_PREFIX}puff_test
2322
${puff_SOURCE_DIR}/pufftest.c
2423
${puff_SOURCE_DIR}/puff.h)
2524
26
- target_link_libraries(zlib_puff_test
27
- PRIVATE zlib_puff_puff)
25
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}puff_test
26
+ PRIVATE ${ZLIB_CONTRIB_PREFIX}puff_puff)
2827
29
- add_test(NAME zlib_puff_test
28
+ add_test(NAME ${ZLIB_CONTRIB_PREFIX}puff_test
3029
COMMAND ${CMAKE_COMMAND} -P
3130
${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
32
- "$<TARGET_FILE:zlib_puff_test>"
31
+ "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_test>"
3332
"${puff_SOURCE_DIR}")
3433
3534
if(GCOV_EXECUTABLE)
36
- add_executable(zlib_puff_test-coverage
35
+ add_executable(${ZLIB_CONTRIB_PREFIX}puff_test-coverage
3736
${puff_SOURCE_DIR}/pufftest.c
3837
${puff_SOURCE_DIR}/puff.c
3938
${puff_SOURCE_DIR}/puff.h)
4039
41
- target_compile_options(zlib_puff_test-coverage PRIVATE -coverage)
40
+ target_compile_options(${ZLIB_CONTRIB_PREFIX}puff_test-coverage PRIVATE -coverage)
4241
43
- target_link_options(zlib_puff_test-coverage PRIVATE -coverage)
42
+ target_link_options(${ZLIB_CONTRIB_PREFIX}puff_test-coverage PRIVATE -coverage)
4443
45
- add_test(NAME zlib_puff_test-coverage
46
- COMMAND ${CMAKE_COMMAND} -P
44
+ add_test(NAME ${ZLIB_CONTRIB_PREFIX}puff_test-coverage
45
+ COMMAND ${CMAKE_COMMAND}
46
+ -P
4747
${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
48
- "$<TARGET_FILE:zlib_puff_test-coverage>"
48
+ "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_test-coverage>"
4949
"${puff_SOURCE_DIR}"
50
- "$<TARGET_FILE:zlib_puff_bin-writer>"
50
+ "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_bin-writer>"
5151
${GCOV_EXECUTABLE}
5252
${llvm_option})
5353
endif(GCOV_EXECUTABLE)
5454
endif(ZLIB_PUFF_BUILD_SHARED AND NOT WIN32)
5555
5656
if(ZLIB_PUFF_BUILD_STATIC AND NOT WIN32)
57
- add_executable(zlib_puff_testStatic
57
+ add_executable(${ZLIB_CONTRIB_PREFIX}puff_testStatic
5858
${puff_SOURCE_DIR}/pufftest.c
5959
${puff_SOURCE_DIR}/puff.h)
6060
61
- target_link_libraries(zlib_puff_testStatic
62
- PRIVATE zlib_puff_puffStatic)
63
- add_test(NAME zlib_puff_testStatic
61
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}puff_testStatic
62
+ PRIVATE ${ZLIB_CONTRIB_PREFIX}puff_puffStatic)
63
+ add_test(NAME ${ZLIB_CONTRIB_PREFIX}puff_testStatic
6464
COMMAND ${CMAKE_COMMAND} -P
6565
${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
66
- "$<TARGET_FILE:zlib_puff_testStatic>"
66
+ "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_testStatic>"
6767
"${puff_SOURCE_DIR}")
6868
6969
if(GCOV_EXECUTABLE)
70
- add_executable(zlib_puff_testStatic-coverage
70
+ add_executable(${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage
7171
${puff_SOURCE_DIR}/pufftest.c
7272
${puff_SOURCE_DIR}/puff.c
7373
${puff_SOURCE_DIR}/puff.h)
7474
75
- target_compile_options(zlib_puff_testStatic-coverage
75
+ target_compile_options(${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage
7676
PRIVATE -coverage)
7777
78
- target_link_options(zlib_puff_testStatic-coverage
78
+ target_link_options(${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage
7979
PRIVATE -coverage)
8080
81
- add_test(NAME zlib_puff_testStatic-coverage
82
- COMMAND ${CMAKE_COMMAND} -P
83
- ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
84
- "$<TARGET_FILE:zlib_puff_testStatic-coverage>"
85
- "${puff_SOURCE_DIR}"
86
- "$<TARGET_FILE:zlib_puff_bin-writer>"
87
- ${GCOV_EXECUTABLE}
88
- ${llvm_option})
81
+ add_test(NAME ${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage
82
+ COMMAND ${CMAKE_COMMAND}
83
+ -P
84
+ ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
85
+ "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage>"
86
+ "${puff_SOURCE_DIR}"
87
+ "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_bin-writer>"
88
+ ${GCOV_EXECUTABLE}
89
+ ${llvm_option})
8990
endif(GCOV_EXECUTABLE)
9091
endif(ZLIB_PUFF_BUILD_STATIC AND NOT WIN32)
9192
92
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
93
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
94
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
95
-
9693
configure_file(
9794
${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
98
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
95
+ ${WORK_DIR}/puff_find_package_test/CMakeLists.txt @ONLY)
9996
10097
configure_file(
10198
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
102
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
99
+ ${WORK_DIR}/puff_add_subdirectory_test/CMakeLists.txt @ONLY)
103100
104101
configure_file(
105102
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
106
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
103
+ ${WORK_DIR}/puff_add_subdirectory_exclude_test/CMakeLists.txt
107104
@ONLY)
108105
109106
configure_file(
110107
${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
111
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
108
+ ${WORK_DIR}/puff_find_package_no_components_test/CMakeLists.txt
112109
@ONLY)
113110
114111
configure_file(
115112
${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
116
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
113
+ ${WORK_DIR}/puff_find_package_wrong_components_test/CMakeLists.txt
117114
@ONLY)
118115
119116
# CMAKE_GENERATOR_PLATFORM doesn't work in the if
120117
set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
121118
@@ -122,31 +119,33 @@
122119
if(GENERATOR)
123120
set(PLATFORM "-A ${GENERATOR}")
124121
endif(GENERATOR)
125122
126123
#
127
-# findpackage_test
124
+# find_package_test
128125
#
129126
add_test(
130127
NAME zlib_puff_find_package_configure
131128
COMMAND
132129
${CMAKE_COMMAND}
133130
${PLATFORM}
134
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
131
+ -B${WORK_DIR}/puff_find_package_test_build
135132
-DCMAKE_BUILD_TYPE=$<CONFIG>
136133
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
137134
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
138
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install
135
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
136
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
137
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
139138
${ZLIB_ARG}
140
- --fresh
139
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
141140
-G "${CMAKE_GENERATOR}"
142
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
141
+ -S${WORK_DIR}/puff_find_package_test)
143142
144143
add_test(
145144
NAME zlib_puff_find_package_build
146145
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
147
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
146
+ WORKING_DIRECTORY ${WORK_DIR}/puff_find_package_test_build)
148147
149148
set_tests_properties(zlib_puff_find_package_configure
150149
PROPERTIES
151150
FIXTURES_REQUIRED ${inst_setup}
152151
FIXTURES_SETUP puff_fp_config)
@@ -159,29 +158,33 @@
159158
# add_subdirectory_test
160159
#
161160
add_test(
162161
NAME zlib_puff_add_subdirectory_configure
163162
COMMAND
164
- ${CMAKE_COMMAND} ${PLATFORM}
165
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
163
+ ${CMAKE_COMMAND}
164
+ ${PLATFORM}
165
+ -B${WORK_DIR}/puff_add_subdirectory_test_build
166166
-DCMAKE_BUILD_TYPE=$<CONFIG>
167167
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
168168
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
169
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
170
- --fresh
169
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
170
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
171
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
172
+ ${ZLIB_ARG}
173
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
171174
-G "${CMAKE_GENERATOR}"
172
- -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
175
+ -S${WORK_DIR}/puff_add_subdirectory_test)
173176
174177
add_test(
175178
NAME zlib_puff_add_subdirectory_build
176179
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
177
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
180
+ WORKING_DIRECTORY ${WORK_DIR}/puff_add_subdirectory_test_build)
178181
179182
set_tests_properties(zlib_puff_add_subdirectory_configure
180183
PROPERTIES
181184
FIXTURES_REQUIRED ${inst_setup}
182
- FIXTURES_SETUP puiff_as_config)
185
+ FIXTURES_SETUP puff_as_config)
183186
184187
set_tests_properties(zlib_puff_add_subdirectory_build
185188
PROPERTIES
186189
FIXTURES_REQUIRED puff_as_config)
187190
@@ -189,24 +192,29 @@
189192
# add_subdirectory_exclude_test
190193
#
191194
add_test(
192195
NAME zlib_puff_add_subdirectory_exclude_configure
193196
COMMAND
194
- ${CMAKE_COMMAND} ${PLATFORM}
195
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
196
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
197
+ ${CMAKE_COMMAND}
198
+ ${PLATFORM}
199
+ -B${WORK_DIR}/puff_add_subdirectory_exclude_test_build
200
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
201
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
197202
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
198
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
199
- --fresh
203
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
204
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
205
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
206
+ ${ZLIB_ARG}
207
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
200208
-G "${CMAKE_GENERATOR}"
201
- -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
209
+ -S${WORK_DIR}/puff_add_subdirectory_exclude_test)
202210
203211
add_test(
204212
NAME zlib_puff_add_subdirectory_exclude_build
205213
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
206214
WORKING_DIRECTORY
207
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
215
+ ${WORK_DIR}/puff_add_subdirectory_exclude_test_build)
208216
209217
set_tests_properties(zlib_puff_add_subdirectory_exclude_configure
210218
PROPERTIES
211219
FIXTURES_REQUIRED ${inst_setup}
212220
FIXTURES_SETUP puff_asx_config)
@@ -214,49 +222,58 @@
214222
set_tests_properties(zlib_puff_add_subdirectory_exclude_build
215223
PROPERTIES
216224
FIXTURES_REQUIRED puff_asx_config)
217225
218226
#
219
-# findpackage_no_components_test
227
+# find_package_no_components_test
220228
#
221229
add_test(
222230
NAME zlib_puff_find_package_no_components_configure
223231
COMMAND
224
- ${CMAKE_COMMAND} ${PLATFORM}
225
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
226
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
232
+ ${CMAKE_COMMAND}
233
+ ${PLATFORM}
234
+ -B${WORK_DIR}/puff_findpackage_no_components_test_build
235
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
236
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
227237
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
228
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
229
- --fresh
230
- -G "${CMAKE_GENERATOR}"
231
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
232
-
233
-set_tests_properties(
234
- zlib_puff_find_package_no_components_configure
235
- PROPERTIES
236
- FIXTURES_REQUIRED ${inst_setup})
238
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
239
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
240
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
241
+ ${ZLIB_ARG}
242
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
243
+ -G "${CMAKE_GENERATOR}"
244
+ -S${WORK_DIR}/puff_find_package_no_components_test)
245
+
246
+set_tests_properties(zlib_puff_find_package_no_components_configure
247
+ PROPERTIES
248
+ FIXTURES_REQUIRED ${inst_setup})
237249
238250
if(NOT ZLIB_PUFF_BUILD_SHARED OR NOT ZLIB_PUFF_BUILD_STATIC)
239251
set_tests_properties(zlib_puff_find_package_no_components_configure
240252
PROPERTIES
241253
WILL_FAIL TRUE)
242254
endif(NOT ZLIB_PUFF_BUILD_SHARED OR NOT ZLIB_PUFF_BUILD_STATIC)
243255
244256
#
245
-# findpackage_no_components_test
257
+# find_package_no_components_test
246258
#
247259
add_test(
248260
NAME zlib_puff_find_package_wrong_components_configure
249261
COMMAND
250
- ${CMAKE_COMMAND} ${PLATFORM}
251
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
252
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
262
+ ${CMAKE_COMMAND}
263
+ ${PLATFORM}
264
+ -B${WORK_DIR}/puff_find_package_wrong_components_test_build
265
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
266
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
253267
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
254
- -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
255
- --fresh
268
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
269
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
270
+ -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
271
+ ${ZLIB_ARG}
272
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
256273
-G "${CMAKE_GENERATOR}"
257
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
274
+ -S${WORK_DIR}/puff_find_package_wrong_components_test)
258275
259276
set_tests_properties(zlib_puff_find_package_wrong_components_configure
260277
PROPERTIES
261278
FIXTURES_REQUIRED ${inst_setup}
262279
WILL_FAIL TRUE)
263280
--- compat/zlib/contrib/puff/test/CMakeLists.txt
+++ compat/zlib/contrib/puff/test/CMakeLists.txt
@@ -1,121 +1,118 @@
1 # if we are built from with zlib, use this path's)
2 if(DEFINED ZLIB_BUILD_PUFF)
3 set(WORK_DIR ${zlib_BINARY_DIR})
4 set(inst_setup zlib_install)
5 else(DEFINED ZLIB_BUILD_PUFF)
6 set(WORK_DIR ${puff_BINARY_DIR})
7 set(inst_setup zlib_puff_install)
8 set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
9
10 add_test(
11 NAME zlib_puff_install
12 COMMAND ${CMAKE_COMMAND} --install ${puff_BINARY_DIR} --prefix
13 ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
14 WORKING_DIRECTORY ${puff_BINARY_DIR})
 
 
15
16 set_tests_properties(zlib_puff_install
17 PROPERTIES
18 FIXTURES_SETUP zlib_puff_install)
19 endif(DEFINED ZLIB_BUILD_PUFF)
20
21 if(ZLIB_PUFF_BUILD_SHARED AND NOT WIN32)
22 add_executable(zlib_puff_test
23 ${puff_SOURCE_DIR}/pufftest.c
24 ${puff_SOURCE_DIR}/puff.h)
25
26 target_link_libraries(zlib_puff_test
27 PRIVATE zlib_puff_puff)
28
29 add_test(NAME zlib_puff_test
30 COMMAND ${CMAKE_COMMAND} -P
31 ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
32 "$<TARGET_FILE:zlib_puff_test>"
33 "${puff_SOURCE_DIR}")
34
35 if(GCOV_EXECUTABLE)
36 add_executable(zlib_puff_test-coverage
37 ${puff_SOURCE_DIR}/pufftest.c
38 ${puff_SOURCE_DIR}/puff.c
39 ${puff_SOURCE_DIR}/puff.h)
40
41 target_compile_options(zlib_puff_test-coverage PRIVATE -coverage)
42
43 target_link_options(zlib_puff_test-coverage PRIVATE -coverage)
44
45 add_test(NAME zlib_puff_test-coverage
46 COMMAND ${CMAKE_COMMAND} -P
 
47 ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
48 "$<TARGET_FILE:zlib_puff_test-coverage>"
49 "${puff_SOURCE_DIR}"
50 "$<TARGET_FILE:zlib_puff_bin-writer>"
51 ${GCOV_EXECUTABLE}
52 ${llvm_option})
53 endif(GCOV_EXECUTABLE)
54 endif(ZLIB_PUFF_BUILD_SHARED AND NOT WIN32)
55
56 if(ZLIB_PUFF_BUILD_STATIC AND NOT WIN32)
57 add_executable(zlib_puff_testStatic
58 ${puff_SOURCE_DIR}/pufftest.c
59 ${puff_SOURCE_DIR}/puff.h)
60
61 target_link_libraries(zlib_puff_testStatic
62 PRIVATE zlib_puff_puffStatic)
63 add_test(NAME zlib_puff_testStatic
64 COMMAND ${CMAKE_COMMAND} -P
65 ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
66 "$<TARGET_FILE:zlib_puff_testStatic>"
67 "${puff_SOURCE_DIR}")
68
69 if(GCOV_EXECUTABLE)
70 add_executable(zlib_puff_testStatic-coverage
71 ${puff_SOURCE_DIR}/pufftest.c
72 ${puff_SOURCE_DIR}/puff.c
73 ${puff_SOURCE_DIR}/puff.h)
74
75 target_compile_options(zlib_puff_testStatic-coverage
76 PRIVATE -coverage)
77
78 target_link_options(zlib_puff_testStatic-coverage
79 PRIVATE -coverage)
80
81 add_test(NAME zlib_puff_testStatic-coverage
82 COMMAND ${CMAKE_COMMAND} -P
83 ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
84 "$<TARGET_FILE:zlib_puff_testStatic-coverage>"
85 "${puff_SOURCE_DIR}"
86 "$<TARGET_FILE:zlib_puff_bin-writer>"
87 ${GCOV_EXECUTABLE}
88 ${llvm_option})
 
89 endif(GCOV_EXECUTABLE)
90 endif(ZLIB_PUFF_BUILD_STATIC AND NOT WIN32)
91
92 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
93 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
94 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
95
96 configure_file(
97 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
98 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
99
100 configure_file(
101 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
102 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
103
104 configure_file(
105 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
106 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
107 @ONLY)
108
109 configure_file(
110 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
111 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt
112 @ONLY)
113
114 configure_file(
115 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
116 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt
117 @ONLY)
118
119 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
120 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
121
@@ -122,31 +119,33 @@
122 if(GENERATOR)
123 set(PLATFORM "-A ${GENERATOR}")
124 endif(GENERATOR)
125
126 #
127 # findpackage_test
128 #
129 add_test(
130 NAME zlib_puff_find_package_configure
131 COMMAND
132 ${CMAKE_COMMAND}
133 ${PLATFORM}
134 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
135 -DCMAKE_BUILD_TYPE=$<CONFIG>
136 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
137 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
138 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install
 
 
139 ${ZLIB_ARG}
140 --fresh
141 -G "${CMAKE_GENERATOR}"
142 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
143
144 add_test(
145 NAME zlib_puff_find_package_build
146 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
147 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
148
149 set_tests_properties(zlib_puff_find_package_configure
150 PROPERTIES
151 FIXTURES_REQUIRED ${inst_setup}
152 FIXTURES_SETUP puff_fp_config)
@@ -159,29 +158,33 @@
159 # add_subdirectory_test
160 #
161 add_test(
162 NAME zlib_puff_add_subdirectory_configure
163 COMMAND
164 ${CMAKE_COMMAND} ${PLATFORM}
165 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
 
166 -DCMAKE_BUILD_TYPE=$<CONFIG>
167 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
168 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
169 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
170 --fresh
 
 
 
171 -G "${CMAKE_GENERATOR}"
172 -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
173
174 add_test(
175 NAME zlib_puff_add_subdirectory_build
176 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
177 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
178
179 set_tests_properties(zlib_puff_add_subdirectory_configure
180 PROPERTIES
181 FIXTURES_REQUIRED ${inst_setup}
182 FIXTURES_SETUP puiff_as_config)
183
184 set_tests_properties(zlib_puff_add_subdirectory_build
185 PROPERTIES
186 FIXTURES_REQUIRED puff_as_config)
187
@@ -189,24 +192,29 @@
189 # add_subdirectory_exclude_test
190 #
191 add_test(
192 NAME zlib_puff_add_subdirectory_exclude_configure
193 COMMAND
194 ${CMAKE_COMMAND} ${PLATFORM}
195 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
196 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
197 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
198 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
199 --fresh
 
 
 
200 -G "${CMAKE_GENERATOR}"
201 -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
202
203 add_test(
204 NAME zlib_puff_add_subdirectory_exclude_build
205 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
206 WORKING_DIRECTORY
207 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
208
209 set_tests_properties(zlib_puff_add_subdirectory_exclude_configure
210 PROPERTIES
211 FIXTURES_REQUIRED ${inst_setup}
212 FIXTURES_SETUP puff_asx_config)
@@ -214,49 +222,58 @@
214 set_tests_properties(zlib_puff_add_subdirectory_exclude_build
215 PROPERTIES
216 FIXTURES_REQUIRED puff_asx_config)
217
218 #
219 # findpackage_no_components_test
220 #
221 add_test(
222 NAME zlib_puff_find_package_no_components_configure
223 COMMAND
224 ${CMAKE_COMMAND} ${PLATFORM}
225 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
226 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
227 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
228 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
229 --fresh
230 -G "${CMAKE_GENERATOR}"
231 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
232
233 set_tests_properties(
234 zlib_puff_find_package_no_components_configure
235 PROPERTIES
236 FIXTURES_REQUIRED ${inst_setup})
 
 
237
238 if(NOT ZLIB_PUFF_BUILD_SHARED OR NOT ZLIB_PUFF_BUILD_STATIC)
239 set_tests_properties(zlib_puff_find_package_no_components_configure
240 PROPERTIES
241 WILL_FAIL TRUE)
242 endif(NOT ZLIB_PUFF_BUILD_SHARED OR NOT ZLIB_PUFF_BUILD_STATIC)
243
244 #
245 # findpackage_no_components_test
246 #
247 add_test(
248 NAME zlib_puff_find_package_wrong_components_configure
249 COMMAND
250 ${CMAKE_COMMAND} ${PLATFORM}
251 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
252 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
253 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
254 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
255 --fresh
 
 
 
256 -G "${CMAKE_GENERATOR}"
257 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
258
259 set_tests_properties(zlib_puff_find_package_wrong_components_configure
260 PROPERTIES
261 FIXTURES_REQUIRED ${inst_setup}
262 WILL_FAIL TRUE)
263
--- compat/zlib/contrib/puff/test/CMakeLists.txt
+++ compat/zlib/contrib/puff/test/CMakeLists.txt
@@ -1,121 +1,118 @@
1 # if we are built from with zlib, use this path's)
2 if(NOT DEFINED ZLIB_BUILD_PUFF)
3 set(WORK_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
 
 
4 set(inst_setup zlib_puff_install)
5 set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
6
7 add_test(
8 NAME zlib_puff_install
9 COMMAND ${CMAKE_COMMAND}
10 --install ${puff_BINARY_DIR}
11 --prefix ${WORK_DIR}/test_install
12 --config $<CONFIG>
13 WORKING_DIRECTORY ${WORK_DIR})
14
15 set_tests_properties(zlib_puff_install
16 PROPERTIES
17 FIXTURES_SETUP zlib_puff_install)
18 endif(NOT DEFINED ZLIB_BUILD_PUFF)
19
20 if(ZLIB_PUFF_BUILD_SHARED AND NOT WIN32)
21 add_executable(${ZLIB_CONTRIB_PREFIX}puff_test
22 ${puff_SOURCE_DIR}/pufftest.c
23 ${puff_SOURCE_DIR}/puff.h)
24
25 target_link_libraries(${ZLIB_CONTRIB_PREFIX}puff_test
26 PRIVATE ${ZLIB_CONTRIB_PREFIX}puff_puff)
27
28 add_test(NAME ${ZLIB_CONTRIB_PREFIX}puff_test
29 COMMAND ${CMAKE_COMMAND} -P
30 ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
31 "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_test>"
32 "${puff_SOURCE_DIR}")
33
34 if(GCOV_EXECUTABLE)
35 add_executable(${ZLIB_CONTRIB_PREFIX}puff_test-coverage
36 ${puff_SOURCE_DIR}/pufftest.c
37 ${puff_SOURCE_DIR}/puff.c
38 ${puff_SOURCE_DIR}/puff.h)
39
40 target_compile_options(${ZLIB_CONTRIB_PREFIX}puff_test-coverage PRIVATE -coverage)
41
42 target_link_options(${ZLIB_CONTRIB_PREFIX}puff_test-coverage PRIVATE -coverage)
43
44 add_test(NAME ${ZLIB_CONTRIB_PREFIX}puff_test-coverage
45 COMMAND ${CMAKE_COMMAND}
46 -P
47 ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
48 "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_test-coverage>"
49 "${puff_SOURCE_DIR}"
50 "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_bin-writer>"
51 ${GCOV_EXECUTABLE}
52 ${llvm_option})
53 endif(GCOV_EXECUTABLE)
54 endif(ZLIB_PUFF_BUILD_SHARED AND NOT WIN32)
55
56 if(ZLIB_PUFF_BUILD_STATIC AND NOT WIN32)
57 add_executable(${ZLIB_CONTRIB_PREFIX}puff_testStatic
58 ${puff_SOURCE_DIR}/pufftest.c
59 ${puff_SOURCE_DIR}/puff.h)
60
61 target_link_libraries(${ZLIB_CONTRIB_PREFIX}puff_testStatic
62 PRIVATE ${ZLIB_CONTRIB_PREFIX}puff_puffStatic)
63 add_test(NAME ${ZLIB_CONTRIB_PREFIX}puff_testStatic
64 COMMAND ${CMAKE_COMMAND} -P
65 ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
66 "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_testStatic>"
67 "${puff_SOURCE_DIR}")
68
69 if(GCOV_EXECUTABLE)
70 add_executable(${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage
71 ${puff_SOURCE_DIR}/pufftest.c
72 ${puff_SOURCE_DIR}/puff.c
73 ${puff_SOURCE_DIR}/puff.h)
74
75 target_compile_options(${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage
76 PRIVATE -coverage)
77
78 target_link_options(${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage
79 PRIVATE -coverage)
80
81 add_test(NAME ${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage
82 COMMAND ${CMAKE_COMMAND}
83 -P
84 ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
85 "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_testStatic-coverage>"
86 "${puff_SOURCE_DIR}"
87 "$<TARGET_FILE:${ZLIB_CONTRIB_PREFIX}puff_bin-writer>"
88 ${GCOV_EXECUTABLE}
89 ${llvm_option})
90 endif(GCOV_EXECUTABLE)
91 endif(ZLIB_PUFF_BUILD_STATIC AND NOT WIN32)
92
 
 
 
 
93 configure_file(
94 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
95 ${WORK_DIR}/puff_find_package_test/CMakeLists.txt @ONLY)
96
97 configure_file(
98 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
99 ${WORK_DIR}/puff_add_subdirectory_test/CMakeLists.txt @ONLY)
100
101 configure_file(
102 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
103 ${WORK_DIR}/puff_add_subdirectory_exclude_test/CMakeLists.txt
104 @ONLY)
105
106 configure_file(
107 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
108 ${WORK_DIR}/puff_find_package_no_components_test/CMakeLists.txt
109 @ONLY)
110
111 configure_file(
112 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
113 ${WORK_DIR}/puff_find_package_wrong_components_test/CMakeLists.txt
114 @ONLY)
115
116 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
117 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
118
@@ -122,31 +119,33 @@
119 if(GENERATOR)
120 set(PLATFORM "-A ${GENERATOR}")
121 endif(GENERATOR)
122
123 #
124 # find_package_test
125 #
126 add_test(
127 NAME zlib_puff_find_package_configure
128 COMMAND
129 ${CMAKE_COMMAND}
130 ${PLATFORM}
131 -B${WORK_DIR}/puff_find_package_test_build
132 -DCMAKE_BUILD_TYPE=$<CONFIG>
133 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
134 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
135 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
136 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
137 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
138 ${ZLIB_ARG}
139 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
140 -G "${CMAKE_GENERATOR}"
141 -S${WORK_DIR}/puff_find_package_test)
142
143 add_test(
144 NAME zlib_puff_find_package_build
145 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
146 WORKING_DIRECTORY ${WORK_DIR}/puff_find_package_test_build)
147
148 set_tests_properties(zlib_puff_find_package_configure
149 PROPERTIES
150 FIXTURES_REQUIRED ${inst_setup}
151 FIXTURES_SETUP puff_fp_config)
@@ -159,29 +158,33 @@
158 # add_subdirectory_test
159 #
160 add_test(
161 NAME zlib_puff_add_subdirectory_configure
162 COMMAND
163 ${CMAKE_COMMAND}
164 ${PLATFORM}
165 -B${WORK_DIR}/puff_add_subdirectory_test_build
166 -DCMAKE_BUILD_TYPE=$<CONFIG>
167 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
168 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
169 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
170 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
171 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
172 ${ZLIB_ARG}
173 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
174 -G "${CMAKE_GENERATOR}"
175 -S${WORK_DIR}/puff_add_subdirectory_test)
176
177 add_test(
178 NAME zlib_puff_add_subdirectory_build
179 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
180 WORKING_DIRECTORY ${WORK_DIR}/puff_add_subdirectory_test_build)
181
182 set_tests_properties(zlib_puff_add_subdirectory_configure
183 PROPERTIES
184 FIXTURES_REQUIRED ${inst_setup}
185 FIXTURES_SETUP puff_as_config)
186
187 set_tests_properties(zlib_puff_add_subdirectory_build
188 PROPERTIES
189 FIXTURES_REQUIRED puff_as_config)
190
@@ -189,24 +192,29 @@
192 # add_subdirectory_exclude_test
193 #
194 add_test(
195 NAME zlib_puff_add_subdirectory_exclude_configure
196 COMMAND
197 ${CMAKE_COMMAND}
198 ${PLATFORM}
199 -B${WORK_DIR}/puff_add_subdirectory_exclude_test_build
200 -DCMAKE_BUILD_TYPE=$<CONFIG>
201 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
202 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
203 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
204 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
205 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
206 ${ZLIB_ARG}
207 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
208 -G "${CMAKE_GENERATOR}"
209 -S${WORK_DIR}/puff_add_subdirectory_exclude_test)
210
211 add_test(
212 NAME zlib_puff_add_subdirectory_exclude_build
213 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
214 WORKING_DIRECTORY
215 ${WORK_DIR}/puff_add_subdirectory_exclude_test_build)
216
217 set_tests_properties(zlib_puff_add_subdirectory_exclude_configure
218 PROPERTIES
219 FIXTURES_REQUIRED ${inst_setup}
220 FIXTURES_SETUP puff_asx_config)
@@ -214,49 +222,58 @@
222 set_tests_properties(zlib_puff_add_subdirectory_exclude_build
223 PROPERTIES
224 FIXTURES_REQUIRED puff_asx_config)
225
226 #
227 # find_package_no_components_test
228 #
229 add_test(
230 NAME zlib_puff_find_package_no_components_configure
231 COMMAND
232 ${CMAKE_COMMAND}
233 ${PLATFORM}
234 -B${WORK_DIR}/puff_findpackage_no_components_test_build
235 -DCMAKE_BUILD_TYPE=$<CONFIG>
236 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
237 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
238 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
239 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
240 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
241 ${ZLIB_ARG}
242 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
243 -G "${CMAKE_GENERATOR}"
244 -S${WORK_DIR}/puff_find_package_no_components_test)
245
246 set_tests_properties(zlib_puff_find_package_no_components_configure
247 PROPERTIES
248 FIXTURES_REQUIRED ${inst_setup})
249
250 if(NOT ZLIB_PUFF_BUILD_SHARED OR NOT ZLIB_PUFF_BUILD_STATIC)
251 set_tests_properties(zlib_puff_find_package_no_components_configure
252 PROPERTIES
253 WILL_FAIL TRUE)
254 endif(NOT ZLIB_PUFF_BUILD_SHARED OR NOT ZLIB_PUFF_BUILD_STATIC)
255
256 #
257 # find_package_no_components_test
258 #
259 add_test(
260 NAME zlib_puff_find_package_wrong_components_configure
261 COMMAND
262 ${CMAKE_COMMAND}
263 ${PLATFORM}
264 -B${WORK_DIR}/puff_find_package_wrong_components_test_build
265 -DCMAKE_BUILD_TYPE=$<CONFIG>
266 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
267 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
268 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
269 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
270 -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test_install
271 ${ZLIB_ARG}
272 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
273 -G "${CMAKE_GENERATOR}"
274 -S${WORK_DIR}/puff_find_package_wrong_components_test)
275
276 set_tests_properties(zlib_puff_find_package_wrong_components_configure
277 PROPERTIES
278 FIXTURES_REQUIRED ${inst_setup}
279 WILL_FAIL TRUE)
280
--- compat/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
zlib_puff_add_subdirectory_exclude_from_all
55
LANGUAGES C
66
VERSION @puff_VERSION@)
77
--- compat/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib_puff_add_subdirectory_exclude_from_all
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 zlib_puff_add_subdirectory_exclude_from_all
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/puff/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
zlib_puff_add_subdirectory
55
LANGUAGES C
66
VERSION @puff_VERSION@)
77
--- compat/zlib/contrib/puff/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/puff/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib_puff_add_subdirectory
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/add_subdirectory_test.cmake.in
+++ compat/zlib/contrib/puff/test/add_subdirectory_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 zlib_puff_add_subdirectory
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
puff_find_package
55
LANGUAGES C
66
VERSION @puff_VERSION@)
77
--- compat/zlib/contrib/puff/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 puff_find_package
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/find_package_no_components_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_no_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 puff_find_package
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/find_package_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
puff_find_package
55
LANGUAGES C
66
VERSION @puff_VERSION@)
77
--- compat/zlib/contrib/puff/test/find_package_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 puff_find_package
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/find_package_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 puff_find_package
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
puff_find_package
55
LANGUAGES C
66
VERSION @puff_VERSION@)
77
--- compat/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 puff_find_package
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 puff_find_package
5 LANGUAGES C
6 VERSION @puff_VERSION@)
7
--- compat/zlib/contrib/puff/test/tester-cov.cmake
+++ compat/zlib/contrib/puff/test/tester-cov.cmake
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
#CMAKE_ARGV0 = ${CMAKE_COMMAND}
44
#CMAKE_ARGV1 = -P
55
#CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
66
#CMAKE_ARGV3 = "$<TARGET_FILE:puff-test-cov>"
77
--- compat/zlib/contrib/puff/test/tester-cov.cmake
+++ compat/zlib/contrib/puff/test/tester-cov.cmake
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 #CMAKE_ARGV0 = ${CMAKE_COMMAND}
4 #CMAKE_ARGV1 = -P
5 #CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
6 #CMAKE_ARGV3 = "$<TARGET_FILE:puff-test-cov>"
7
--- compat/zlib/contrib/puff/test/tester-cov.cmake
+++ compat/zlib/contrib/puff/test/tester-cov.cmake
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 #CMAKE_ARGV0 = ${CMAKE_COMMAND}
4 #CMAKE_ARGV1 = -P
5 #CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester-cov.cmake
6 #CMAKE_ARGV3 = "$<TARGET_FILE:puff-test-cov>"
7
--- compat/zlib/contrib/puff/test/tester.cmake
+++ compat/zlib/contrib/puff/test/tester.cmake
@@ -1,6 +1,6 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
#CMAKE_ARGV0 = ${CMAKE_COMMAND}
44
#CMAKE_ARGV1 = -P
55
#CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
66
#CMAKE_ARGV3 = "$<TARGET_FILE:puff-test>"
77
--- compat/zlib/contrib/puff/test/tester.cmake
+++ compat/zlib/contrib/puff/test/tester.cmake
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 #CMAKE_ARGV0 = ${CMAKE_COMMAND}
4 #CMAKE_ARGV1 = -P
5 #CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
6 #CMAKE_ARGV3 = "$<TARGET_FILE:puff-test>"
7
--- compat/zlib/contrib/puff/test/tester.cmake
+++ compat/zlib/contrib/puff/test/tester.cmake
@@ -1,6 +1,6 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 #CMAKE_ARGV0 = ${CMAKE_COMMAND}
4 #CMAKE_ARGV1 = -P
5 #CMAKE_ARGV2 = ${CMAKE_CURRENT_SOURCE_DIR}/tester.cmake
6 #CMAKE_ARGV3 = "$<TARGET_FILE:puff-test>"
7
--- compat/zlib/contrib/testzlib/CMakeLists.txt
+++ compat/zlib/contrib/testzlib/CMakeLists.txt
@@ -1,44 +1,65 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
testzlib
55
VERSION 1.0.0
66
LANGUAGES C
77
DESCRIPTION "A little program to test zlib"
88
HOMEPAGE_URL "https://www.zlib.net")
9
+
10
+# ============================================================================
11
+# set options if build from zlib
12
+# ============================================================================
13
+if(ZLIB_BUILD_TESTZLIB)
14
+ set(ZLIB_TESTZLIB_BUILD_SHARED ${ZLIB_BUILD_SHARED} CACHE BOOL "")
15
+ set(ZLIB_TESTZLIB_BUILD_STATIC ${ZLIB_BUILD_STATIC} CACHE BOOL "")
16
+endif(ZLIB_BUILD_TESTZLIB)
917
1018
option(ZLIB_TESTZLIB_BUILD_SHARED "Enable building testzlib" ON)
1119
option(ZLIB_TESTZLIB_BUILD_STATIC "Enable building static linked testzlib" ON)
1220
option(ZLIB_TESTZLIB_INSTALL "Enable installation of testzlib" ON)
1321
1422
if(ZLIB_TESTZLIB_BUILD_SHARED)
15
- add_executable(zlib_testzlib testzlib.c)
16
- target_link_libraries(zlib_testzlib PRIVATE ZLIB::ZLIB)
23
+ list(APPEND REQUIRED_COMPONENTS "shared")
24
+endif(ZLIB_TESTZLIB_BUILD_SHARED)
25
+
26
+if(ZLIB_TESTZLIB_BUILD_STATIC)
27
+ list(APPEND REQUIRED_COMPONENTS "static")
28
+endif(ZLIB_TESTZLIB_BUILD_STATIC)
29
+
30
+if(NOT ZLIB_BUILD_TESTZLIB)
31
+ find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
32
+endif(NOT ZLIB_BUILD_TESTZLIB)
33
+
34
+if(ZLIB_TESTZLIB_BUILD_SHARED)
35
+ add_executable(${ZLIB_CONTRIB_PREFIX}testzlib testzlib.c)
36
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}testzlib PRIVATE ZLIB::ZLIB)
1737
18
- set_target_properties(zlib_testzlib
38
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}testzlib
1939
PROPERTIES
2040
OUTPUT_NAME testzlib)
2141
2242
if(ZLIB_TESTZLIB_INSTALL)
2343
install(
24
- TARGETS zlib_testzlib
44
+ TARGETS ${ZLIB_CONTRIB_PREFIX}testzlib
2545
COMPONENT Runtime
2646
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
2747
endif(ZLIB_TESTZLIB_INSTALL)
2848
endif(ZLIB_TESTZLIB_BUILD_SHARED)
2949
3050
if(ZLIB_TESTZLIB_BUILD_STATIC)
31
- add_executable(zlib_testzlibStatic testzlib.c)
32
- target_link_libraries(zlib_testzlibStatic PRIVATE ZLIB::ZLIBSTATIC)
51
+ add_executable(${ZLIB_CONTRIB_PREFIX}testzlibStatic testzlib.c)
52
+ target_link_libraries(${ZLIB_CONTRIB_PREFIX}testzlibStatic
53
+ PRIVATE ZLIB::ZLIBSTATIC)
3354
34
- set_target_properties(zlib_testzlibStatic
55
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}testzlibStatic
3556
PROPERTIES
3657
OUTPUT_NAME testzlibStatic)
3758
3859
if(ZLIB_TESTZLIB_INSTALL)
3960
install(
40
- TARGETS zlib_testzlibStatic
61
+ TARGETS ${ZLIB_CONTRIB_PREFIX}testzlibStatic
4162
COMPONENT Runtime
4263
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
4364
endif(ZLIB_TESTZLIB_INSTALL)
4465
endif(ZLIB_TESTZLIB_BUILD_STATIC)
4566
--- compat/zlib/contrib/testzlib/CMakeLists.txt
+++ compat/zlib/contrib/testzlib/CMakeLists.txt
@@ -1,44 +1,65 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 testzlib
5 VERSION 1.0.0
6 LANGUAGES C
7 DESCRIPTION "A little program to test zlib"
8 HOMEPAGE_URL "https://www.zlib.net")
 
 
 
 
 
 
 
 
9
10 option(ZLIB_TESTZLIB_BUILD_SHARED "Enable building testzlib" ON)
11 option(ZLIB_TESTZLIB_BUILD_STATIC "Enable building static linked testzlib" ON)
12 option(ZLIB_TESTZLIB_INSTALL "Enable installation of testzlib" ON)
13
14 if(ZLIB_TESTZLIB_BUILD_SHARED)
15 add_executable(zlib_testzlib testzlib.c)
16 target_link_libraries(zlib_testzlib PRIVATE ZLIB::ZLIB)
 
 
 
 
 
 
 
 
 
 
 
 
17
18 set_target_properties(zlib_testzlib
19 PROPERTIES
20 OUTPUT_NAME testzlib)
21
22 if(ZLIB_TESTZLIB_INSTALL)
23 install(
24 TARGETS zlib_testzlib
25 COMPONENT Runtime
26 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
27 endif(ZLIB_TESTZLIB_INSTALL)
28 endif(ZLIB_TESTZLIB_BUILD_SHARED)
29
30 if(ZLIB_TESTZLIB_BUILD_STATIC)
31 add_executable(zlib_testzlibStatic testzlib.c)
32 target_link_libraries(zlib_testzlibStatic PRIVATE ZLIB::ZLIBSTATIC)
 
33
34 set_target_properties(zlib_testzlibStatic
35 PROPERTIES
36 OUTPUT_NAME testzlibStatic)
37
38 if(ZLIB_TESTZLIB_INSTALL)
39 install(
40 TARGETS zlib_testzlibStatic
41 COMPONENT Runtime
42 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
43 endif(ZLIB_TESTZLIB_INSTALL)
44 endif(ZLIB_TESTZLIB_BUILD_STATIC)
45
--- compat/zlib/contrib/testzlib/CMakeLists.txt
+++ compat/zlib/contrib/testzlib/CMakeLists.txt
@@ -1,44 +1,65 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 testzlib
5 VERSION 1.0.0
6 LANGUAGES C
7 DESCRIPTION "A little program to test zlib"
8 HOMEPAGE_URL "https://www.zlib.net")
9
10 # ============================================================================
11 # set options if build from zlib
12 # ============================================================================
13 if(ZLIB_BUILD_TESTZLIB)
14 set(ZLIB_TESTZLIB_BUILD_SHARED ${ZLIB_BUILD_SHARED} CACHE BOOL "")
15 set(ZLIB_TESTZLIB_BUILD_STATIC ${ZLIB_BUILD_STATIC} CACHE BOOL "")
16 endif(ZLIB_BUILD_TESTZLIB)
17
18 option(ZLIB_TESTZLIB_BUILD_SHARED "Enable building testzlib" ON)
19 option(ZLIB_TESTZLIB_BUILD_STATIC "Enable building static linked testzlib" ON)
20 option(ZLIB_TESTZLIB_INSTALL "Enable installation of testzlib" ON)
21
22 if(ZLIB_TESTZLIB_BUILD_SHARED)
23 list(APPEND REQUIRED_COMPONENTS "shared")
24 endif(ZLIB_TESTZLIB_BUILD_SHARED)
25
26 if(ZLIB_TESTZLIB_BUILD_STATIC)
27 list(APPEND REQUIRED_COMPONENTS "static")
28 endif(ZLIB_TESTZLIB_BUILD_STATIC)
29
30 if(NOT ZLIB_BUILD_TESTZLIB)
31 find_package(ZLIB REQUIRED COMPONENTS ${REQUIRED_COMPONENTS} CONFIG)
32 endif(NOT ZLIB_BUILD_TESTZLIB)
33
34 if(ZLIB_TESTZLIB_BUILD_SHARED)
35 add_executable(${ZLIB_CONTRIB_PREFIX}testzlib testzlib.c)
36 target_link_libraries(${ZLIB_CONTRIB_PREFIX}testzlib PRIVATE ZLIB::ZLIB)
37
38 set_target_properties(${ZLIB_CONTRIB_PREFIX}testzlib
39 PROPERTIES
40 OUTPUT_NAME testzlib)
41
42 if(ZLIB_TESTZLIB_INSTALL)
43 install(
44 TARGETS ${ZLIB_CONTRIB_PREFIX}testzlib
45 COMPONENT Runtime
46 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
47 endif(ZLIB_TESTZLIB_INSTALL)
48 endif(ZLIB_TESTZLIB_BUILD_SHARED)
49
50 if(ZLIB_TESTZLIB_BUILD_STATIC)
51 add_executable(${ZLIB_CONTRIB_PREFIX}testzlibStatic testzlib.c)
52 target_link_libraries(${ZLIB_CONTRIB_PREFIX}testzlibStatic
53 PRIVATE ZLIB::ZLIBSTATIC)
54
55 set_target_properties(${ZLIB_CONTRIB_PREFIX}testzlibStatic
56 PROPERTIES
57 OUTPUT_NAME testzlibStatic)
58
59 if(ZLIB_TESTZLIB_INSTALL)
60 install(
61 TARGETS ${ZLIB_CONTRIB_PREFIX}testzlibStatic
62 COMPONENT Runtime
63 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
64 endif(ZLIB_TESTZLIB_INSTALL)
65 endif(ZLIB_TESTZLIB_BUILD_STATIC)
66
--- compat/zlib/contrib/zlib1-dll/CMakeLists.txt
+++ compat/zlib/contrib/zlib1-dll/CMakeLists.txt
@@ -1,38 +1,55 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.20...3.31)
22
33
project(
44
zlib1-dll
55
LANGUAGES C
6
- VERSION 1.3.2
6
+ VERSION 1.4
77
HOMEPAGE_URL "https://zlib.net/"
88
DESCRIPTION "zlib1.dll is the legacy DLL with zlib and minizip")
99
1010
# ============================================================================
1111
# configuration
1212
# ============================================================================
1313
14
-if(NOT WIN32)
14
+if(WIN32)
15
+ set(CMAKE_DEBUG_POSTFIX "d")
16
+else(WIN32)
1517
message(FATAL_ERROR "This creates zlib1.<DLL>, Nothing else")
16
-endif(NOT WIN32)
18
+endif(WIN32)
19
+
20
+if(ZLIB_BUILD_ZLIB1_DLL)
21
+ set(ZLIB1_DLL_BUILD_TESTING ${ZLIB_BUILD_TESTING} CACHE BOOL "")
22
+ set(ZLIB1_DLL_ENABLE_BZIP2 ${MINIZIP_ENABLE_BZIP2} CACHE BOOL "")
23
+ set(ZLIB1_DLL_INSTALL ${ZLIB_INSTALL} CACHE BOOL "")
24
+ set(ZLIB1_DLL_PREFIX "${ZLIB_PREFIX}" CACHE STRING
25
+ "prefix for all types and library functions, see zconf.h.in")
26
+endif(ZLIB_BUILD_ZLIB1_DLL)
1727
18
-option(ENABLE_BZIP2 "Build with bzip2 support" OFF)
28
+option(ZLIB1_DLL_ENABLE_BZIP2 "Build with bzip2 support" OFF)
29
+option(ZLIB1_DLL_INSTALL "Install zlib1.dll" ON)
30
+option(ZLIB1_DLL_BUILD_TESTING "Build and run tests for zlib1.dll" ON)
31
+set(ZLIB1_DLL_PREFIX "" CACHE STRING
32
+ "prefix for all types and library functions, see zconf.h.in")
1933
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
2034
2135
include(CheckCSourceCompiles)
22
-include(CheckFunctionExists)
36
+include(CheckSymbolExists)
2337
include(CheckIncludeFile)
2438
include(CMakePackageConfigHelpers)
2539
include(CheckTypeSize)
26
-include(CPack)
2740
include(GNUInstallDirs)
2841
42
+if(NOT CPACK_INCLUDED)
43
+ include(CPack)
44
+endif(NOT CPACK_INCLUDED)
45
+
2946
if(NOT ZLIB_CONF_WRITTEN)
3047
set(CONF_OUT_FILE ${zlib1-dll_BINARY_DIR}/zconf.h.cmakein)
3148
file(READ ../../zconf.h ZCONF_CONTENT LIMIT 245)
3249
file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT})
33
- file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX 1\n")
50
+ file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX @Z_PREFIX@\n")
3451
file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n")
3552
file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n")
3653
file(READ ../../zconf.h ZCONF_CONTENT OFFSET 244)
3754
set(FIRST_ITEM TRUE)
3855
@@ -48,20 +65,24 @@
4865
file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT})
4966
set(ZLIB_CONF_WRITTEN
5067
TRUE
5168
CACHE BOOL "zconf.h.cmakein was created")
5269
mark_as_advanced(ZLIB_CONF_WRITTEN)
70
+
71
+ set(ZCONF_IN_ZLIB1 True CACHE INTERNAL "find zconf.h in zlib1-dll")
5372
endif(NOT ZLIB_CONF_WRITTEN)
5473
55
-if(ENABLE_BZIP2)
74
+set(Z_PREFIX "${ZLIB1_DLL_PREFIX}")
75
+
76
+if(ZLIB1_DLL_ENABLE_BZIP2)
5677
find_package(BZip2 REQUIRED)
57
-endif(ENABLE_BZIP2)
78
+endif(ZLIB1_DLL_ENABLE_BZIP2)
5879
5980
#
6081
# Check for fopen64
6182
#
62
-check_function_exists(fopen64 HAVE_FOPEN64)
83
+check_symbol_exists(fopen64 stdio.h HAVE_FOPEN64)
6384
6485
#
6586
# Check to see if we have large file support
6687
#
6788
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
@@ -69,11 +90,11 @@
6990
unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable
7091
7192
#
7293
# Check for fseeko
7394
#
74
-check_function_exists(fseeko HAVE_FSEEKO)
95
+check_symbol_exists(fseeko stdio.h HAVE_FSEEKO)
7596
7697
#
7798
# Check for stdarg.h
7899
#
79100
check_include_file(stdarg.h HAVE_STDARG_H)
@@ -99,17 +120,24 @@
99120
int main(void) {return 0;}
100121
"
101122
HAVE___ATTR__VIS_HIDDEN)
102123
103124
unset(CMAKE_COMPILE_FLAGS)
104
-configure_file(${zlib1-dll_BINARY_DIR}/zconf.h.cmakein ${zlib1-dll_BINARY_DIR}/zconf.h)
125
+
126
+if(ZCONF_IN_ZLIB1)
127
+ configure_file(${zlib1-dll_BINARY_DIR}/zconf.h.cmakein
128
+ ${zlib1-dll_BINARY_DIR}/zconf.h)
129
+ set(ZCONF_H "${zlib1-dll_BINARY_DIR}/zconf.h")
130
+else(ZCONF_IN_ZLIB1)
131
+ set(ZCONF_H "${zlib1-dll_BINARY_DIR}/../../zconf.h")
132
+endif(ZCONF_IN_ZLIB1)
105133
106134
# ============================================================================
107135
# zlib1-dll
108136
# ============================================================================
109137
set(ZLIB1-DLL_PUBLIC_HDRS
110
- ${zlib1-dll_BINARY_DIR}/zconf.h
138
+ ${ZCONF_H}
111139
../../zlib.h
112140
../minizip/crypt.h
113141
../minizip/ints.h
114142
../minizip/ioapi.h
115143
../minizip/mztools.h
@@ -140,57 +168,151 @@
140168
../../infback.c
141169
../../inftrees.c
142170
../../inffast.c
143171
../../trees.c
144172
../../uncompr.c
145
- ../../win32/zlib1.rc
146173
../../zutil.c
147174
../minizip/ioapi.c
148175
../minizip/mztools.c
149176
../minizip/unzip.c
150177
../minizip/zip.c)
151178
152
-add_library(zlib1 SHARED ${ZLIB1-DLL_SRCS}
153
- ${ZLIB1-DLL_PUBLIC_HDRS}
154
- ${ZLIB1-DLL_PRIVATE_HDRS})
155
-
156
-#taget_include_directories doesn't like relative paths
157
-include_directories(../../
158
- ../minizip
159
- ${CMAKE_CURRENT_BINARY_DIR})
160
-
161
-target_compile_definitions(zlib1
179
+cmake_path(SET p1 "../../")
180
+cmake_path(SET p2 "../../")
181
+cmake_path(ABSOLUTE_PATH "p1" OUTPUT_VARIABLE DOTDOT)
182
+cmake_path(ABSOLUTE_PATH "p2" OUTPUT_VARIABLE DOTMINIZIP)
183
+
184
+add_library(${ZLIB_CONTRIB_PREFIX}zlib1 SHARED
185
+ ${ZLIB1-DLL_SRCS}
186
+ ${ZLIB1-DLL_PUBLIC_HDRS}
187
+ ${ZLIB1-DLL_PRIVATE_HDRS}
188
+ zlib1.rc)
189
+
190
+add_library(ZLIB1DLL::ZLIB1DLL ALIAS ${ZLIB_CONTRIB_PREFIX}zlib1)
191
+
192
+set_target_properties(${ZLIB_CONTRIB_PREFIX}zlib1
193
+ PROPERTIES
194
+ OUTPUT_NAME zlib1)
195
+
196
+target_compile_definitions(${ZLIB_CONTRIB_PREFIX}zlib1
197
+ PRIVATE ZLIB_BUILD
198
+ $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
199
+ $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
200
+ $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
201
+ $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
202
+ $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
203
+ $<$<BOOL:${ZLIB1_DLL_PREFIX}>:Z_PREFIX=${ZLIB1_DLL_PREFIX}>
204
+ PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
205
+ $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
206
+ $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
207
+
208
+target_include_directories(${ZLIB_CONTRIB_PREFIX}zlib1
209
+ PUBLIC $<BUILD_INTERFACE:${DOTDOT}>
210
+ $<BUILD_INTERFACE:${DOTMINIZIP}>
211
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
212
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
213
+
214
+target_link_libraries(${ZLIB_CONTRIB_PREFIX}zlib1
215
+ PUBLIC $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
216
+
217
+set_target_properties(${ZLIB_CONTRIB_PREFIX}zlib1 PROPERTIES
218
+ DEFINE_SYMBOL ZLIB_DLL
219
+ EXPORT_NAME ZLIB1DLL)
220
+
221
+add_library(${ZLIB_CONTRIB_PREFIX}zlibwapi SHARED
222
+ ${ZLIB1-DLL_SRCS}
223
+ ${ZLIB1-DLL_PUBLIC_HDRS}
224
+ ${ZLIB1-DLL_PRIVATE_HDRS}
225
+ zlibwapi.rc)
226
+
227
+add_library(ZLIB1DLL::ZLIBWAPI ALIAS ${ZLIB_CONTRIB_PREFIX}zlibwapi)
228
+
229
+set_target_properties(${ZLIB_CONTRIB_PREFIX}zlibwapi
230
+ PROPERTIES
231
+ OUTPUT_NAME zlibwapi)
232
+
233
+target_include_directories(${ZLIB_CONTRIB_PREFIX}zlibwapi
234
+ PUBLIC $<BUILD_INTERFACE:${DOTDOT}>
235
+ $<BUILD_INTERFACE:${DOTMINIZIP}>
236
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
237
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
238
+
239
+target_compile_definitions(${ZLIB_CONTRIB_PREFIX}zlibwapi
162240
PRIVATE ZLIB_BUILD
163241
$<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
164242
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
165243
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
166244
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
167245
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
168246
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
169247
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
170
- $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
248
+ $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>
249
+ ZLIB_WINAPI)
171250
172
-target_link_libraries(zlib1
251
+target_link_libraries(${ZLIB_CONTRIB_PREFIX}zlibwapi
173252
PUBLIC $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
174253
175254
if(NOT CYGWIN)
176
- set_target_properties(zlib1 PROPERTIES
177
- SOVERSION ${zlib1-dll_VERSION_MAJOR}
178
- VERSION ${zlib1-dll_VERSION})
255
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}zlib1
256
+ PROPERTIES
257
+ SOVERSION ${zlib1-dll_VERSION_MAJOR}
258
+ VERSION ${zlib1-dll_VERSION})
259
+ set_target_properties(${ZLIB_CONTRIB_PREFIX}zlibwapi
260
+ PROPERTIES
261
+ SOVERSION ${zlib1-dll_VERSION_MAJOR}
262
+ VERSION ${zlib1-dll_VERSION})
179263
endif(NOT CYGWIN)
180264
181
-set_target_properties(zlib1 PROPERTIES
182
- DEFINE_SYMBOL ZLIB_DLL)
183
-
184
-install(
185
- TARGETS zlib1
186
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
187
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
188
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
189
-
190
-install(
191
- FILES ${ZLIB1-DLL_PUBLIC_HDRS}
192
- DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
193
-
194
-install(
195
- FILES ../../LICENSE
196
- DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib1-dll")
265
+set_target_properties(${ZLIB_CONTRIB_PREFIX}zlibwapi PROPERTIES
266
+ DEFINE_SYMBOL ZLIB_DLL
267
+ EXPORT_NAME ZLIBWAPI)
268
+
269
+if(ZLIB1_DLL_INSTALL)
270
+ install(
271
+ TARGETS ${ZLIB_CONTRIB_PREFIX}zlib1 ${ZLIB_CONTRIB_PREFIX}zlibwapi
272
+ COMPONENT Runtime
273
+ EXPORT zlibDllExport
274
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
275
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
276
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
277
+
278
+ install(
279
+ EXPORT zlibDllExport
280
+ FILE ZLIB1DLLTargets.cmake
281
+ NAMESPACE ZLIB1DLL::
282
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib1dll)
283
+
284
+ install(
285
+ FILES $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}zlib1>
286
+ $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}zlibwapi>
287
+ COMPONENT Runtime
288
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
289
+ CONFIGURATIONS Debug OR RelWithDebInfo
290
+ OPTIONAL)
291
+
292
+ configure_package_config_file(
293
+ ${zlib1-dll_SOURCE_DIR}/zlib1dllConfig.cmake.in
294
+ ${zlib1-dll_BINARY_DIR}/ZLIB1DLLConfig.cmake
295
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
296
+
297
+ write_basic_package_version_file(
298
+ "${zlib1-dll_BINARY_DIR}/ZLIB1DLLConfigVersion.cmake"
299
+ VERSION "${zlib1-dll_VERSION}"
300
+ COMPATIBILITY AnyNewerVersion)
301
+
302
+ install(FILES ${zlib1-dll_BINARY_DIR}/ZLIB1DLLConfig.cmake
303
+ ${zlib1-dll_BINARY_DIR}/ZLIB1DLLConfigVersion.cmake
304
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib1dll)
305
+
306
+ install(
307
+ FILES ${ZLIB1-DLL_PUBLIC_HDRS}
308
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
309
+
310
+ install(
311
+ FILES ../../LICENSE
312
+ DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib1-dll")
313
+endif(ZLIB1_DLL_INSTALL)
314
+
315
+if(ZLIB1_DLL_BUILD_TESTING)
316
+ enable_testing()
317
+ add_subdirectory(test)
318
+endif(ZLIB1_DLL_BUILD_TESTING)
197319
--- compat/zlib/contrib/zlib1-dll/CMakeLists.txt
+++ compat/zlib/contrib/zlib1-dll/CMakeLists.txt
@@ -1,38 +1,55 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib1-dll
5 LANGUAGES C
6 VERSION 1.3.2
7 HOMEPAGE_URL "https://zlib.net/"
8 DESCRIPTION "zlib1.dll is the legacy DLL with zlib and minizip")
9
10 # ============================================================================
11 # configuration
12 # ============================================================================
13
14 if(NOT WIN32)
 
 
15 message(FATAL_ERROR "This creates zlib1.<DLL>, Nothing else")
16 endif(NOT WIN32)
 
 
 
 
 
 
 
 
17
18 option(ENABLE_BZIP2 "Build with bzip2 support" OFF)
 
 
 
 
19 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
20
21 include(CheckCSourceCompiles)
22 include(CheckFunctionExists)
23 include(CheckIncludeFile)
24 include(CMakePackageConfigHelpers)
25 include(CheckTypeSize)
26 include(CPack)
27 include(GNUInstallDirs)
28
 
 
 
 
29 if(NOT ZLIB_CONF_WRITTEN)
30 set(CONF_OUT_FILE ${zlib1-dll_BINARY_DIR}/zconf.h.cmakein)
31 file(READ ../../zconf.h ZCONF_CONTENT LIMIT 245)
32 file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT})
33 file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX 1\n")
34 file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n")
35 file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n")
36 file(READ ../../zconf.h ZCONF_CONTENT OFFSET 244)
37 set(FIRST_ITEM TRUE)
38
@@ -48,20 +65,24 @@
48 file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT})
49 set(ZLIB_CONF_WRITTEN
50 TRUE
51 CACHE BOOL "zconf.h.cmakein was created")
52 mark_as_advanced(ZLIB_CONF_WRITTEN)
 
 
53 endif(NOT ZLIB_CONF_WRITTEN)
54
55 if(ENABLE_BZIP2)
 
 
56 find_package(BZip2 REQUIRED)
57 endif(ENABLE_BZIP2)
58
59 #
60 # Check for fopen64
61 #
62 check_function_exists(fopen64 HAVE_FOPEN64)
63
64 #
65 # Check to see if we have large file support
66 #
67 set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
@@ -69,11 +90,11 @@
69 unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable
70
71 #
72 # Check for fseeko
73 #
74 check_function_exists(fseeko HAVE_FSEEKO)
75
76 #
77 # Check for stdarg.h
78 #
79 check_include_file(stdarg.h HAVE_STDARG_H)
@@ -99,17 +120,24 @@
99 int main(void) {return 0;}
100 "
101 HAVE___ATTR__VIS_HIDDEN)
102
103 unset(CMAKE_COMPILE_FLAGS)
104 configure_file(${zlib1-dll_BINARY_DIR}/zconf.h.cmakein ${zlib1-dll_BINARY_DIR}/zconf.h)
 
 
 
 
 
 
 
105
106 # ============================================================================
107 # zlib1-dll
108 # ============================================================================
109 set(ZLIB1-DLL_PUBLIC_HDRS
110 ${zlib1-dll_BINARY_DIR}/zconf.h
111 ../../zlib.h
112 ../minizip/crypt.h
113 ../minizip/ints.h
114 ../minizip/ioapi.h
115 ../minizip/mztools.h
@@ -140,57 +168,151 @@
140 ../../infback.c
141 ../../inftrees.c
142 ../../inffast.c
143 ../../trees.c
144 ../../uncompr.c
145 ../../win32/zlib1.rc
146 ../../zutil.c
147 ../minizip/ioapi.c
148 ../minizip/mztools.c
149 ../minizip/unzip.c
150 ../minizip/zip.c)
151
152 add_library(zlib1 SHARED ${ZLIB1-DLL_SRCS}
153 ${ZLIB1-DLL_PUBLIC_HDRS}
154 ${ZLIB1-DLL_PRIVATE_HDRS})
155
156 #taget_include_directories doesn't like relative paths
157 include_directories(../../
158 ../minizip
159 ${CMAKE_CURRENT_BINARY_DIR})
160
161 target_compile_definitions(zlib1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162 PRIVATE ZLIB_BUILD
163 $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
164 $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
165 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
166 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
167 $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
168 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
169 $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
170 $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
 
171
172 target_link_libraries(zlib1
173 PUBLIC $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
174
175 if(NOT CYGWIN)
176 set_target_properties(zlib1 PROPERTIES
177 SOVERSION ${zlib1-dll_VERSION_MAJOR}
178 VERSION ${zlib1-dll_VERSION})
 
 
 
 
 
179 endif(NOT CYGWIN)
180
181 set_target_properties(zlib1 PROPERTIES
182 DEFINE_SYMBOL ZLIB_DLL)
183
184 install(
185 TARGETS zlib1
186 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
187 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
188 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
189
190 install(
191 FILES ${ZLIB1-DLL_PUBLIC_HDRS}
192 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
193
194 install(
195 FILES ../../LICENSE
196 DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib1-dll")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
--- compat/zlib/contrib/zlib1-dll/CMakeLists.txt
+++ compat/zlib/contrib/zlib1-dll/CMakeLists.txt
@@ -1,38 +1,55 @@
1 cmake_minimum_required(VERSION 3.20...3.31)
2
3 project(
4 zlib1-dll
5 LANGUAGES C
6 VERSION 1.4
7 HOMEPAGE_URL "https://zlib.net/"
8 DESCRIPTION "zlib1.dll is the legacy DLL with zlib and minizip")
9
10 # ============================================================================
11 # configuration
12 # ============================================================================
13
14 if(WIN32)
15 set(CMAKE_DEBUG_POSTFIX "d")
16 else(WIN32)
17 message(FATAL_ERROR "This creates zlib1.<DLL>, Nothing else")
18 endif(WIN32)
19
20 if(ZLIB_BUILD_ZLIB1_DLL)
21 set(ZLIB1_DLL_BUILD_TESTING ${ZLIB_BUILD_TESTING} CACHE BOOL "")
22 set(ZLIB1_DLL_ENABLE_BZIP2 ${MINIZIP_ENABLE_BZIP2} CACHE BOOL "")
23 set(ZLIB1_DLL_INSTALL ${ZLIB_INSTALL} CACHE BOOL "")
24 set(ZLIB1_DLL_PREFIX "${ZLIB_PREFIX}" CACHE STRING
25 "prefix for all types and library functions, see zconf.h.in")
26 endif(ZLIB_BUILD_ZLIB1_DLL)
27
28 option(ZLIB1_DLL_ENABLE_BZIP2 "Build with bzip2 support" OFF)
29 option(ZLIB1_DLL_INSTALL "Install zlib1.dll" ON)
30 option(ZLIB1_DLL_BUILD_TESTING "Build and run tests for zlib1.dll" ON)
31 set(ZLIB1_DLL_PREFIX "" CACHE STRING
32 "prefix for all types and library functions, see zconf.h.in")
33 set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
34
35 include(CheckCSourceCompiles)
36 include(CheckSymbolExists)
37 include(CheckIncludeFile)
38 include(CMakePackageConfigHelpers)
39 include(CheckTypeSize)
 
40 include(GNUInstallDirs)
41
42 if(NOT CPACK_INCLUDED)
43 include(CPack)
44 endif(NOT CPACK_INCLUDED)
45
46 if(NOT ZLIB_CONF_WRITTEN)
47 set(CONF_OUT_FILE ${zlib1-dll_BINARY_DIR}/zconf.h.cmakein)
48 file(READ ../../zconf.h ZCONF_CONTENT LIMIT 245)
49 file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT})
50 file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX @Z_PREFIX@\n")
51 file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n")
52 file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n")
53 file(READ ../../zconf.h ZCONF_CONTENT OFFSET 244)
54 set(FIRST_ITEM TRUE)
55
@@ -48,20 +65,24 @@
65 file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT})
66 set(ZLIB_CONF_WRITTEN
67 TRUE
68 CACHE BOOL "zconf.h.cmakein was created")
69 mark_as_advanced(ZLIB_CONF_WRITTEN)
70
71 set(ZCONF_IN_ZLIB1 True CACHE INTERNAL "find zconf.h in zlib1-dll")
72 endif(NOT ZLIB_CONF_WRITTEN)
73
74 set(Z_PREFIX "${ZLIB1_DLL_PREFIX}")
75
76 if(ZLIB1_DLL_ENABLE_BZIP2)
77 find_package(BZip2 REQUIRED)
78 endif(ZLIB1_DLL_ENABLE_BZIP2)
79
80 #
81 # Check for fopen64
82 #
83 check_symbol_exists(fopen64 stdio.h HAVE_FOPEN64)
84
85 #
86 # Check to see if we have large file support
87 #
88 set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
@@ -69,11 +90,11 @@
90 unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable
91
92 #
93 # Check for fseeko
94 #
95 check_symbol_exists(fseeko stdio.h HAVE_FSEEKO)
96
97 #
98 # Check for stdarg.h
99 #
100 check_include_file(stdarg.h HAVE_STDARG_H)
@@ -99,17 +120,24 @@
120 int main(void) {return 0;}
121 "
122 HAVE___ATTR__VIS_HIDDEN)
123
124 unset(CMAKE_COMPILE_FLAGS)
125
126 if(ZCONF_IN_ZLIB1)
127 configure_file(${zlib1-dll_BINARY_DIR}/zconf.h.cmakein
128 ${zlib1-dll_BINARY_DIR}/zconf.h)
129 set(ZCONF_H "${zlib1-dll_BINARY_DIR}/zconf.h")
130 else(ZCONF_IN_ZLIB1)
131 set(ZCONF_H "${zlib1-dll_BINARY_DIR}/../../zconf.h")
132 endif(ZCONF_IN_ZLIB1)
133
134 # ============================================================================
135 # zlib1-dll
136 # ============================================================================
137 set(ZLIB1-DLL_PUBLIC_HDRS
138 ${ZCONF_H}
139 ../../zlib.h
140 ../minizip/crypt.h
141 ../minizip/ints.h
142 ../minizip/ioapi.h
143 ../minizip/mztools.h
@@ -140,57 +168,151 @@
168 ../../infback.c
169 ../../inftrees.c
170 ../../inffast.c
171 ../../trees.c
172 ../../uncompr.c
 
173 ../../zutil.c
174 ../minizip/ioapi.c
175 ../minizip/mztools.c
176 ../minizip/unzip.c
177 ../minizip/zip.c)
178
179 cmake_path(SET p1 "../../")
180 cmake_path(SET p2 "../../")
181 cmake_path(ABSOLUTE_PATH "p1" OUTPUT_VARIABLE DOTDOT)
182 cmake_path(ABSOLUTE_PATH "p2" OUTPUT_VARIABLE DOTMINIZIP)
183
184 add_library(${ZLIB_CONTRIB_PREFIX}zlib1 SHARED
185 ${ZLIB1-DLL_SRCS}
186 ${ZLIB1-DLL_PUBLIC_HDRS}
187 ${ZLIB1-DLL_PRIVATE_HDRS}
188 zlib1.rc)
189
190 add_library(ZLIB1DLL::ZLIB1DLL ALIAS ${ZLIB_CONTRIB_PREFIX}zlib1)
191
192 set_target_properties(${ZLIB_CONTRIB_PREFIX}zlib1
193 PROPERTIES
194 OUTPUT_NAME zlib1)
195
196 target_compile_definitions(${ZLIB_CONTRIB_PREFIX}zlib1
197 PRIVATE ZLIB_BUILD
198 $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
199 $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
200 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
201 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
202 $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
203 $<$<BOOL:${ZLIB1_DLL_PREFIX}>:Z_PREFIX=${ZLIB1_DLL_PREFIX}>
204 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
205 $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
206 $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
207
208 target_include_directories(${ZLIB_CONTRIB_PREFIX}zlib1
209 PUBLIC $<BUILD_INTERFACE:${DOTDOT}>
210 $<BUILD_INTERFACE:${DOTMINIZIP}>
211 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
212 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
213
214 target_link_libraries(${ZLIB_CONTRIB_PREFIX}zlib1
215 PUBLIC $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
216
217 set_target_properties(${ZLIB_CONTRIB_PREFIX}zlib1 PROPERTIES
218 DEFINE_SYMBOL ZLIB_DLL
219 EXPORT_NAME ZLIB1DLL)
220
221 add_library(${ZLIB_CONTRIB_PREFIX}zlibwapi SHARED
222 ${ZLIB1-DLL_SRCS}
223 ${ZLIB1-DLL_PUBLIC_HDRS}
224 ${ZLIB1-DLL_PRIVATE_HDRS}
225 zlibwapi.rc)
226
227 add_library(ZLIB1DLL::ZLIBWAPI ALIAS ${ZLIB_CONTRIB_PREFIX}zlibwapi)
228
229 set_target_properties(${ZLIB_CONTRIB_PREFIX}zlibwapi
230 PROPERTIES
231 OUTPUT_NAME zlibwapi)
232
233 target_include_directories(${ZLIB_CONTRIB_PREFIX}zlibwapi
234 PUBLIC $<BUILD_INTERFACE:${DOTDOT}>
235 $<BUILD_INTERFACE:${DOTMINIZIP}>
236 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
237 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
238
239 target_compile_definitions(${ZLIB_CONTRIB_PREFIX}zlibwapi
240 PRIVATE ZLIB_BUILD
241 $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
242 $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
243 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
244 $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
245 $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
246 PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
247 $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
248 $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>
249 ZLIB_WINAPI)
250
251 target_link_libraries(${ZLIB_CONTRIB_PREFIX}zlibwapi
252 PUBLIC $<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
253
254 if(NOT CYGWIN)
255 set_target_properties(${ZLIB_CONTRIB_PREFIX}zlib1
256 PROPERTIES
257 SOVERSION ${zlib1-dll_VERSION_MAJOR}
258 VERSION ${zlib1-dll_VERSION})
259 set_target_properties(${ZLIB_CONTRIB_PREFIX}zlibwapi
260 PROPERTIES
261 SOVERSION ${zlib1-dll_VERSION_MAJOR}
262 VERSION ${zlib1-dll_VERSION})
263 endif(NOT CYGWIN)
264
265 set_target_properties(${ZLIB_CONTRIB_PREFIX}zlibwapi PROPERTIES
266 DEFINE_SYMBOL ZLIB_DLL
267 EXPORT_NAME ZLIBWAPI)
268
269 if(ZLIB1_DLL_INSTALL)
270 install(
271 TARGETS ${ZLIB_CONTRIB_PREFIX}zlib1 ${ZLIB_CONTRIB_PREFIX}zlibwapi
272 COMPONENT Runtime
273 EXPORT zlibDllExport
274 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
275 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
276 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
277
278 install(
279 EXPORT zlibDllExport
280 FILE ZLIB1DLLTargets.cmake
281 NAMESPACE ZLIB1DLL::
282 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib1dll)
283
284 install(
285 FILES $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}zlib1>
286 $<TARGET_PDB_FILE:${ZLIB_CONTRIB_PREFIX}zlibwapi>
287 COMPONENT Runtime
288 DESTINATION ${CMAKE_INSTALL_BINDIR}
289 CONFIGURATIONS Debug OR RelWithDebInfo
290 OPTIONAL)
291
292 configure_package_config_file(
293 ${zlib1-dll_SOURCE_DIR}/zlib1dllConfig.cmake.in
294 ${zlib1-dll_BINARY_DIR}/ZLIB1DLLConfig.cmake
295 INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
296
297 write_basic_package_version_file(
298 "${zlib1-dll_BINARY_DIR}/ZLIB1DLLConfigVersion.cmake"
299 VERSION "${zlib1-dll_VERSION}"
300 COMPATIBILITY AnyNewerVersion)
301
302 install(FILES ${zlib1-dll_BINARY_DIR}/ZLIB1DLLConfig.cmake
303 ${zlib1-dll_BINARY_DIR}/ZLIB1DLLConfigVersion.cmake
304 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib1dll)
305
306 install(
307 FILES ${ZLIB1-DLL_PUBLIC_HDRS}
308 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
309
310 install(
311 FILES ../../LICENSE
312 DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib1-dll")
313 endif(ZLIB1_DLL_INSTALL)
314
315 if(ZLIB1_DLL_BUILD_TESTING)
316 enable_testing()
317 add_subdirectory(test)
318 endif(ZLIB1_DLL_BUILD_TESTING)
319
--- compat/zlib/crc32.c
+++ compat/zlib/crc32.c
@@ -684,11 +684,11 @@
684684
#endif
685685
#endif
686686
#endif
687687
688688
/* Initialize the CRC for each braid. */
689
- crc0 = crc;
689
+ crc0 = (z_crc_t)crc;
690690
#if N > 1
691691
crc1 = 0;
692692
#if N > 2
693693
crc2 = 0;
694694
#if N > 3
695695
--- compat/zlib/crc32.c
+++ compat/zlib/crc32.c
@@ -684,11 +684,11 @@
684 #endif
685 #endif
686 #endif
687
688 /* Initialize the CRC for each braid. */
689 crc0 = crc;
690 #if N > 1
691 crc1 = 0;
692 #if N > 2
693 crc2 = 0;
694 #if N > 3
695
--- compat/zlib/crc32.c
+++ compat/zlib/crc32.c
@@ -684,11 +684,11 @@
684 #endif
685 #endif
686 #endif
687
688 /* Initialize the CRC for each braid. */
689 crc0 = (z_crc_t)crc;
690 #if N > 1
691 crc1 = 0;
692 #if N > 2
693 crc2 = 0;
694 #if N > 3
695
--- compat/zlib/deflate.c
+++ compat/zlib/deflate.c
@@ -50,11 +50,11 @@
5050
/* @(#) $Id$ */
5151
5252
#include "deflate.h"
5353
5454
const char deflate_copyright[] =
55
- " deflate 1.3.2 Copyright 1995-2026 Jean-loup Gailly and Mark Adler ";
55
+ " deflate 1.4 Copyright 1995-2026 Jean-loup Gailly and Mark Adler ";
5656
/*
5757
If you use the zlib library in a product, an acknowledgment is welcome
5858
in the documentation of your product. If for some reason you cannot
5959
include such an acknowledgment, I would appreciate that you keep this
6060
copyright string in the executable of your product.
@@ -443,11 +443,10 @@
443443
strm->state = (struct internal_state FAR *)s;
444444
s->strm = strm;
445445
s->status = INIT_STATE; /* to pass state test in deflateReset() */
446446
447447
s->wrap = wrap;
448
- s->gzhead = Z_NULL;
449448
s->w_bits = (uInt)windowBits;
450449
s->w_size = 1 << s->w_bits;
451450
s->w_mask = s->w_size - 1;
452451
453452
s->hash_bits = (uInt)memLevel + 7;
@@ -566,11 +565,12 @@
566565
567566
if (deflateStateCheck(strm) || dictionary == Z_NULL)
568567
return Z_STREAM_ERROR;
569568
s = strm->state;
570569
wrap = s->wrap;
571
- if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
570
+ if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead ||
571
+ (wrap == 0 && (long)s->strstart != s->block_start))
572572
return Z_STREAM_ERROR;
573573
574574
/* when using zlib wrappers, compute Adler-32 for provided dictionary */
575575
if (wrap == 1)
576576
strm->adler = adler32(strm->adler, dictionary, dictLength);
@@ -669,11 +669,24 @@
669669
s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
670670
#endif
671671
adler32(0L, Z_NULL, 0);
672672
s->last_flush = -2;
673673
674
- _tr_init(s);
674
+ s->gzhead = Z_NULL;
675
+
676
+ {
677
+ /* Retain the hash work done for level 0. */
678
+ uInt matches = s->level == 0 ? s->matches : 0;
679
+ _tr_init(s);
680
+ s->matches = matches;
681
+ }
682
+
683
+ /* Keep the window and the hash, but drop what was left unfinished */
684
+ s->block_start = (long)s->strstart;
685
+ s->lookahead = 0;
686
+ s->match_length = s->prev_length = MIN_MATCH-1;
687
+ s->match_available = 0;
675688
676689
return Z_OK;
677690
}
678691
679692
/* ===========================================================================
@@ -681,10 +694,11 @@
681694
*/
682695
local void lm_init(deflate_state *s) {
683696
s->window_size = (ulg)2L*s->w_size;
684697
685698
CLEAR_HASH(s);
699
+ s->matches = 0; /* the hash is clear */
686700
687701
/* Set the default configuration parameters:
688702
*/
689703
s->max_lazy_match = configuration_table[s->level].max_lazy;
690704
s->good_match = configuration_table[s->level].good_length;
@@ -743,22 +757,27 @@
743757
744758
/* ========================================================================= */
745759
int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
746760
deflate_state *s;
747761
int put;
762
+ int need;
748763
749764
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
750765
s = strm->state;
751
-#ifdef LIT_MEM
752
- if (bits < 0 || bits > 16 ||
753
- (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
754
- return Z_BUF_ERROR;
755
-#else
756
- if (bits < 0 || bits > 16 ||
757
- s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
758
- return Z_BUF_ERROR;
759
-#endif
766
+ if (bits < 0 || bits > 16)
767
+ return Z_BUF_ERROR;
768
+ if (s->pending_out != s->pending_buf) {
769
+ /* move partially flushed pending output to buffer start */
770
+ Bytef *to = s->pending_buf, *from = s->pending_out;
771
+ ulg n = s->pending;
772
+ while (n--)
773
+ *to++ = *from++;
774
+ s->pending_out = s->pending_buf;
775
+ }
776
+ need = (s->bi_valid + bits) >> 3;
777
+ if (s->pending_buf_size - s->pending < (ulg)need)
778
+ return Z_BUF_ERROR;
760779
do {
761780
put = Buf_size - s->bi_valid;
762781
if (put > bits)
763782
put = bits;
764783
s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
@@ -1314,43 +1333,53 @@
13141333
* To simplify the source, this is not supported for 16-bit MSDOS (which
13151334
* doesn't have enough memory anyway to duplicate compression states).
13161335
*/
13171336
int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
13181337
#ifdef MAXSEG_64K
1319
- (void)dest;
13201338
(void)source;
1339
+ if (dest != Z_NULL)
1340
+ dest->state = Z_NULL;
13211341
return Z_STREAM_ERROR;
13221342
#else
13231343
deflate_state *ds;
13241344
deflate_state *ss;
13251345
1326
-
1327
- if (deflateStateCheck(source) || dest == Z_NULL) {
1346
+ if (dest == Z_NULL)
1347
+ return Z_STREAM_ERROR;
1348
+ if (deflateStateCheck(source)) {
1349
+ dest->state = Z_NULL;
13281350
return Z_STREAM_ERROR;
13291351
}
13301352
13311353
ss = source->state;
13321354
1333
- zmemcpy(dest, source, sizeof(z_stream));
1334
-
1335
- ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
1336
- if (ds == Z_NULL) return Z_MEM_ERROR;
1337
- zmemzero(ds, sizeof(deflate_state));
1338
- dest->state = (struct internal_state FAR *) ds;
1355
+ ds = (deflate_state *) ZALLOC(source, 1, sizeof(deflate_state));
1356
+ if (ds == Z_NULL) {
1357
+ dest->state = Z_NULL;
1358
+ return Z_MEM_ERROR;
1359
+ }
13391360
zmemcpy(ds, ss, sizeof(deflate_state));
1340
- ds->strm = dest;
1341
-
1342
- ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
1343
- ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
1344
- ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
1345
- ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
1346
-
1361
+ ds->window = (Bytef *) ZALLOC(source, ds->w_size, 2*sizeof(Byte));
1362
+ ds->prev = (Posf *) ZALLOC(source, ds->w_size, sizeof(Pos));
1363
+ ds->head = (Posf *) ZALLOC(source, ds->hash_size, sizeof(Pos));
1364
+ ds->pending_buf = (uchf *) ZALLOC(source, ds->lit_bufsize, LIT_BUFS);
13471365
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
13481366
ds->pending_buf == Z_NULL) {
1349
- deflateEnd (dest);
1367
+ TRY_FREE(source, ds->pending_buf);
1368
+ TRY_FREE(source, ds->head);
1369
+ TRY_FREE(source, ds->prev);
1370
+ TRY_FREE(source, ds->window);
1371
+ ZFREE(source, ds);
1372
+ dest->state = Z_NULL;
13501373
return Z_MEM_ERROR;
13511374
}
1375
+
1376
+ /* copy the stream and attach the new state */
1377
+ zmemcpy(dest, source, sizeof(z_stream));
1378
+ dest->state = (struct internal_state FAR *) ds;
1379
+ ds->strm = dest;
1380
+
13521381
/* following zmemcpy's do not work for 16-bit MSDOS */
13531382
zmemcpy(ds->window, ss->window, ss->high_water);
13541383
zmemcpy(ds->prev, ss->prev,
13551384
(ss->slid || ss->strstart - ss->insert > ds->w_size ? ds->w_size :
13561385
ss->strstart - ss->insert) * sizeof(Pos));
@@ -1639,11 +1668,14 @@
16391668
}
16401669
16411670
/* Same but force premature exit if necessary. */
16421671
#define FLUSH_BLOCK(s, last) { \
16431672
FLUSH_BLOCK_ONLY(s, last); \
1644
- if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1673
+ if (s->strm->avail_out == 0) { \
1674
+ if (!(last)) return need_more; \
1675
+ if (s->pending != 0 || s->wrap != 0) return finish_started; \
1676
+ } \
16451677
}
16461678
16471679
/* Maximum stored block length in deflate format (not including header). */
16481680
#define MAX_STORED 65535
16491681
@@ -1674,11 +1706,11 @@
16741706
16751707
/* Copy as many min_block or larger stored blocks directly to next_out as
16761708
* possible. If flushing, copy the remaining available input to next_out as
16771709
* stored blocks, if there is enough space.
16781710
*/
1679
- int last = 0;
1711
+ int last = 0, all;
16801712
unsigned len, left, have;
16811713
unsigned used = s->strm->avail_in;
16821714
do {
16831715
/* Set len to the maximum size block that we can copy directly with the
16841716
* available input data and output space. Set left to how much of that
@@ -1689,29 +1721,32 @@
16891721
if (s->strm->avail_out < have) /* need room for header */
16901722
break;
16911723
/* maximum stored block length that will fit in avail_out: */
16921724
have = s->strm->avail_out - have;
16931725
left = (unsigned)(s->strstart - s->block_start); /* window bytes */
1694
- if (len > (ulg)left + s->strm->avail_in)
1726
+ if (left < len && s->strm->avail_in < len - left)
16951727
len = left + s->strm->avail_in; /* limit len to the input */
16961728
if (len > have)
16971729
len = have; /* limit len to the output */
1730
+
1731
+ /* all is true if len is all of the available input */
1732
+ all = len >= left && len - left == s->strm->avail_in;
16981733
16991734
/* If the stored block would be less than min_block in length, or if
17001735
* unable to copy all of the available input when flushing, then try
17011736
* copying to the window and the pending buffer instead. Also don't
17021737
* write an empty block when flushing -- deflate() does that.
17031738
*/
17041739
if (len < min_block && ((len == 0 && flush != Z_FINISH) ||
17051740
flush == Z_NO_FLUSH ||
1706
- len != left + s->strm->avail_in))
1741
+ !all))
17071742
break;
17081743
17091744
/* Make a dummy stored block in pending to get the header bytes,
17101745
* including any pending bits. This also updates the debugging counts.
17111746
*/
1712
- last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
1747
+ last = flush == Z_FINISH && all ? 1 : 0;
17131748
_tr_stored_block(s, (char *)0, 0L, last);
17141749
17151750
/* Replace the lengths in the dummy stored block with len. */
17161751
s->pending_buf[s->pending - 4] = (Bytef)len;
17171752
s->pending_buf[s->pending - 3] = (Bytef)(len >> 8);
@@ -2012,11 +2047,12 @@
20122047
*/
20132048
if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
20142049
uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
20152050
/* Do not insert strings in hash table beyond this. */
20162051
2017
- check_match(s, s->strstart - 1, s->prev_match, (int)s->prev_length);
2052
+ check_match(s, s->strstart - 1, s->prev_match,
2053
+ (int)s->prev_length);
20182054
20192055
_tr_tally_dist(s, s->strstart - 1 - s->prev_match,
20202056
s->prev_length - MIN_MATCH, bflush);
20212057
20222058
/* Insert in hash table all strings up to the end of the match.
20232059
--- compat/zlib/deflate.c
+++ compat/zlib/deflate.c
@@ -50,11 +50,11 @@
50 /* @(#) $Id$ */
51
52 #include "deflate.h"
53
54 const char deflate_copyright[] =
55 " deflate 1.3.2 Copyright 1995-2026 Jean-loup Gailly and Mark Adler ";
56 /*
57 If you use the zlib library in a product, an acknowledgment is welcome
58 in the documentation of your product. If for some reason you cannot
59 include such an acknowledgment, I would appreciate that you keep this
60 copyright string in the executable of your product.
@@ -443,11 +443,10 @@
443 strm->state = (struct internal_state FAR *)s;
444 s->strm = strm;
445 s->status = INIT_STATE; /* to pass state test in deflateReset() */
446
447 s->wrap = wrap;
448 s->gzhead = Z_NULL;
449 s->w_bits = (uInt)windowBits;
450 s->w_size = 1 << s->w_bits;
451 s->w_mask = s->w_size - 1;
452
453 s->hash_bits = (uInt)memLevel + 7;
@@ -566,11 +565,12 @@
566
567 if (deflateStateCheck(strm) || dictionary == Z_NULL)
568 return Z_STREAM_ERROR;
569 s = strm->state;
570 wrap = s->wrap;
571 if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
 
572 return Z_STREAM_ERROR;
573
574 /* when using zlib wrappers, compute Adler-32 for provided dictionary */
575 if (wrap == 1)
576 strm->adler = adler32(strm->adler, dictionary, dictLength);
@@ -669,11 +669,24 @@
669 s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
670 #endif
671 adler32(0L, Z_NULL, 0);
672 s->last_flush = -2;
673
674 _tr_init(s);
 
 
 
 
 
 
 
 
 
 
 
 
 
675
676 return Z_OK;
677 }
678
679 /* ===========================================================================
@@ -681,10 +694,11 @@
681 */
682 local void lm_init(deflate_state *s) {
683 s->window_size = (ulg)2L*s->w_size;
684
685 CLEAR_HASH(s);
 
686
687 /* Set the default configuration parameters:
688 */
689 s->max_lazy_match = configuration_table[s->level].max_lazy;
690 s->good_match = configuration_table[s->level].good_length;
@@ -743,22 +757,27 @@
743
744 /* ========================================================================= */
745 int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
746 deflate_state *s;
747 int put;
 
748
749 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
750 s = strm->state;
751 #ifdef LIT_MEM
752 if (bits < 0 || bits > 16 ||
753 (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
754 return Z_BUF_ERROR;
755 #else
756 if (bits < 0 || bits > 16 ||
757 s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
758 return Z_BUF_ERROR;
759 #endif
 
 
 
 
760 do {
761 put = Buf_size - s->bi_valid;
762 if (put > bits)
763 put = bits;
764 s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
@@ -1314,43 +1333,53 @@
1314 * To simplify the source, this is not supported for 16-bit MSDOS (which
1315 * doesn't have enough memory anyway to duplicate compression states).
1316 */
1317 int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
1318 #ifdef MAXSEG_64K
1319 (void)dest;
1320 (void)source;
 
 
1321 return Z_STREAM_ERROR;
1322 #else
1323 deflate_state *ds;
1324 deflate_state *ss;
1325
1326
1327 if (deflateStateCheck(source) || dest == Z_NULL) {
 
 
1328 return Z_STREAM_ERROR;
1329 }
1330
1331 ss = source->state;
1332
1333 zmemcpy(dest, source, sizeof(z_stream));
1334
1335 ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
1336 if (ds == Z_NULL) return Z_MEM_ERROR;
1337 zmemzero(ds, sizeof(deflate_state));
1338 dest->state = (struct internal_state FAR *) ds;
1339 zmemcpy(ds, ss, sizeof(deflate_state));
1340 ds->strm = dest;
1341
1342 ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
1343 ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
1344 ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
1345 ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
1346
1347 if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
1348 ds->pending_buf == Z_NULL) {
1349 deflateEnd (dest);
 
 
 
 
 
1350 return Z_MEM_ERROR;
1351 }
 
 
 
 
 
 
1352 /* following zmemcpy's do not work for 16-bit MSDOS */
1353 zmemcpy(ds->window, ss->window, ss->high_water);
1354 zmemcpy(ds->prev, ss->prev,
1355 (ss->slid || ss->strstart - ss->insert > ds->w_size ? ds->w_size :
1356 ss->strstart - ss->insert) * sizeof(Pos));
@@ -1639,11 +1668,14 @@
1639 }
1640
1641 /* Same but force premature exit if necessary. */
1642 #define FLUSH_BLOCK(s, last) { \
1643 FLUSH_BLOCK_ONLY(s, last); \
1644 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
 
 
 
1645 }
1646
1647 /* Maximum stored block length in deflate format (not including header). */
1648 #define MAX_STORED 65535
1649
@@ -1674,11 +1706,11 @@
1674
1675 /* Copy as many min_block or larger stored blocks directly to next_out as
1676 * possible. If flushing, copy the remaining available input to next_out as
1677 * stored blocks, if there is enough space.
1678 */
1679 int last = 0;
1680 unsigned len, left, have;
1681 unsigned used = s->strm->avail_in;
1682 do {
1683 /* Set len to the maximum size block that we can copy directly with the
1684 * available input data and output space. Set left to how much of that
@@ -1689,29 +1721,32 @@
1689 if (s->strm->avail_out < have) /* need room for header */
1690 break;
1691 /* maximum stored block length that will fit in avail_out: */
1692 have = s->strm->avail_out - have;
1693 left = (unsigned)(s->strstart - s->block_start); /* window bytes */
1694 if (len > (ulg)left + s->strm->avail_in)
1695 len = left + s->strm->avail_in; /* limit len to the input */
1696 if (len > have)
1697 len = have; /* limit len to the output */
 
 
 
1698
1699 /* If the stored block would be less than min_block in length, or if
1700 * unable to copy all of the available input when flushing, then try
1701 * copying to the window and the pending buffer instead. Also don't
1702 * write an empty block when flushing -- deflate() does that.
1703 */
1704 if (len < min_block && ((len == 0 && flush != Z_FINISH) ||
1705 flush == Z_NO_FLUSH ||
1706 len != left + s->strm->avail_in))
1707 break;
1708
1709 /* Make a dummy stored block in pending to get the header bytes,
1710 * including any pending bits. This also updates the debugging counts.
1711 */
1712 last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
1713 _tr_stored_block(s, (char *)0, 0L, last);
1714
1715 /* Replace the lengths in the dummy stored block with len. */
1716 s->pending_buf[s->pending - 4] = (Bytef)len;
1717 s->pending_buf[s->pending - 3] = (Bytef)(len >> 8);
@@ -2012,11 +2047,12 @@
2012 */
2013 if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
2014 uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
2015 /* Do not insert strings in hash table beyond this. */
2016
2017 check_match(s, s->strstart - 1, s->prev_match, (int)s->prev_length);
 
2018
2019 _tr_tally_dist(s, s->strstart - 1 - s->prev_match,
2020 s->prev_length - MIN_MATCH, bflush);
2021
2022 /* Insert in hash table all strings up to the end of the match.
2023
--- compat/zlib/deflate.c
+++ compat/zlib/deflate.c
@@ -50,11 +50,11 @@
50 /* @(#) $Id$ */
51
52 #include "deflate.h"
53
54 const char deflate_copyright[] =
55 " deflate 1.4 Copyright 1995-2026 Jean-loup Gailly and Mark Adler ";
56 /*
57 If you use the zlib library in a product, an acknowledgment is welcome
58 in the documentation of your product. If for some reason you cannot
59 include such an acknowledgment, I would appreciate that you keep this
60 copyright string in the executable of your product.
@@ -443,11 +443,10 @@
443 strm->state = (struct internal_state FAR *)s;
444 s->strm = strm;
445 s->status = INIT_STATE; /* to pass state test in deflateReset() */
446
447 s->wrap = wrap;
 
448 s->w_bits = (uInt)windowBits;
449 s->w_size = 1 << s->w_bits;
450 s->w_mask = s->w_size - 1;
451
452 s->hash_bits = (uInt)memLevel + 7;
@@ -566,11 +565,12 @@
565
566 if (deflateStateCheck(strm) || dictionary == Z_NULL)
567 return Z_STREAM_ERROR;
568 s = strm->state;
569 wrap = s->wrap;
570 if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead ||
571 (wrap == 0 && (long)s->strstart != s->block_start))
572 return Z_STREAM_ERROR;
573
574 /* when using zlib wrappers, compute Adler-32 for provided dictionary */
575 if (wrap == 1)
576 strm->adler = adler32(strm->adler, dictionary, dictLength);
@@ -669,11 +669,24 @@
669 s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
670 #endif
671 adler32(0L, Z_NULL, 0);
672 s->last_flush = -2;
673
674 s->gzhead = Z_NULL;
675
676 {
677 /* Retain the hash work done for level 0. */
678 uInt matches = s->level == 0 ? s->matches : 0;
679 _tr_init(s);
680 s->matches = matches;
681 }
682
683 /* Keep the window and the hash, but drop what was left unfinished */
684 s->block_start = (long)s->strstart;
685 s->lookahead = 0;
686 s->match_length = s->prev_length = MIN_MATCH-1;
687 s->match_available = 0;
688
689 return Z_OK;
690 }
691
692 /* ===========================================================================
@@ -681,10 +694,11 @@
694 */
695 local void lm_init(deflate_state *s) {
696 s->window_size = (ulg)2L*s->w_size;
697
698 CLEAR_HASH(s);
699 s->matches = 0; /* the hash is clear */
700
701 /* Set the default configuration parameters:
702 */
703 s->max_lazy_match = configuration_table[s->level].max_lazy;
704 s->good_match = configuration_table[s->level].good_length;
@@ -743,22 +757,27 @@
757
758 /* ========================================================================= */
759 int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
760 deflate_state *s;
761 int put;
762 int need;
763
764 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
765 s = strm->state;
766 if (bits < 0 || bits > 16)
767 return Z_BUF_ERROR;
768 if (s->pending_out != s->pending_buf) {
769 /* move partially flushed pending output to buffer start */
770 Bytef *to = s->pending_buf, *from = s->pending_out;
771 ulg n = s->pending;
772 while (n--)
773 *to++ = *from++;
774 s->pending_out = s->pending_buf;
775 }
776 need = (s->bi_valid + bits) >> 3;
777 if (s->pending_buf_size - s->pending < (ulg)need)
778 return Z_BUF_ERROR;
779 do {
780 put = Buf_size - s->bi_valid;
781 if (put > bits)
782 put = bits;
783 s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
@@ -1314,43 +1333,53 @@
1333 * To simplify the source, this is not supported for 16-bit MSDOS (which
1334 * doesn't have enough memory anyway to duplicate compression states).
1335 */
1336 int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
1337 #ifdef MAXSEG_64K
 
1338 (void)source;
1339 if (dest != Z_NULL)
1340 dest->state = Z_NULL;
1341 return Z_STREAM_ERROR;
1342 #else
1343 deflate_state *ds;
1344 deflate_state *ss;
1345
1346 if (dest == Z_NULL)
1347 return Z_STREAM_ERROR;
1348 if (deflateStateCheck(source)) {
1349 dest->state = Z_NULL;
1350 return Z_STREAM_ERROR;
1351 }
1352
1353 ss = source->state;
1354
1355 ds = (deflate_state *) ZALLOC(source, 1, sizeof(deflate_state));
1356 if (ds == Z_NULL) {
1357 dest->state = Z_NULL;
1358 return Z_MEM_ERROR;
1359 }
 
1360 zmemcpy(ds, ss, sizeof(deflate_state));
1361 ds->window = (Bytef *) ZALLOC(source, ds->w_size, 2*sizeof(Byte));
1362 ds->prev = (Posf *) ZALLOC(source, ds->w_size, sizeof(Pos));
1363 ds->head = (Posf *) ZALLOC(source, ds->hash_size, sizeof(Pos));
1364 ds->pending_buf = (uchf *) ZALLOC(source, ds->lit_bufsize, LIT_BUFS);
 
 
 
1365 if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
1366 ds->pending_buf == Z_NULL) {
1367 TRY_FREE(source, ds->pending_buf);
1368 TRY_FREE(source, ds->head);
1369 TRY_FREE(source, ds->prev);
1370 TRY_FREE(source, ds->window);
1371 ZFREE(source, ds);
1372 dest->state = Z_NULL;
1373 return Z_MEM_ERROR;
1374 }
1375
1376 /* copy the stream and attach the new state */
1377 zmemcpy(dest, source, sizeof(z_stream));
1378 dest->state = (struct internal_state FAR *) ds;
1379 ds->strm = dest;
1380
1381 /* following zmemcpy's do not work for 16-bit MSDOS */
1382 zmemcpy(ds->window, ss->window, ss->high_water);
1383 zmemcpy(ds->prev, ss->prev,
1384 (ss->slid || ss->strstart - ss->insert > ds->w_size ? ds->w_size :
1385 ss->strstart - ss->insert) * sizeof(Pos));
@@ -1639,11 +1668,14 @@
1668 }
1669
1670 /* Same but force premature exit if necessary. */
1671 #define FLUSH_BLOCK(s, last) { \
1672 FLUSH_BLOCK_ONLY(s, last); \
1673 if (s->strm->avail_out == 0) { \
1674 if (!(last)) return need_more; \
1675 if (s->pending != 0 || s->wrap != 0) return finish_started; \
1676 } \
1677 }
1678
1679 /* Maximum stored block length in deflate format (not including header). */
1680 #define MAX_STORED 65535
1681
@@ -1674,11 +1706,11 @@
1706
1707 /* Copy as many min_block or larger stored blocks directly to next_out as
1708 * possible. If flushing, copy the remaining available input to next_out as
1709 * stored blocks, if there is enough space.
1710 */
1711 int last = 0, all;
1712 unsigned len, left, have;
1713 unsigned used = s->strm->avail_in;
1714 do {
1715 /* Set len to the maximum size block that we can copy directly with the
1716 * available input data and output space. Set left to how much of that
@@ -1689,29 +1721,32 @@
1721 if (s->strm->avail_out < have) /* need room for header */
1722 break;
1723 /* maximum stored block length that will fit in avail_out: */
1724 have = s->strm->avail_out - have;
1725 left = (unsigned)(s->strstart - s->block_start); /* window bytes */
1726 if (left < len && s->strm->avail_in < len - left)
1727 len = left + s->strm->avail_in; /* limit len to the input */
1728 if (len > have)
1729 len = have; /* limit len to the output */
1730
1731 /* all is true if len is all of the available input */
1732 all = len >= left && len - left == s->strm->avail_in;
1733
1734 /* If the stored block would be less than min_block in length, or if
1735 * unable to copy all of the available input when flushing, then try
1736 * copying to the window and the pending buffer instead. Also don't
1737 * write an empty block when flushing -- deflate() does that.
1738 */
1739 if (len < min_block && ((len == 0 && flush != Z_FINISH) ||
1740 flush == Z_NO_FLUSH ||
1741 !all))
1742 break;
1743
1744 /* Make a dummy stored block in pending to get the header bytes,
1745 * including any pending bits. This also updates the debugging counts.
1746 */
1747 last = flush == Z_FINISH && all ? 1 : 0;
1748 _tr_stored_block(s, (char *)0, 0L, last);
1749
1750 /* Replace the lengths in the dummy stored block with len. */
1751 s->pending_buf[s->pending - 4] = (Bytef)len;
1752 s->pending_buf[s->pending - 3] = (Bytef)(len >> 8);
@@ -2012,11 +2047,12 @@
2047 */
2048 if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
2049 uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
2050 /* Do not insert strings in hash table beyond this. */
2051
2052 check_match(s, s->strstart - 1, s->prev_match,
2053 (int)s->prev_length);
2054
2055 _tr_tally_dist(s, s->strstart - 1 - s->prev_match,
2056 s->prev_length - MIN_MATCH, bflush);
2057
2058 /* Insert in hash table all strings up to the end of the match.
2059
--- compat/zlib/gzguts.h
+++ compat/zlib/gzguts.h
@@ -90,12 +90,14 @@
9090
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
9191
# ifndef vsnprintf
9292
# define vsnprintf _vsnprintf
9393
# endif
9494
# endif
95
-# elif !defined(__STDC_VERSION__) || __STDC_VERSION__-0 < 199901L
96
-/* Otherwise if C89/90, assume no C99 snprintf() or vsnprintf() */
95
+# elif (!defined(__STDC_VERSION__) || __STDC_VERSION__-0 < 199901L) && \
96
+ (!defined(__cplusplus) || __cplusplus < 201103L)
97
+/* Otherwise if C89/90 (and not C++11 or later), assume no C99 snprintf() or
98
+ vsnprintf() */
9799
# ifndef NO_snprintf
98100
# define NO_snprintf
99101
# endif
100102
# ifndef NO_vsnprintf
101103
# define NO_vsnprintf
@@ -126,17 +128,31 @@
126128
/* get errno and strerror definition */
127129
#if defined UNDER_CE
128130
# include <windows.h>
129131
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
130132
#else
133
+# include <errno.h>
131134
# ifndef NO_STRERROR
132
-# include <errno.h>
133135
# define zstrerror() strerror(errno)
134136
# else
135137
# define zstrerror() "stdio error (consult errno)"
136138
# endif
137139
#endif
140
+
141
+#ifdef EAGAIN
142
+# ifdef EWOULDBLOCK
143
+# define BLOCKED(e) ((e) == EAGAIN || (e) == EWOULDBLOCK)
144
+# else
145
+# define BLOCKED(e) ((e) == EAGAIN)
146
+# endif
147
+#else
148
+# ifdef EWOULDBLOCK
149
+# define BLOCKED(e) ((e) == EWOULDBLOCK)
150
+# else
151
+# define BLOCKED(e) (0)
152
+# endif
153
+#endif
138154
139155
/* provide prototypes for these when building zlib without LFS */
140156
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
141157
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
142158
ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
@@ -212,5 +228,12 @@
212228
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
213229
value -- needed when comparing unsigned to z_off64_t, which is signed
214230
(possible z_off64_t types off_t, off64_t, and long are all signed) */
215231
unsigned ZLIB_INTERNAL gz_intmax(void);
216232
#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
233
+
234
+/* largest value representable in z_off64_t */
235
+#ifndef CHAR_BIT
236
+# define CHAR_BIT 8
237
+#endif
238
+#define GZ_OFF_MAX \
239
+ ((((z_off64_t)1 << (sizeof(z_off64_t) * CHAR_BIT - 2)) - 1) * 2 + 1)
217240
--- compat/zlib/gzguts.h
+++ compat/zlib/gzguts.h
@@ -90,12 +90,14 @@
90 # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
91 # ifndef vsnprintf
92 # define vsnprintf _vsnprintf
93 # endif
94 # endif
95 # elif !defined(__STDC_VERSION__) || __STDC_VERSION__-0 < 199901L
96 /* Otherwise if C89/90, assume no C99 snprintf() or vsnprintf() */
 
 
97 # ifndef NO_snprintf
98 # define NO_snprintf
99 # endif
100 # ifndef NO_vsnprintf
101 # define NO_vsnprintf
@@ -126,17 +128,31 @@
126 /* get errno and strerror definition */
127 #if defined UNDER_CE
128 # include <windows.h>
129 # define zstrerror() gz_strwinerror((DWORD)GetLastError())
130 #else
 
131 # ifndef NO_STRERROR
132 # include <errno.h>
133 # define zstrerror() strerror(errno)
134 # else
135 # define zstrerror() "stdio error (consult errno)"
136 # endif
137 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
139 /* provide prototypes for these when building zlib without LFS */
140 #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
141 ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
142 ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
@@ -212,5 +228,12 @@
212 /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
213 value -- needed when comparing unsigned to z_off64_t, which is signed
214 (possible z_off64_t types off_t, off64_t, and long are all signed) */
215 unsigned ZLIB_INTERNAL gz_intmax(void);
216 #define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
 
 
 
 
 
 
 
217
--- compat/zlib/gzguts.h
+++ compat/zlib/gzguts.h
@@ -90,12 +90,14 @@
90 # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
91 # ifndef vsnprintf
92 # define vsnprintf _vsnprintf
93 # endif
94 # endif
95 # elif (!defined(__STDC_VERSION__) || __STDC_VERSION__-0 < 199901L) && \
96 (!defined(__cplusplus) || __cplusplus < 201103L)
97 /* Otherwise if C89/90 (and not C++11 or later), assume no C99 snprintf() or
98 vsnprintf() */
99 # ifndef NO_snprintf
100 # define NO_snprintf
101 # endif
102 # ifndef NO_vsnprintf
103 # define NO_vsnprintf
@@ -126,17 +128,31 @@
128 /* get errno and strerror definition */
129 #if defined UNDER_CE
130 # include <windows.h>
131 # define zstrerror() gz_strwinerror((DWORD)GetLastError())
132 #else
133 # include <errno.h>
134 # ifndef NO_STRERROR
 
135 # define zstrerror() strerror(errno)
136 # else
137 # define zstrerror() "stdio error (consult errno)"
138 # endif
139 #endif
140
141 #ifdef EAGAIN
142 # ifdef EWOULDBLOCK
143 # define BLOCKED(e) ((e) == EAGAIN || (e) == EWOULDBLOCK)
144 # else
145 # define BLOCKED(e) ((e) == EAGAIN)
146 # endif
147 #else
148 # ifdef EWOULDBLOCK
149 # define BLOCKED(e) ((e) == EWOULDBLOCK)
150 # else
151 # define BLOCKED(e) (0)
152 # endif
153 #endif
154
155 /* provide prototypes for these when building zlib without LFS */
156 #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
157 ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
158 ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
@@ -212,5 +228,12 @@
228 /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
229 value -- needed when comparing unsigned to z_off64_t, which is signed
230 (possible z_off64_t types off_t, off64_t, and long are all signed) */
231 unsigned ZLIB_INTERNAL gz_intmax(void);
232 #define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
233
234 /* largest value representable in z_off64_t */
235 #ifndef CHAR_BIT
236 # define CHAR_BIT 8
237 #endif
238 #define GZ_OFF_MAX \
239 ((((z_off64_t)1 << (sizeof(z_off64_t) * CHAR_BIT - 2)) - 1) * 2 + 1)
240
--- compat/zlib/gzlib.c
+++ compat/zlib/gzlib.c
@@ -66,13 +66,13 @@
6666
#endif /* UNDER_CE */
6767
6868
/* Reset gzip file state */
6969
local void gz_reset(gz_statep state) {
7070
state->x.have = 0; /* no output data available */
71
+ state->past = 0; /* have not read past end yet */
7172
if (state->mode == GZ_READ) { /* for reading ... */
7273
state->eof = 0; /* not at end of file */
73
- state->past = 0; /* have not read past end yet */
7474
state->how = LOOK; /* look for gzip header */
7575
state->junk = -1; /* mark first member */
7676
}
7777
else /* for writing ... */
7878
state->reset = 0; /* no deflateReset pending */
@@ -86,13 +86,11 @@
8686
/* Open a gzip file either by name or file descriptor. */
8787
local gzFile gz_open(const void *path, int fd, const char *mode) {
8888
gz_statep state;
8989
z_size_t len;
9090
int oflag = 0;
91
-#ifdef O_EXCL
9291
int exclusive = 0;
93
-#endif
9492
9593
/* check input */
9694
if (path == NULL || mode == NULL)
9795
return NULL;
9896
@@ -134,15 +132,13 @@
134132
#ifdef O_CLOEXEC
135133
case 'e':
136134
oflag |= O_CLOEXEC;
137135
break;
138136
#endif
139
-#ifdef O_EXCL
140137
case 'x':
141138
exclusive = 1;
142139
break;
143
-#endif
144140
case 'f':
145141
state->strategy = Z_FILTERED;
146142
break;
147143
case 'h':
148144
state->strategy = Z_HUFFMAN_ONLY;
@@ -193,15 +189,26 @@
193189
free(state);
194190
return NULL;
195191
}
196192
/* if reading, direct == 1 for auto-detect, -1 for gzip only; if writing or
197193
appending, direct == 0 for gzip, 1 for transparent (copy in to out) */
194
+
195
+#ifndef O_EXCL
196
+ if (exclusive && state->mode != GZ_READ && fd < 0) {
197
+ /* exclusive creation request can't be honored -- fail out */
198
+ free(state);
199
+ return NULL;
200
+ }
201
+#endif
198202
199203
/* save the path name for error messages */
200204
#ifdef WIDECHAR
201
- if (fd == -2)
205
+ if (fd == -2) {
202206
len = wcstombs(NULL, path, 0);
207
+ if (len == (z_size_t)-1)
208
+ len = 0; /* not representable in the current locale */
209
+ }
203210
else
204211
#endif
205212
len = strlen((const char *)path);
206213
state->path = (char *)malloc(len + 1);
207214
if (state->path == NULL) {
@@ -208,22 +215,20 @@
208215
free(state);
209216
return NULL;
210217
}
211218
#ifdef WIDECHAR
212219
if (fd == -2) {
213
- if (len)
214
- wcstombs(state->path, path, len + 1);
215
- else
220
+ if (len == 0 || wcstombs(state->path, path, len + 1) != len)
216221
*(state->path) = 0;
217222
}
218223
else
219224
#endif
220225
{
221226
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
222227
(void)snprintf(state->path, len + 1, "%s", (const char *)path);
223228
#else
224
- strcpy(state->path, path);
229
+ strcpy(state->path, (const char *)path);
225230
#endif
226231
}
227232
228233
/* compute the flags for open() */
229234
oflag |=
@@ -253,13 +258,13 @@
253258
else {
254259
#ifdef O_NONBLOCK
255260
if (oflag & O_NONBLOCK)
256261
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
257262
#endif
258
-#ifdef O_CLOEXEC
263
+#if defined(O_CLOEXEC) && defined(FD_CLOEXEC)
259264
if (oflag & O_CLOEXEC)
260
- fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | O_CLOEXEC);
265
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
261266
#endif
262267
state->fd = fd;
263268
}
264269
if (state->fd == -1) {
265270
free(state->path);
@@ -297,11 +302,11 @@
297302
/* -- see zlib.h -- */
298303
gzFile ZEXPORT gzdopen(int fd, const char *mode) {
299304
char *path; /* identifier for error messages */
300305
gzFile gz;
301306
302
- if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
307
+ if (fd < 0 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
303308
return NULL;
304309
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
305310
(void)snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd);
306311
#else
307312
sprintf(path, "<fd:%d>", fd); /* for debugging */
@@ -364,11 +369,11 @@
364369
}
365370
366371
/* -- see zlib.h -- */
367372
z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
368373
unsigned n;
369
- z_off64_t ret;
374
+ z_off64_t ret, pos;
370375
gz_statep state;
371376
372377
/* get internal structure and check integrity */
373378
if (file == NULL)
374379
return -1;
@@ -382,44 +387,43 @@
382387
383388
/* can only seek from start or relative to current position */
384389
if (whence != SEEK_SET && whence != SEEK_CUR)
385390
return -1;
386391
387
- /* normalize offset to a SEEK_CUR specification */
388
- if (whence == SEEK_SET)
389
- offset -= state->x.pos;
390
- else {
391
- offset += state->past ? 0 : state->skip;
392
- state->skip = 0;
393
- }
392
+ /* compute the absolute position */
393
+ pos = whence == SEEK_SET ? 0 :
394
+ state->x.pos + (state->past ? 0 : state->skip);
395
+ if (offset > GZ_OFF_MAX - pos)
396
+ return -1; /* would overflow z_off64_t */
397
+ if (offset < -pos)
398
+ return -1; /* before start of file */
399
+ pos += offset;
394400
395401
/* if within raw area while reading, just go there */
396
- if (state->mode == GZ_READ && state->how == COPY &&
397
- state->x.pos + offset >= 0) {
398
- ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR);
402
+ if (state->mode == GZ_READ && state->how == COPY) {
403
+ ret = LSEEK(state->fd, pos - state->x.pos - (z_off64_t)state->x.have,
404
+ SEEK_CUR);
399405
if (ret == -1)
400406
return -1;
401407
state->x.have = 0;
402408
state->eof = 0;
403409
state->past = 0;
404410
state->skip = 0;
405411
gz_error(state, Z_OK, NULL);
406412
state->strm.avail_in = 0;
407
- state->x.pos += offset;
408
- return state->x.pos;
413
+ state->x.pos = pos;
414
+ return pos;
409415
}
410416
411
- /* calculate skip amount, rewinding if needed for back seek when reading */
412
- if (offset < 0) {
417
+ /* rewind if needed for back seek when reading */
418
+ if (pos < state->x.pos) {
413419
if (state->mode != GZ_READ) /* writing -- can't go backwards */
414420
return -1;
415
- offset += state->x.pos;
416
- if (offset < 0) /* before start of file! */
417
- return -1;
418
- if (gzrewind(file) == -1) /* rewind, then skip to offset */
421
+ if (gzrewind(file) == -1) /* rewind, then skip to pos */
419422
return -1;
420423
}
424
+ offset = pos - state->x.pos;
421425
422426
/* if reading, skip what's in output buffer (one less gzgetc() check) */
423427
if (state->mode == GZ_READ) {
424428
n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
425429
(unsigned)offset : state->x.have;
@@ -429,11 +433,11 @@
429433
offset -= n;
430434
}
431435
432436
/* request skip (if not zero) */
433437
state->skip = offset;
434
- return state->x.pos + offset;
438
+ return pos;
435439
}
436440
437441
/* -- see zlib.h -- */
438442
z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
439443
z_off64_t ret;
@@ -558,14 +562,10 @@
558562
if (state->err != Z_MEM_ERROR)
559563
free(state->msg);
560564
state->msg = NULL;
561565
}
562566
563
- /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
564
- if (err != Z_OK && err != Z_BUF_ERROR && !state->again)
565
- state->x.have = 0;
566
-
567567
/* set error code, and if no message, then done */
568568
state->err = err;
569569
if (msg == NULL)
570570
return;
571571
572572
--- compat/zlib/gzlib.c
+++ compat/zlib/gzlib.c
@@ -66,13 +66,13 @@
66 #endif /* UNDER_CE */
67
68 /* Reset gzip file state */
69 local void gz_reset(gz_statep state) {
70 state->x.have = 0; /* no output data available */
 
71 if (state->mode == GZ_READ) { /* for reading ... */
72 state->eof = 0; /* not at end of file */
73 state->past = 0; /* have not read past end yet */
74 state->how = LOOK; /* look for gzip header */
75 state->junk = -1; /* mark first member */
76 }
77 else /* for writing ... */
78 state->reset = 0; /* no deflateReset pending */
@@ -86,13 +86,11 @@
86 /* Open a gzip file either by name or file descriptor. */
87 local gzFile gz_open(const void *path, int fd, const char *mode) {
88 gz_statep state;
89 z_size_t len;
90 int oflag = 0;
91 #ifdef O_EXCL
92 int exclusive = 0;
93 #endif
94
95 /* check input */
96 if (path == NULL || mode == NULL)
97 return NULL;
98
@@ -134,15 +132,13 @@
134 #ifdef O_CLOEXEC
135 case 'e':
136 oflag |= O_CLOEXEC;
137 break;
138 #endif
139 #ifdef O_EXCL
140 case 'x':
141 exclusive = 1;
142 break;
143 #endif
144 case 'f':
145 state->strategy = Z_FILTERED;
146 break;
147 case 'h':
148 state->strategy = Z_HUFFMAN_ONLY;
@@ -193,15 +189,26 @@
193 free(state);
194 return NULL;
195 }
196 /* if reading, direct == 1 for auto-detect, -1 for gzip only; if writing or
197 appending, direct == 0 for gzip, 1 for transparent (copy in to out) */
 
 
 
 
 
 
 
 
198
199 /* save the path name for error messages */
200 #ifdef WIDECHAR
201 if (fd == -2)
202 len = wcstombs(NULL, path, 0);
 
 
 
203 else
204 #endif
205 len = strlen((const char *)path);
206 state->path = (char *)malloc(len + 1);
207 if (state->path == NULL) {
@@ -208,22 +215,20 @@
208 free(state);
209 return NULL;
210 }
211 #ifdef WIDECHAR
212 if (fd == -2) {
213 if (len)
214 wcstombs(state->path, path, len + 1);
215 else
216 *(state->path) = 0;
217 }
218 else
219 #endif
220 {
221 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
222 (void)snprintf(state->path, len + 1, "%s", (const char *)path);
223 #else
224 strcpy(state->path, path);
225 #endif
226 }
227
228 /* compute the flags for open() */
229 oflag |=
@@ -253,13 +258,13 @@
253 else {
254 #ifdef O_NONBLOCK
255 if (oflag & O_NONBLOCK)
256 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
257 #endif
258 #ifdef O_CLOEXEC
259 if (oflag & O_CLOEXEC)
260 fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | O_CLOEXEC);
261 #endif
262 state->fd = fd;
263 }
264 if (state->fd == -1) {
265 free(state->path);
@@ -297,11 +302,11 @@
297 /* -- see zlib.h -- */
298 gzFile ZEXPORT gzdopen(int fd, const char *mode) {
299 char *path; /* identifier for error messages */
300 gzFile gz;
301
302 if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
303 return NULL;
304 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
305 (void)snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd);
306 #else
307 sprintf(path, "<fd:%d>", fd); /* for debugging */
@@ -364,11 +369,11 @@
364 }
365
366 /* -- see zlib.h -- */
367 z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
368 unsigned n;
369 z_off64_t ret;
370 gz_statep state;
371
372 /* get internal structure and check integrity */
373 if (file == NULL)
374 return -1;
@@ -382,44 +387,43 @@
382
383 /* can only seek from start or relative to current position */
384 if (whence != SEEK_SET && whence != SEEK_CUR)
385 return -1;
386
387 /* normalize offset to a SEEK_CUR specification */
388 if (whence == SEEK_SET)
389 offset -= state->x.pos;
390 else {
391 offset += state->past ? 0 : state->skip;
392 state->skip = 0;
393 }
 
394
395 /* if within raw area while reading, just go there */
396 if (state->mode == GZ_READ && state->how == COPY &&
397 state->x.pos + offset >= 0) {
398 ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR);
399 if (ret == -1)
400 return -1;
401 state->x.have = 0;
402 state->eof = 0;
403 state->past = 0;
404 state->skip = 0;
405 gz_error(state, Z_OK, NULL);
406 state->strm.avail_in = 0;
407 state->x.pos += offset;
408 return state->x.pos;
409 }
410
411 /* calculate skip amount, rewinding if needed for back seek when reading */
412 if (offset < 0) {
413 if (state->mode != GZ_READ) /* writing -- can't go backwards */
414 return -1;
415 offset += state->x.pos;
416 if (offset < 0) /* before start of file! */
417 return -1;
418 if (gzrewind(file) == -1) /* rewind, then skip to offset */
419 return -1;
420 }
 
421
422 /* if reading, skip what's in output buffer (one less gzgetc() check) */
423 if (state->mode == GZ_READ) {
424 n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
425 (unsigned)offset : state->x.have;
@@ -429,11 +433,11 @@
429 offset -= n;
430 }
431
432 /* request skip (if not zero) */
433 state->skip = offset;
434 return state->x.pos + offset;
435 }
436
437 /* -- see zlib.h -- */
438 z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
439 z_off64_t ret;
@@ -558,14 +562,10 @@
558 if (state->err != Z_MEM_ERROR)
559 free(state->msg);
560 state->msg = NULL;
561 }
562
563 /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
564 if (err != Z_OK && err != Z_BUF_ERROR && !state->again)
565 state->x.have = 0;
566
567 /* set error code, and if no message, then done */
568 state->err = err;
569 if (msg == NULL)
570 return;
571
572
--- compat/zlib/gzlib.c
+++ compat/zlib/gzlib.c
@@ -66,13 +66,13 @@
66 #endif /* UNDER_CE */
67
68 /* Reset gzip file state */
69 local void gz_reset(gz_statep state) {
70 state->x.have = 0; /* no output data available */
71 state->past = 0; /* have not read past end yet */
72 if (state->mode == GZ_READ) { /* for reading ... */
73 state->eof = 0; /* not at end of file */
 
74 state->how = LOOK; /* look for gzip header */
75 state->junk = -1; /* mark first member */
76 }
77 else /* for writing ... */
78 state->reset = 0; /* no deflateReset pending */
@@ -86,13 +86,11 @@
86 /* Open a gzip file either by name or file descriptor. */
87 local gzFile gz_open(const void *path, int fd, const char *mode) {
88 gz_statep state;
89 z_size_t len;
90 int oflag = 0;
 
91 int exclusive = 0;
 
92
93 /* check input */
94 if (path == NULL || mode == NULL)
95 return NULL;
96
@@ -134,15 +132,13 @@
132 #ifdef O_CLOEXEC
133 case 'e':
134 oflag |= O_CLOEXEC;
135 break;
136 #endif
 
137 case 'x':
138 exclusive = 1;
139 break;
 
140 case 'f':
141 state->strategy = Z_FILTERED;
142 break;
143 case 'h':
144 state->strategy = Z_HUFFMAN_ONLY;
@@ -193,15 +189,26 @@
189 free(state);
190 return NULL;
191 }
192 /* if reading, direct == 1 for auto-detect, -1 for gzip only; if writing or
193 appending, direct == 0 for gzip, 1 for transparent (copy in to out) */
194
195 #ifndef O_EXCL
196 if (exclusive && state->mode != GZ_READ && fd < 0) {
197 /* exclusive creation request can't be honored -- fail out */
198 free(state);
199 return NULL;
200 }
201 #endif
202
203 /* save the path name for error messages */
204 #ifdef WIDECHAR
205 if (fd == -2) {
206 len = wcstombs(NULL, path, 0);
207 if (len == (z_size_t)-1)
208 len = 0; /* not representable in the current locale */
209 }
210 else
211 #endif
212 len = strlen((const char *)path);
213 state->path = (char *)malloc(len + 1);
214 if (state->path == NULL) {
@@ -208,22 +215,20 @@
215 free(state);
216 return NULL;
217 }
218 #ifdef WIDECHAR
219 if (fd == -2) {
220 if (len == 0 || wcstombs(state->path, path, len + 1) != len)
 
 
221 *(state->path) = 0;
222 }
223 else
224 #endif
225 {
226 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
227 (void)snprintf(state->path, len + 1, "%s", (const char *)path);
228 #else
229 strcpy(state->path, (const char *)path);
230 #endif
231 }
232
233 /* compute the flags for open() */
234 oflag |=
@@ -253,13 +258,13 @@
258 else {
259 #ifdef O_NONBLOCK
260 if (oflag & O_NONBLOCK)
261 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
262 #endif
263 #if defined(O_CLOEXEC) && defined(FD_CLOEXEC)
264 if (oflag & O_CLOEXEC)
265 fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
266 #endif
267 state->fd = fd;
268 }
269 if (state->fd == -1) {
270 free(state->path);
@@ -297,11 +302,11 @@
302 /* -- see zlib.h -- */
303 gzFile ZEXPORT gzdopen(int fd, const char *mode) {
304 char *path; /* identifier for error messages */
305 gzFile gz;
306
307 if (fd < 0 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
308 return NULL;
309 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
310 (void)snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd);
311 #else
312 sprintf(path, "<fd:%d>", fd); /* for debugging */
@@ -364,11 +369,11 @@
369 }
370
371 /* -- see zlib.h -- */
372 z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
373 unsigned n;
374 z_off64_t ret, pos;
375 gz_statep state;
376
377 /* get internal structure and check integrity */
378 if (file == NULL)
379 return -1;
@@ -382,44 +387,43 @@
387
388 /* can only seek from start or relative to current position */
389 if (whence != SEEK_SET && whence != SEEK_CUR)
390 return -1;
391
392 /* compute the absolute position */
393 pos = whence == SEEK_SET ? 0 :
394 state->x.pos + (state->past ? 0 : state->skip);
395 if (offset > GZ_OFF_MAX - pos)
396 return -1; /* would overflow z_off64_t */
397 if (offset < -pos)
398 return -1; /* before start of file */
399 pos += offset;
400
401 /* if within raw area while reading, just go there */
402 if (state->mode == GZ_READ && state->how == COPY) {
403 ret = LSEEK(state->fd, pos - state->x.pos - (z_off64_t)state->x.have,
404 SEEK_CUR);
405 if (ret == -1)
406 return -1;
407 state->x.have = 0;
408 state->eof = 0;
409 state->past = 0;
410 state->skip = 0;
411 gz_error(state, Z_OK, NULL);
412 state->strm.avail_in = 0;
413 state->x.pos = pos;
414 return pos;
415 }
416
417 /* rewind if needed for back seek when reading */
418 if (pos < state->x.pos) {
419 if (state->mode != GZ_READ) /* writing -- can't go backwards */
420 return -1;
421 if (gzrewind(file) == -1) /* rewind, then skip to pos */
 
 
 
422 return -1;
423 }
424 offset = pos - state->x.pos;
425
426 /* if reading, skip what's in output buffer (one less gzgetc() check) */
427 if (state->mode == GZ_READ) {
428 n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
429 (unsigned)offset : state->x.have;
@@ -429,11 +433,11 @@
433 offset -= n;
434 }
435
436 /* request skip (if not zero) */
437 state->skip = offset;
438 return pos;
439 }
440
441 /* -- see zlib.h -- */
442 z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
443 z_off64_t ret;
@@ -558,14 +562,10 @@
562 if (state->err != Z_MEM_ERROR)
563 free(state->msg);
564 state->msg = NULL;
565 }
566
 
 
 
 
567 /* set error code, and if no message, then done */
568 state->err = err;
569 if (msg == NULL)
570 return;
571
572
--- compat/zlib/gzread.c
+++ compat/zlib/gzread.c
@@ -31,11 +31,11 @@
3131
if (ret <= 0)
3232
break;
3333
*have += (unsigned)ret;
3434
} while (*have < len);
3535
if (ret < 0) {
36
- if (errno == EAGAIN || errno == EWOULDBLOCK) {
36
+ if (BLOCKED(errno)) {
3737
state->again = 1;
3838
if (*have != 0)
3939
return 0;
4040
}
4141
gz_error(state, Z_ERRNO, zstrerror());
@@ -123,10 +123,17 @@
123123
124124
/* if transparent reading is disabled, which would only be at the start, or
125125
if we're looking for a gzip member after the first one, which is not at
126126
the start, then proceed directly to look for a gzip member next */
127127
if (state->direct == -1 || state->junk == 0) {
128
+ /* wait for input before committing to another gzip member */
129
+ if (state->junk == 0 && strm->avail_in == 0) {
130
+ if (gz_avail(state) == -1)
131
+ return -1;
132
+ if (strm->avail_in == 0)
133
+ return 0;
134
+ }
128135
inflateReset(strm);
129136
state->how = GZIP;
130137
state->junk = state->junk != -1;
131138
state->direct = 0;
132139
return 0;
@@ -151,11 +158,11 @@
151158
if (strm->avail_in > 3 &&
152159
strm->next_in[0] == 31 && strm->next_in[1] == 139 &&
153160
strm->next_in[2] == 8 && strm->next_in[3] < 32) {
154161
inflateReset(strm);
155162
state->how = GZIP;
156
- state->junk = 1;
163
+ state->junk = 0;
157164
state->direct = 0;
158165
return 0;
159166
}
160167
161168
/* doing raw i/o: copy any leftover input to output -- this assumes that
@@ -246,10 +253,15 @@
246253
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
247254
end of the input file has been reached and all data has been processed. */
248255
local int gz_fetch(gz_statep state) {
249256
z_streamp strm = &(state->strm);
250257
258
+ /* after a serious error, only what is already in the output buffer is
259
+ delivered -- don't try to decompress any more */
260
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
261
+ return -1;
262
+
251263
do {
252264
switch(state->how) {
253265
case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
254266
if (gz_look(state) == -1)
255267
return -1;
@@ -273,37 +285,51 @@
273285
return -1;
274286
}
275287
} while (state->x.have == 0 && (!state->eof || strm->avail_in));
276288
return 0;
277289
}
290
+
291
+/* Apply as much of a pending skip request as the output already available in
292
+ state->x allows. */
293
+local void gz_skip_have(gz_statep state) {
294
+ unsigned n;
295
+
296
+ n = GT_OFF(state->x.have) ||
297
+ (z_off64_t)state->x.have > state->skip ?
298
+ (unsigned)state->skip : state->x.have;
299
+ state->x.have -= n;
300
+ state->x.next += n;
301
+ state->x.pos += n;
302
+ state->skip -= n;
303
+}
278304
279305
/* Skip state->skip (> 0) uncompressed bytes of output. Return -1 on error, 0
280306
on success. */
281307
local int gz_skip(gz_statep state) {
282
- unsigned n;
283
-
284308
/* skip over len bytes or reach end-of-file, whichever comes first */
285309
do {
286310
/* skip over whatever is in output buffer */
287
- if (state->x.have) {
288
- n = GT_OFF(state->x.have) ||
289
- (z_off64_t)state->x.have > state->skip ?
290
- (unsigned)state->skip : state->x.have;
291
- state->x.have -= n;
292
- state->x.next += n;
293
- state->x.pos += n;
294
- state->skip -= n;
295
- }
311
+ if (state->x.have)
312
+ gz_skip_have(state);
296313
297314
/* output buffer empty -- return if we're at the end of the input */
298
- else if (state->eof && state->strm.avail_in == 0)
315
+ else if (state->eof && state->strm.avail_in == 0) {
316
+ if (state->how == GZIP && state->err == Z_OK)
317
+ gz_error(state, Z_BUF_ERROR, "unexpected end of file");
318
+ state->skip = 0;
319
+ state->past = 1;
299320
break;
321
+ }
300322
301323
/* need more data to skip -- load up output buffer */
302324
else {
303
- /* get more output, looking for header if required */
304
- if (gz_fetch(state) == -1)
325
+ /* get more output, looking for header if required. If the fetch
326
+ stalled but provided some output, consume it before returning
327
+ so that x.have > 0 always implies the data is at the current
328
+ logical position (x.pos), as assumed by the gzgetc() fast path
329
+ in zlib.h and gzread.c */
330
+ if (gz_fetch(state) == -1 && state->x.have == 0)
305331
return -1;
306332
}
307333
} while (state->skip);
308334
return 0;
309335
}
@@ -347,12 +373,15 @@
347373
/* caught deferred error from gz_fetch() */
348374
err = -1;
349375
}
350376
351377
/* output buffer empty -- return if we're at the end of the input */
352
- else if (state->eof && state->strm.avail_in == 0)
378
+ else if (state->eof && state->strm.avail_in == 0) {
379
+ if (state->how == GZIP && state->err == Z_OK)
380
+ gz_error(state, Z_BUF_ERROR, "unexpected end of file");
353381
break;
382
+ }
354383
355384
/* need output data -- for small len or new stream load up our output
356385
buffer, so that gzgetc() can be fast */
357386
else if (state->how == LOOK || n < (state->size << 1)) {
358387
/* get more output, looking for header if required */
@@ -401,19 +430,25 @@
401430
return -1;
402431
state = (gz_statep)file;
403432
if (state->mode != GZ_READ)
404433
return -1;
405434
406
- /* check that there was no (serious) error */
407
- if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
435
+ /* check that there was no (serious) error -- if there was, deliver any
436
+ data read before the error until it is exhausted, and only then return
437
+ the error */
438
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
439
+ state->x.have == 0)
408440
return -1;
409
- gz_error(state, Z_OK, NULL);
441
+ if (state->again)
442
+ gz_error(state, Z_OK, NULL);
410443
411444
/* since an int is returned, make sure len fits in one, otherwise return
412
- with an error (this avoids a flaw in the interface) */
445
+ with an error (this avoids a flaw in the interface) -- keep a pending
446
+ serious error, which is the one the caller needs to see */
413447
if ((int)len < 0) {
414
- gz_error(state, Z_STREAM_ERROR, "request does not fit in an int");
448
+ if (state->err == Z_OK || state->err == Z_BUF_ERROR)
449
+ gz_error(state, Z_STREAM_ERROR, "request does not fit in an int");
415450
return -1;
416451
}
417452
418453
/* read len or fewer bytes to buf */
419454
len = (unsigned)gz_read(state, buf, len);
@@ -446,19 +481,26 @@
446481
return 0;
447482
state = (gz_statep)file;
448483
if (state->mode != GZ_READ)
449484
return 0;
450485
451
- /* check that there was no (serious) error */
452
- if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
486
+ /* check that there was no (serious) error -- if there was, deliver any
487
+ data read before the error until it is exhausted, and only then return
488
+ the error */
489
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
490
+ state->x.have == 0)
453491
return 0;
454
- gz_error(state, Z_OK, NULL);
492
+ if (state->again)
493
+ gz_error(state, Z_OK, NULL);
455494
456
- /* compute bytes to read -- error on overflow */
495
+ /* compute bytes to read -- error on overflow, keeping a pending serious
496
+ error, which is the one the caller needs to see */
457497
len = nitems * size;
458498
if (size && len / size != nitems) {
459
- gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
499
+ if (state->err == Z_OK || state->err == Z_BUF_ERROR)
500
+ gz_error(state, Z_STREAM_ERROR,
501
+ "request does not fit in a size_t");
460502
return 0;
461503
}
462504
463505
/* read len or fewer bytes to buf, return the number of full items read */
464506
return len ? gz_read(state, buf, len) / size : 0;
@@ -479,14 +521,18 @@
479521
return -1;
480522
state = (gz_statep)file;
481523
if (state->mode != GZ_READ)
482524
return -1;
483525
484
- /* check that there was no (serious) error */
485
- if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
526
+ /* check that there was no (serious) error -- if there was, deliver any
527
+ data read before the error until it is exhausted, and only then return
528
+ the error, as the gzgetc() macro does */
529
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
530
+ state->x.have == 0)
486531
return -1;
487
- gz_error(state, Z_OK, NULL);
532
+ if (state->again)
533
+ gz_error(state, Z_OK, NULL);
488534
489535
/* try output buffer (no need to check for skip request) */
490536
if (state->x.have) {
491537
state->x.have--;
492538
state->x.pos++;
@@ -514,14 +560,19 @@
514560
515561
/* in case this was just opened, set up the input buffer */
516562
if (state->how == LOOK && state->x.have == 0)
517563
(void)gz_look(state);
518564
519
- /* check that there was no (serious) error */
520
- if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
565
+ /* check that there was no (serious) error -- a character can still be
566
+ pushed back after one, since it is data that was read before the
567
+ error, and it will be returned before the error is signaled -- but only
568
+ if there is an output buffer to put it in */
569
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
570
+ state->size == 0)
521571
return -1;
522
- gz_error(state, Z_OK, NULL);
572
+ if (state->again)
573
+ gz_error(state, Z_OK, NULL);
523574
524575
/* process a skip request */
525576
if (state->skip && gz_skip(state) == -1)
526577
return -1;
527578
@@ -539,11 +590,12 @@
539590
return c;
540591
}
541592
542593
/* if no room, give up (must have already done a gzungetc()) */
543594
if (state->x.have == (state->size << 1)) {
544
- gz_error(state, Z_DATA_ERROR, "out of room to push characters");
595
+ if (state->err == Z_OK || state->err == Z_BUF_ERROR)
596
+ gz_error(state, Z_DATA_ERROR, "out of room to push characters");
545597
return -1;
546598
}
547599
548600
/* slide output data if needed and insert byte before existing data */
549601
if (state->x.next == state->out) {
@@ -575,14 +627,18 @@
575627
return NULL;
576628
state = (gz_statep)file;
577629
if (state->mode != GZ_READ)
578630
return NULL;
579631
580
- /* check that there was no (serious) error */
581
- if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
632
+ /* check that there was no (serious) error -- if there was, deliver any
633
+ data read before the error until it is exhausted, and only then return
634
+ the error */
635
+ if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
636
+ state->x.have == 0)
582637
return NULL;
583
- gz_error(state, Z_OK, NULL);
638
+ if (state->again)
639
+ gz_error(state, Z_OK, NULL);
584640
585641
/* process a skip request */
586642
if (state->skip && gz_skip(state) == -1)
587643
return NULL;
588644
@@ -590,12 +646,13 @@
590646
whichever comes first */
591647
str = buf;
592648
left = (unsigned)len - 1;
593649
if (left) do {
594650
/* assure that something is in the output buffer */
595
- if (state->x.have == 0 && gz_fetch(state) == -1)
596
- break; /* error */
651
+ if (state->x.have == 0 && gz_fetch(state) == -1 &&
652
+ state->x.have == 0)
653
+ break; /* error, and nothing left to return */
597654
if (state->x.have == 0) { /* end of file */
598655
state->past = 1; /* read past end */
599656
break; /* return what we have */
600657
}
601658
@@ -615,11 +672,11 @@
615672
} while (left && eol == NULL);
616673
617674
/* append a terminating zero to the string (we don't check for a zero in
618675
the contents, let the user worry about that) -- return the terminated
619676
string, or if nothing was read, NULL */
620
- if (buf == str)
677
+ if (buf == str && len > 1)
621678
return NULL;
622679
buf[0] = 0;
623680
return str;
624681
}
625682
@@ -632,12 +689,14 @@
632689
return 0;
633690
state = (gz_statep)file;
634691
635692
/* if the state is not known, but we can find out, then do so (this is
636693
mainly for right after a gzopen() or gzdopen()) */
637
- if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
694
+ if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) {
638695
(void)gz_look(state);
696
+ gz_skip_have(state); /* apply skip to current buffer */
697
+ }
639698
640699
/* return 1 if transparent, 0 if processing a gzip stream */
641700
return state->direct == 1;
642701
}
643702
644703
--- compat/zlib/gzread.c
+++ compat/zlib/gzread.c
@@ -31,11 +31,11 @@
31 if (ret <= 0)
32 break;
33 *have += (unsigned)ret;
34 } while (*have < len);
35 if (ret < 0) {
36 if (errno == EAGAIN || errno == EWOULDBLOCK) {
37 state->again = 1;
38 if (*have != 0)
39 return 0;
40 }
41 gz_error(state, Z_ERRNO, zstrerror());
@@ -123,10 +123,17 @@
123
124 /* if transparent reading is disabled, which would only be at the start, or
125 if we're looking for a gzip member after the first one, which is not at
126 the start, then proceed directly to look for a gzip member next */
127 if (state->direct == -1 || state->junk == 0) {
 
 
 
 
 
 
 
128 inflateReset(strm);
129 state->how = GZIP;
130 state->junk = state->junk != -1;
131 state->direct = 0;
132 return 0;
@@ -151,11 +158,11 @@
151 if (strm->avail_in > 3 &&
152 strm->next_in[0] == 31 && strm->next_in[1] == 139 &&
153 strm->next_in[2] == 8 && strm->next_in[3] < 32) {
154 inflateReset(strm);
155 state->how = GZIP;
156 state->junk = 1;
157 state->direct = 0;
158 return 0;
159 }
160
161 /* doing raw i/o: copy any leftover input to output -- this assumes that
@@ -246,10 +253,15 @@
246 otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
247 end of the input file has been reached and all data has been processed. */
248 local int gz_fetch(gz_statep state) {
249 z_streamp strm = &(state->strm);
250
 
 
 
 
 
251 do {
252 switch(state->how) {
253 case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
254 if (gz_look(state) == -1)
255 return -1;
@@ -273,37 +285,51 @@
273 return -1;
274 }
275 } while (state->x.have == 0 && (!state->eof || strm->avail_in));
276 return 0;
277 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
279 /* Skip state->skip (> 0) uncompressed bytes of output. Return -1 on error, 0
280 on success. */
281 local int gz_skip(gz_statep state) {
282 unsigned n;
283
284 /* skip over len bytes or reach end-of-file, whichever comes first */
285 do {
286 /* skip over whatever is in output buffer */
287 if (state->x.have) {
288 n = GT_OFF(state->x.have) ||
289 (z_off64_t)state->x.have > state->skip ?
290 (unsigned)state->skip : state->x.have;
291 state->x.have -= n;
292 state->x.next += n;
293 state->x.pos += n;
294 state->skip -= n;
295 }
296
297 /* output buffer empty -- return if we're at the end of the input */
298 else if (state->eof && state->strm.avail_in == 0)
 
 
 
 
299 break;
 
300
301 /* need more data to skip -- load up output buffer */
302 else {
303 /* get more output, looking for header if required */
304 if (gz_fetch(state) == -1)
 
 
 
 
305 return -1;
306 }
307 } while (state->skip);
308 return 0;
309 }
@@ -347,12 +373,15 @@
347 /* caught deferred error from gz_fetch() */
348 err = -1;
349 }
350
351 /* output buffer empty -- return if we're at the end of the input */
352 else if (state->eof && state->strm.avail_in == 0)
 
 
353 break;
 
354
355 /* need output data -- for small len or new stream load up our output
356 buffer, so that gzgetc() can be fast */
357 else if (state->how == LOOK || n < (state->size << 1)) {
358 /* get more output, looking for header if required */
@@ -401,19 +430,25 @@
401 return -1;
402 state = (gz_statep)file;
403 if (state->mode != GZ_READ)
404 return -1;
405
406 /* check that there was no (serious) error */
407 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
 
 
 
408 return -1;
409 gz_error(state, Z_OK, NULL);
 
410
411 /* since an int is returned, make sure len fits in one, otherwise return
412 with an error (this avoids a flaw in the interface) */
 
413 if ((int)len < 0) {
414 gz_error(state, Z_STREAM_ERROR, "request does not fit in an int");
 
415 return -1;
416 }
417
418 /* read len or fewer bytes to buf */
419 len = (unsigned)gz_read(state, buf, len);
@@ -446,19 +481,26 @@
446 return 0;
447 state = (gz_statep)file;
448 if (state->mode != GZ_READ)
449 return 0;
450
451 /* check that there was no (serious) error */
452 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
 
 
 
453 return 0;
454 gz_error(state, Z_OK, NULL);
 
455
456 /* compute bytes to read -- error on overflow */
 
457 len = nitems * size;
458 if (size && len / size != nitems) {
459 gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
 
 
460 return 0;
461 }
462
463 /* read len or fewer bytes to buf, return the number of full items read */
464 return len ? gz_read(state, buf, len) / size : 0;
@@ -479,14 +521,18 @@
479 return -1;
480 state = (gz_statep)file;
481 if (state->mode != GZ_READ)
482 return -1;
483
484 /* check that there was no (serious) error */
485 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
 
 
 
486 return -1;
487 gz_error(state, Z_OK, NULL);
 
488
489 /* try output buffer (no need to check for skip request) */
490 if (state->x.have) {
491 state->x.have--;
492 state->x.pos++;
@@ -514,14 +560,19 @@
514
515 /* in case this was just opened, set up the input buffer */
516 if (state->how == LOOK && state->x.have == 0)
517 (void)gz_look(state);
518
519 /* check that there was no (serious) error */
520 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
 
 
 
 
521 return -1;
522 gz_error(state, Z_OK, NULL);
 
523
524 /* process a skip request */
525 if (state->skip && gz_skip(state) == -1)
526 return -1;
527
@@ -539,11 +590,12 @@
539 return c;
540 }
541
542 /* if no room, give up (must have already done a gzungetc()) */
543 if (state->x.have == (state->size << 1)) {
544 gz_error(state, Z_DATA_ERROR, "out of room to push characters");
 
545 return -1;
546 }
547
548 /* slide output data if needed and insert byte before existing data */
549 if (state->x.next == state->out) {
@@ -575,14 +627,18 @@
575 return NULL;
576 state = (gz_statep)file;
577 if (state->mode != GZ_READ)
578 return NULL;
579
580 /* check that there was no (serious) error */
581 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
 
 
 
582 return NULL;
583 gz_error(state, Z_OK, NULL);
 
584
585 /* process a skip request */
586 if (state->skip && gz_skip(state) == -1)
587 return NULL;
588
@@ -590,12 +646,13 @@
590 whichever comes first */
591 str = buf;
592 left = (unsigned)len - 1;
593 if (left) do {
594 /* assure that something is in the output buffer */
595 if (state->x.have == 0 && gz_fetch(state) == -1)
596 break; /* error */
 
597 if (state->x.have == 0) { /* end of file */
598 state->past = 1; /* read past end */
599 break; /* return what we have */
600 }
601
@@ -615,11 +672,11 @@
615 } while (left && eol == NULL);
616
617 /* append a terminating zero to the string (we don't check for a zero in
618 the contents, let the user worry about that) -- return the terminated
619 string, or if nothing was read, NULL */
620 if (buf == str)
621 return NULL;
622 buf[0] = 0;
623 return str;
624 }
625
@@ -632,12 +689,14 @@
632 return 0;
633 state = (gz_statep)file;
634
635 /* if the state is not known, but we can find out, then do so (this is
636 mainly for right after a gzopen() or gzdopen()) */
637 if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
638 (void)gz_look(state);
 
 
639
640 /* return 1 if transparent, 0 if processing a gzip stream */
641 return state->direct == 1;
642 }
643
644
--- compat/zlib/gzread.c
+++ compat/zlib/gzread.c
@@ -31,11 +31,11 @@
31 if (ret <= 0)
32 break;
33 *have += (unsigned)ret;
34 } while (*have < len);
35 if (ret < 0) {
36 if (BLOCKED(errno)) {
37 state->again = 1;
38 if (*have != 0)
39 return 0;
40 }
41 gz_error(state, Z_ERRNO, zstrerror());
@@ -123,10 +123,17 @@
123
124 /* if transparent reading is disabled, which would only be at the start, or
125 if we're looking for a gzip member after the first one, which is not at
126 the start, then proceed directly to look for a gzip member next */
127 if (state->direct == -1 || state->junk == 0) {
128 /* wait for input before committing to another gzip member */
129 if (state->junk == 0 && strm->avail_in == 0) {
130 if (gz_avail(state) == -1)
131 return -1;
132 if (strm->avail_in == 0)
133 return 0;
134 }
135 inflateReset(strm);
136 state->how = GZIP;
137 state->junk = state->junk != -1;
138 state->direct = 0;
139 return 0;
@@ -151,11 +158,11 @@
158 if (strm->avail_in > 3 &&
159 strm->next_in[0] == 31 && strm->next_in[1] == 139 &&
160 strm->next_in[2] == 8 && strm->next_in[3] < 32) {
161 inflateReset(strm);
162 state->how = GZIP;
163 state->junk = 0;
164 state->direct = 0;
165 return 0;
166 }
167
168 /* doing raw i/o: copy any leftover input to output -- this assumes that
@@ -246,10 +253,15 @@
253 otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
254 end of the input file has been reached and all data has been processed. */
255 local int gz_fetch(gz_statep state) {
256 z_streamp strm = &(state->strm);
257
258 /* after a serious error, only what is already in the output buffer is
259 delivered -- don't try to decompress any more */
260 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again)
261 return -1;
262
263 do {
264 switch(state->how) {
265 case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
266 if (gz_look(state) == -1)
267 return -1;
@@ -273,37 +285,51 @@
285 return -1;
286 }
287 } while (state->x.have == 0 && (!state->eof || strm->avail_in));
288 return 0;
289 }
290
291 /* Apply as much of a pending skip request as the output already available in
292 state->x allows. */
293 local void gz_skip_have(gz_statep state) {
294 unsigned n;
295
296 n = GT_OFF(state->x.have) ||
297 (z_off64_t)state->x.have > state->skip ?
298 (unsigned)state->skip : state->x.have;
299 state->x.have -= n;
300 state->x.next += n;
301 state->x.pos += n;
302 state->skip -= n;
303 }
304
305 /* Skip state->skip (> 0) uncompressed bytes of output. Return -1 on error, 0
306 on success. */
307 local int gz_skip(gz_statep state) {
 
 
308 /* skip over len bytes or reach end-of-file, whichever comes first */
309 do {
310 /* skip over whatever is in output buffer */
311 if (state->x.have)
312 gz_skip_have(state);
 
 
 
 
 
 
 
313
314 /* output buffer empty -- return if we're at the end of the input */
315 else if (state->eof && state->strm.avail_in == 0) {
316 if (state->how == GZIP && state->err == Z_OK)
317 gz_error(state, Z_BUF_ERROR, "unexpected end of file");
318 state->skip = 0;
319 state->past = 1;
320 break;
321 }
322
323 /* need more data to skip -- load up output buffer */
324 else {
325 /* get more output, looking for header if required. If the fetch
326 stalled but provided some output, consume it before returning
327 so that x.have > 0 always implies the data is at the current
328 logical position (x.pos), as assumed by the gzgetc() fast path
329 in zlib.h and gzread.c */
330 if (gz_fetch(state) == -1 && state->x.have == 0)
331 return -1;
332 }
333 } while (state->skip);
334 return 0;
335 }
@@ -347,12 +373,15 @@
373 /* caught deferred error from gz_fetch() */
374 err = -1;
375 }
376
377 /* output buffer empty -- return if we're at the end of the input */
378 else if (state->eof && state->strm.avail_in == 0) {
379 if (state->how == GZIP && state->err == Z_OK)
380 gz_error(state, Z_BUF_ERROR, "unexpected end of file");
381 break;
382 }
383
384 /* need output data -- for small len or new stream load up our output
385 buffer, so that gzgetc() can be fast */
386 else if (state->how == LOOK || n < (state->size << 1)) {
387 /* get more output, looking for header if required */
@@ -401,19 +430,25 @@
430 return -1;
431 state = (gz_statep)file;
432 if (state->mode != GZ_READ)
433 return -1;
434
435 /* check that there was no (serious) error -- if there was, deliver any
436 data read before the error until it is exhausted, and only then return
437 the error */
438 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
439 state->x.have == 0)
440 return -1;
441 if (state->again)
442 gz_error(state, Z_OK, NULL);
443
444 /* since an int is returned, make sure len fits in one, otherwise return
445 with an error (this avoids a flaw in the interface) -- keep a pending
446 serious error, which is the one the caller needs to see */
447 if ((int)len < 0) {
448 if (state->err == Z_OK || state->err == Z_BUF_ERROR)
449 gz_error(state, Z_STREAM_ERROR, "request does not fit in an int");
450 return -1;
451 }
452
453 /* read len or fewer bytes to buf */
454 len = (unsigned)gz_read(state, buf, len);
@@ -446,19 +481,26 @@
481 return 0;
482 state = (gz_statep)file;
483 if (state->mode != GZ_READ)
484 return 0;
485
486 /* check that there was no (serious) error -- if there was, deliver any
487 data read before the error until it is exhausted, and only then return
488 the error */
489 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
490 state->x.have == 0)
491 return 0;
492 if (state->again)
493 gz_error(state, Z_OK, NULL);
494
495 /* compute bytes to read -- error on overflow, keeping a pending serious
496 error, which is the one the caller needs to see */
497 len = nitems * size;
498 if (size && len / size != nitems) {
499 if (state->err == Z_OK || state->err == Z_BUF_ERROR)
500 gz_error(state, Z_STREAM_ERROR,
501 "request does not fit in a size_t");
502 return 0;
503 }
504
505 /* read len or fewer bytes to buf, return the number of full items read */
506 return len ? gz_read(state, buf, len) / size : 0;
@@ -479,14 +521,18 @@
521 return -1;
522 state = (gz_statep)file;
523 if (state->mode != GZ_READ)
524 return -1;
525
526 /* check that there was no (serious) error -- if there was, deliver any
527 data read before the error until it is exhausted, and only then return
528 the error, as the gzgetc() macro does */
529 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
530 state->x.have == 0)
531 return -1;
532 if (state->again)
533 gz_error(state, Z_OK, NULL);
534
535 /* try output buffer (no need to check for skip request) */
536 if (state->x.have) {
537 state->x.have--;
538 state->x.pos++;
@@ -514,14 +560,19 @@
560
561 /* in case this was just opened, set up the input buffer */
562 if (state->how == LOOK && state->x.have == 0)
563 (void)gz_look(state);
564
565 /* check that there was no (serious) error -- a character can still be
566 pushed back after one, since it is data that was read before the
567 error, and it will be returned before the error is signaled -- but only
568 if there is an output buffer to put it in */
569 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
570 state->size == 0)
571 return -1;
572 if (state->again)
573 gz_error(state, Z_OK, NULL);
574
575 /* process a skip request */
576 if (state->skip && gz_skip(state) == -1)
577 return -1;
578
@@ -539,11 +590,12 @@
590 return c;
591 }
592
593 /* if no room, give up (must have already done a gzungetc()) */
594 if (state->x.have == (state->size << 1)) {
595 if (state->err == Z_OK || state->err == Z_BUF_ERROR)
596 gz_error(state, Z_DATA_ERROR, "out of room to push characters");
597 return -1;
598 }
599
600 /* slide output data if needed and insert byte before existing data */
601 if (state->x.next == state->out) {
@@ -575,14 +627,18 @@
627 return NULL;
628 state = (gz_statep)file;
629 if (state->mode != GZ_READ)
630 return NULL;
631
632 /* check that there was no (serious) error -- if there was, deliver any
633 data read before the error until it is exhausted, and only then return
634 the error */
635 if (state->err != Z_OK && state->err != Z_BUF_ERROR && !state->again &&
636 state->x.have == 0)
637 return NULL;
638 if (state->again)
639 gz_error(state, Z_OK, NULL);
640
641 /* process a skip request */
642 if (state->skip && gz_skip(state) == -1)
643 return NULL;
644
@@ -590,12 +646,13 @@
646 whichever comes first */
647 str = buf;
648 left = (unsigned)len - 1;
649 if (left) do {
650 /* assure that something is in the output buffer */
651 if (state->x.have == 0 && gz_fetch(state) == -1 &&
652 state->x.have == 0)
653 break; /* error, and nothing left to return */
654 if (state->x.have == 0) { /* end of file */
655 state->past = 1; /* read past end */
656 break; /* return what we have */
657 }
658
@@ -615,11 +672,11 @@
672 } while (left && eol == NULL);
673
674 /* append a terminating zero to the string (we don't check for a zero in
675 the contents, let the user worry about that) -- return the terminated
676 string, or if nothing was read, NULL */
677 if (buf == str && len > 1)
678 return NULL;
679 buf[0] = 0;
680 return str;
681 }
682
@@ -632,12 +689,14 @@
689 return 0;
690 state = (gz_statep)file;
691
692 /* if the state is not known, but we can find out, then do so (this is
693 mainly for right after a gzopen() or gzdopen()) */
694 if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) {
695 (void)gz_look(state);
696 gz_skip_have(state); /* apply skip to current buffer */
697 }
698
699 /* return 1 if transparent, 0 if processing a gzip stream */
700 return state->direct == 1;
701 }
702
703
--- compat/zlib/gzwrite.c
+++ compat/zlib/gzwrite.c
@@ -39,12 +39,12 @@
3939
free(state->out);
4040
free(state->in);
4141
gz_error(state, Z_MEM_ERROR, "out of memory");
4242
return -1;
4343
}
44
- strm->next_in = NULL;
4544
}
45
+ strm->next_in = NULL;
4646
4747
/* mark state as initialized */
4848
state->size = state->want;
4949
5050
/* initialize write buffer if compressing */
@@ -77,11 +77,11 @@
7777
errno = 0;
7878
state->again = 0;
7979
put = strm->avail_in > max ? max : strm->avail_in;
8080
writ = (int)write(state->fd, strm->next_in, put);
8181
if (writ < 0) {
82
- if (errno == EAGAIN || errno == EWOULDBLOCK)
82
+ if (BLOCKED(errno))
8383
state->again = 1;
8484
gz_error(state, Z_ERRNO, zstrerror());
8585
return -1;
8686
}
8787
strm->avail_in -= (unsigned)writ;
@@ -112,11 +112,11 @@
112112
state->again = 0;
113113
put = strm->next_out - state->x.next > (int)max ? max :
114114
(unsigned)(strm->next_out - state->x.next);
115115
writ = (int)write(state->fd, state->x.next, put);
116116
if (writ < 0) {
117
- if (errno == EAGAIN || errno == EWOULDBLOCK)
117
+ if (BLOCKED(errno))
118118
state->again = 1;
119119
gz_error(state, Z_ERRNO, zstrerror());
120120
return -1;
121121
}
122122
state->x.next += writ;
@@ -153,10 +153,15 @@
153153
stall on a non-blocking write destination. */
154154
local int gz_zero(gz_statep state) {
155155
int first, ret;
156156
unsigned n;
157157
z_streamp strm = &(state->strm);
158
+
159
+ /* allocate memory if this is the first time through -- the input buffer
160
+ must exist before it is zeroed below */
161
+ if (state->size == 0 && gz_init(state) == -1)
162
+ return -1;
158163
159164
/* consume whatever's left in the input buffer */
160165
if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
161166
return -1;
162167
@@ -173,12 +178,18 @@
173178
strm->next_in = state->in;
174179
ret = gz_comp(state, Z_NO_FLUSH);
175180
n -= strm->avail_in;
176181
state->x.pos += n;
177182
state->skip -= n;
178
- if (ret == -1)
183
+ if (ret == -1) {
184
+ /* discard any unconsumed zero fill -- it was not yet accounted
185
+ for in state->skip, so it will be generated again when the
186
+ operation is retried */
187
+ strm->avail_in = 0;
188
+ strm->next_in = state->in;
179189
return -1;
190
+ }
180191
} while (state->skip);
181192
return 0;
182193
}
183194
184195
/* Write len bytes from buf to file. Return the number of bytes written. If
@@ -240,13 +251,17 @@
240251
state->strm.avail_in = n;
241252
ret = gz_comp(state, Z_NO_FLUSH);
242253
n -= state->strm.avail_in;
243254
state->x.pos += n;
244255
len -= n;
245
- if (ret == -1)
256
+ if (ret == -1) {
257
+ state->strm.avail_in = 0;
258
+ state->strm.next_in = state->in;
246259
return state->again ? put - len : 0;
260
+ }
247261
} while (len);
262
+ state->strm.next_in = state->in;
248263
}
249264
250265
/* input was all buffered or compressed */
251266
return put;
252267
}
@@ -369,23 +384,25 @@
369384
}
370385
put = gz_write(state, s, len);
371386
return len && put == 0 ? -1 : (int)put;
372387
}
373388
374
-#if (((!defined(STDC) && !defined(Z_HAVE_STDARG_H)) || !defined(NO_vsnprintf)) && \
375
- (defined(STDC) || defined(Z_HAVE_STDARG_H) || !defined(NO_snprintf))) || \
376
- defined(ZLIB_INSECURE)
389
+#if (((!defined(STDC) && !defined(Z_HAVE_STDARG_H)) || \
390
+ !defined(NO_vsnprintf)) && \
391
+ (defined(STDC) || defined(Z_HAVE_STDARG_H) || \
392
+ !defined(NO_snprintf))) || defined(ZLIB_INSECURE)
377393
/* If the second half of the input buffer is occupied, write out the contents.
378394
If there is any input remaining due to a non-blocking stall on write, move
379395
it to the start of the buffer. Return true if this did not open up the
380396
second half of the buffer. state->err should be checked after this to
381397
handle a gz_comp() error. */
382398
local int gz_vacate(gz_statep state) {
383399
z_streamp strm;
384400
385401
strm = &(state->strm);
386
- if (strm->next_in + strm->avail_in <= state->in + state->size)
402
+ if (strm->next_in == NULL ||
403
+ strm->next_in + strm->avail_in <= state->in + state->size)
387404
return 0;
388405
(void)gz_comp(state, Z_NO_FLUSH);
389406
if (strm->avail_in == 0) {
390407
strm->next_in = state->in;
391408
return 0;
@@ -441,10 +458,11 @@
441458
/* There was a non-blocking stall on write, resulting in the part
442459
of the second half of the output buffer being occupied. Return
443460
a Z_BUF_ERROR to let the application know that this gzprintf()
444461
needs to be retried. */
445462
gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
463
+ return state->err;
446464
}
447465
if (!state->again)
448466
return state->err;
449467
}
450468
if (strm->avail_in == 0)
@@ -476,10 +494,18 @@
476494
strm->avail_in += (unsigned)len;
477495
state->x.pos += len;
478496
479497
/* write out buffer if more than half is occupied */
480498
ret = gz_vacate(state);
499
+ if (ret) {
500
+ /* discard unwritten formatted output */
501
+ strm->avail_in -= (unsigned)len;
502
+ state->x.pos -= len;
503
+ if (state->again)
504
+ gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
505
+ return state->err;
506
+ }
481507
if (state->err && !state->again)
482508
return state->err;
483509
return len;
484510
#endif
485511
}
@@ -549,10 +575,11 @@
549575
/* There was a non-blocking stall on write, resulting in the part
550576
of the second half of the output buffer being occupied. Return
551577
a Z_BUF_ERROR to let the application know that this gzprintf()
552578
needs to be retried. */
553579
gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
580
+ return state->err;
554581
}
555582
if (!state->again)
556583
return state->err;
557584
}
558585
if (strm->avail_in == 0)
@@ -589,10 +616,18 @@
589616
strm->avail_in += len;
590617
state->x.pos += len;
591618
592619
/* write out buffer if more than half is occupied */
593620
ret = gz_vacate(state);
621
+ if (ret) {
622
+ /* discard unwritten formatted output */
623
+ strm->avail_in -= (unsigned)len;
624
+ state->x.pos -= len;
625
+ if (state->again)
626
+ gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
627
+ return state->err;
628
+ }
594629
if (state->err && !state->again)
595630
return state->err;
596631
return (int)len;
597632
#endif
598633
}
599634
--- compat/zlib/gzwrite.c
+++ compat/zlib/gzwrite.c
@@ -39,12 +39,12 @@
39 free(state->out);
40 free(state->in);
41 gz_error(state, Z_MEM_ERROR, "out of memory");
42 return -1;
43 }
44 strm->next_in = NULL;
45 }
 
46
47 /* mark state as initialized */
48 state->size = state->want;
49
50 /* initialize write buffer if compressing */
@@ -77,11 +77,11 @@
77 errno = 0;
78 state->again = 0;
79 put = strm->avail_in > max ? max : strm->avail_in;
80 writ = (int)write(state->fd, strm->next_in, put);
81 if (writ < 0) {
82 if (errno == EAGAIN || errno == EWOULDBLOCK)
83 state->again = 1;
84 gz_error(state, Z_ERRNO, zstrerror());
85 return -1;
86 }
87 strm->avail_in -= (unsigned)writ;
@@ -112,11 +112,11 @@
112 state->again = 0;
113 put = strm->next_out - state->x.next > (int)max ? max :
114 (unsigned)(strm->next_out - state->x.next);
115 writ = (int)write(state->fd, state->x.next, put);
116 if (writ < 0) {
117 if (errno == EAGAIN || errno == EWOULDBLOCK)
118 state->again = 1;
119 gz_error(state, Z_ERRNO, zstrerror());
120 return -1;
121 }
122 state->x.next += writ;
@@ -153,10 +153,15 @@
153 stall on a non-blocking write destination. */
154 local int gz_zero(gz_statep state) {
155 int first, ret;
156 unsigned n;
157 z_streamp strm = &(state->strm);
 
 
 
 
 
158
159 /* consume whatever's left in the input buffer */
160 if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
161 return -1;
162
@@ -173,12 +178,18 @@
173 strm->next_in = state->in;
174 ret = gz_comp(state, Z_NO_FLUSH);
175 n -= strm->avail_in;
176 state->x.pos += n;
177 state->skip -= n;
178 if (ret == -1)
 
 
 
 
 
179 return -1;
 
180 } while (state->skip);
181 return 0;
182 }
183
184 /* Write len bytes from buf to file. Return the number of bytes written. If
@@ -240,13 +251,17 @@
240 state->strm.avail_in = n;
241 ret = gz_comp(state, Z_NO_FLUSH);
242 n -= state->strm.avail_in;
243 state->x.pos += n;
244 len -= n;
245 if (ret == -1)
 
 
246 return state->again ? put - len : 0;
 
247 } while (len);
 
248 }
249
250 /* input was all buffered or compressed */
251 return put;
252 }
@@ -369,23 +384,25 @@
369 }
370 put = gz_write(state, s, len);
371 return len && put == 0 ? -1 : (int)put;
372 }
373
374 #if (((!defined(STDC) && !defined(Z_HAVE_STDARG_H)) || !defined(NO_vsnprintf)) && \
375 (defined(STDC) || defined(Z_HAVE_STDARG_H) || !defined(NO_snprintf))) || \
376 defined(ZLIB_INSECURE)
 
377 /* If the second half of the input buffer is occupied, write out the contents.
378 If there is any input remaining due to a non-blocking stall on write, move
379 it to the start of the buffer. Return true if this did not open up the
380 second half of the buffer. state->err should be checked after this to
381 handle a gz_comp() error. */
382 local int gz_vacate(gz_statep state) {
383 z_streamp strm;
384
385 strm = &(state->strm);
386 if (strm->next_in + strm->avail_in <= state->in + state->size)
 
387 return 0;
388 (void)gz_comp(state, Z_NO_FLUSH);
389 if (strm->avail_in == 0) {
390 strm->next_in = state->in;
391 return 0;
@@ -441,10 +458,11 @@
441 /* There was a non-blocking stall on write, resulting in the part
442 of the second half of the output buffer being occupied. Return
443 a Z_BUF_ERROR to let the application know that this gzprintf()
444 needs to be retried. */
445 gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
 
446 }
447 if (!state->again)
448 return state->err;
449 }
450 if (strm->avail_in == 0)
@@ -476,10 +494,18 @@
476 strm->avail_in += (unsigned)len;
477 state->x.pos += len;
478
479 /* write out buffer if more than half is occupied */
480 ret = gz_vacate(state);
 
 
 
 
 
 
 
 
481 if (state->err && !state->again)
482 return state->err;
483 return len;
484 #endif
485 }
@@ -549,10 +575,11 @@
549 /* There was a non-blocking stall on write, resulting in the part
550 of the second half of the output buffer being occupied. Return
551 a Z_BUF_ERROR to let the application know that this gzprintf()
552 needs to be retried. */
553 gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
 
554 }
555 if (!state->again)
556 return state->err;
557 }
558 if (strm->avail_in == 0)
@@ -589,10 +616,18 @@
589 strm->avail_in += len;
590 state->x.pos += len;
591
592 /* write out buffer if more than half is occupied */
593 ret = gz_vacate(state);
 
 
 
 
 
 
 
 
594 if (state->err && !state->again)
595 return state->err;
596 return (int)len;
597 #endif
598 }
599
--- compat/zlib/gzwrite.c
+++ compat/zlib/gzwrite.c
@@ -39,12 +39,12 @@
39 free(state->out);
40 free(state->in);
41 gz_error(state, Z_MEM_ERROR, "out of memory");
42 return -1;
43 }
 
44 }
45 strm->next_in = NULL;
46
47 /* mark state as initialized */
48 state->size = state->want;
49
50 /* initialize write buffer if compressing */
@@ -77,11 +77,11 @@
77 errno = 0;
78 state->again = 0;
79 put = strm->avail_in > max ? max : strm->avail_in;
80 writ = (int)write(state->fd, strm->next_in, put);
81 if (writ < 0) {
82 if (BLOCKED(errno))
83 state->again = 1;
84 gz_error(state, Z_ERRNO, zstrerror());
85 return -1;
86 }
87 strm->avail_in -= (unsigned)writ;
@@ -112,11 +112,11 @@
112 state->again = 0;
113 put = strm->next_out - state->x.next > (int)max ? max :
114 (unsigned)(strm->next_out - state->x.next);
115 writ = (int)write(state->fd, state->x.next, put);
116 if (writ < 0) {
117 if (BLOCKED(errno))
118 state->again = 1;
119 gz_error(state, Z_ERRNO, zstrerror());
120 return -1;
121 }
122 state->x.next += writ;
@@ -153,10 +153,15 @@
153 stall on a non-blocking write destination. */
154 local int gz_zero(gz_statep state) {
155 int first, ret;
156 unsigned n;
157 z_streamp strm = &(state->strm);
158
159 /* allocate memory if this is the first time through -- the input buffer
160 must exist before it is zeroed below */
161 if (state->size == 0 && gz_init(state) == -1)
162 return -1;
163
164 /* consume whatever's left in the input buffer */
165 if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
166 return -1;
167
@@ -173,12 +178,18 @@
178 strm->next_in = state->in;
179 ret = gz_comp(state, Z_NO_FLUSH);
180 n -= strm->avail_in;
181 state->x.pos += n;
182 state->skip -= n;
183 if (ret == -1) {
184 /* discard any unconsumed zero fill -- it was not yet accounted
185 for in state->skip, so it will be generated again when the
186 operation is retried */
187 strm->avail_in = 0;
188 strm->next_in = state->in;
189 return -1;
190 }
191 } while (state->skip);
192 return 0;
193 }
194
195 /* Write len bytes from buf to file. Return the number of bytes written. If
@@ -240,13 +251,17 @@
251 state->strm.avail_in = n;
252 ret = gz_comp(state, Z_NO_FLUSH);
253 n -= state->strm.avail_in;
254 state->x.pos += n;
255 len -= n;
256 if (ret == -1) {
257 state->strm.avail_in = 0;
258 state->strm.next_in = state->in;
259 return state->again ? put - len : 0;
260 }
261 } while (len);
262 state->strm.next_in = state->in;
263 }
264
265 /* input was all buffered or compressed */
266 return put;
267 }
@@ -369,23 +384,25 @@
384 }
385 put = gz_write(state, s, len);
386 return len && put == 0 ? -1 : (int)put;
387 }
388
389 #if (((!defined(STDC) && !defined(Z_HAVE_STDARG_H)) || \
390 !defined(NO_vsnprintf)) && \
391 (defined(STDC) || defined(Z_HAVE_STDARG_H) || \
392 !defined(NO_snprintf))) || defined(ZLIB_INSECURE)
393 /* If the second half of the input buffer is occupied, write out the contents.
394 If there is any input remaining due to a non-blocking stall on write, move
395 it to the start of the buffer. Return true if this did not open up the
396 second half of the buffer. state->err should be checked after this to
397 handle a gz_comp() error. */
398 local int gz_vacate(gz_statep state) {
399 z_streamp strm;
400
401 strm = &(state->strm);
402 if (strm->next_in == NULL ||
403 strm->next_in + strm->avail_in <= state->in + state->size)
404 return 0;
405 (void)gz_comp(state, Z_NO_FLUSH);
406 if (strm->avail_in == 0) {
407 strm->next_in = state->in;
408 return 0;
@@ -441,10 +458,11 @@
458 /* There was a non-blocking stall on write, resulting in the part
459 of the second half of the output buffer being occupied. Return
460 a Z_BUF_ERROR to let the application know that this gzprintf()
461 needs to be retried. */
462 gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
463 return state->err;
464 }
465 if (!state->again)
466 return state->err;
467 }
468 if (strm->avail_in == 0)
@@ -476,10 +494,18 @@
494 strm->avail_in += (unsigned)len;
495 state->x.pos += len;
496
497 /* write out buffer if more than half is occupied */
498 ret = gz_vacate(state);
499 if (ret) {
500 /* discard unwritten formatted output */
501 strm->avail_in -= (unsigned)len;
502 state->x.pos -= len;
503 if (state->again)
504 gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
505 return state->err;
506 }
507 if (state->err && !state->again)
508 return state->err;
509 return len;
510 #endif
511 }
@@ -549,10 +575,11 @@
575 /* There was a non-blocking stall on write, resulting in the part
576 of the second half of the output buffer being occupied. Return
577 a Z_BUF_ERROR to let the application know that this gzprintf()
578 needs to be retried. */
579 gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
580 return state->err;
581 }
582 if (!state->again)
583 return state->err;
584 }
585 if (strm->avail_in == 0)
@@ -589,10 +616,18 @@
616 strm->avail_in += len;
617 state->x.pos += len;
618
619 /* write out buffer if more than half is occupied */
620 ret = gz_vacate(state);
621 if (ret) {
622 /* discard unwritten formatted output */
623 strm->avail_in -= (unsigned)len;
624 state->x.pos -= len;
625 if (state->again)
626 gz_error(state, Z_BUF_ERROR, "stalled write on gzprintf");
627 return state->err;
628 }
629 if (state->err && !state->again)
630 return state->err;
631 return (int)len;
632 #endif
633 }
634
--- compat/zlib/infback.c
+++ compat/zlib/infback.c
@@ -421,12 +421,10 @@
421421
422422
case LEN:
423423
/* use inflate_fast() if we have enough input and output */
424424
if (have >= 6 && left >= 258) {
425425
RESTORE();
426
- if (state->whave < state->wsize)
427
- state->whave = state->wsize - left;
428426
inflate_fast(strm, state->wsize);
429427
LOAD();
430428
break;
431429
}
432430
433431
--- compat/zlib/infback.c
+++ compat/zlib/infback.c
@@ -421,12 +421,10 @@
421
422 case LEN:
423 /* use inflate_fast() if we have enough input and output */
424 if (have >= 6 && left >= 258) {
425 RESTORE();
426 if (state->whave < state->wsize)
427 state->whave = state->wsize - left;
428 inflate_fast(strm, state->wsize);
429 LOAD();
430 break;
431 }
432
433
--- compat/zlib/infback.c
+++ compat/zlib/infback.c
@@ -421,12 +421,10 @@
421
422 case LEN:
423 /* use inflate_fast() if we have enough input and output */
424 if (have >= 6 && left >= 258) {
425 RESTORE();
 
 
426 inflate_fast(strm, state->wsize);
427 LOAD();
428 break;
429 }
430
431
--- compat/zlib/inflate.c
+++ compat/zlib/inflate.c
@@ -125,10 +125,18 @@
125125
int ZEXPORT inflateReset(z_streamp strm) {
126126
struct inflate_state FAR *state;
127127
128128
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
129129
state = (struct inflate_state FAR *)strm->state;
130
+ if (state->wbits != state->reqbits) {
131
+ if (state->window != Z_NULL) {
132
+ ZFREE(strm, state->window);
133
+ state->window = Z_NULL;
134
+ }
135
+ state->wbits = state->reqbits;
136
+ }
137
+ state->wrap = state->reqwrap;
130138
state->wsize = 0;
131139
state->whave = 0;
132140
state->wnext = 0;
133141
return inflateResetKeep(strm);
134142
}
@@ -163,12 +171,12 @@
163171
ZFREE(strm, state->window);
164172
state->window = Z_NULL;
165173
}
166174
167175
/* update state and reset the rest of it */
168
- state->wrap = wrap;
169
- state->wbits = (unsigned)windowBits;
176
+ state->reqwrap = state->wrap = wrap;
177
+ state->reqbits = state->wbits = (unsigned)windowBits;
170178
return inflateReset(strm);
171179
}
172180
173181
int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
174182
const char *version, int stream_size) {
@@ -535,17 +543,17 @@
535543
state->mode = BAD;
536544
break;
537545
}
538546
DROPBITS(4);
539547
len = BITS(4) + 8;
540
- if (state->wbits == 0)
541
- state->wbits = len;
542
- if (len > 15 || len > state->wbits) {
548
+ if (len > 15 || (state->wbits != 0 && len > state->wbits)) {
543549
strm->msg = (z_const char *)"invalid window size";
544550
state->mode = BAD;
545551
break;
546552
}
553
+ if (state->wbits == 0)
554
+ state->wbits = len;
547555
state->dmax = 1U << len;
548556
state->flags = 0; /* indicate zlib header */
549557
Tracev((stderr, "inflate: zlib header ok\n"));
550558
strm->adler = state->check = adler32(0L, Z_NULL, 0);
551559
state->mode = hold & 0x200 ? DICTID : TYPE;
@@ -698,10 +706,11 @@
698706
state->mode = DICT;
699707
/* fallthrough */
700708
case DICT:
701709
if (state->havedict == 0) {
702710
RESTORE();
711
+ strm->total_in += in - strm->avail_in;
703712
return Z_NEED_DICT;
704713
}
705714
strm->adler = state->check = adler32(0L, Z_NULL, 0);
706715
state->mode = TYPE;
707716
/* fallthrough */
@@ -910,11 +919,11 @@
910919
/* fallthrough */
911920
case LEN_:
912921
state->mode = LEN;
913922
/* fallthrough */
914923
case LEN:
915
- if (have >= 6 && left >= 258) {
924
+ if (have >= 6 && left >= 258 && bits < 8) {
916925
RESTORE();
917926
inflate_fast(strm, out);
918927
LOAD();
919928
if (state->mode == TYPE)
920929
state->back = -1;
@@ -1189,11 +1198,12 @@
11891198
struct inflate_state FAR *state;
11901199
unsigned long dictid;
11911200
int ret;
11921201
11931202
/* check state */
1194
- if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1203
+ if (inflateStateCheck(strm) || dictionary == Z_NULL)
1204
+ return Z_STREAM_ERROR;
11951205
state = (struct inflate_state FAR *)strm->state;
11961206
if (state->wrap != 0 && state->mode != DICT)
11971207
return Z_STREAM_ERROR;
11981208
11991209
/* check for correct dictionary identifier */
@@ -1294,19 +1304,27 @@
12941304
strm->next_in += len;
12951305
strm->total_in += len;
12961306
12971307
/* return no joy or set up to restart inflate() on a new block */
12981308
if (state->have != 4) return Z_DATA_ERROR;
1299
- if (state->flags == -1)
1300
- state->wrap = 0; /* if no header yet, treat as raw */
1301
- else
1302
- state->wrap &= ~4; /* no point in computing a check value now */
13031309
flags = state->flags;
13041310
in = strm->total_in; out = strm->total_out;
13051311
inflateReset(strm);
13061312
strm->total_in = in; strm->total_out = out;
13071313
state->flags = flags;
1314
+ if (flags == -1)
1315
+ state->wrap = 0; /* if no header yet, treat as raw */
1316
+ else
1317
+ state->wrap &= ~4; /* no point in computing a check value now */
1318
+ if (state->wbits == 0) {
1319
+ /* we never got to see a header for the window size -- set to max */
1320
+ if (state->window != Z_NULL) {
1321
+ ZFREE(strm, state->window);
1322
+ state->window = Z_NULL;
1323
+ }
1324
+ state->wbits = 15;
1325
+ }
13081326
state->mode = TYPE;
13091327
return Z_OK;
13101328
}
13111329
13121330
/*
@@ -1329,25 +1347,33 @@
13291347
struct inflate_state FAR *state;
13301348
struct inflate_state FAR *copy;
13311349
unsigned char FAR *window;
13321350
13331351
/* check input */
1334
- if (inflateStateCheck(source) || dest == Z_NULL)
1352
+ if (dest == Z_NULL)
1353
+ return Z_STREAM_ERROR;
1354
+ if (inflateStateCheck(source)) {
1355
+ dest->state = Z_NULL;
13351356
return Z_STREAM_ERROR;
1357
+ }
13361358
state = (struct inflate_state FAR *)source->state;
13371359
13381360
/* allocate space */
13391361
copy = (struct inflate_state FAR *)
13401362
ZALLOC(source, 1, sizeof(struct inflate_state));
1341
- if (copy == Z_NULL) return Z_MEM_ERROR;
1363
+ if (copy == Z_NULL) {
1364
+ dest->state = Z_NULL;
1365
+ return Z_MEM_ERROR;
1366
+ }
13421367
zmemzero(copy, sizeof(struct inflate_state));
13431368
window = Z_NULL;
13441369
if (state->window != Z_NULL) {
13451370
window = (unsigned char FAR *)
13461371
ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
13471372
if (window == Z_NULL) {
13481373
ZFREE(source, copy);
1374
+ dest->state = Z_NULL;
13491375
return Z_MEM_ERROR;
13501376
}
13511377
}
13521378
13531379
/* copy state */
@@ -1389,10 +1415,14 @@
13891415
state = (struct inflate_state FAR *)strm->state;
13901416
if (check && state->wrap)
13911417
state->wrap |= 4;
13921418
else
13931419
state->wrap &= ~4;
1420
+ if (check && state->reqwrap)
1421
+ state->reqwrap |= 4;
1422
+ else
1423
+ state->reqwrap &= ~4;
13941424
return Z_OK;
13951425
}
13961426
13971427
long ZEXPORT inflateMark(z_streamp strm) {
13981428
struct inflate_state FAR *state;
13991429
--- compat/zlib/inflate.c
+++ compat/zlib/inflate.c
@@ -125,10 +125,18 @@
125 int ZEXPORT inflateReset(z_streamp strm) {
126 struct inflate_state FAR *state;
127
128 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
129 state = (struct inflate_state FAR *)strm->state;
 
 
 
 
 
 
 
 
130 state->wsize = 0;
131 state->whave = 0;
132 state->wnext = 0;
133 return inflateResetKeep(strm);
134 }
@@ -163,12 +171,12 @@
163 ZFREE(strm, state->window);
164 state->window = Z_NULL;
165 }
166
167 /* update state and reset the rest of it */
168 state->wrap = wrap;
169 state->wbits = (unsigned)windowBits;
170 return inflateReset(strm);
171 }
172
173 int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
174 const char *version, int stream_size) {
@@ -535,17 +543,17 @@
535 state->mode = BAD;
536 break;
537 }
538 DROPBITS(4);
539 len = BITS(4) + 8;
540 if (state->wbits == 0)
541 state->wbits = len;
542 if (len > 15 || len > state->wbits) {
543 strm->msg = (z_const char *)"invalid window size";
544 state->mode = BAD;
545 break;
546 }
 
 
547 state->dmax = 1U << len;
548 state->flags = 0; /* indicate zlib header */
549 Tracev((stderr, "inflate: zlib header ok\n"));
550 strm->adler = state->check = adler32(0L, Z_NULL, 0);
551 state->mode = hold & 0x200 ? DICTID : TYPE;
@@ -698,10 +706,11 @@
698 state->mode = DICT;
699 /* fallthrough */
700 case DICT:
701 if (state->havedict == 0) {
702 RESTORE();
 
703 return Z_NEED_DICT;
704 }
705 strm->adler = state->check = adler32(0L, Z_NULL, 0);
706 state->mode = TYPE;
707 /* fallthrough */
@@ -910,11 +919,11 @@
910 /* fallthrough */
911 case LEN_:
912 state->mode = LEN;
913 /* fallthrough */
914 case LEN:
915 if (have >= 6 && left >= 258) {
916 RESTORE();
917 inflate_fast(strm, out);
918 LOAD();
919 if (state->mode == TYPE)
920 state->back = -1;
@@ -1189,11 +1198,12 @@
1189 struct inflate_state FAR *state;
1190 unsigned long dictid;
1191 int ret;
1192
1193 /* check state */
1194 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
 
1195 state = (struct inflate_state FAR *)strm->state;
1196 if (state->wrap != 0 && state->mode != DICT)
1197 return Z_STREAM_ERROR;
1198
1199 /* check for correct dictionary identifier */
@@ -1294,19 +1304,27 @@
1294 strm->next_in += len;
1295 strm->total_in += len;
1296
1297 /* return no joy or set up to restart inflate() on a new block */
1298 if (state->have != 4) return Z_DATA_ERROR;
1299 if (state->flags == -1)
1300 state->wrap = 0; /* if no header yet, treat as raw */
1301 else
1302 state->wrap &= ~4; /* no point in computing a check value now */
1303 flags = state->flags;
1304 in = strm->total_in; out = strm->total_out;
1305 inflateReset(strm);
1306 strm->total_in = in; strm->total_out = out;
1307 state->flags = flags;
 
 
 
 
 
 
 
 
 
 
 
 
1308 state->mode = TYPE;
1309 return Z_OK;
1310 }
1311
1312 /*
@@ -1329,25 +1347,33 @@
1329 struct inflate_state FAR *state;
1330 struct inflate_state FAR *copy;
1331 unsigned char FAR *window;
1332
1333 /* check input */
1334 if (inflateStateCheck(source) || dest == Z_NULL)
 
 
 
1335 return Z_STREAM_ERROR;
 
1336 state = (struct inflate_state FAR *)source->state;
1337
1338 /* allocate space */
1339 copy = (struct inflate_state FAR *)
1340 ZALLOC(source, 1, sizeof(struct inflate_state));
1341 if (copy == Z_NULL) return Z_MEM_ERROR;
 
 
 
1342 zmemzero(copy, sizeof(struct inflate_state));
1343 window = Z_NULL;
1344 if (state->window != Z_NULL) {
1345 window = (unsigned char FAR *)
1346 ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
1347 if (window == Z_NULL) {
1348 ZFREE(source, copy);
 
1349 return Z_MEM_ERROR;
1350 }
1351 }
1352
1353 /* copy state */
@@ -1389,10 +1415,14 @@
1389 state = (struct inflate_state FAR *)strm->state;
1390 if (check && state->wrap)
1391 state->wrap |= 4;
1392 else
1393 state->wrap &= ~4;
 
 
 
 
1394 return Z_OK;
1395 }
1396
1397 long ZEXPORT inflateMark(z_streamp strm) {
1398 struct inflate_state FAR *state;
1399
--- compat/zlib/inflate.c
+++ compat/zlib/inflate.c
@@ -125,10 +125,18 @@
125 int ZEXPORT inflateReset(z_streamp strm) {
126 struct inflate_state FAR *state;
127
128 if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
129 state = (struct inflate_state FAR *)strm->state;
130 if (state->wbits != state->reqbits) {
131 if (state->window != Z_NULL) {
132 ZFREE(strm, state->window);
133 state->window = Z_NULL;
134 }
135 state->wbits = state->reqbits;
136 }
137 state->wrap = state->reqwrap;
138 state->wsize = 0;
139 state->whave = 0;
140 state->wnext = 0;
141 return inflateResetKeep(strm);
142 }
@@ -163,12 +171,12 @@
171 ZFREE(strm, state->window);
172 state->window = Z_NULL;
173 }
174
175 /* update state and reset the rest of it */
176 state->reqwrap = state->wrap = wrap;
177 state->reqbits = state->wbits = (unsigned)windowBits;
178 return inflateReset(strm);
179 }
180
181 int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
182 const char *version, int stream_size) {
@@ -535,17 +543,17 @@
543 state->mode = BAD;
544 break;
545 }
546 DROPBITS(4);
547 len = BITS(4) + 8;
548 if (len > 15 || (state->wbits != 0 && len > state->wbits)) {
 
 
549 strm->msg = (z_const char *)"invalid window size";
550 state->mode = BAD;
551 break;
552 }
553 if (state->wbits == 0)
554 state->wbits = len;
555 state->dmax = 1U << len;
556 state->flags = 0; /* indicate zlib header */
557 Tracev((stderr, "inflate: zlib header ok\n"));
558 strm->adler = state->check = adler32(0L, Z_NULL, 0);
559 state->mode = hold & 0x200 ? DICTID : TYPE;
@@ -698,10 +706,11 @@
706 state->mode = DICT;
707 /* fallthrough */
708 case DICT:
709 if (state->havedict == 0) {
710 RESTORE();
711 strm->total_in += in - strm->avail_in;
712 return Z_NEED_DICT;
713 }
714 strm->adler = state->check = adler32(0L, Z_NULL, 0);
715 state->mode = TYPE;
716 /* fallthrough */
@@ -910,11 +919,11 @@
919 /* fallthrough */
920 case LEN_:
921 state->mode = LEN;
922 /* fallthrough */
923 case LEN:
924 if (have >= 6 && left >= 258 && bits < 8) {
925 RESTORE();
926 inflate_fast(strm, out);
927 LOAD();
928 if (state->mode == TYPE)
929 state->back = -1;
@@ -1189,11 +1198,12 @@
1198 struct inflate_state FAR *state;
1199 unsigned long dictid;
1200 int ret;
1201
1202 /* check state */
1203 if (inflateStateCheck(strm) || dictionary == Z_NULL)
1204 return Z_STREAM_ERROR;
1205 state = (struct inflate_state FAR *)strm->state;
1206 if (state->wrap != 0 && state->mode != DICT)
1207 return Z_STREAM_ERROR;
1208
1209 /* check for correct dictionary identifier */
@@ -1294,19 +1304,27 @@
1304 strm->next_in += len;
1305 strm->total_in += len;
1306
1307 /* return no joy or set up to restart inflate() on a new block */
1308 if (state->have != 4) return Z_DATA_ERROR;
 
 
 
 
1309 flags = state->flags;
1310 in = strm->total_in; out = strm->total_out;
1311 inflateReset(strm);
1312 strm->total_in = in; strm->total_out = out;
1313 state->flags = flags;
1314 if (flags == -1)
1315 state->wrap = 0; /* if no header yet, treat as raw */
1316 else
1317 state->wrap &= ~4; /* no point in computing a check value now */
1318 if (state->wbits == 0) {
1319 /* we never got to see a header for the window size -- set to max */
1320 if (state->window != Z_NULL) {
1321 ZFREE(strm, state->window);
1322 state->window = Z_NULL;
1323 }
1324 state->wbits = 15;
1325 }
1326 state->mode = TYPE;
1327 return Z_OK;
1328 }
1329
1330 /*
@@ -1329,25 +1347,33 @@
1347 struct inflate_state FAR *state;
1348 struct inflate_state FAR *copy;
1349 unsigned char FAR *window;
1350
1351 /* check input */
1352 if (dest == Z_NULL)
1353 return Z_STREAM_ERROR;
1354 if (inflateStateCheck(source)) {
1355 dest->state = Z_NULL;
1356 return Z_STREAM_ERROR;
1357 }
1358 state = (struct inflate_state FAR *)source->state;
1359
1360 /* allocate space */
1361 copy = (struct inflate_state FAR *)
1362 ZALLOC(source, 1, sizeof(struct inflate_state));
1363 if (copy == Z_NULL) {
1364 dest->state = Z_NULL;
1365 return Z_MEM_ERROR;
1366 }
1367 zmemzero(copy, sizeof(struct inflate_state));
1368 window = Z_NULL;
1369 if (state->window != Z_NULL) {
1370 window = (unsigned char FAR *)
1371 ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
1372 if (window == Z_NULL) {
1373 ZFREE(source, copy);
1374 dest->state = Z_NULL;
1375 return Z_MEM_ERROR;
1376 }
1377 }
1378
1379 /* copy state */
@@ -1389,10 +1415,14 @@
1415 state = (struct inflate_state FAR *)strm->state;
1416 if (check && state->wrap)
1417 state->wrap |= 4;
1418 else
1419 state->wrap &= ~4;
1420 if (check && state->reqwrap)
1421 state->reqwrap |= 4;
1422 else
1423 state->reqwrap &= ~4;
1424 return Z_OK;
1425 }
1426
1427 long ZEXPORT inflateMark(z_streamp strm) {
1428 struct inflate_state FAR *state;
1429
--- compat/zlib/inflate.h
+++ compat/zlib/inflate.h
@@ -83,19 +83,21 @@
8383
z_streamp strm; /* pointer back to this zlib stream */
8484
inflate_mode mode; /* current inflate mode */
8585
int last; /* true if processing last block */
8686
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
8787
bit 2 true to validate check value */
88
+ int reqwrap; /* requested wrap */
8889
int havedict; /* true if dictionary provided */
8990
int flags; /* gzip header method and flags, 0 if zlib, or
9091
-1 if raw or no header yet */
9192
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
9293
unsigned long check; /* protected copy of check value */
9394
unsigned long total; /* protected copy of output count */
9495
gz_headerp head; /* where to save gzip header information */
9596
/* sliding window */
96
- unsigned wbits; /* log base 2 of requested window size */
97
+ unsigned reqbits; /* requested log base 2 of window size */
98
+ unsigned wbits; /* current log base 2 of window size */
9799
unsigned wsize; /* window size or zero if not using window */
98100
unsigned whave; /* valid bytes in the window */
99101
unsigned wnext; /* window write index */
100102
unsigned char FAR *window; /* allocated sliding window, if needed */
101103
/* bit accumulator */
102104
--- compat/zlib/inflate.h
+++ compat/zlib/inflate.h
@@ -83,19 +83,21 @@
83 z_streamp strm; /* pointer back to this zlib stream */
84 inflate_mode mode; /* current inflate mode */
85 int last; /* true if processing last block */
86 int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
87 bit 2 true to validate check value */
 
88 int havedict; /* true if dictionary provided */
89 int flags; /* gzip header method and flags, 0 if zlib, or
90 -1 if raw or no header yet */
91 unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
92 unsigned long check; /* protected copy of check value */
93 unsigned long total; /* protected copy of output count */
94 gz_headerp head; /* where to save gzip header information */
95 /* sliding window */
96 unsigned wbits; /* log base 2 of requested window size */
 
97 unsigned wsize; /* window size or zero if not using window */
98 unsigned whave; /* valid bytes in the window */
99 unsigned wnext; /* window write index */
100 unsigned char FAR *window; /* allocated sliding window, if needed */
101 /* bit accumulator */
102
--- compat/zlib/inflate.h
+++ compat/zlib/inflate.h
@@ -83,19 +83,21 @@
83 z_streamp strm; /* pointer back to this zlib stream */
84 inflate_mode mode; /* current inflate mode */
85 int last; /* true if processing last block */
86 int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
87 bit 2 true to validate check value */
88 int reqwrap; /* requested wrap */
89 int havedict; /* true if dictionary provided */
90 int flags; /* gzip header method and flags, 0 if zlib, or
91 -1 if raw or no header yet */
92 unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
93 unsigned long check; /* protected copy of check value */
94 unsigned long total; /* protected copy of output count */
95 gz_headerp head; /* where to save gzip header information */
96 /* sliding window */
97 unsigned reqbits; /* requested log base 2 of window size */
98 unsigned wbits; /* current log base 2 of window size */
99 unsigned wsize; /* window size or zero if not using window */
100 unsigned whave; /* valid bytes in the window */
101 unsigned wnext; /* window write index */
102 unsigned char FAR *window; /* allocated sliding window, if needed */
103 /* bit accumulator */
104
--- compat/zlib/inftrees.c
+++ compat/zlib/inftrees.c
@@ -21,11 +21,11 @@
2121
#endif
2222
2323
#define MAXBITS 15
2424
2525
const char inflate_copyright[] =
26
- " inflate 1.3.2 Copyright 1995-2026 Mark Adler ";
26
+ " inflate 1.4 Copyright 1995-2026 Mark Adler ";
2727
/*
2828
If you use the zlib library in a product, an acknowledgment is welcome
2929
in the documentation of your product. If for some reason you cannot
3030
include such an acknowledgment, I would appreciate that you keep this
3131
copyright string in the executable of your product.
@@ -69,11 +69,11 @@
6969
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
7070
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
7171
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
7272
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
7373
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
74
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 75};
74
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 71, 77};
7575
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
7676
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
7777
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
7878
8193, 12289, 16385, 24577, 0, 0};
7979
static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
8080
--- compat/zlib/inftrees.c
+++ compat/zlib/inftrees.c
@@ -21,11 +21,11 @@
21 #endif
22
23 #define MAXBITS 15
24
25 const char inflate_copyright[] =
26 " inflate 1.3.2 Copyright 1995-2026 Mark Adler ";
27 /*
28 If you use the zlib library in a product, an acknowledgment is welcome
29 in the documentation of your product. If for some reason you cannot
30 include such an acknowledgment, I would appreciate that you keep this
31 copyright string in the executable of your product.
@@ -69,11 +69,11 @@
69 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
70 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
71 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
72 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
73 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
74 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 75};
75 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
76 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
77 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
78 8193, 12289, 16385, 24577, 0, 0};
79 static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
80
--- compat/zlib/inftrees.c
+++ compat/zlib/inftrees.c
@@ -21,11 +21,11 @@
21 #endif
22
23 #define MAXBITS 15
24
25 const char inflate_copyright[] =
26 " inflate 1.4 Copyright 1995-2026 Mark Adler ";
27 /*
28 If you use the zlib library in a product, an acknowledgment is welcome
29 in the documentation of your product. If for some reason you cannot
30 include such an acknowledgment, I would appreciate that you keep this
31 copyright string in the executable of your product.
@@ -69,11 +69,11 @@
69 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
70 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
71 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
72 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
73 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
74 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 71, 77};
75 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
76 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
77 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
78 8193, 12289, 16385, 24577, 0, 0};
79 static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
80
--- compat/zlib/inftrees.h
+++ compat/zlib/inftrees.h
@@ -44,12 +44,18 @@
4444
returns 852, and "enough 30 6 15" for distance codes returns 592. The
4545
initial root table size (9 or 6) is found in the fifth argument of the
4646
inflate_table() calls in inflate.c and infback.c. If the root table size is
4747
changed, then these maximum sizes would be need to be recalculated and
4848
updated. */
49
-#define ENOUGH_LENS 852
50
-#define ENOUGH_DISTS 592
49
+#ifndef PKZIP_BUG_WORKAROUND
50
+# define ENOUGH_LENS 852
51
+# define ENOUGH_DISTS 592
52
+#else
53
+/* That workaround permits 288 literal/length codes and 32 distance codes. */
54
+# define ENOUGH_LENS 854
55
+# define ENOUGH_DISTS 594
56
+#endif
5157
#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
5258
5359
/* Type of code to build for inflate_table() */
5460
typedef enum {
5561
CODES,
5662
--- compat/zlib/inftrees.h
+++ compat/zlib/inftrees.h
@@ -44,12 +44,18 @@
44 returns 852, and "enough 30 6 15" for distance codes returns 592. The
45 initial root table size (9 or 6) is found in the fifth argument of the
46 inflate_table() calls in inflate.c and infback.c. If the root table size is
47 changed, then these maximum sizes would be need to be recalculated and
48 updated. */
49 #define ENOUGH_LENS 852
50 #define ENOUGH_DISTS 592
 
 
 
 
 
 
51 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
52
53 /* Type of code to build for inflate_table() */
54 typedef enum {
55 CODES,
56
--- compat/zlib/inftrees.h
+++ compat/zlib/inftrees.h
@@ -44,12 +44,18 @@
44 returns 852, and "enough 30 6 15" for distance codes returns 592. The
45 initial root table size (9 or 6) is found in the fifth argument of the
46 inflate_table() calls in inflate.c and infback.c. If the root table size is
47 changed, then these maximum sizes would be need to be recalculated and
48 updated. */
49 #ifndef PKZIP_BUG_WORKAROUND
50 # define ENOUGH_LENS 852
51 # define ENOUGH_DISTS 592
52 #else
53 /* That workaround permits 288 literal/length codes and 32 distance codes. */
54 # define ENOUGH_LENS 854
55 # define ENOUGH_DISTS 594
56 #endif
57 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
58
59 /* Type of code to build for inflate_table() */
60 typedef enum {
61 CODES,
62
--- compat/zlib/os400/README400
+++ compat/zlib/os400/README400
@@ -1,6 +1,6 @@
1
- ZLIB version 1.3.2 for OS/400 installation instructions
1
+ ZLIB version 1.4 for OS/400 installation instructions
22
33
1) Download and unpack the zlib tarball to some IFS directory.
44
(i.e.: /path/to/the/zlib/ifs/source/directory)
55
66
If the installed IFS command supports gzip format, this is straightforward,
77
--- compat/zlib/os400/README400
+++ compat/zlib/os400/README400
@@ -1,6 +1,6 @@
1 ZLIB version 1.3.2 for OS/400 installation instructions
2
3 1) Download and unpack the zlib tarball to some IFS directory.
4 (i.e.: /path/to/the/zlib/ifs/source/directory)
5
6 If the installed IFS command supports gzip format, this is straightforward,
7
--- compat/zlib/os400/README400
+++ compat/zlib/os400/README400
@@ -1,6 +1,6 @@
1 ZLIB version 1.4 for OS/400 installation instructions
2
3 1) Download and unpack the zlib tarball to some IFS directory.
4 (i.e.: /path/to/the/zlib/ifs/source/directory)
5
6 If the installed IFS command supports gzip format, this is straightforward,
7
--- compat/zlib/os400/zlibfixed.rpgle
+++ compat/zlib/os400/zlibfixed.rpgle
@@ -1,9 +1,9 @@
11
* ZLIB.INC - Interface to the general purpose compression library
22
*
33
* ILE RPG400 version by Patrick Monnerat, DATASPHERE.
4
- * Version 1.3.2
4
+ * Version 1.4
55
*
66
*
77
* WARNING:
88
* Procedures inflateInit(), inflateInit2(), deflateInit(),
99
* deflateInit2() and inflateBackInit() need to be called with
@@ -20,16 +20,16 @@
2020
* Constants
2121
**************************************************************************
2222
*
2323
* Versioning information.
2424
*
25
- D ZLIB_VERSION C '1.3.2'
26
- D ZLIB_VERNUM C X'1320'
25
+ D ZLIB_VERSION C '1.4'
26
+ D ZLIB_VERNUM C X'1400'
2727
D ZLIB_VER_MAJOR C 1
28
- D ZLIB_VER_MINOR C 3
28
+ D ZLIB_VER_MINOR C 4
2929
D ZLIB_VER_REVISION...
30
- D C 2
30
+ D C 0
3131
D ZLIB_VER_SUBREVISION...
3232
D C 0
3333
*
3434
* Other equates.
3535
*
3636
--- compat/zlib/os400/zlibfixed.rpgle
+++ compat/zlib/os400/zlibfixed.rpgle
@@ -1,9 +1,9 @@
1 * ZLIB.INC - Interface to the general purpose compression library
2 *
3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
4 * Version 1.3.2
5 *
6 *
7 * WARNING:
8 * Procedures inflateInit(), inflateInit2(), deflateInit(),
9 * deflateInit2() and inflateBackInit() need to be called with
@@ -20,16 +20,16 @@
20 * Constants
21 **************************************************************************
22 *
23 * Versioning information.
24 *
25 D ZLIB_VERSION C '1.3.2'
26 D ZLIB_VERNUM C X'1320'
27 D ZLIB_VER_MAJOR C 1
28 D ZLIB_VER_MINOR C 3
29 D ZLIB_VER_REVISION...
30 D C 2
31 D ZLIB_VER_SUBREVISION...
32 D C 0
33 *
34 * Other equates.
35 *
36
--- compat/zlib/os400/zlibfixed.rpgle
+++ compat/zlib/os400/zlibfixed.rpgle
@@ -1,9 +1,9 @@
1 * ZLIB.INC - Interface to the general purpose compression library
2 *
3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
4 * Version 1.4
5 *
6 *
7 * WARNING:
8 * Procedures inflateInit(), inflateInit2(), deflateInit(),
9 * deflateInit2() and inflateBackInit() need to be called with
@@ -20,16 +20,16 @@
20 * Constants
21 **************************************************************************
22 *
23 * Versioning information.
24 *
25 D ZLIB_VERSION C '1.4'
26 D ZLIB_VERNUM C X'1400'
27 D ZLIB_VER_MAJOR C 1
28 D ZLIB_VER_MINOR C 4
29 D ZLIB_VER_REVISION...
30 D C 0
31 D ZLIB_VER_SUBREVISION...
32 D C 0
33 *
34 * Other equates.
35 *
36
--- compat/zlib/os400/zlibfree.rpgle
+++ compat/zlib/os400/zlibfree.rpgle
@@ -1,10 +1,10 @@
11
**free
22
// ZLIB.INC - Interface to the general purpose compression library
33
44
// ILE RPG400 version by Patrick Monnerat, DATASPHERE.
5
-// Version 1.3.2
5
+// Version 1.4
66
77
88
// WARNING:
99
// Procedures inflateInit(), inflateInit2(), deflateInit(),
1010
// deflateInit2() and inflateBackInit() need to be called with
@@ -21,15 +21,15 @@
2121
// Constants
2222
//*************************************************************************
2323
2424
// Versioning information.
2525
26
-Dcl-C ZLIB_VERSION '1.3.2';
27
-Dcl-C ZLIB_VERNUM X'1320';
26
+Dcl-C ZLIB_VERSION '1.4';
27
+Dcl-C ZLIB_VERNUM X'1400';
2828
Dcl-C ZLIB_VER_MAJOR 1;
29
-Dcl-C ZLIB_VER_MINOR 3;
30
-Dcl-C ZLIB_VER_REVISION 2;
29
+Dcl-C ZLIB_VER_MINOR 4;
30
+Dcl-C ZLIB_VER_REVISION 0;
3131
Dcl-C ZLIB_VER_SUBREVISION 0;
3232
3333
// Other equates.
3434
3535
Dcl-C Z_NO_FLUSH 0;
3636
--- compat/zlib/os400/zlibfree.rpgle
+++ compat/zlib/os400/zlibfree.rpgle
@@ -1,10 +1,10 @@
1 **free
2 // ZLIB.INC - Interface to the general purpose compression library
3
4 // ILE RPG400 version by Patrick Monnerat, DATASPHERE.
5 // Version 1.3.2
6
7
8 // WARNING:
9 // Procedures inflateInit(), inflateInit2(), deflateInit(),
10 // deflateInit2() and inflateBackInit() need to be called with
@@ -21,15 +21,15 @@
21 // Constants
22 //*************************************************************************
23
24 // Versioning information.
25
26 Dcl-C ZLIB_VERSION '1.3.2';
27 Dcl-C ZLIB_VERNUM X'1320';
28 Dcl-C ZLIB_VER_MAJOR 1;
29 Dcl-C ZLIB_VER_MINOR 3;
30 Dcl-C ZLIB_VER_REVISION 2;
31 Dcl-C ZLIB_VER_SUBREVISION 0;
32
33 // Other equates.
34
35 Dcl-C Z_NO_FLUSH 0;
36
--- compat/zlib/os400/zlibfree.rpgle
+++ compat/zlib/os400/zlibfree.rpgle
@@ -1,10 +1,10 @@
1 **free
2 // ZLIB.INC - Interface to the general purpose compression library
3
4 // ILE RPG400 version by Patrick Monnerat, DATASPHERE.
5 // Version 1.4
6
7
8 // WARNING:
9 // Procedures inflateInit(), inflateInit2(), deflateInit(),
10 // deflateInit2() and inflateBackInit() need to be called with
@@ -21,15 +21,15 @@
21 // Constants
22 //*************************************************************************
23
24 // Versioning information.
25
26 Dcl-C ZLIB_VERSION '1.4';
27 Dcl-C ZLIB_VERNUM X'1400';
28 Dcl-C ZLIB_VER_MAJOR 1;
29 Dcl-C ZLIB_VER_MINOR 4;
30 Dcl-C ZLIB_VER_REVISION 0;
31 Dcl-C ZLIB_VER_SUBREVISION 0;
32
33 // Other equates.
34
35 Dcl-C Z_NO_FLUSH 0;
36
--- compat/zlib/qnx/package.qpg
+++ compat/zlib/qnx/package.qpg
@@ -23,14 +23,14 @@
2323
2424
<QPG:Values>
2525
<QPG:Files>
2626
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
2727
<QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
28
- <QPG:Add file="../libz.so.1.3.2" install="/opt/lib/" user="root:bin" permission="644"/>
29
- <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.3.2"/>
30
- <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.3.2"/>
31
- <QPG:Add file="../libz.so.1.3.2" install="/opt/lib/" component="slib"/>
28
+ <QPG:Add file="../libz.so.1.4" install="/opt/lib/" user="root:bin" permission="644"/>
29
+ <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.4"/>
30
+ <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.4"/>
31
+ <QPG:Add file="../libz.so.1.4" install="/opt/lib/" component="slib"/>
3232
</QPG:Files>
3333
3434
<QPG:PackageFilter>
3535
<QPM:PackageManifest>
3636
<QPM:PackageDescription>
@@ -61,11 +61,11 @@
6161
<QPM:ProductDescriptionURL>https://zlib.net/</QPM:ProductDescriptionURL>
6262
<QPM:ProductDescriptionEmbedURL></QPM:ProductDescriptionEmbedURL>
6363
</QPM:ProductDescription>
6464
6565
<QPM:ReleaseDescription>
66
- <QPM:ReleaseVersion>1.3.2</QPM:ReleaseVersion>
66
+ <QPM:ReleaseVersion>1.4</QPM:ReleaseVersion>
6767
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
6868
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
6969
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
7070
<QPM:ReleaseNoteMajor></QPM:ReleaseNoteMajor>
7171
<QPM:ExcludeCountries>
7272
--- compat/zlib/qnx/package.qpg
+++ compat/zlib/qnx/package.qpg
@@ -23,14 +23,14 @@
23
24 <QPG:Values>
25 <QPG:Files>
26 <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
27 <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
28 <QPG:Add file="../libz.so.1.3.2" install="/opt/lib/" user="root:bin" permission="644"/>
29 <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.3.2"/>
30 <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.3.2"/>
31 <QPG:Add file="../libz.so.1.3.2" install="/opt/lib/" component="slib"/>
32 </QPG:Files>
33
34 <QPG:PackageFilter>
35 <QPM:PackageManifest>
36 <QPM:PackageDescription>
@@ -61,11 +61,11 @@
61 <QPM:ProductDescriptionURL>https://zlib.net/</QPM:ProductDescriptionURL>
62 <QPM:ProductDescriptionEmbedURL></QPM:ProductDescriptionEmbedURL>
63 </QPM:ProductDescription>
64
65 <QPM:ReleaseDescription>
66 <QPM:ReleaseVersion>1.3.2</QPM:ReleaseVersion>
67 <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
68 <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
69 <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
70 <QPM:ReleaseNoteMajor></QPM:ReleaseNoteMajor>
71 <QPM:ExcludeCountries>
72
--- compat/zlib/qnx/package.qpg
+++ compat/zlib/qnx/package.qpg
@@ -23,14 +23,14 @@
23
24 <QPG:Values>
25 <QPG:Files>
26 <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
27 <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
28 <QPG:Add file="../libz.so.1.4" install="/opt/lib/" user="root:bin" permission="644"/>
29 <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.4"/>
30 <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.4"/>
31 <QPG:Add file="../libz.so.1.4" install="/opt/lib/" component="slib"/>
32 </QPG:Files>
33
34 <QPG:PackageFilter>
35 <QPM:PackageManifest>
36 <QPM:PackageDescription>
@@ -61,11 +61,11 @@
61 <QPM:ProductDescriptionURL>https://zlib.net/</QPM:ProductDescriptionURL>
62 <QPM:ProductDescriptionEmbedURL></QPM:ProductDescriptionEmbedURL>
63 </QPM:ProductDescription>
64
65 <QPM:ReleaseDescription>
66 <QPM:ReleaseVersion>1.4</QPM:ReleaseVersion>
67 <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
68 <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
69 <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
70 <QPM:ReleaseNoteMajor></QPM:ReleaseNoteMajor>
71 <QPM:ExcludeCountries>
72
--- compat/zlib/test/CMakeLists.txt
+++ compat/zlib/test/CMakeLists.txt
@@ -15,11 +15,11 @@
1515
1616
if(ZLIB_BUILD_SHARED)
1717
add_executable(zlib_example example.c)
1818
target_link_libraries(zlib_example ZLIB::ZLIB)
1919
target_compile_definitions(zlib_example PRIVATE ZLIB_BUILD)
20
- add_test(NAME zlib_example COMMAND zlib_example)
20
+ add_test(NAME zlib_example COMMAND zlib_example zlib_example.gz)
2121
2222
add_executable(minigzip minigzip.c)
2323
target_compile_definitions(
2424
minigzip PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
2525
target_link_libraries(minigzip ZLIB::ZLIB)
@@ -40,11 +40,11 @@
4040
target_compile_definitions(
4141
zlib_example64
4242
PRIVATE ZLIB_BUILD
4343
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
4444
target_link_libraries(zlib_example64 ZLIB::ZLIB)
45
- add_test(NAME zlib_example64 COMMAND zlib_example64)
45
+ add_test(NAME zlib_example64 COMMAND zlib_example64 zlib_example64.gz)
4646
4747
if(MSVC
4848
OR MSYS
4949
OR MINGW
5050
OR CYGWIN)
@@ -56,43 +56,45 @@
5656
OR CYGWIN)
5757
endif(HAVE_OFF64_T)
5858
endif(ZLIB_BUILD_SHARED)
5959
6060
if(ZLIB_BUILD_STATIC)
61
- add_executable(zlib_static_example example.c)
62
- target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC)
61
+ add_executable(zlib_examplestatic example.c)
62
+ target_link_libraries(zlib_examplestatic ZLIB::ZLIBSTATIC)
6363
target_compile_definitions(
64
- zlib_static_example
64
+ zlib_examplestatic
6565
PRIVATE ZLIB_BUILD
6666
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
67
- add_test(NAME zlib_static_example COMMAND zlib_static_example)
67
+ add_test(NAME zlib_examplestatic COMMAND zlib_examplestatic zlib_examplestatic.gz)
6868
69
- add_executable(static_minigzip minigzip.c)
70
- target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC)
69
+ add_executable(minigzipstatic minigzip.c)
70
+ target_link_libraries(minigzipstatic ZLIB::ZLIBSTATIC)
7171
72
- if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL
73
- "Clang")
72
+ if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
73
+ ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
7474
set(CFLAGS_OLD ${CMAKE_C_FLAGS})
7575
set(CMAKE_C_FLAGS
7676
""
7777
CACHE STRING "" FORCE)
7878
7979
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
8080
find_program(GCOV_EXECUTABLE gcov)
8181
endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
8282
83
- if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
83
+ if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
84
+ AND NOT CMAKE_CROSSCOMPILING)
8485
set(llvm_names llvm_cov)
8586
list(APPEND llvm_names llvm-cov)
8687
8788
foreach(ver RANGE 11 99)
8889
list(APPEND llvm_names llvm-cov-${ver})
8990
endforeach(ver RANGE 11 99)
9091
9192
find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
9293
set(llvm_option "gcov")
93
- endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
94
+ endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
95
+ AND NOT CMAKE_CROSSCOMPILING)
9496
9597
add_executable(infcover infcover.c)
9698
target_link_libraries(infcover ZLIB::ZLIBSTATIC)
9799
target_compile_options(infcover PRIVATE -coverage)
98100
target_link_options(infcover PRIVATE -coverage)
@@ -104,215 +106,251 @@
104106
NAME zlib_coverage-summary
105107
COMMAND
106108
${GCOV_EXECUTABLE} ${llvm_option}
107109
${CMAKE_CURRENT_SOURCE_DIR}/infcover.c -o
108110
${INFCOVER_DIR}/infcover.c.gcda)
109
- set_tests_properties(zlib_coverage-summary PROPERTIES DEPENDS
110
- zlib-coverage)
111
+ set_tests_properties(zlib_coverage-summary
112
+ PROPERTIES
113
+ DEPENDS zlib-coverage)
111114
set(CMAKE_C_FLAGS
112115
${CFLAGS_OLD}
113116
CACHE STRING "" FORCE)
114
- endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID}
115
- STREQUAL "Clang")
117
+ endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
118
+ ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
116119
117120
if(HAVE_OFF64_T)
118
- add_executable(zlib_static_example64 example.c)
119
- target_compile_definitions(
120
- zlib_static_example64
121
- PRIVATE ZLIB_BUILD
122
- $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
123
- target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC)
124
- add_test(NAME zlib_static_example64 COMMAND zlib_static_example64)
121
+ add_executable(zlib_example64static example.c)
122
+ target_compile_definitions(zlib_example64static
123
+ PRIVATE
124
+ ZLIB_BUILD
125
+ $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
126
+ target_link_libraries(zlib_example64static ZLIB::ZLIBSTATIC)
127
+ add_test(NAME zlib_example64static COMMAND zlib_example64static zlib_example64static.gz)
125128
endif(HAVE_OFF64_T)
126129
endif(ZLIB_BUILD_STATIC)
127130
128131
add_test(
129132
NAME zlib_install
130
- COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} --prefix
131
- ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
133
+ COMMAND ${CMAKE_COMMAND}
134
+ --install ${zlib_BINARY_DIR}
135
+ --prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install
136
+ --config $<CONFIG>
132137
WORKING_DIRECTORY ${zlib_BINARY_DIR})
133138
134139
set_tests_properties(zlib_install PROPERTIES FIXTURES_SETUP zlib_install)
135140
136
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
137
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/find_package_no_components_test)
138
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/find_package_wrong_components_test)
139
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
140
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
141
-
142141
configure_file(
143142
${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
144
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
143
+ ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test/CMakeLists.txt @ONLY)
145144
146145
configure_file(
147146
${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
148
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt @ONLY)
147
+ ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test/CMakeLists.txt @ONLY)
149148
150149
configure_file(
151150
${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
152
- ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt @ONLY)
151
+ ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test/CMakeLists.txt @ONLY)
153152
154153
configure_file(
155154
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
156
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
155
+ ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test/CMakeLists.txt @ONLY)
157156
158157
configure_file(
159158
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
160
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
159
+ ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test/CMakeLists.txt
161160
@ONLY)
162161
163162
# CMAKE_GENERATOR_PLATFORM doesn't work in the if
164163
set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
165164
166165
if(GENERATOR)
167166
set(PLATFORM "-A ${GENERATOR}")
168167
endif(GENERATOR)
169168
#
170
-# findpackage_test
169
+# find_package_test
171170
#
172171
add_test(
173172
NAME zlib_find_package_configure
174173
COMMAND
175
- ${CMAKE_COMMAND} ${PLATFORM}
176
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
177
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
174
+ ${CMAKE_COMMAND}
175
+ ${PLATFORM}
176
+ -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build
177
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
178
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
178179
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
179
- -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
180
- -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
180
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
181
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
182
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
183
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
184
+ -G "${CMAKE_GENERATOR}"
185
+ -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test)
181186
182187
add_test(
183188
NAME zlib_find_package_build
184189
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
185
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
190
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build)
186191
187192
add_test(
188193
NAME zlib_find_package_test
189194
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
190
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
191
-
192
-set_tests_properties(
193
- zlib_find_package_configure PROPERTIES FIXTURES_REQUIRED zlib_install
194
- FIXTURES_SETUP fp_config)
195
-
196
-set_tests_properties(
197
- zlib_find_package_build PROPERTIES FIXTURES_REQUIRED fp_config
198
- FIXTURES_SETUP fp_build)
199
-
200
-set_tests_properties(
201
- zlib_find_package_test PROPERTIES FIXTURES_REQUIRED fp_build ENVIRONMENT
202
- CTEST_OUTPUT_ON_FAILURE=1)
203
-
204
-#
205
-# findpackage_no_components_test
195
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build)
196
+
197
+set_tests_properties(zlib_find_package_configure
198
+ PROPERTIES
199
+ FIXTURES_REQUIRED zlib_install
200
+ FIXTURES_SETUP fp_config)
201
+
202
+set_tests_properties(zlib_find_package_build
203
+ PROPERTIES
204
+ FIXTURES_REQUIRED fp_config
205
+ FIXTURES_SETUP fp_build)
206
+
207
+set_tests_properties(zlib_find_package_test
208
+ PROPERTIES
209
+ FIXTURES_REQUIRED fp_build
210
+ ENVIRONMENT
211
+ CTEST_OUTPUT_ON_FAILURE=1)
212
+
213
+#
214
+# find_package_no_components_test
206215
#
207216
add_test(
208217
NAME zlib_find_package_no_components_configure
209218
COMMAND
210
- ${CMAKE_COMMAND} ${PLATFORM}
211
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
212
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
219
+ ${CMAKE_COMMAND}
220
+ ${PLATFORM}
221
+ -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test_build
222
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
223
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
213224
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
214
- -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
225
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
226
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
227
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
228
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
215229
-G "${CMAKE_GENERATOR}"
216
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
230
+ -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test)
217231
218
-set_tests_properties(
219
- zlib_find_package_no_components_configure
220
- PROPERTIES FIXTURES_REQUIRED zlib_install)
232
+set_tests_properties(zlib_find_package_no_components_configure
233
+ PROPERTIES
234
+ FIXTURES_REQUIRED zlib_install)
221235
222236
if(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)
223
- set_tests_properties(
224
- zlib_find_package_no_components_configure
225
- PROPERTIES WILL_FAIL TRUE)
237
+ set_tests_properties(zlib_find_package_no_components_configure
238
+ PROPERTIES
239
+ WILL_FAIL TRUE)
226240
endif(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)
227241
228242
#
229
-# findpackage_no_component_test
243
+# find_package_wrong_component_test
230244
#
231245
add_test(
232246
NAME zlib_find_package_wrong_components_configure
233247
COMMAND
234
- ${CMAKE_COMMAND} ${PLATFORM}
235
- -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
236
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
248
+ ${CMAKE_COMMAND}
249
+ ${PLATFORM}
250
+ -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test_build
251
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
252
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
237253
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
238
- -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
254
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
255
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
256
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
257
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
239258
-G "${CMAKE_GENERATOR}"
240
- -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
259
+ -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test)
241260
242
-set_tests_properties(
243
- zlib_find_package_wrong_components_configure
244
- PROPERTIES FIXTURES_REQUIRED zlib_install
245
- WILL_FAIL TRUE)
261
+set_tests_properties(zlib_find_package_wrong_components_configure
262
+ PROPERTIES
263
+ FIXTURES_REQUIRED zlib_install
264
+ WILL_FAIL TRUE)
246265
247266
#
248267
# add_subdirectory_test
249268
#
250269
add_test(
251270
NAME zlib_add_subdirectory_configure
252271
COMMAND
253
- ${CMAKE_COMMAND} ${PLATFORM}
254
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
255
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
272
+ ${CMAKE_COMMAND}
273
+ ${PLATFORM}
274
+ -B${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build
275
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
276
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
256277
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
257
- -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
258
- -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
278
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
279
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
280
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
281
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
282
+ -G "${CMAKE_GENERATOR}"
283
+ -S${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test)
259284
260285
add_test(
261286
NAME zlib_add_subdirectory_build
262287
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
263
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
288
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build)
264289
265290
add_test(
266291
NAME zlib_add_subdirectory_test
267292
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
268
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
269
-
270
-set_tests_properties(
271
- zlib_add_subdirectory_configure PROPERTIES FIXTURES_REQUIRED zlib_install
272
- FIXTURES_SETUP as_config)
273
-
274
-set_tests_properties(
275
- zlib_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED as_config
276
- FIXTURES_SETUP as_build)
277
-
278
-set_tests_properties(
279
- zlib_add_subdirectory_test PROPERTIES FIXTURES_REQUIRED as_build
280
- ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)
293
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build)
294
+
295
+set_tests_properties(zlib_add_subdirectory_configure
296
+ PROPERTIES
297
+ FIXTURES_REQUIRED zlib_install
298
+ FIXTURES_SETUP as_config)
299
+
300
+set_tests_properties(zlib_add_subdirectory_build
301
+ PROPERTIES
302
+ FIXTURES_REQUIRED as_config
303
+ FIXTURES_SETUP as_build)
304
+
305
+set_tests_properties(zlib_add_subdirectory_test
306
+ PROPERTIES
307
+ FIXTURES_REQUIRED as_build
308
+ ENVIRONMENT
309
+ CTEST_OUTPUT_ON_FAILURE=1)
281310
282311
#
283312
# add_subdirectory_exclude_test
284313
#
285314
add_test(
286315
NAME zlib_add_subdirectory_exclude_configure
287316
COMMAND
288
- ${CMAKE_COMMAND} ${PLATFORM}
289
- -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
290
- -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
317
+ ${CMAKE_COMMAND}
318
+ ${PLATFORM}
319
+ -B${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build
320
+ -DCMAKE_BUILD_TYPE=$<CONFIG>
321
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
291322
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
292
- -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
293
- -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
323
+ "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
324
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
325
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
326
+ $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
327
+ -G "${CMAKE_GENERATOR}"
328
+ -S${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test)
294329
295330
add_test(
296331
NAME zlib_add_subdirectory_exclude_build
297332
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
298333
WORKING_DIRECTORY
299
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
334
+ ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build)
300335
301336
add_test(
302337
NAME zlib_add_subdirectory_exclude_test
303338
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
304339
WORKING_DIRECTORY
305
- ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
306
-
307
-set_tests_properties(
308
- zlib_add_subdirectory_exclude_configure
309
- PROPERTIES FIXTURES_REQUIRED zlib_install FIXTURES_SETUP asx_config)
310
-
311
-set_tests_properties(
312
- zlib_add_subdirectory_exclude_build PROPERTIES FIXTURES_REQUIRED as_config
313
- FIXTURES_SETUP asx_build)
314
-
315
-set_tests_properties(
316
- zlib_add_subdirectory_exclude_test
317
- PROPERTIES FIXTURES_REQUIRED asx_build ENVIRONMENT
318
- CTEST_OUTPUT_ON_FAILURE=1)
340
+ ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build)
341
+
342
+set_tests_properties(zlib_add_subdirectory_exclude_configure
343
+ PROPERTIES
344
+ FIXTURES_REQUIRED zlib_install
345
+ FIXTURES_SETUP asx_config)
346
+
347
+set_tests_properties(zlib_add_subdirectory_exclude_build
348
+ PROPERTIES
349
+ FIXTURES_REQUIRED asx_config
350
+ FIXTURES_SETUP asx_build)
351
+
352
+set_tests_properties(zlib_add_subdirectory_exclude_test
353
+ PROPERTIES
354
+ FIXTURES_REQUIRED asx_build
355
+ ENVIRONMENT
356
+ CTEST_OUTPUT_ON_FAILURE=1)
319357
--- compat/zlib/test/CMakeLists.txt
+++ compat/zlib/test/CMakeLists.txt
@@ -15,11 +15,11 @@
15
16 if(ZLIB_BUILD_SHARED)
17 add_executable(zlib_example example.c)
18 target_link_libraries(zlib_example ZLIB::ZLIB)
19 target_compile_definitions(zlib_example PRIVATE ZLIB_BUILD)
20 add_test(NAME zlib_example COMMAND zlib_example)
21
22 add_executable(minigzip minigzip.c)
23 target_compile_definitions(
24 minigzip PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
25 target_link_libraries(minigzip ZLIB::ZLIB)
@@ -40,11 +40,11 @@
40 target_compile_definitions(
41 zlib_example64
42 PRIVATE ZLIB_BUILD
43 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
44 target_link_libraries(zlib_example64 ZLIB::ZLIB)
45 add_test(NAME zlib_example64 COMMAND zlib_example64)
46
47 if(MSVC
48 OR MSYS
49 OR MINGW
50 OR CYGWIN)
@@ -56,43 +56,45 @@
56 OR CYGWIN)
57 endif(HAVE_OFF64_T)
58 endif(ZLIB_BUILD_SHARED)
59
60 if(ZLIB_BUILD_STATIC)
61 add_executable(zlib_static_example example.c)
62 target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC)
63 target_compile_definitions(
64 zlib_static_example
65 PRIVATE ZLIB_BUILD
66 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
67 add_test(NAME zlib_static_example COMMAND zlib_static_example)
68
69 add_executable(static_minigzip minigzip.c)
70 target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC)
71
72 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL
73 "Clang")
74 set(CFLAGS_OLD ${CMAKE_C_FLAGS})
75 set(CMAKE_C_FLAGS
76 ""
77 CACHE STRING "" FORCE)
78
79 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
80 find_program(GCOV_EXECUTABLE gcov)
81 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
82
83 if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
 
84 set(llvm_names llvm_cov)
85 list(APPEND llvm_names llvm-cov)
86
87 foreach(ver RANGE 11 99)
88 list(APPEND llvm_names llvm-cov-${ver})
89 endforeach(ver RANGE 11 99)
90
91 find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
92 set(llvm_option "gcov")
93 endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
 
94
95 add_executable(infcover infcover.c)
96 target_link_libraries(infcover ZLIB::ZLIBSTATIC)
97 target_compile_options(infcover PRIVATE -coverage)
98 target_link_options(infcover PRIVATE -coverage)
@@ -104,215 +106,251 @@
104 NAME zlib_coverage-summary
105 COMMAND
106 ${GCOV_EXECUTABLE} ${llvm_option}
107 ${CMAKE_CURRENT_SOURCE_DIR}/infcover.c -o
108 ${INFCOVER_DIR}/infcover.c.gcda)
109 set_tests_properties(zlib_coverage-summary PROPERTIES DEPENDS
110 zlib-coverage)
 
111 set(CMAKE_C_FLAGS
112 ${CFLAGS_OLD}
113 CACHE STRING "" FORCE)
114 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID}
115 STREQUAL "Clang")
116
117 if(HAVE_OFF64_T)
118 add_executable(zlib_static_example64 example.c)
119 target_compile_definitions(
120 zlib_static_example64
121 PRIVATE ZLIB_BUILD
122 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
123 target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC)
124 add_test(NAME zlib_static_example64 COMMAND zlib_static_example64)
125 endif(HAVE_OFF64_T)
126 endif(ZLIB_BUILD_STATIC)
127
128 add_test(
129 NAME zlib_install
130 COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} --prefix
131 ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
 
 
132 WORKING_DIRECTORY ${zlib_BINARY_DIR})
133
134 set_tests_properties(zlib_install PROPERTIES FIXTURES_SETUP zlib_install)
135
136 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
137 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/find_package_no_components_test)
138 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/find_package_wrong_components_test)
139 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
140 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
141
142 configure_file(
143 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
144 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
145
146 configure_file(
147 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
148 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test/CMakeLists.txt @ONLY)
149
150 configure_file(
151 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
152 ${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test/CMakeLists.txt @ONLY)
153
154 configure_file(
155 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
156 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
157
158 configure_file(
159 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
160 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
161 @ONLY)
162
163 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
164 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
165
166 if(GENERATOR)
167 set(PLATFORM "-A ${GENERATOR}")
168 endif(GENERATOR)
169 #
170 # findpackage_test
171 #
172 add_test(
173 NAME zlib_find_package_configure
174 COMMAND
175 ${CMAKE_COMMAND} ${PLATFORM}
176 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
177 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
178 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
179 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
180 -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
 
 
 
 
181
182 add_test(
183 NAME zlib_find_package_build
184 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
185 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
186
187 add_test(
188 NAME zlib_find_package_test
189 COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
190 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
191
192 set_tests_properties(
193 zlib_find_package_configure PROPERTIES FIXTURES_REQUIRED zlib_install
194 FIXTURES_SETUP fp_config)
195
196 set_tests_properties(
197 zlib_find_package_build PROPERTIES FIXTURES_REQUIRED fp_config
198 FIXTURES_SETUP fp_build)
199
200 set_tests_properties(
201 zlib_find_package_test PROPERTIES FIXTURES_REQUIRED fp_build ENVIRONMENT
202 CTEST_OUTPUT_ON_FAILURE=1)
203
204 #
205 # findpackage_no_components_test
 
 
 
 
206 #
207 add_test(
208 NAME zlib_find_package_no_components_configure
209 COMMAND
210 ${CMAKE_COMMAND} ${PLATFORM}
211 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test_build
212 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
213 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
214 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
 
 
 
215 -G "${CMAKE_GENERATOR}"
216 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_no_components_test)
217
218 set_tests_properties(
219 zlib_find_package_no_components_configure
220 PROPERTIES FIXTURES_REQUIRED zlib_install)
221
222 if(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)
223 set_tests_properties(
224 zlib_find_package_no_components_configure
225 PROPERTIES WILL_FAIL TRUE)
226 endif(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)
227
228 #
229 # findpackage_no_component_test
230 #
231 add_test(
232 NAME zlib_find_package_wrong_components_configure
233 COMMAND
234 ${CMAKE_COMMAND} ${PLATFORM}
235 -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test_build
236 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
237 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
238 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
 
 
 
239 -G "${CMAKE_GENERATOR}"
240 -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_wrong_components_test)
241
242 set_tests_properties(
243 zlib_find_package_wrong_components_configure
244 PROPERTIES FIXTURES_REQUIRED zlib_install
245 WILL_FAIL TRUE)
246
247 #
248 # add_subdirectory_test
249 #
250 add_test(
251 NAME zlib_add_subdirectory_configure
252 COMMAND
253 ${CMAKE_COMMAND} ${PLATFORM}
254 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
255 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
256 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
257 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
258 -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
 
 
 
 
259
260 add_test(
261 NAME zlib_add_subdirectory_build
262 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
263 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
264
265 add_test(
266 NAME zlib_add_subdirectory_test
267 COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
268 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
269
270 set_tests_properties(
271 zlib_add_subdirectory_configure PROPERTIES FIXTURES_REQUIRED zlib_install
272 FIXTURES_SETUP as_config)
273
274 set_tests_properties(
275 zlib_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED as_config
276 FIXTURES_SETUP as_build)
277
278 set_tests_properties(
279 zlib_add_subdirectory_test PROPERTIES FIXTURES_REQUIRED as_build
280 ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)
 
 
 
 
281
282 #
283 # add_subdirectory_exclude_test
284 #
285 add_test(
286 NAME zlib_add_subdirectory_exclude_configure
287 COMMAND
288 ${CMAKE_COMMAND} ${PLATFORM}
289 -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
290 -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
 
 
291 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
292 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
293 -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
 
 
 
 
294
295 add_test(
296 NAME zlib_add_subdirectory_exclude_build
297 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
298 WORKING_DIRECTORY
299 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
300
301 add_test(
302 NAME zlib_add_subdirectory_exclude_test
303 COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
304 WORKING_DIRECTORY
305 ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
306
307 set_tests_properties(
308 zlib_add_subdirectory_exclude_configure
309 PROPERTIES FIXTURES_REQUIRED zlib_install FIXTURES_SETUP asx_config)
310
311 set_tests_properties(
312 zlib_add_subdirectory_exclude_build PROPERTIES FIXTURES_REQUIRED as_config
313 FIXTURES_SETUP asx_build)
314
315 set_tests_properties(
316 zlib_add_subdirectory_exclude_test
317 PROPERTIES FIXTURES_REQUIRED asx_build ENVIRONMENT
318 CTEST_OUTPUT_ON_FAILURE=1)
 
 
 
319
--- compat/zlib/test/CMakeLists.txt
+++ compat/zlib/test/CMakeLists.txt
@@ -15,11 +15,11 @@
15
16 if(ZLIB_BUILD_SHARED)
17 add_executable(zlib_example example.c)
18 target_link_libraries(zlib_example ZLIB::ZLIB)
19 target_compile_definitions(zlib_example PRIVATE ZLIB_BUILD)
20 add_test(NAME zlib_example COMMAND zlib_example zlib_example.gz)
21
22 add_executable(minigzip minigzip.c)
23 target_compile_definitions(
24 minigzip PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
25 target_link_libraries(minigzip ZLIB::ZLIB)
@@ -40,11 +40,11 @@
40 target_compile_definitions(
41 zlib_example64
42 PRIVATE ZLIB_BUILD
43 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
44 target_link_libraries(zlib_example64 ZLIB::ZLIB)
45 add_test(NAME zlib_example64 COMMAND zlib_example64 zlib_example64.gz)
46
47 if(MSVC
48 OR MSYS
49 OR MINGW
50 OR CYGWIN)
@@ -56,43 +56,45 @@
56 OR CYGWIN)
57 endif(HAVE_OFF64_T)
58 endif(ZLIB_BUILD_SHARED)
59
60 if(ZLIB_BUILD_STATIC)
61 add_executable(zlib_examplestatic example.c)
62 target_link_libraries(zlib_examplestatic ZLIB::ZLIBSTATIC)
63 target_compile_definitions(
64 zlib_examplestatic
65 PRIVATE ZLIB_BUILD
66 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
67 add_test(NAME zlib_examplestatic COMMAND zlib_examplestatic zlib_examplestatic.gz)
68
69 add_executable(minigzipstatic minigzip.c)
70 target_link_libraries(minigzipstatic ZLIB::ZLIBSTATIC)
71
72 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
73 ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
74 set(CFLAGS_OLD ${CMAKE_C_FLAGS})
75 set(CMAKE_C_FLAGS
76 ""
77 CACHE STRING "" FORCE)
78
79 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
80 find_program(GCOV_EXECUTABLE gcov)
81 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
82
83 if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
84 AND NOT CMAKE_CROSSCOMPILING)
85 set(llvm_names llvm_cov)
86 list(APPEND llvm_names llvm-cov)
87
88 foreach(ver RANGE 11 99)
89 list(APPEND llvm_names llvm-cov-${ver})
90 endforeach(ver RANGE 11 99)
91
92 find_program(GCOV_EXECUTABLE NAMES ${llvm_names})
93 set(llvm_option "gcov")
94 endif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang"
95 AND NOT CMAKE_CROSSCOMPILING)
96
97 add_executable(infcover infcover.c)
98 target_link_libraries(infcover ZLIB::ZLIBSTATIC)
99 target_compile_options(infcover PRIVATE -coverage)
100 target_link_options(infcover PRIVATE -coverage)
@@ -104,215 +106,251 @@
106 NAME zlib_coverage-summary
107 COMMAND
108 ${GCOV_EXECUTABLE} ${llvm_option}
109 ${CMAKE_CURRENT_SOURCE_DIR}/infcover.c -o
110 ${INFCOVER_DIR}/infcover.c.gcda)
111 set_tests_properties(zlib_coverage-summary
112 PROPERTIES
113 DEPENDS zlib-coverage)
114 set(CMAKE_C_FLAGS
115 ${CFLAGS_OLD}
116 CACHE STRING "" FORCE)
117 endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
118 ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
119
120 if(HAVE_OFF64_T)
121 add_executable(zlib_example64static example.c)
122 target_compile_definitions(zlib_example64static
123 PRIVATE
124 ZLIB_BUILD
125 $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
126 target_link_libraries(zlib_example64static ZLIB::ZLIBSTATIC)
127 add_test(NAME zlib_example64static COMMAND zlib_example64static zlib_example64static.gz)
128 endif(HAVE_OFF64_T)
129 endif(ZLIB_BUILD_STATIC)
130
131 add_test(
132 NAME zlib_install
133 COMMAND ${CMAKE_COMMAND}
134 --install ${zlib_BINARY_DIR}
135 --prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install
136 --config $<CONFIG>
137 WORKING_DIRECTORY ${zlib_BINARY_DIR})
138
139 set_tests_properties(zlib_install PROPERTIES FIXTURES_SETUP zlib_install)
140
 
 
 
 
 
 
141 configure_file(
142 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
143 ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test/CMakeLists.txt @ONLY)
144
145 configure_file(
146 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_no_components_test.cmake.in
147 ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test/CMakeLists.txt @ONLY)
148
149 configure_file(
150 ${CMAKE_CURRENT_SOURCE_DIR}/find_package_wrong_components_test.cmake.in
151 ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test/CMakeLists.txt @ONLY)
152
153 configure_file(
154 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
155 ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test/CMakeLists.txt @ONLY)
156
157 configure_file(
158 ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
159 ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test/CMakeLists.txt
160 @ONLY)
161
162 # CMAKE_GENERATOR_PLATFORM doesn't work in the if
163 set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
164
165 if(GENERATOR)
166 set(PLATFORM "-A ${GENERATOR}")
167 endif(GENERATOR)
168 #
169 # find_package_test
170 #
171 add_test(
172 NAME zlib_find_package_configure
173 COMMAND
174 ${CMAKE_COMMAND}
175 ${PLATFORM}
176 -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build
177 -DCMAKE_BUILD_TYPE=$<CONFIG>
178 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
179 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
180 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
181 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
182 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
183 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
184 -G "${CMAKE_GENERATOR}"
185 -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test)
186
187 add_test(
188 NAME zlib_find_package_build
189 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
190 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build)
191
192 add_test(
193 NAME zlib_find_package_test
194 COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
195 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_test_build)
196
197 set_tests_properties(zlib_find_package_configure
198 PROPERTIES
199 FIXTURES_REQUIRED zlib_install
200 FIXTURES_SETUP fp_config)
201
202 set_tests_properties(zlib_find_package_build
203 PROPERTIES
204 FIXTURES_REQUIRED fp_config
205 FIXTURES_SETUP fp_build)
206
207 set_tests_properties(zlib_find_package_test
208 PROPERTIES
209 FIXTURES_REQUIRED fp_build
210 ENVIRONMENT
211 CTEST_OUTPUT_ON_FAILURE=1)
212
213 #
214 # find_package_no_components_test
215 #
216 add_test(
217 NAME zlib_find_package_no_components_configure
218 COMMAND
219 ${CMAKE_COMMAND}
220 ${PLATFORM}
221 -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test_build
222 -DCMAKE_BUILD_TYPE=$<CONFIG>
223 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
224 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
225 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
226 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
227 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
228 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
229 -G "${CMAKE_GENERATOR}"
230 -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_no_components_test)
231
232 set_tests_properties(zlib_find_package_no_components_configure
233 PROPERTIES
234 FIXTURES_REQUIRED zlib_install)
235
236 if(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)
237 set_tests_properties(zlib_find_package_no_components_configure
238 PROPERTIES
239 WILL_FAIL TRUE)
240 endif(NOT ZLIB_BUILD_SHARED OR NOT ZLIB_BUILD_STATIC)
241
242 #
243 # find_package_wrong_component_test
244 #
245 add_test(
246 NAME zlib_find_package_wrong_components_configure
247 COMMAND
248 ${CMAKE_COMMAND}
249 ${PLATFORM}
250 -B${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test_build
251 -DCMAKE_BUILD_TYPE=$<CONFIG>
252 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
253 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
254 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
255 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
256 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
257 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
258 -G "${CMAKE_GENERATOR}"
259 -S${CMAKE_CURRENT_BINARY_DIR}/zlib_find_package_wrong_components_test)
260
261 set_tests_properties(zlib_find_package_wrong_components_configure
262 PROPERTIES
263 FIXTURES_REQUIRED zlib_install
264 WILL_FAIL TRUE)
265
266 #
267 # add_subdirectory_test
268 #
269 add_test(
270 NAME zlib_add_subdirectory_configure
271 COMMAND
272 ${CMAKE_COMMAND}
273 ${PLATFORM}
274 -B${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build
275 -DCMAKE_BUILD_TYPE=$<CONFIG>
276 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
277 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
278 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
279 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
280 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
281 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
282 -G "${CMAKE_GENERATOR}"
283 -S${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test)
284
285 add_test(
286 NAME zlib_add_subdirectory_build
287 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
288 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build)
289
290 add_test(
291 NAME zlib_add_subdirectory_test
292 COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
293 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_test_build)
294
295 set_tests_properties(zlib_add_subdirectory_configure
296 PROPERTIES
297 FIXTURES_REQUIRED zlib_install
298 FIXTURES_SETUP as_config)
299
300 set_tests_properties(zlib_add_subdirectory_build
301 PROPERTIES
302 FIXTURES_REQUIRED as_config
303 FIXTURES_SETUP as_build)
304
305 set_tests_properties(zlib_add_subdirectory_test
306 PROPERTIES
307 FIXTURES_REQUIRED as_build
308 ENVIRONMENT
309 CTEST_OUTPUT_ON_FAILURE=1)
310
311 #
312 # add_subdirectory_exclude_test
313 #
314 add_test(
315 NAME zlib_add_subdirectory_exclude_configure
316 COMMAND
317 ${CMAKE_COMMAND}
318 ${PLATFORM}
319 -B${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build
320 -DCMAKE_BUILD_TYPE=$<CONFIG>
321 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
322 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
323 "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
324 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
325 -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
326 $<$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.24>:--fresh>
327 -G "${CMAKE_GENERATOR}"
328 -S${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test)
329
330 add_test(
331 NAME zlib_add_subdirectory_exclude_build
332 COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
333 WORKING_DIRECTORY
334 ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build)
335
336 add_test(
337 NAME zlib_add_subdirectory_exclude_test
338 COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
339 WORKING_DIRECTORY
340 ${CMAKE_CURRENT_BINARY_DIR}/zlib_add_subdirectory_exclude_test_build)
341
342 set_tests_properties(zlib_add_subdirectory_exclude_configure
343 PROPERTIES
344 FIXTURES_REQUIRED zlib_install
345 FIXTURES_SETUP asx_config)
346
347 set_tests_properties(zlib_add_subdirectory_exclude_build
348 PROPERTIES
349 FIXTURES_REQUIRED asx_config
350 FIXTURES_SETUP asx_build)
351
352 set_tests_properties(zlib_add_subdirectory_exclude_test
353 PROPERTIES
354 FIXTURES_REQUIRED asx_build
355 ENVIRONMENT
356 CTEST_OUTPUT_ON_FAILURE=1)
357
--- compat/zlib/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/test/add_subdirectory_exclude_test.cmake.in
@@ -1,13 +1,12 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
zlib_find_package_test
55
LANGUAGES C
66
VERSION @zlib_VERSION@)
77
8
-enable_testing()
98
option(ZLIB_BUILD_TESTING "" OFF)
109
option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
1110
option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
1211
1312
add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib
1413
--- compat/zlib/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/test/add_subdirectory_exclude_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
8 enable_testing()
9 option(ZLIB_BUILD_TESTING "" OFF)
10 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
11 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
12
13 add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib
14
--- compat/zlib/test/add_subdirectory_exclude_test.cmake.in
+++ compat/zlib/test/add_subdirectory_exclude_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
 
8 option(ZLIB_BUILD_TESTING "" OFF)
9 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
10 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
11
12 add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib
13
--- compat/zlib/test/add_subdirectory_test.cmake.in
+++ compat/zlib/test/add_subdirectory_test.cmake.in
@@ -1,13 +1,12 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
zlib_find_package_test
55
LANGUAGES C
66
VERSION @zlib_VERSION@)
77
8
-enable_testing()
98
option(ZLIB_BUILD_TESTING "" OFF)
109
option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
1110
option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
1211
1312
add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib)
@@ -23,6 +22,6 @@
2322
2423
if(ZLIB_BUILD_STATIC)
2524
add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
2625
target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
2726
add_test(NAME zlib_test_example_static COMMAND test_example_static)
28
-endif(@ZLIB_BUILD_STATIC)
27
+endif(ZLIB_BUILD_STATIC)
2928
--- compat/zlib/test/add_subdirectory_test.cmake.in
+++ compat/zlib/test/add_subdirectory_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
8 enable_testing()
9 option(ZLIB_BUILD_TESTING "" OFF)
10 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
11 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
12
13 add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib)
@@ -23,6 +22,6 @@
23
24 if(ZLIB_BUILD_STATIC)
25 add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
26 target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
27 add_test(NAME zlib_test_example_static COMMAND test_example_static)
28 endif(@ZLIB_BUILD_STATIC)
29
--- compat/zlib/test/add_subdirectory_test.cmake.in
+++ compat/zlib/test/add_subdirectory_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
 
8 option(ZLIB_BUILD_TESTING "" OFF)
9 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
10 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
11
12 add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib)
@@ -23,6 +22,6 @@
22
23 if(ZLIB_BUILD_STATIC)
24 add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
25 target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
26 add_test(NAME zlib_test_example_static COMMAND test_example_static)
27 endif(ZLIB_BUILD_STATIC)
28
--- compat/zlib/test/find_package_no_components_test.cmake.in
+++ compat/zlib/test/find_package_no_components_test.cmake.in
@@ -1,13 +1,12 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
zlib_find_package_test
55
LANGUAGES C
66
VERSION @zlib_VERSION@)
77
8
-enable_testing()
98
option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
109
option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
1110
1211
find_package(ZLIB @zlib_VERSION@ CONFIG REQUIRED)
1312
1413
--- compat/zlib/test/find_package_no_components_test.cmake.in
+++ compat/zlib/test/find_package_no_components_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
8 enable_testing()
9 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
10 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
11
12 find_package(ZLIB @zlib_VERSION@ CONFIG REQUIRED)
13
14
--- compat/zlib/test/find_package_no_components_test.cmake.in
+++ compat/zlib/test/find_package_no_components_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
 
8 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
9 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
10
11 find_package(ZLIB @zlib_VERSION@ CONFIG REQUIRED)
12
13
--- compat/zlib/test/find_package_test.cmake.in
+++ compat/zlib/test/find_package_test.cmake.in
@@ -1,13 +1,12 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
zlib_find_package_test
55
LANGUAGES C
66
VERSION @zlib_VERSION@)
77
8
-enable_testing()
98
option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
109
option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
1110
1211
if(ZLIB_BUILD_SHARED)
1312
find_package(ZLIB @zlib_VERSION@ CONFIG COMPONENTS shared REQUIRED)
1413
--- compat/zlib/test/find_package_test.cmake.in
+++ compat/zlib/test/find_package_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
8 enable_testing()
9 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
10 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
11
12 if(ZLIB_BUILD_SHARED)
13 find_package(ZLIB @zlib_VERSION@ CONFIG COMPONENTS shared REQUIRED)
14
--- compat/zlib/test/find_package_test.cmake.in
+++ compat/zlib/test/find_package_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
 
8 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
9 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
10
11 if(ZLIB_BUILD_SHARED)
12 find_package(ZLIB @zlib_VERSION@ CONFIG COMPONENTS shared REQUIRED)
13
--- compat/zlib/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/test/find_package_wrong_components_test.cmake.in
@@ -1,13 +1,12 @@
1
-cmake_minimum_required(VERSION 3.12...3.31)
1
+cmake_minimum_required(VERSION 3.15...3.31)
22
33
project(
44
zlib_find_package_test
55
LANGUAGES C
66
VERSION @zlib_VERSION@)
77
8
-enable_testing()
98
option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
109
option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
1110
1211
find_package(ZLIB @zlib_VERSION@ CONFIG COMPONENTS wrong REQUIRED)
1312
1413
--- compat/zlib/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/test/find_package_wrong_components_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.12...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
8 enable_testing()
9 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
10 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
11
12 find_package(ZLIB @zlib_VERSION@ CONFIG COMPONENTS wrong REQUIRED)
13
14
--- compat/zlib/test/find_package_wrong_components_test.cmake.in
+++ compat/zlib/test/find_package_wrong_components_test.cmake.in
@@ -1,13 +1,12 @@
1 cmake_minimum_required(VERSION 3.15...3.31)
2
3 project(
4 zlib_find_package_test
5 LANGUAGES C
6 VERSION @zlib_VERSION@)
7
 
8 option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
9 option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
10
11 find_package(ZLIB @zlib_VERSION@ CONFIG COMPONENTS wrong REQUIRED)
12
13
--- compat/zlib/test/infcover.c
+++ compat/zlib/test/infcover.c
@@ -296,11 +296,11 @@
296296
ret = inflateInit2(&strm, win);
297297
if (ret != Z_OK) {
298298
mem_done(&strm, what);
299299
return;
300300
}
301
- out = malloc(len); assert(out != NULL);
301
+ out = malloc(len ? len : 1); assert(out != NULL);
302302
if (win == 47) {
303303
head.extra = out;
304304
head.extra_max = len;
305305
head.name = out;
306306
head.name_max = len;
@@ -358,10 +358,13 @@
358358
ret = inflateInit(&strm); assert(ret == Z_OK);
359359
mem_used(&strm, "inflate init");
360360
ret = inflatePrime(&strm, 5, 31); assert(ret == Z_OK);
361361
ret = inflatePrime(&strm, -1, 0); assert(ret == Z_OK);
362362
ret = inflateSetDictionary(&strm, Z_NULL, 0);
363
+ assert(ret == Z_STREAM_ERROR);
364
+ ret = inflateReset2(&strm, -15); assert(ret == Z_OK);
365
+ ret = inflateSetDictionary(&strm, Z_NULL, 1);
363366
assert(ret == Z_STREAM_ERROR);
364367
ret = inflateEnd(&strm); assert(ret == Z_OK);
365368
mem_done(&strm, "prime");
366369
367370
inf("63 0", "force window allocation", 0, -15, 1, Z_OK);
368371
--- compat/zlib/test/infcover.c
+++ compat/zlib/test/infcover.c
@@ -296,11 +296,11 @@
296 ret = inflateInit2(&strm, win);
297 if (ret != Z_OK) {
298 mem_done(&strm, what);
299 return;
300 }
301 out = malloc(len); assert(out != NULL);
302 if (win == 47) {
303 head.extra = out;
304 head.extra_max = len;
305 head.name = out;
306 head.name_max = len;
@@ -358,10 +358,13 @@
358 ret = inflateInit(&strm); assert(ret == Z_OK);
359 mem_used(&strm, "inflate init");
360 ret = inflatePrime(&strm, 5, 31); assert(ret == Z_OK);
361 ret = inflatePrime(&strm, -1, 0); assert(ret == Z_OK);
362 ret = inflateSetDictionary(&strm, Z_NULL, 0);
 
 
 
363 assert(ret == Z_STREAM_ERROR);
364 ret = inflateEnd(&strm); assert(ret == Z_OK);
365 mem_done(&strm, "prime");
366
367 inf("63 0", "force window allocation", 0, -15, 1, Z_OK);
368
--- compat/zlib/test/infcover.c
+++ compat/zlib/test/infcover.c
@@ -296,11 +296,11 @@
296 ret = inflateInit2(&strm, win);
297 if (ret != Z_OK) {
298 mem_done(&strm, what);
299 return;
300 }
301 out = malloc(len ? len : 1); assert(out != NULL);
302 if (win == 47) {
303 head.extra = out;
304 head.extra_max = len;
305 head.name = out;
306 head.name_max = len;
@@ -358,10 +358,13 @@
358 ret = inflateInit(&strm); assert(ret == Z_OK);
359 mem_used(&strm, "inflate init");
360 ret = inflatePrime(&strm, 5, 31); assert(ret == Z_OK);
361 ret = inflatePrime(&strm, -1, 0); assert(ret == Z_OK);
362 ret = inflateSetDictionary(&strm, Z_NULL, 0);
363 assert(ret == Z_STREAM_ERROR);
364 ret = inflateReset2(&strm, -15); assert(ret == Z_OK);
365 ret = inflateSetDictionary(&strm, Z_NULL, 1);
366 assert(ret == Z_STREAM_ERROR);
367 ret = inflateEnd(&strm); assert(ret == Z_OK);
368 mem_done(&strm, "prime");
369
370 inf("63 0", "force window allocation", 0, -15, 1, Z_OK);
371
--- compat/zlib/test/minigzip.c
+++ compat/zlib/test/minigzip.c
@@ -35,10 +35,13 @@
3535
#endif
3636
3737
#ifdef USE_MMAP
3838
# include <sys/types.h>
3939
# include <sys/mman.h>
40
+# ifndef MAP_FAILED
41
+# define MAP_FAILED ((void *)-1)
42
+# endif
4043
# include <sys/stat.h>
4144
#endif
4245
4346
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
4447
# include <fcntl.h>
@@ -335,22 +338,22 @@
335338
*/
336339
static int gz_compress_mmap(FILE *in, gzFile out) {
337340
int len;
338341
int err;
339342
int ifd = fileno(in);
340
- caddr_t buf; /* mmap'ed buffer for the entire input file */
343
+ void *buf; /* mmap'ed buffer for the entire input file */
341344
off_t buf_len; /* length of the input file */
342345
struct stat sb;
343346
344347
/* Determine the size of the file, needed for mmap: */
345348
if (fstat(ifd, &sb) < 0) return Z_ERRNO;
346349
buf_len = sb.st_size;
347350
if (buf_len <= 0) return Z_ERRNO;
348351
349352
/* Now do the actual mmap: */
350
- buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
351
- if (buf == (caddr_t)(-1)) return Z_ERRNO;
353
+ buf = mmap(NULL, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
354
+ if (buf == MAP_FAILED) return Z_ERRNO;
352355
353356
/* Compress the whole file at once: */
354357
len = gzwrite(out, (char *)buf, (unsigned)buf_len);
355358
356359
if (len != (int)buf_len) error(gzerror(out, &err));
357360
--- compat/zlib/test/minigzip.c
+++ compat/zlib/test/minigzip.c
@@ -35,10 +35,13 @@
35 #endif
36
37 #ifdef USE_MMAP
38 # include <sys/types.h>
39 # include <sys/mman.h>
 
 
 
40 # include <sys/stat.h>
41 #endif
42
43 #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
44 # include <fcntl.h>
@@ -335,22 +338,22 @@
335 */
336 static int gz_compress_mmap(FILE *in, gzFile out) {
337 int len;
338 int err;
339 int ifd = fileno(in);
340 caddr_t buf; /* mmap'ed buffer for the entire input file */
341 off_t buf_len; /* length of the input file */
342 struct stat sb;
343
344 /* Determine the size of the file, needed for mmap: */
345 if (fstat(ifd, &sb) < 0) return Z_ERRNO;
346 buf_len = sb.st_size;
347 if (buf_len <= 0) return Z_ERRNO;
348
349 /* Now do the actual mmap: */
350 buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
351 if (buf == (caddr_t)(-1)) return Z_ERRNO;
352
353 /* Compress the whole file at once: */
354 len = gzwrite(out, (char *)buf, (unsigned)buf_len);
355
356 if (len != (int)buf_len) error(gzerror(out, &err));
357
--- compat/zlib/test/minigzip.c
+++ compat/zlib/test/minigzip.c
@@ -35,10 +35,13 @@
35 #endif
36
37 #ifdef USE_MMAP
38 # include <sys/types.h>
39 # include <sys/mman.h>
40 # ifndef MAP_FAILED
41 # define MAP_FAILED ((void *)-1)
42 # endif
43 # include <sys/stat.h>
44 #endif
45
46 #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
47 # include <fcntl.h>
@@ -335,22 +338,22 @@
338 */
339 static int gz_compress_mmap(FILE *in, gzFile out) {
340 int len;
341 int err;
342 int ifd = fileno(in);
343 void *buf; /* mmap'ed buffer for the entire input file */
344 off_t buf_len; /* length of the input file */
345 struct stat sb;
346
347 /* Determine the size of the file, needed for mmap: */
348 if (fstat(ifd, &sb) < 0) return Z_ERRNO;
349 buf_len = sb.st_size;
350 if (buf_len <= 0) return Z_ERRNO;
351
352 /* Now do the actual mmap: */
353 buf = mmap(NULL, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
354 if (buf == MAP_FAILED) return Z_ERRNO;
355
356 /* Compress the whole file at once: */
357 len = gzwrite(out, (char *)buf, (unsigned)buf_len);
358
359 if (len != (int)buf_len) error(gzerror(out, &err));
360
--- compat/zlib/treebuild.xml
+++ compat/zlib/treebuild.xml
@@ -1,8 +1,8 @@
11
<?xml version="1.0" ?>
2
-<package name="zlib" version="1.3.2">
3
- <library name="zlib" dlversion="1.3.2" dlname="z">
2
+<package name="zlib" version="1.4">
3
+ <library name="zlib" dlversion="1.4" dlname="z">
44
<property name="description"> zip compression library </property>
55
<property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
66
77
<!-- fixme: not implemented yet -->
88
<property name="compiler/c/inline" value="yes" />
99
--- compat/zlib/treebuild.xml
+++ compat/zlib/treebuild.xml
@@ -1,8 +1,8 @@
1 <?xml version="1.0" ?>
2 <package name="zlib" version="1.3.2">
3 <library name="zlib" dlversion="1.3.2" dlname="z">
4 <property name="description"> zip compression library </property>
5 <property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
6
7 <!-- fixme: not implemented yet -->
8 <property name="compiler/c/inline" value="yes" />
9
--- compat/zlib/treebuild.xml
+++ compat/zlib/treebuild.xml
@@ -1,8 +1,8 @@
1 <?xml version="1.0" ?>
2 <package name="zlib" version="1.4">
3 <library name="zlib" dlversion="1.4" dlname="z">
4 <property name="description"> zip compression library </property>
5 <property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
6
7 <!-- fixme: not implemented yet -->
8 <property name="compiler/c/inline" value="yes" />
9
--- compat/zlib/trees.c
+++ compat/zlib/trees.c
@@ -225,11 +225,11 @@
225225
if (len == 0) continue;
226226
/* Now reverse the bits */
227227
tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
228228
229229
Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
230
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
230
+ n, (isgraph(n & 0xff) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
231231
}
232232
}
233233
234234
#ifdef GEN_TREES_H
235235
local void gen_trees_header(void);
236236
--- compat/zlib/trees.c
+++ compat/zlib/trees.c
@@ -225,11 +225,11 @@
225 if (len == 0) continue;
226 /* Now reverse the bits */
227 tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
228
229 Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
230 n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
231 }
232 }
233
234 #ifdef GEN_TREES_H
235 local void gen_trees_header(void);
236
--- compat/zlib/trees.c
+++ compat/zlib/trees.c
@@ -225,11 +225,11 @@
225 if (len == 0) continue;
226 /* Now reverse the bits */
227 tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
228
229 Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
230 n, (isgraph(n & 0xff) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
231 }
232 }
233
234 #ifdef GEN_TREES_H
235 local void gen_trees_header(void);
236
--- compat/zlib/uncompr.c
+++ compat/zlib/uncompr.c
@@ -31,12 +31,12 @@
3131
z_stream stream;
3232
int err;
3333
const uInt max = (uInt)-1;
3434
z_size_t len, left;
3535
36
- if (sourceLen == NULL || (*sourceLen > 0 && source == NULL) ||
37
- destLen == NULL || (*destLen > 0 && dest == NULL))
36
+ if (sourceLen == Z_NULL || (*sourceLen > 0 && source == Z_NULL) ||
37
+ destLen == Z_NULL || (*destLen > 0 && dest == Z_NULL))
3838
return Z_STREAM_ERROR;
3939
4040
len = *sourceLen;
4141
left = *destLen;
4242
if (left == 0 && dest == Z_NULL)
4343
--- compat/zlib/uncompr.c
+++ compat/zlib/uncompr.c
@@ -31,12 +31,12 @@
31 z_stream stream;
32 int err;
33 const uInt max = (uInt)-1;
34 z_size_t len, left;
35
36 if (sourceLen == NULL || (*sourceLen > 0 && source == NULL) ||
37 destLen == NULL || (*destLen > 0 && dest == NULL))
38 return Z_STREAM_ERROR;
39
40 len = *sourceLen;
41 left = *destLen;
42 if (left == 0 && dest == Z_NULL)
43
--- compat/zlib/uncompr.c
+++ compat/zlib/uncompr.c
@@ -31,12 +31,12 @@
31 z_stream stream;
32 int err;
33 const uInt max = (uInt)-1;
34 z_size_t len, left;
35
36 if (sourceLen == Z_NULL || (*sourceLen > 0 && source == Z_NULL) ||
37 destLen == Z_NULL || (*destLen > 0 && dest == Z_NULL))
38 return Z_STREAM_ERROR;
39
40 len = *sourceLen;
41 left = *destLen;
42 if (left == 0 && dest == Z_NULL)
43
--- compat/zlib/win32/Makefile.msc
+++ compat/zlib/win32/Makefile.msc
@@ -43,11 +43,11 @@
4343
4444
$(IMPLIB): $(SHAREDLIB)
4545
4646
$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res
4747
$(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \
48
- -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
48
+ -out:$@ $(OBJS) $(OBJA) zlib1.res
4949
if exist [email protected] \
5050
mt -nologo -manifest [email protected] -outputresource:$@;2
5151
5252
example.exe: example.obj $(STATICLIB)
5353
$(LD) $(LDFLAGS) example.obj $(STATICLIB)
5454
--- compat/zlib/win32/Makefile.msc
+++ compat/zlib/win32/Makefile.msc
@@ -43,11 +43,11 @@
43
44 $(IMPLIB): $(SHAREDLIB)
45
46 $(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res
47 $(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \
48 -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
49 if exist [email protected] \
50 mt -nologo -manifest [email protected] -outputresource:$@;2
51
52 example.exe: example.obj $(STATICLIB)
53 $(LD) $(LDFLAGS) example.obj $(STATICLIB)
54
--- compat/zlib/win32/Makefile.msc
+++ compat/zlib/win32/Makefile.msc
@@ -43,11 +43,11 @@
43
44 $(IMPLIB): $(SHAREDLIB)
45
46 $(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res
47 $(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \
48 -out:$@ $(OBJS) $(OBJA) zlib1.res
49 if exist [email protected] \
50 mt -nologo -manifest [email protected] -outputresource:$@;2
51
52 example.exe: example.obj $(STATICLIB)
53 $(LD) $(LDFLAGS) example.obj $(STATICLIB)
54
--- compat/zlib/win32/README-WIN32.txt
+++ compat/zlib/win32/README-WIN32.txt
@@ -1,8 +1,8 @@
11
ZLIB DATA COMPRESSION LIBRARY
22
3
-zlib 1.3.2 is a general purpose data compression library. All the code is
3
+zlib 1.4 is a general purpose data compression library. All the code is
44
thread safe. The data format used by the zlib library is described by RFCs
55
(Request for Comments) 1950 to 1952 in the files
66
https://datatracker.ietf.org/doc/html/rfc1951 (zlib format), rfc1951.txt
77
(deflate format), and rfc1952.txt (gzip format).
88
@@ -20,11 +20,11 @@
2020
asking for help.
2121
2222
2323
Manifest:
2424
25
-The package zlib-1.3.2-win32-x86.zip will contain the following files:
25
+The package zlib-1.4-win32-x86.zip will contain the following files:
2626
2727
README-WIN32.txt This document
2828
ChangeLog Changes since previous zlib packages
2929
DLL_FAQ.txt Frequently asked questions about zlib1.dll
3030
zlib.3.pdf Documentation of this library in Adobe Acrobat format
3131
--- compat/zlib/win32/README-WIN32.txt
+++ compat/zlib/win32/README-WIN32.txt
@@ -1,8 +1,8 @@
1 ZLIB DATA COMPRESSION LIBRARY
2
3 zlib 1.3.2 is a general purpose data compression library. All the code is
4 thread safe. The data format used by the zlib library is described by RFCs
5 (Request for Comments) 1950 to 1952 in the files
6 https://datatracker.ietf.org/doc/html/rfc1951 (zlib format), rfc1951.txt
7 (deflate format), and rfc1952.txt (gzip format).
8
@@ -20,11 +20,11 @@
20 asking for help.
21
22
23 Manifest:
24
25 The package zlib-1.3.2-win32-x86.zip will contain the following files:
26
27 README-WIN32.txt This document
28 ChangeLog Changes since previous zlib packages
29 DLL_FAQ.txt Frequently asked questions about zlib1.dll
30 zlib.3.pdf Documentation of this library in Adobe Acrobat format
31
--- compat/zlib/win32/README-WIN32.txt
+++ compat/zlib/win32/README-WIN32.txt
@@ -1,8 +1,8 @@
1 ZLIB DATA COMPRESSION LIBRARY
2
3 zlib 1.4 is a general purpose data compression library. All the code is
4 thread safe. The data format used by the zlib library is described by RFCs
5 (Request for Comments) 1950 to 1952 in the files
6 https://datatracker.ietf.org/doc/html/rfc1951 (zlib format), rfc1951.txt
7 (deflate format), and rfc1952.txt (gzip format).
8
@@ -20,11 +20,11 @@
20 asking for help.
21
22
23 Manifest:
24
25 The package zlib-1.4-win32-x86.zip will contain the following files:
26
27 README-WIN32.txt This document
28 ChangeLog Changes since previous zlib packages
29 DLL_FAQ.txt Frequently asked questions about zlib1.dll
30 zlib.3.pdf Documentation of this library in Adobe Acrobat format
31
--- compat/zlib/zconf.h
+++ compat/zlib/zconf.h
@@ -441,15 +441,15 @@
441441
typedef Z_U4 z_crc_t;
442442
#else
443443
typedef unsigned long z_crc_t;
444444
#endif
445445
446
-#if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */
446
+#if 1 /* was set to #if 1 by ./configure */
447447
# define Z_HAVE_UNISTD_H
448448
#endif
449449
450
-#if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */
450
+#if 1 /* was set to #if 1 by ./configure */
451451
# define Z_HAVE_STDARG_H
452452
#endif
453453
454454
#ifdef STDC
455455
# ifndef Z_SOLO
@@ -497,10 +497,14 @@
497497
# endif
498498
#endif
499499
500500
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
501501
# define Z_LFS64
502
+#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && \
503
+ !defined(UNDER_CE) && (defined(__MINGW32__) || !defined(__GNUC__))
504
+# define Z_LFS64 /* native Windows has 64-bit file offsets */
505
+# define Z_WINLFS
502506
#endif
503507
504508
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
505509
# define Z_LARGE64
506510
#endif
@@ -514,11 +518,11 @@
514518
# define SEEK_CUR 1 /* Seek from current position. */
515519
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
516520
#endif
517521
518522
#ifndef z_off_t
519
-# define z_off_t long long
523
+# define z_off_t long
520524
#endif
521525
522526
#if !defined(_WIN32) && defined(Z_LARGE64)
523527
# define z_off64_t off64_t
524528
#elif defined(__MINGW32__)
@@ -528,10 +532,15 @@
528532
#elif defined(__GO32__)
529533
# define z_off64_t offset_t
530534
#else
531535
# define z_off64_t z_off_t
532536
#endif
537
+
538
+#if defined(Z_WINLFS) && defined(Z_WANT64) && !defined(Z_SOLO)
539
+# undef z_off_t
540
+# define z_off_t z_off64_t
541
+#endif
533542
534543
/* MVS linker does not support external names larger than 8 bytes */
535544
#if defined(__MVS__)
536545
#pragma map(deflateInit_,"DEIN")
537546
#pragma map(deflateInit2_,"DEIN2")
538547
--- compat/zlib/zconf.h
+++ compat/zlib/zconf.h
@@ -441,15 +441,15 @@
441 typedef Z_U4 z_crc_t;
442 #else
443 typedef unsigned long z_crc_t;
444 #endif
445
446 #if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */
447 # define Z_HAVE_UNISTD_H
448 #endif
449
450 #if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */
451 # define Z_HAVE_STDARG_H
452 #endif
453
454 #ifdef STDC
455 # ifndef Z_SOLO
@@ -497,10 +497,14 @@
497 # endif
498 #endif
499
500 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
501 # define Z_LFS64
 
 
 
 
502 #endif
503
504 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
505 # define Z_LARGE64
506 #endif
@@ -514,11 +518,11 @@
514 # define SEEK_CUR 1 /* Seek from current position. */
515 # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
516 #endif
517
518 #ifndef z_off_t
519 # define z_off_t long long
520 #endif
521
522 #if !defined(_WIN32) && defined(Z_LARGE64)
523 # define z_off64_t off64_t
524 #elif defined(__MINGW32__)
@@ -528,10 +532,15 @@
528 #elif defined(__GO32__)
529 # define z_off64_t offset_t
530 #else
531 # define z_off64_t z_off_t
532 #endif
 
 
 
 
 
533
534 /* MVS linker does not support external names larger than 8 bytes */
535 #if defined(__MVS__)
536 #pragma map(deflateInit_,"DEIN")
537 #pragma map(deflateInit2_,"DEIN2")
538
--- compat/zlib/zconf.h
+++ compat/zlib/zconf.h
@@ -441,15 +441,15 @@
441 typedef Z_U4 z_crc_t;
442 #else
443 typedef unsigned long z_crc_t;
444 #endif
445
446 #if 1 /* was set to #if 1 by ./configure */
447 # define Z_HAVE_UNISTD_H
448 #endif
449
450 #if 1 /* was set to #if 1 by ./configure */
451 # define Z_HAVE_STDARG_H
452 #endif
453
454 #ifdef STDC
455 # ifndef Z_SOLO
@@ -497,10 +497,14 @@
497 # endif
498 #endif
499
500 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
501 # define Z_LFS64
502 #elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && \
503 !defined(UNDER_CE) && (defined(__MINGW32__) || !defined(__GNUC__))
504 # define Z_LFS64 /* native Windows has 64-bit file offsets */
505 # define Z_WINLFS
506 #endif
507
508 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
509 # define Z_LARGE64
510 #endif
@@ -514,11 +518,11 @@
518 # define SEEK_CUR 1 /* Seek from current position. */
519 # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
520 #endif
521
522 #ifndef z_off_t
523 # define z_off_t long
524 #endif
525
526 #if !defined(_WIN32) && defined(Z_LARGE64)
527 # define z_off64_t off64_t
528 #elif defined(__MINGW32__)
@@ -528,10 +532,15 @@
532 #elif defined(__GO32__)
533 # define z_off64_t offset_t
534 #else
535 # define z_off64_t z_off_t
536 #endif
537
538 #if defined(Z_WINLFS) && defined(Z_WANT64) && !defined(Z_SOLO)
539 # undef z_off_t
540 # define z_off_t z_off64_t
541 #endif
542
543 /* MVS linker does not support external names larger than 8 bytes */
544 #if defined(__MVS__)
545 #pragma map(deflateInit_,"DEIN")
546 #pragma map(deflateInit2_,"DEIN2")
547
--- compat/zlib/zconf.h.in
+++ compat/zlib/zconf.h.in
@@ -497,10 +497,14 @@
497497
# endif
498498
#endif
499499
500500
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
501501
# define Z_LFS64
502
+#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && \
503
+ !defined(UNDER_CE) && (defined(__MINGW32__) || !defined(__GNUC__))
504
+# define Z_LFS64 /* native Windows has 64-bit file offsets */
505
+# define Z_WINLFS
502506
#endif
503507
504508
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
505509
# define Z_LARGE64
506510
#endif
@@ -514,11 +518,11 @@
514518
# define SEEK_CUR 1 /* Seek from current position. */
515519
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
516520
#endif
517521
518522
#ifndef z_off_t
519
-# define z_off_t long long
523
+# define z_off_t long
520524
#endif
521525
522526
#if !defined(_WIN32) && defined(Z_LARGE64)
523527
# define z_off64_t off64_t
524528
#elif defined(__MINGW32__)
@@ -528,10 +532,15 @@
528532
#elif defined(__GO32__)
529533
# define z_off64_t offset_t
530534
#else
531535
# define z_off64_t z_off_t
532536
#endif
537
+
538
+#if defined(Z_WINLFS) && defined(Z_WANT64) && !defined(Z_SOLO)
539
+# undef z_off_t
540
+# define z_off_t z_off64_t
541
+#endif
533542
534543
/* MVS linker does not support external names larger than 8 bytes */
535544
#if defined(__MVS__)
536545
#pragma map(deflateInit_,"DEIN")
537546
#pragma map(deflateInit2_,"DEIN2")
538547
--- compat/zlib/zconf.h.in
+++ compat/zlib/zconf.h.in
@@ -497,10 +497,14 @@
497 # endif
498 #endif
499
500 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
501 # define Z_LFS64
 
 
 
 
502 #endif
503
504 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
505 # define Z_LARGE64
506 #endif
@@ -514,11 +518,11 @@
514 # define SEEK_CUR 1 /* Seek from current position. */
515 # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
516 #endif
517
518 #ifndef z_off_t
519 # define z_off_t long long
520 #endif
521
522 #if !defined(_WIN32) && defined(Z_LARGE64)
523 # define z_off64_t off64_t
524 #elif defined(__MINGW32__)
@@ -528,10 +532,15 @@
528 #elif defined(__GO32__)
529 # define z_off64_t offset_t
530 #else
531 # define z_off64_t z_off_t
532 #endif
 
 
 
 
 
533
534 /* MVS linker does not support external names larger than 8 bytes */
535 #if defined(__MVS__)
536 #pragma map(deflateInit_,"DEIN")
537 #pragma map(deflateInit2_,"DEIN2")
538
--- compat/zlib/zconf.h.in
+++ compat/zlib/zconf.h.in
@@ -497,10 +497,14 @@
497 # endif
498 #endif
499
500 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
501 # define Z_LFS64
502 #elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && \
503 !defined(UNDER_CE) && (defined(__MINGW32__) || !defined(__GNUC__))
504 # define Z_LFS64 /* native Windows has 64-bit file offsets */
505 # define Z_WINLFS
506 #endif
507
508 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
509 # define Z_LARGE64
510 #endif
@@ -514,11 +518,11 @@
518 # define SEEK_CUR 1 /* Seek from current position. */
519 # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
520 #endif
521
522 #ifndef z_off_t
523 # define z_off_t long
524 #endif
525
526 #if !defined(_WIN32) && defined(Z_LARGE64)
527 # define z_off64_t off64_t
528 #elif defined(__MINGW32__)
@@ -528,10 +532,15 @@
532 #elif defined(__GO32__)
533 # define z_off64_t offset_t
534 #else
535 # define z_off64_t z_off_t
536 #endif
537
538 #if defined(Z_WINLFS) && defined(Z_WANT64) && !defined(Z_SOLO)
539 # undef z_off_t
540 # define z_off_t z_off64_t
541 #endif
542
543 /* MVS linker does not support external names larger than 8 bytes */
544 #if defined(__MVS__)
545 #pragma map(deflateInit_,"DEIN")
546 #pragma map(deflateInit2_,"DEIN2")
547
--- compat/zlib/zlib.3
+++ compat/zlib/zlib.3
@@ -1,6 +1,6 @@
1
-.TH ZLIB 3 "17 Feb 2026"
1
+.TH ZLIB 3 "4 Nov 2026"
22
.SH NAME
33
zlib \- compression/decompression library
44
.SH SYNOPSIS
55
[see
66
.I zlib.h
@@ -103,11 +103,11 @@
103103
.LP
104104
before asking for help.
105105
Send questions and/or comments to [email protected],
106106
or (for the Windows DLL version) to Gilles Vollant ([email protected]).
107107
.SH AUTHORS AND LICENSE
108
-Version 1.3.2
108
+Version 1.4
109109
.LP
110110
Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler
111111
.LP
112112
This software is provided 'as-is', without any express or implied
113113
warranty. In no event will the authors be held liable for any damages
114114
--- compat/zlib/zlib.3
+++ compat/zlib/zlib.3
@@ -1,6 +1,6 @@
1 .TH ZLIB 3 "17 Feb 2026"
2 .SH NAME
3 zlib \- compression/decompression library
4 .SH SYNOPSIS
5 [see
6 .I zlib.h
@@ -103,11 +103,11 @@
103 .LP
104 before asking for help.
105 Send questions and/or comments to [email protected],
106 or (for the Windows DLL version) to Gilles Vollant ([email protected]).
107 .SH AUTHORS AND LICENSE
108 Version 1.3.2
109 .LP
110 Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler
111 .LP
112 This software is provided 'as-is', without any express or implied
113 warranty. In no event will the authors be held liable for any damages
114
--- compat/zlib/zlib.3
+++ compat/zlib/zlib.3
@@ -1,6 +1,6 @@
1 .TH ZLIB 3 "4 Nov 2026"
2 .SH NAME
3 zlib \- compression/decompression library
4 .SH SYNOPSIS
5 [see
6 .I zlib.h
@@ -103,11 +103,11 @@
103 .LP
104 before asking for help.
105 Send questions and/or comments to [email protected],
106 or (for the Windows DLL version) to Gilles Vollant ([email protected]).
107 .SH AUTHORS AND LICENSE
108 Version 1.4
109 .LP
110 Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler
111 .LP
112 This software is provided 'as-is', without any express or implied
113 warranty. In no event will the authors be held liable for any damages
114
--- compat/zlib/zlib.3.pdf
+++ compat/zlib/zlib.3.pdf
cannot compute difference between binary files
11
--- compat/zlib/zlib.3.pdf
+++ compat/zlib/zlib.3.pdf
0 annot compute difference between binary files
1
--- compat/zlib/zlib.3.pdf
+++ compat/zlib/zlib.3.pdf
0 annot compute difference between binary files
1
+45 -34
--- compat/zlib/zlib.h
+++ compat/zlib/zlib.h
@@ -1,7 +1,7 @@
11
/* zlib.h -- interface of the 'zlib' general purpose compression library
2
- version 1.3.2, February 17th, 2026
2
+ version 1.4, November 4th, 2026
33
44
Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler
55
66
This software is provided 'as-is', without any express or implied
77
warranty. In no event will the authors be held liable for any damages
@@ -39,15 +39,15 @@
3939
4040
#ifdef __cplusplus
4141
extern "C" {
4242
#endif
4343
44
-#define ZLIB_VERSION "1.3.2"
45
-#define ZLIB_VERNUM 0x1320
44
+#define ZLIB_VERSION "1.4"
45
+#define ZLIB_VERNUM 0x1400
4646
#define ZLIB_VER_MAJOR 1
47
-#define ZLIB_VER_MINOR 3
48
-#define ZLIB_VER_REVISION 2
47
+#define ZLIB_VER_MINOR 4
48
+#define ZLIB_VER_REVISION 0
4949
#define ZLIB_VER_SUBREVISION 0
5050
5151
/*
5252
The 'zlib' compression library provides in-memory compression and
5353
decompression functions, including integrity checks of the uncompressed data.
@@ -694,11 +694,13 @@
694694
consume lots of memory.
695695
696696
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
697697
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
698698
(such as zalloc being Z_NULL). msg is left unchanged in both source and
699
- destination.
699
+ destination. If deflateCopy fails and dest is not Z_NULL, then dest->state
700
+ is set to Z_NULL with dest otherwise unchanged, so that deflateEnd(dest) can
701
+ be called safely, though dest is not a usable stream.
700702
*/
701703
702704
ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
703705
/*
704706
This function is equivalent to deflateEnd followed by deflateInit, but
@@ -767,31 +769,31 @@
767769
768770
ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen);
769771
ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen);
770772
/*
771773
deflateBound() returns an upper bound on the compressed size after
772
- deflation of sourceLen bytes. It must be called after deflateInit() or
773
- deflateInit2(), and after deflateSetHeader(), if used. This would be used
774
- to allocate an output buffer for deflation in a single pass, and so would be
775
- called before deflate(). If that first deflate() call is provided the
776
- sourceLen input bytes, an output buffer allocated to the size returned by
777
- deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
778
- to return Z_STREAM_END. Note that it is possible for the compressed size to
779
- be larger than the value returned by deflateBound() if flush options other
780
- than Z_FINISH or Z_NO_FLUSH are used.
781
-
782
- delfateBound_z() is the same, but takes and returns a size_t length. Note
774
+ deflation of sourceLen bytes. It must be called after deflateInit() or
775
+ deflateInit2(), and after deflateSetHeader() or deflateSetDictionary(), if
776
+ used. This would be used to allocate an output buffer for deflation in a
777
+ single pass, and so would be called before deflate(). If that first
778
+ deflate() call is provided the sourceLen input bytes, an output buffer
779
+ allocated to the size returned by deflateBound(), and the flush value
780
+ Z_FINISH, then deflate() is guaranteed to return Z_STREAM_END. Note that it
781
+ is possible for the compressed size to be larger than the value returned by
782
+ deflateBound() if flush options other than Z_FINISH or Z_NO_FLUSH are used.
783
+
784
+ deflateBound_z() is the same, but takes and returns a size_t length. Note
783785
that a long is 32 bits on Windows.
784786
*/
785787
786788
ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
787789
unsigned *pending,
788790
int *bits);
789791
/*
790792
deflatePending() returns the number of bytes and bits of output that have
791793
been generated, but not yet provided in the available output. The bytes not
792
- provided would be due to the available output space having being consumed.
794
+ provided would be due to the available output space having been consumed.
793795
The number of bits of output not provided are between 0 and 7, where they
794796
await more bits to join them in order to fill out a full byte. If pending
795797
or bits are Z_NULL, then those values are not set.
796798
797799
deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
@@ -867,12 +869,11 @@
867869
size (the size of the history buffer). It should be in the range 8..15 for
868870
this version of the library. The default value is 15 if inflateInit is used
869871
instead. windowBits must be greater than or equal to the windowBits value
870872
provided to deflateInit2() while compressing, or it must be equal to 15 if
871873
deflateInit2() was not used. If a compressed stream with a larger window
872
- size is given as input, inflate() will return with the error code
873
- Z_DATA_ERROR instead of trying to allocate a larger window.
874
+ size is given as input, inflate() may return with a Z_DATA_ERROR.
874875
875876
windowBits can also be zero to request that inflate use the window size in
876877
the zlib header of the compressed stream.
877878
878879
windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
@@ -978,11 +979,13 @@
978979
stream.
979980
980981
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
981982
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
982983
(such as zalloc being Z_NULL). msg is left unchanged in both source and
983
- destination.
984
+ destination. If inflateCopy fails and dest is not Z_NULL, then dest->state
985
+ is set to Z_NULL with dest otherwise unchanged, so that inflateEnd(dest) can
986
+ be called safely, though dest is not a usable stream.
984987
*/
985988
986989
ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
987990
/*
988991
This function is equivalent to inflateEnd followed by inflateInit,
@@ -1093,13 +1096,14 @@
10931096
including the terminating zero, are written there. The application can tell
10941097
that the name or comment did not fit in the provided space by the absence of
10951098
a terminating zero. If any of extra, name, or comment are not present in
10961099
the header, then that field's pointer is set to Z_NULL. This allows the use
10971100
of deflateSetHeader() with the returned structure to duplicate the header.
1098
- Note that if those fields initially pointed to allocated memory, then the
1099
- application will need to save them elsewhere so that they can be eventually
1100
- freed.
1101
+ Though take care that none of the fields were truncated before so using it,
1102
+ lest havoc ensue. Note that if those fields initially pointed to allocated
1103
+ memory, then the application will need to save them elsewhere so that they
1104
+ can be eventually freed.
11011105
11021106
If inflateGetHeader is not used, then the header information is simply
11031107
discarded. The header is always checked for validity, including the header
11041108
CRC if present. inflateReset() will reset the process to discard the header
11051109
information. The application would need to call inflateGetHeader() again to
@@ -1392,12 +1396,12 @@
13921396
insufficient memory to allocate the gzFile state, or if an invalid mode was
13931397
specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
13941398
errno can be checked to determine if the reason gzopen failed was that the
13951399
file could not be opened. Note that if 'N' is in mode for non-blocking, the
13961400
open() itself can fail in order to not block. In that case gzopen() will
1397
- return NULL and errno will be EAGAIN or ENONBLOCK. The call to gzopen() can
1398
- then be re-tried. If the application would like to block on opening the
1401
+ return NULL and errno will be EAGAIN or EWOULDBLOCK. The call to gzopen()
1402
+ can then be re-tried. If the application would like to block on opening the
13991403
file, then it can use open() without O_NONBLOCK, and then gzdopen() with the
14001404
resulting file descriptor and 'N' in the mode, which will set it to non-
14011405
blocking.
14021406
*/
14031407
@@ -1499,13 +1503,16 @@
14991503
is an unsigned integer type that can contain a pointer.
15001504
15011505
gzfread() returns the number of full items read of size size, or zero if
15021506
the end of the file was reached and a full item could not be read, or if
15031507
there was an error. gzerror() must be consulted if zero is returned in
1504
- order to determine if there was an error. If the multiplication of size and
1505
- nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
1506
- is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
1508
+ order to determine if there was an error. If some data was read before an
1509
+ error, then that data is returned until exhausted, after which the next call
1510
+ will return zero and gzerror() will report the error. If the multiplication
1511
+ of size and nitems overflows, i.e. the product does not fit in a z_size_t,
1512
+ then nothing is read, zero is returned, and the error state is set to
1513
+ Z_STREAM_ERROR.
15071514
15081515
In the event that the end of file is reached and only a partial item is
15091516
available at the end, i.e. the remaining uncompressed data length is not a
15101517
multiple of size, then the final partial item is nevertheless read into buf
15111518
and the end-of-file flag is set. The length of the partial item read is not
@@ -1567,11 +1574,11 @@
15671574
secure functions were not available and having gzprintf() be insecure was
15681575
not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of
15691576
these possibilities can be determined using zlibCompileFlags().
15701577
15711578
If a Z_BUF_ERROR is returned, then nothing was written due to a stall on
1572
- the non-blocking write destination.
1579
+ the non-blocking write destination. The operation can be retried.
15731580
*/
15741581
15751582
ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
15761583
/*
15771584
Compress and write the given null-terminated string s to file, excluding
@@ -1675,11 +1682,13 @@
16751682
until the next read or write operation, or close operation when writing.
16761683
16771684
gzseek returns the resulting offset location as measured in bytes from
16781685
the beginning of the uncompressed stream, or -1 in case of error, in
16791686
particular if the file is opened for writing and the new starting position
1680
- would be before the current position.
1687
+ would be before the current position, or if the resulting position would
1688
+ not be representable in the offset type. If gzseek returns -1, the stream
1689
+ position is unchanged.
16811690
*/
16821691
16831692
ZEXTERN int ZEXPORT gzrewind(gzFile file);
16841693
/*
16851694
Rewind file. This function is supported only for reading.
@@ -1776,11 +1785,12 @@
17761785
/*
17771786
Return the error message for the last error which occurred on file.
17781787
If errnum is not NULL, *errnum is set to zlib error number. If an error
17791788
occurred in the file system and not in the compression library, *errnum is
17801789
set to Z_ERRNO and the application may consult errno to get the exact error
1781
- code.
1790
+ code. The error is reported by gzerror() as soon as it is detected, which
1791
+ may be before all of the data read prior to the error has been returned.
17821792
17831793
The application must not modify the returned string. Future calls to
17841794
this function may invalidate the previously returned string. If file is
17851795
closed, then the string previously returned by gzerror will no longer be
17861796
available.
@@ -1970,11 +1980,12 @@
19701980
19711981
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
19721982
* change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
19731983
* both are true, the application gets the *64 functions, and the regular
19741984
* functions are changed to 64 bits) -- in case these are set on systems
1975
- * without large file support, _LFS64_LARGEFILE must also be true
1985
+ * without large file support, _LFS64_LARGEFILE must also be true, except on
1986
+ * native Windows, where 64-bit offsets are always available
19761987
*/
19771988
#ifdef Z_LARGE64
19781989
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
19791990
ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
19801991
ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
@@ -2027,11 +2038,11 @@
20272038
ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
20282039
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
20292040
20302041
#endif /* !Z_SOLO */
20312042
2032
-/* undocumented functions */
2043
+/* undocumented functions (not part of the zlib API) */
20332044
ZEXTERN const char * ZEXPORT zError(int);
20342045
ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp);
20352046
ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void);
20362047
ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int);
20372048
ZEXTERN int ZEXPORT inflateValidate(z_streamp, int);
20382049
--- compat/zlib/zlib.h
+++ compat/zlib/zlib.h
@@ -1,7 +1,7 @@
1 /* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.3.2, February 17th, 2026
3
4 Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler
5
6 This software is provided 'as-is', without any express or implied
7 warranty. In no event will the authors be held liable for any damages
@@ -39,15 +39,15 @@
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 #define ZLIB_VERSION "1.3.2"
45 #define ZLIB_VERNUM 0x1320
46 #define ZLIB_VER_MAJOR 1
47 #define ZLIB_VER_MINOR 3
48 #define ZLIB_VER_REVISION 2
49 #define ZLIB_VER_SUBREVISION 0
50
51 /*
52 The 'zlib' compression library provides in-memory compression and
53 decompression functions, including integrity checks of the uncompressed data.
@@ -694,11 +694,13 @@
694 consume lots of memory.
695
696 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
697 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
698 (such as zalloc being Z_NULL). msg is left unchanged in both source and
699 destination.
 
 
700 */
701
702 ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
703 /*
704 This function is equivalent to deflateEnd followed by deflateInit, but
@@ -767,31 +769,31 @@
767
768 ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen);
769 ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen);
770 /*
771 deflateBound() returns an upper bound on the compressed size after
772 deflation of sourceLen bytes. It must be called after deflateInit() or
773 deflateInit2(), and after deflateSetHeader(), if used. This would be used
774 to allocate an output buffer for deflation in a single pass, and so would be
775 called before deflate(). If that first deflate() call is provided the
776 sourceLen input bytes, an output buffer allocated to the size returned by
777 deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
778 to return Z_STREAM_END. Note that it is possible for the compressed size to
779 be larger than the value returned by deflateBound() if flush options other
780 than Z_FINISH or Z_NO_FLUSH are used.
781
782 delfateBound_z() is the same, but takes and returns a size_t length. Note
783 that a long is 32 bits on Windows.
784 */
785
786 ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
787 unsigned *pending,
788 int *bits);
789 /*
790 deflatePending() returns the number of bytes and bits of output that have
791 been generated, but not yet provided in the available output. The bytes not
792 provided would be due to the available output space having being consumed.
793 The number of bits of output not provided are between 0 and 7, where they
794 await more bits to join them in order to fill out a full byte. If pending
795 or bits are Z_NULL, then those values are not set.
796
797 deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
@@ -867,12 +869,11 @@
867 size (the size of the history buffer). It should be in the range 8..15 for
868 this version of the library. The default value is 15 if inflateInit is used
869 instead. windowBits must be greater than or equal to the windowBits value
870 provided to deflateInit2() while compressing, or it must be equal to 15 if
871 deflateInit2() was not used. If a compressed stream with a larger window
872 size is given as input, inflate() will return with the error code
873 Z_DATA_ERROR instead of trying to allocate a larger window.
874
875 windowBits can also be zero to request that inflate use the window size in
876 the zlib header of the compressed stream.
877
878 windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
@@ -978,11 +979,13 @@
978 stream.
979
980 inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
981 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
982 (such as zalloc being Z_NULL). msg is left unchanged in both source and
983 destination.
 
 
984 */
985
986 ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
987 /*
988 This function is equivalent to inflateEnd followed by inflateInit,
@@ -1093,13 +1096,14 @@
1093 including the terminating zero, are written there. The application can tell
1094 that the name or comment did not fit in the provided space by the absence of
1095 a terminating zero. If any of extra, name, or comment are not present in
1096 the header, then that field's pointer is set to Z_NULL. This allows the use
1097 of deflateSetHeader() with the returned structure to duplicate the header.
1098 Note that if those fields initially pointed to allocated memory, then the
1099 application will need to save them elsewhere so that they can be eventually
1100 freed.
 
1101
1102 If inflateGetHeader is not used, then the header information is simply
1103 discarded. The header is always checked for validity, including the header
1104 CRC if present. inflateReset() will reset the process to discard the header
1105 information. The application would need to call inflateGetHeader() again to
@@ -1392,12 +1396,12 @@
1392 insufficient memory to allocate the gzFile state, or if an invalid mode was
1393 specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
1394 errno can be checked to determine if the reason gzopen failed was that the
1395 file could not be opened. Note that if 'N' is in mode for non-blocking, the
1396 open() itself can fail in order to not block. In that case gzopen() will
1397 return NULL and errno will be EAGAIN or ENONBLOCK. The call to gzopen() can
1398 then be re-tried. If the application would like to block on opening the
1399 file, then it can use open() without O_NONBLOCK, and then gzdopen() with the
1400 resulting file descriptor and 'N' in the mode, which will set it to non-
1401 blocking.
1402 */
1403
@@ -1499,13 +1503,16 @@
1499 is an unsigned integer type that can contain a pointer.
1500
1501 gzfread() returns the number of full items read of size size, or zero if
1502 the end of the file was reached and a full item could not be read, or if
1503 there was an error. gzerror() must be consulted if zero is returned in
1504 order to determine if there was an error. If the multiplication of size and
1505 nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
1506 is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
 
 
 
1507
1508 In the event that the end of file is reached and only a partial item is
1509 available at the end, i.e. the remaining uncompressed data length is not a
1510 multiple of size, then the final partial item is nevertheless read into buf
1511 and the end-of-file flag is set. The length of the partial item read is not
@@ -1567,11 +1574,11 @@
1567 secure functions were not available and having gzprintf() be insecure was
1568 not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of
1569 these possibilities can be determined using zlibCompileFlags().
1570
1571 If a Z_BUF_ERROR is returned, then nothing was written due to a stall on
1572 the non-blocking write destination.
1573 */
1574
1575 ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
1576 /*
1577 Compress and write the given null-terminated string s to file, excluding
@@ -1675,11 +1682,13 @@
1675 until the next read or write operation, or close operation when writing.
1676
1677 gzseek returns the resulting offset location as measured in bytes from
1678 the beginning of the uncompressed stream, or -1 in case of error, in
1679 particular if the file is opened for writing and the new starting position
1680 would be before the current position.
 
 
1681 */
1682
1683 ZEXTERN int ZEXPORT gzrewind(gzFile file);
1684 /*
1685 Rewind file. This function is supported only for reading.
@@ -1776,11 +1785,12 @@
1776 /*
1777 Return the error message for the last error which occurred on file.
1778 If errnum is not NULL, *errnum is set to zlib error number. If an error
1779 occurred in the file system and not in the compression library, *errnum is
1780 set to Z_ERRNO and the application may consult errno to get the exact error
1781 code.
 
1782
1783 The application must not modify the returned string. Future calls to
1784 this function may invalidate the previously returned string. If file is
1785 closed, then the string previously returned by gzerror will no longer be
1786 available.
@@ -1970,11 +1980,12 @@
1970
1971 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
1972 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
1973 * both are true, the application gets the *64 functions, and the regular
1974 * functions are changed to 64 bits) -- in case these are set on systems
1975 * without large file support, _LFS64_LARGEFILE must also be true
 
1976 */
1977 #ifdef Z_LARGE64
1978 ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
1979 ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
1980 ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
@@ -2027,11 +2038,11 @@
2027 ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
2028 ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
2029
2030 #endif /* !Z_SOLO */
2031
2032 /* undocumented functions */
2033 ZEXTERN const char * ZEXPORT zError(int);
2034 ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp);
2035 ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void);
2036 ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int);
2037 ZEXTERN int ZEXPORT inflateValidate(z_streamp, int);
2038
--- compat/zlib/zlib.h
+++ compat/zlib/zlib.h
@@ -1,7 +1,7 @@
1 /* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.4, November 4th, 2026
3
4 Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler
5
6 This software is provided 'as-is', without any express or implied
7 warranty. In no event will the authors be held liable for any damages
@@ -39,15 +39,15 @@
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 #define ZLIB_VERSION "1.4"
45 #define ZLIB_VERNUM 0x1400
46 #define ZLIB_VER_MAJOR 1
47 #define ZLIB_VER_MINOR 4
48 #define ZLIB_VER_REVISION 0
49 #define ZLIB_VER_SUBREVISION 0
50
51 /*
52 The 'zlib' compression library provides in-memory compression and
53 decompression functions, including integrity checks of the uncompressed data.
@@ -694,11 +694,13 @@
694 consume lots of memory.
695
696 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
697 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
698 (such as zalloc being Z_NULL). msg is left unchanged in both source and
699 destination. If deflateCopy fails and dest is not Z_NULL, then dest->state
700 is set to Z_NULL with dest otherwise unchanged, so that deflateEnd(dest) can
701 be called safely, though dest is not a usable stream.
702 */
703
704 ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
705 /*
706 This function is equivalent to deflateEnd followed by deflateInit, but
@@ -767,31 +769,31 @@
769
770 ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen);
771 ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen);
772 /*
773 deflateBound() returns an upper bound on the compressed size after
774 deflation of sourceLen bytes. It must be called after deflateInit() or
775 deflateInit2(), and after deflateSetHeader() or deflateSetDictionary(), if
776 used. This would be used to allocate an output buffer for deflation in a
777 single pass, and so would be called before deflate(). If that first
778 deflate() call is provided the sourceLen input bytes, an output buffer
779 allocated to the size returned by deflateBound(), and the flush value
780 Z_FINISH, then deflate() is guaranteed to return Z_STREAM_END. Note that it
781 is possible for the compressed size to be larger than the value returned by
782 deflateBound() if flush options other than Z_FINISH or Z_NO_FLUSH are used.
783
784 deflateBound_z() is the same, but takes and returns a size_t length. Note
785 that a long is 32 bits on Windows.
786 */
787
788 ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
789 unsigned *pending,
790 int *bits);
791 /*
792 deflatePending() returns the number of bytes and bits of output that have
793 been generated, but not yet provided in the available output. The bytes not
794 provided would be due to the available output space having been consumed.
795 The number of bits of output not provided are between 0 and 7, where they
796 await more bits to join them in order to fill out a full byte. If pending
797 or bits are Z_NULL, then those values are not set.
798
799 deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
@@ -867,12 +869,11 @@
869 size (the size of the history buffer). It should be in the range 8..15 for
870 this version of the library. The default value is 15 if inflateInit is used
871 instead. windowBits must be greater than or equal to the windowBits value
872 provided to deflateInit2() while compressing, or it must be equal to 15 if
873 deflateInit2() was not used. If a compressed stream with a larger window
874 size is given as input, inflate() may return with a Z_DATA_ERROR.
 
875
876 windowBits can also be zero to request that inflate use the window size in
877 the zlib header of the compressed stream.
878
879 windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
@@ -978,11 +979,13 @@
979 stream.
980
981 inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
982 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
983 (such as zalloc being Z_NULL). msg is left unchanged in both source and
984 destination. If inflateCopy fails and dest is not Z_NULL, then dest->state
985 is set to Z_NULL with dest otherwise unchanged, so that inflateEnd(dest) can
986 be called safely, though dest is not a usable stream.
987 */
988
989 ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
990 /*
991 This function is equivalent to inflateEnd followed by inflateInit,
@@ -1093,13 +1096,14 @@
1096 including the terminating zero, are written there. The application can tell
1097 that the name or comment did not fit in the provided space by the absence of
1098 a terminating zero. If any of extra, name, or comment are not present in
1099 the header, then that field's pointer is set to Z_NULL. This allows the use
1100 of deflateSetHeader() with the returned structure to duplicate the header.
1101 Though take care that none of the fields were truncated before so using it,
1102 lest havoc ensue. Note that if those fields initially pointed to allocated
1103 memory, then the application will need to save them elsewhere so that they
1104 can be eventually freed.
1105
1106 If inflateGetHeader is not used, then the header information is simply
1107 discarded. The header is always checked for validity, including the header
1108 CRC if present. inflateReset() will reset the process to discard the header
1109 information. The application would need to call inflateGetHeader() again to
@@ -1392,12 +1396,12 @@
1396 insufficient memory to allocate the gzFile state, or if an invalid mode was
1397 specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
1398 errno can be checked to determine if the reason gzopen failed was that the
1399 file could not be opened. Note that if 'N' is in mode for non-blocking, the
1400 open() itself can fail in order to not block. In that case gzopen() will
1401 return NULL and errno will be EAGAIN or EWOULDBLOCK. The call to gzopen()
1402 can then be re-tried. If the application would like to block on opening the
1403 file, then it can use open() without O_NONBLOCK, and then gzdopen() with the
1404 resulting file descriptor and 'N' in the mode, which will set it to non-
1405 blocking.
1406 */
1407
@@ -1499,13 +1503,16 @@
1503 is an unsigned integer type that can contain a pointer.
1504
1505 gzfread() returns the number of full items read of size size, or zero if
1506 the end of the file was reached and a full item could not be read, or if
1507 there was an error. gzerror() must be consulted if zero is returned in
1508 order to determine if there was an error. If some data was read before an
1509 error, then that data is returned until exhausted, after which the next call
1510 will return zero and gzerror() will report the error. If the multiplication
1511 of size and nitems overflows, i.e. the product does not fit in a z_size_t,
1512 then nothing is read, zero is returned, and the error state is set to
1513 Z_STREAM_ERROR.
1514
1515 In the event that the end of file is reached and only a partial item is
1516 available at the end, i.e. the remaining uncompressed data length is not a
1517 multiple of size, then the final partial item is nevertheless read into buf
1518 and the end-of-file flag is set. The length of the partial item read is not
@@ -1567,11 +1574,11 @@
1574 secure functions were not available and having gzprintf() be insecure was
1575 not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of
1576 these possibilities can be determined using zlibCompileFlags().
1577
1578 If a Z_BUF_ERROR is returned, then nothing was written due to a stall on
1579 the non-blocking write destination. The operation can be retried.
1580 */
1581
1582 ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
1583 /*
1584 Compress and write the given null-terminated string s to file, excluding
@@ -1675,11 +1682,13 @@
1682 until the next read or write operation, or close operation when writing.
1683
1684 gzseek returns the resulting offset location as measured in bytes from
1685 the beginning of the uncompressed stream, or -1 in case of error, in
1686 particular if the file is opened for writing and the new starting position
1687 would be before the current position, or if the resulting position would
1688 not be representable in the offset type. If gzseek returns -1, the stream
1689 position is unchanged.
1690 */
1691
1692 ZEXTERN int ZEXPORT gzrewind(gzFile file);
1693 /*
1694 Rewind file. This function is supported only for reading.
@@ -1776,11 +1785,12 @@
1785 /*
1786 Return the error message for the last error which occurred on file.
1787 If errnum is not NULL, *errnum is set to zlib error number. If an error
1788 occurred in the file system and not in the compression library, *errnum is
1789 set to Z_ERRNO and the application may consult errno to get the exact error
1790 code. The error is reported by gzerror() as soon as it is detected, which
1791 may be before all of the data read prior to the error has been returned.
1792
1793 The application must not modify the returned string. Future calls to
1794 this function may invalidate the previously returned string. If file is
1795 closed, then the string previously returned by gzerror will no longer be
1796 available.
@@ -1970,11 +1980,12 @@
1980
1981 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
1982 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
1983 * both are true, the application gets the *64 functions, and the regular
1984 * functions are changed to 64 bits) -- in case these are set on systems
1985 * without large file support, _LFS64_LARGEFILE must also be true, except on
1986 * native Windows, where 64-bit offsets are always available
1987 */
1988 #ifdef Z_LARGE64
1989 ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
1990 ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
1991 ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
@@ -2027,11 +2038,11 @@
2038 ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
2039 ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
2040
2041 #endif /* !Z_SOLO */
2042
2043 /* undocumented functions (not part of the zlib API) */
2044 ZEXTERN const char * ZEXPORT zError(int);
2045 ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp);
2046 ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void);
2047 ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int);
2048 ZEXTERN int ZEXPORT inflateValidate(z_streamp, int);
2049
--- compat/zlib/zlib.pc.cmakein
+++ compat/zlib/zlib.pc.cmakein
@@ -1,10 +1,10 @@
11
prefix=@CMAKE_INSTALL_PREFIX@
2
-exec_prefix=@CMAKE_INSTALL_PREFIX@
3
-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
4
-sharedlibdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
5
-includedir=${exec_prefix}/@CMAKE_INSTALL_INCLUDEDIR@
2
+exec_prefix=${prefix}
3
+libdir=@pc_libdir@
4
+sharedlibdir=${libdir}
5
+includedir=@pc_includedir@
66
77
Name: zlib
88
Description: zlib compression library
99
Version: @zlib_VERSION@
1010
License: Zlib
1111
--- compat/zlib/zlib.pc.cmakein
+++ compat/zlib/zlib.pc.cmakein
@@ -1,10 +1,10 @@
1 prefix=@CMAKE_INSTALL_PREFIX@
2 exec_prefix=@CMAKE_INSTALL_PREFIX@
3 libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
4 sharedlibdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
5 includedir=${exec_prefix}/@CMAKE_INSTALL_INCLUDEDIR@
6
7 Name: zlib
8 Description: zlib compression library
9 Version: @zlib_VERSION@
10 License: Zlib
11
--- compat/zlib/zlib.pc.cmakein
+++ compat/zlib/zlib.pc.cmakein
@@ -1,10 +1,10 @@
1 prefix=@CMAKE_INSTALL_PREFIX@
2 exec_prefix=${prefix}
3 libdir=@pc_libdir@
4 sharedlibdir=${libdir}
5 includedir=@pc_includedir@
6
7 Name: zlib
8 Description: zlib compression library
9 Version: @zlib_VERSION@
10 License: Zlib
11
--- compat/zlib/zlibConfig.cmake.in
+++ compat/zlib/zlibConfig.cmake.in
@@ -1,18 +1,40 @@
1
-@PACKAGE_INIT@
2
-
31
set(_ZLIB_supported_components "shared" "static")
42
53
if(ZLIB_FIND_COMPONENTS)
64
foreach(_comp ${ZLIB_FIND_COMPONENTS})
75
if(NOT _comp IN_LIST _ZLIB_supported_components)
86
set(ZLIB_FOUND False)
97
set(ZLIB_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
108
endif(NOT _comp IN_LIST _ZLIB_supported_components)
119
12
- include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_comp}.cmake")
10
+ include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_comp}.cmake"
11
+ OPTIONAL
12
+ RESULT_VARIABLE _comp_loaded)
13
+
14
+ if(NOT _comp_loaded)
15
+ set(ZLIB_FOUND False)
16
+ set(ZLIB_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
17
+ else(NOT _comp_loaded)
18
+ set(ZLIB_${_comp}_FOUND TRUE)
19
+ endif(NOT _comp_loaded)
1320
endforeach(_comp ${ZLIB_FIND_COMPONENTS})
1421
else(ZLIB_FIND_COMPONENTS)
1522
foreach(_component_config IN LISTS _ZLIB_supported_components)
16
- include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_component_config}.cmake")
23
+ include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_component_config}.cmake"
24
+ OPTIONAL)
1725
endforeach(_component_config IN LISTS _ZLIB_supported_components)
26
+
27
+ if(NOT TARGET ZLIB::ZLIB)
28
+ set(ZLIB_FOUND False)
29
+ set(ZLIB_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
30
+ string(APPEND ZLIB_NOT_FOUND_MESSAGE "build zlib with support for shared libs or\n")
31
+ string(APPEND ZLIB_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
32
+ endif(NOT TARGET ZLIB::ZLIB)
33
+
34
+ if(NOT TARGET ZLIB::ZLIBSTATIC)
35
+ set(ZLIB_FOUND False)
36
+ set(ZLIB_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
37
+ string(APPEND ZLIB_NOT_FOUND_MESSAGE "build zlib with support for static libs or\n")
38
+ string(APPEND ZLIB_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
39
+ endif(NOT TARGET ZLIB::ZLIBSTATIC)
1840
endif(ZLIB_FIND_COMPONENTS)
1941
--- compat/zlib/zlibConfig.cmake.in
+++ compat/zlib/zlibConfig.cmake.in
@@ -1,18 +1,40 @@
1 @PACKAGE_INIT@
2
3 set(_ZLIB_supported_components "shared" "static")
4
5 if(ZLIB_FIND_COMPONENTS)
6 foreach(_comp ${ZLIB_FIND_COMPONENTS})
7 if(NOT _comp IN_LIST _ZLIB_supported_components)
8 set(ZLIB_FOUND False)
9 set(ZLIB_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
10 endif(NOT _comp IN_LIST _ZLIB_supported_components)
11
12 include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_comp}.cmake")
 
 
 
 
 
 
 
 
 
13 endforeach(_comp ${ZLIB_FIND_COMPONENTS})
14 else(ZLIB_FIND_COMPONENTS)
15 foreach(_component_config IN LISTS _ZLIB_supported_components)
16 include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_component_config}.cmake")
 
17 endforeach(_component_config IN LISTS _ZLIB_supported_components)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18 endif(ZLIB_FIND_COMPONENTS)
19
--- compat/zlib/zlibConfig.cmake.in
+++ compat/zlib/zlibConfig.cmake.in
@@ -1,18 +1,40 @@
 
 
1 set(_ZLIB_supported_components "shared" "static")
2
3 if(ZLIB_FIND_COMPONENTS)
4 foreach(_comp ${ZLIB_FIND_COMPONENTS})
5 if(NOT _comp IN_LIST _ZLIB_supported_components)
6 set(ZLIB_FOUND False)
7 set(ZLIB_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
8 endif(NOT _comp IN_LIST _ZLIB_supported_components)
9
10 include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_comp}.cmake"
11 OPTIONAL
12 RESULT_VARIABLE _comp_loaded)
13
14 if(NOT _comp_loaded)
15 set(ZLIB_FOUND False)
16 set(ZLIB_NOT_FOUND_MESSAGE "Component ${_comp} not found.")
17 else(NOT _comp_loaded)
18 set(ZLIB_${_comp}_FOUND TRUE)
19 endif(NOT _comp_loaded)
20 endforeach(_comp ${ZLIB_FIND_COMPONENTS})
21 else(ZLIB_FIND_COMPONENTS)
22 foreach(_component_config IN LISTS _ZLIB_supported_components)
23 include("${CMAKE_CURRENT_LIST_DIR}/ZLIB-${_component_config}.cmake"
24 OPTIONAL)
25 endforeach(_component_config IN LISTS _ZLIB_supported_components)
26
27 if(NOT TARGET ZLIB::ZLIB)
28 set(ZLIB_FOUND False)
29 set(ZLIB_NOT_FOUND_MESSAGE "Target ZLIB::ZLIB not created\n")
30 string(APPEND ZLIB_NOT_FOUND_MESSAGE "build zlib with support for shared libs or\n")
31 string(APPEND ZLIB_NOT_FOUND_MESSAGE "specify COMPONENTS static in your find_package call")
32 endif(NOT TARGET ZLIB::ZLIB)
33
34 if(NOT TARGET ZLIB::ZLIBSTATIC)
35 set(ZLIB_FOUND False)
36 set(ZLIB_NOT_FOUND_MESSAGE "Target ZLIB::ZLIBSTATIC not created\n")
37 string(APPEND ZLIB_NOT_FOUND_MESSAGE "build zlib with support for static libs or\n")
38 string(APPEND ZLIB_NOT_FOUND_MESSAGE "specify COMPONENTS shared in your find_package call")
39 endif(NOT TARGET ZLIB::ZLIBSTATIC)
40 endif(ZLIB_FIND_COMPONENTS)
41
--- compat/zlib/zutil.c
+++ compat/zlib/zutil.c
@@ -169,11 +169,10 @@
169169
return 0;
170170
}
171171
172172
void ZLIB_INTERNAL zmemzero(void FAR *b, z_size_t len) {
173173
uchf *p = b;
174
- if (len == 0) return;
175174
while (len) {
176175
*p++ = 0;
177176
len--;
178177
}
179178
}
@@ -226,11 +225,15 @@
226225
buf = farmalloc(bsize);
227226
if (*(ush*)&buf != 0) return buf;
228227
} else {
229228
buf = farmalloc(bsize + 16L);
230229
}
231
- if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
230
+ if (buf == NULL) return NULL;
231
+ if (next_ptr >= MAX_PTR) {
232
+ farfree(buf);
233
+ return NULL;
234
+ }
232235
table[next_ptr].org_ptr = buf;
233236
234237
/* Normalize the pointer to seg:0 */
235238
*((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
236239
*(ush*)&buf = 0;
237240
--- compat/zlib/zutil.c
+++ compat/zlib/zutil.c
@@ -169,11 +169,10 @@
169 return 0;
170 }
171
172 void ZLIB_INTERNAL zmemzero(void FAR *b, z_size_t len) {
173 uchf *p = b;
174 if (len == 0) return;
175 while (len) {
176 *p++ = 0;
177 len--;
178 }
179 }
@@ -226,11 +225,15 @@
226 buf = farmalloc(bsize);
227 if (*(ush*)&buf != 0) return buf;
228 } else {
229 buf = farmalloc(bsize + 16L);
230 }
231 if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
 
 
 
 
232 table[next_ptr].org_ptr = buf;
233
234 /* Normalize the pointer to seg:0 */
235 *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
236 *(ush*)&buf = 0;
237
--- compat/zlib/zutil.c
+++ compat/zlib/zutil.c
@@ -169,11 +169,10 @@
169 return 0;
170 }
171
172 void ZLIB_INTERNAL zmemzero(void FAR *b, z_size_t len) {
173 uchf *p = b;
 
174 while (len) {
175 *p++ = 0;
176 len--;
177 }
178 }
@@ -226,11 +225,15 @@
225 buf = farmalloc(bsize);
226 if (*(ush*)&buf != 0) return buf;
227 } else {
228 buf = farmalloc(bsize + 16L);
229 }
230 if (buf == NULL) return NULL;
231 if (next_ptr >= MAX_PTR) {
232 farfree(buf);
233 return NULL;
234 }
235 table[next_ptr].org_ptr = buf;
236
237 /* Normalize the pointer to seg:0 */
238 *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
239 *(ush*)&buf = 0;
240

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button