Skip to content

Commit bc276ac

Browse files
committed
Updated libzip to 1.10.0
1 parent dc589d4 commit bc276ac

File tree

606 files changed

+6262
-4105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

606 files changed

+6262
-4105
lines changed

Diff for: API-CHANGES.md

+12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ You can define `ZIP_DISABLE_DEPRECATED` before including `<zip.h>` to hide
77
prototypes for deprecated functions, to find out about functions that
88
might be removed at some point.
99

10+
## Changed in libzip-1.10.0
11+
12+
### deprecated `zip_source_zip` and `zip_source_zip_create`
13+
14+
These functions were replaced with `zip_source_zip_file` and `zip_source_zip_file_create`. The implicit handling of the flag `ZIP_FL_COMPRESSED` was removed, the flag can now be specified explicitly.
15+
16+
If you want to get the compressed data for the whole file, use
17+
18+
```C
19+
zip_source_zip_file(za, source_archive, source_index, ZIP_FL_COMPRESSED, 0, -1, NULL)
20+
```
21+
1022
## Changed in libzip-1.0
1123
1224
### new type `zip_error_t`

Diff for: CMakeLists.txt

+70-25
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
cmake_minimum_required(VERSION 3.0.2)
1+
cmake_minimum_required(VERSION 3.4.0)
22

33
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
44
if (${CMAKE_VERSION} VERSION_LESS "3.17.0")
55
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-compat)
66
endif()
77

88
project(libzip
9-
VERSION 1.9.2
9+
VERSION 1.10.0
1010
LANGUAGES C)
1111

1212
option(ENABLE_COMMONCRYPTO "Enable use of CommonCrypto" ON)
@@ -19,6 +19,8 @@ option(ENABLE_BZIP2 "Enable use of BZip2" ON)
1919
option(ENABLE_LZMA "Enable use of LZMA" ON)
2020
option(ENABLE_ZSTD "Enable use of Zstandard" ON)
2121

22+
option(ENABLE_FDOPEN "Enable zip_fdopen, which is not allowed in Microsoft CRT secure libraries" ON)
23+
2224
option(BUILD_TOOLS "Build tools in the src directory (zipcmp, zipmerge, ziptool)" ON)
2325
option(BUILD_REGRESS "Build regression tests" ON)
2426
option(BUILD_EXAMPLES "Build examples" ON)
@@ -87,12 +89,17 @@ endif()
8789

8890
# Checks
8991

92+
# Request ISO C secure library functions (memcpy_s &c)
93+
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D__STDC_WANT_LIB_EXT1__=1)
94+
9095
check_function_exists(_close HAVE__CLOSE)
9196
check_function_exists(_dup HAVE__DUP)
9297
check_function_exists(_fdopen HAVE__FDOPEN)
9398
check_function_exists(_fileno HAVE__FILENO)
9499
check_function_exists(_setmode HAVE__SETMODE)
95100
check_symbol_exists(_snprintf stdio.h HAVE__SNPRINTF)
101+
check_symbol_exists(_snprintf_s stdio.h HAVE__SNPRINTF_S)
102+
check_symbol_exists(_snwprintf_s stdio.h HAVE__SNWPRINTF_S)
96103
check_function_exists(_strdup HAVE__STRDUP)
97104
check_symbol_exists(_stricmp string.h HAVE__STRICMP)
98105
check_function_exists(_strtoi64 HAVE__STRTOI64)
@@ -107,12 +114,18 @@ check_function_exists(fileno HAVE_FILENO)
107114
check_function_exists(fseeko HAVE_FSEEKO)
108115
check_function_exists(ftello HAVE_FTELLO)
109116
check_function_exists(getprogname HAVE_GETPROGNAME)
110-
check_function_exists(localtime_r HAVE_LOCALTIME_R)
117+
check_symbol_exists(localtime_r time.h HAVE_LOCALTIME_R)
118+
check_symbol_exists(localtime_s time.h HAVE_LOCALTIME_S)
119+
check_function_exists(memcpy_s HAVE_MEMCPY_S)
111120
check_function_exists(setmode HAVE_SETMODE)
112121
check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF)
122+
check_symbol_exists(snprintf_s stdio.h HAVE_SNPRINTF_S)
113123
check_symbol_exists(strcasecmp strings.h HAVE_STRCASECMP)
114124
check_function_exists(strdup HAVE_STRDUP)
125+
check_function_exists(strerror_s HAVE_STRERROR_S)
126+
check_function_exists(strerrorlen_s HAVE_STRERRORLEN_S)
115127
check_function_exists(stricmp HAVE_STRICMP)
128+
check_function_exists(strncpy_s HAVE_STRNCPY_S)
116129
check_function_exists(strtoll HAVE_STRTOLL)
117130
check_function_exists(strtoull HAVE_STRTOULL)
118131

@@ -177,6 +190,34 @@ int main(int argc, char *argv[]) { }" HAVE_NULLABLE)
177190
test_big_endian(WORDS_BIGENDIAN)
178191

