[libzip] Fix zstd feature (#30500)

* [libzip] Use the upstream package name for zstd.

Without it, when with the zstd feature, calling `find_package` on libzip
would fail due to the `Zstd` not being found.

* [libzip] Bump port version.

* [libzip] Update baseline.

* [libzip] Reduce patch size by using NAMES.

* [libzip] Update version.
This commit is contained in:
Pierre Wendling 2023-03-29 19:09:38 -04:00 committed by GitHub
parent 23f0707b1a
commit 47fb7ebacd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 3 deletions

View File

@ -1,5 +1,40 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d00a4f9f..cf85fc4b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -197,7 +197,7 @@ if(ENABLE_LZMA)
endif(ENABLE_LZMA)
if(ENABLE_ZSTD)
- find_package(Zstd 1.3.6)
+ find_package(Zstd NAMES zstd 1.3.6)
if(Zstd_FOUND)
set(HAVE_LIBZSTD 1)
else()
@@ -301,7 +301,7 @@ foreach(LIB ${LIBS_PRIVATE})
endforeach()
string(REGEX REPLACE "-lBZip2::BZip2" "-lbz2" LIBS ${LIBS})
string(REGEX REPLACE "-lLibLZMA::LibLZMA" "-llzma" LIBS ${LIBS})
-string(REGEX REPLACE "-lZstd::Zstd" "-lzstd" LIBS ${LIBS})
+string(REGEX REPLACE "-l$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>" "-lzstd" LIBS ${LIBS})
string(REGEX REPLACE "-lOpenSSL::Crypto" "-lssl -lcrypto" LIBS ${LIBS})
string(REGEX REPLACE "-lZLIB::ZLIB" "-lz" LIBS ${LIBS})
string(REGEX REPLACE "-lGnuTLS::GnuTLS" "-lgnutls" LIBS ${LIBS})
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 1213fa0a..b6446cbd 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -147,7 +147,7 @@ endif()
if(HAVE_LIBZSTD)
target_sources(zip PRIVATE zip_algorithm_zstd.c)
- target_link_libraries(zip PRIVATE Zstd::Zstd)
+ target_link_libraries(zip PRIVATE $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
endif()
if(HAVE_COMMONCRYPTO)
diff --git a/libzip-config.cmake.in b/libzip-config.cmake.in
index 5b9aa55..0723f3c 100644
index 5b9aa558..f9adc538 100644
--- a/libzip-config.cmake.in
+++ b/libzip-config.cmake.in
@@ -1,8 +1,20 @@
@ -16,7 +51,7 @@ index 5b9aa55..0723f3c 100644
+ find_dependency(LibLZMA)
+endif()
+if(@ENABLE_ZSTD@)
+ find_dependency(Zstd)
+ find_dependency(zstd)
+endif()
+if(@ENABLE_OPENSSL@)
+ find_dependency(OpenSSL)

View File

@ -1,6 +1,7 @@
{
"name": "libzip",
"version": "1.9.2",
"port-version": 1,
"description": "A library for reading, creating, and modifying zip archives.",
"homepage": "https://github.com/nih-at/libzip",
"license": "BSD-3-Clause",

View File

@ -4770,7 +4770,7 @@
},
"libzip": {
"baseline": "1.9.2",
"port-version": 0
"port-version": 1
},
"libzippp": {
"baseline": "6.0-1.9.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "42ad3093c3b335f0ae0bf54179faa30bd751d00c",
"version": "1.9.2",
"port-version": 1
},
{
"git-tree": "ec8e48c035f43c65ce9f0f5b455affaa92aa477e",
"version": "1.9.2",