179192
find_package(ZLIB 1.1.2 REQUIRED)
193+
# so developers on systems where zlib is named differently (Windows, sometimes)
194+
# can override the name used in the pkg-config file
195+
if (NOT ZLIB_LINK_LIBRARY_NAME)
196+
set(ZLIB_LINK_LIBRARY_NAME "z")
197+
198+
# Get the correct name in common cases
199+
list(LENGTH ZLIB_LIBRARIES N_ZLIB_LIBRARIES)
200+
if(N_ZLIB_LIBRARIES EQUAL 1)
201+
set(ZLIB_FILENAME ${ZLIB_LIBRARIES})
202+
elseif(N_ZLIB_LIBRARIES EQUAL 4)
203+
# ZLIB_LIBRARIES might have the target_link_library() format like
204+
# "optimized;path/to/zlib.lib;debug;path/to/zlibd.lib". Use the 'optimized'
205+
# case unless we know we are in a Debug build.
206+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
207+
list(FIND ZLIB_LIBRARIES "debug" ZLIB_LIBRARIES_INDEX_OF_CONFIG)
208+
else()
209+
list(FIND ZLIB_LIBRARIES "optimized" ZLIB_LIBRARIES_INDEX_OF_CONFIG)
210+
endif()
211+
if(ZLIB_LIBRARIES_INDEX_OF_CONFIG GREATER_EQUAL 0)
212+
math(EXPR ZLIB_FILENAME_INDEX "${ZLIB_LIBRARIES_INDEX_OF_CONFIG}+1")
213+
list(GET ZLIB_LIBRARIES ${ZLIB_FILENAME_INDEX} ZLIB_FILENAME)
214+
endif()
215+
endif()
216+
if(ZLIB_FILENAME)
217+
get_filename_component(ZLIB_FILENAME ${ZLIB_FILENAME} NAME_WE)
218+
string(REGEX REPLACE "^lib" "" ZLIB_LINK_LIBRARY_NAME ${ZLIB_FILENAME})
219+
endif()
220+
endif(NOT ZLIB_LINK_LIBRARY_NAME)
180221

181222
if(ENABLE_BZIP2)
182223
find_package(BZip2)
@@ -197,12 +238,17 @@ if(ENABLE_LZMA)
197238
endif(ENABLE_LZMA)
198239

199240
if(ENABLE_ZSTD)
200-
find_package(Zstd 1.3.6)
201-
if(Zstd_FOUND)
241+
find_package(zstd 1.3.6)
242+
if(zstd_FOUND)
202243
set(HAVE_LIBZSTD 1)
244+
if(TARGET zstd::libzstd_shared)
245+
set(zstd_TARGET zstd::libzstd_shared)
246+
else()
247+
set(zstd_TARGET zstd::libzstd_static)
248+
endif()
203249
else()
204250
message(WARNING "-- zstd library not found; zstandard support disabled")
205-
endif(Zstd_FOUND)
251+
endif(zstd_FOUND)
206252
endif(ENABLE_ZSTD)
207253

208254
if (COMMONCRYPTO_FOUND)
@@ -211,12 +257,12 @@ if (COMMONCRYPTO_FOUND)
211257
elseif (WINDOWS_CRYPTO_FOUND)
212258
set(HAVE_CRYPTO 1)
213259
set(HAVE_WINDOWS_CRYPTO 1)
214-
elseif (GNUTLS_FOUND AND NETTLE_FOUND)
215-
set(HAVE_CRYPTO 1)
216-
set(HAVE_GNUTLS 1)
217260
elseif (OPENSSL_FOUND)
218261
set(HAVE_CRYPTO 1)
219262
set(HAVE_OPENSSL 1)
263+
elseif (GNUTLS_FOUND AND NETTLE_FOUND)
264+
set(HAVE_CRYPTO 1)
265+
set(HAVE_GNUTLS 1)
220266
elseif (MBEDTLS_FOUND)
221267
set(HAVE_CRYPTO 1)
222268
set(HAVE_MBEDTLS 1)
@@ -265,10 +311,10 @@ else(BUILD_TOOLS)
265311
endif(BUILD_REGRESS)
266312
endif()
267313

268-
include(FindPerl)
314+
find_program(NIHTEST nihtest)
269315

270-
if(BUILD_REGRESS AND NOT PERL_FOUND)
271-
message(WARNING "-- perl not found, regression testing disabled")
316+
if(BUILD_REGRESS AND NOT NIHTEST)
317+
message(WARNING "-- nihtest not found, regression testing disabled")
272318
set(BUILD_REGRESS OFF)
273319
endif()
274320

@@ -299,11 +345,12 @@ foreach(LIB ${LIBS_PRIVATE})
299345
endif()
300346
set(LIBS "${LIBS} -l${LIB}")
301347
endforeach()
348+
STRING(CONCAT zlib_link_name "-l" ${ZLIB_LINK_LIBRARY_NAME})
302349
string(REGEX REPLACE "-lBZip2::BZip2" "-lbz2" LIBS ${LIBS})
303350
string(REGEX REPLACE "-lLibLZMA::LibLZMA" "-llzma" LIBS ${LIBS})
304-
string(REGEX REPLACE "-lZstd::Zstd" "-lzstd" LIBS ${LIBS})
351+
string(REGEX REPLACE "-l${zstd_TARGET}" "-lzstd" LIBS ${LIBS})
305352
string(REGEX REPLACE "-lOpenSSL::Crypto" "-lssl -lcrypto" LIBS ${LIBS})
306-
string(REGEX REPLACE "-lZLIB::ZLIB" "-lz" LIBS ${LIBS})
353+
string(REGEX REPLACE "-lZLIB::ZLIB" ${zlib_link_name} LIBS ${LIBS})
307354
string(REGEX REPLACE "-lGnuTLS::GnuTLS" "-lgnutls" LIBS ${LIBS})
308355
string(REGEX REPLACE "-lNettle::Nettle" "-lnettle" LIBS ${LIBS})
309356
configure_file(libzip.pc.in libzip.pc @ONLY)
@@ -413,17 +460,6 @@ set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}/regress)
413460
set(abs_srcdir ${CMAKE_CURRENT_SOURCE_DIR}/regress)
414461
set(top_builddir ${PROJECT_BINARY_DIR}) # used to find config.h
415462

416-
configure_file(regress/nihtest.conf.in ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/nihtest.conf @ONLY)
417-
file(COPY ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/nihtest.conf
418-
DESTINATION ${PROJECT_BINARY_DIR}/regress
419-
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
420-
421-
configure_file(regress/runtest.in ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/runtest @ONLY)
422-
file(COPY ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/runtest
423-
DESTINATION ${PROJECT_BINARY_DIR}/regress
424-
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
425-
)
426-
427463
# create package config file
428464
include(CMakePackageConfigHelpers)
429465
write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
@@ -432,6 +468,15 @@ write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-v
432468
configure_package_config_file("${PROJECT_NAME}-config.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
433469
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libzip)
434470

471+
# Install Find* modules, they are required by libzip-config.cmake to resolve dependencies
472+
install(FILES
473+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindNettle.cmake
474+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findzstd.cmake
475+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindMbedTLS.cmake
476+
DESTINATION
477+
${CMAKE_INSTALL_LIBDIR}/cmake/libzip/modules
478+
)
479+
435480
if(LIBZIP_DO_INSTALL)
436481
# Add targets to the build-tree export set
437482
export(TARGETS zip

Diff for: INSTALL.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
libzip uses [cmake](https://cmake.org) to build.
22

3-
For running the tests, you need to have [perl](https://www.perl.org).
4-
53
You'll need [zlib](http://www.zlib.net/) (at least version 1.1.2). It
64
comes with most operating systems.
75

@@ -18,15 +16,19 @@ For AES (encryption) support, you need one of these cryptographic libraries,
1816
listed in order of preference:
1917

2018
- Apple's CommonCrypto (available on macOS and iOS)
19+
- Microsoft Windows Cryptography Framework
20+
- [OpenSSL](https://www.openssl.org/) >= 1.0.
2121
- [GnuTLS](https://www.gnutls.org/) and [Nettle](https://www.lysator.liu.se/~nisse/nettle/) (at least nettle 3.0)
2222
- [mbed TLS](https://tls.mbed.org/)
23-
- [OpenSSL](https://www.openssl.org/) >= 1.0.
24-
- Microsoft Windows Cryptography Framework
2523

2624
If you don't want a library even if it is installed, you can
2725
pass `-DENABLE_<LIBRARY>=OFF` to cmake, where `<LIBRARY>` is one of
2826
`COMMONCRYPTO`, `GNUTLS`, `MBEDTLS`, or `OPENSSL`.
2927

28+
For running the tests, you need to have
29+
[Python](https://www.python.org/) and
30+
[nihtest](https://pypi.org/project/nihtest/) installed.
31+
3032
The basic usage is
3133
```sh
3234
mkdir build
@@ -48,7 +50,7 @@ Some useful parameters you can pass to `cmake` with `-Dparameter=value`:
4850
- `LIBZIP_DO_INSTALL`: If you include libzip as a subproject, link it
4951
statically and do not want to let it install its files, set this
5052
variable to `OFF`. Defaults to `ON`.
51-
53+
5254
If you want to compile with custom `CFLAGS`, set them in the environment
5355
before running `cmake`:
5456
```sh

Diff for: ImageMagick/ImageMagick.version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#define DELEGATE_VERSION_NUM 1,9,2
2-
#define DELEGATE_VERSION_STRING "1.9.2 (2022-06-28)"
1+
#define DELEGATE_VERSION_NUM 1,10,0
2+
#define DELEGATE_VERSION_STRING "1.10.0 (2023-06-23)"

0 commit comments

Comments
 (0)