[libarchive,lz4] Fix pc file, modernize portfile (#20146)

* Fix pc file

* Modernize portfile

* OpenSSL unused on 'Darwin'

* x-add-version

* More port cleanup (CR requests)

* Revise wrapper, using find_package

* Don't use pkgconfig modules for windows openssl

* Update versions

* Use namespaced variables for custom lzo lookup

* Wrapper needs CMP0012

* Skip dependencies if not LibArchive_FOUND

* Update versions

* Fix liblz4.pc debug lib fixup

* Update versions

Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
This commit is contained in:
Kai Pastor 2021-09-24 21:06:17 +02:00 committed by GitHub
parent bb92b7d34d
commit 845a5fda11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 317 additions and 141 deletions

View File

@ -0,0 +1,238 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b6f0ad..18cf15c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -397,6 +397,8 @@ IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}")
ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}")
SET(ADDITIONAL_LIBS "")
+SET(LIBARCHIVE_LIBS_PRIVATE "") # additional libs for which the pc module is unknown
+SET(LIBARCHIVE_REQUIRES_PRIVATE "") # pc modules for additonal libs
#
# Find ZLIB
#
@@ -410,6 +412,7 @@ IF(ZLIB_FOUND)
SET(HAVE_ZLIB_H 1)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES})
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " zlib")
IF(WIN32 AND NOT CYGWIN)
SET(ZLIB_WINAPI OFF) # skip following test, it crashes with weird message box
IF(ZLIB_WINAPI)
@@ -442,6 +445,7 @@ IF(BZIP2_FOUND)
SET(HAVE_BZLIB_H 1)
INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES})
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " bzip2")
# Test if a macro is needed for the library.
TRY_MACRO_FOR_LIBRARY(
"${BZIP2_INCLUDE_DIR}" "${BZIP2_LIBRARIES}"
@@ -471,6 +475,7 @@ IF(LibLZMA_FOUND)
SET(HAVE_LIBLZMA 1)
SET(HAVE_LZMA_H 1)
LIST(APPEND ADDITIONAL_LIBS LibLZMA::LibLZMA)
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " liblzma")
ELSE(LIBLZMA_FOUND)
# LZMA not found and will not be used.
ENDIF(LIBLZMA_FOUND)
@@ -499,6 +504,7 @@ IF(LZO2_FOUND)
SET(HAVE_LZO_LZO1X_H 1)
INCLUDE_DIRECTORIES(${LZO2_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${LZO2_LIBRARY})
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " lzo2")
#
# TODO: test for static library.
#
@@ -526,6 +532,7 @@ IF(LIBB2_FOUND)
SET(HAVE_BLAKE2_H 1)
SET(ARCHIVE_BLAKE2 FALSE)
LIST(APPEND ADDITIONAL_LIBS ${LIBB2_LIBRARY})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBB2_LIBRARY})
CMAKE_PUSH_CHECK_STATE()
SET(CMAKE_REQUIRED_LIBRARIES ${LIBB2_LIBRARY})
SET(CMAKE_REQUIRED_INCLUDES ${LIBB2_INCLUDE_DIR})
@@ -552,6 +559,7 @@ IF(lz4_FOUND)
SET(HAVE_LIBLZ4 1)
SET(HAVE_LZ4_H 1)
LIST(APPEND ADDITIONAL_LIBS lz4::lz4)
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " liblz4")
#
# TODO: test for static library.
#
@@ -581,6 +589,7 @@ IF(zstd_FOUND)
LIST(APPEND ADDITIONAL_LIBS zstd::libzstd_static)
SET(CMAKE_REQUIRED_LIBRARIES zstd::libzstd_static)
ENDIF(TARGET zstd::libzstd_shared)
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " libzstd")
ENDIF(ZSTD_FOUND)
MARK_AS_ADVANCED(CLEAR ZSTD_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR ZSTD_LIBRARY)
@@ -678,6 +687,7 @@ IF(ENABLE_CNG)
LA_CHECK_INCLUDE_FILE("Bcrypt.h" HAVE_BCRYPT_H)
IF(HAVE_BCRYPT_H)
LIST(APPEND ADDITIONAL_LIBS "Bcrypt")
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE "Bcrypt")
ENDIF(HAVE_BCRYPT_H)
ELSE(ENABLE_CNG)
UNSET(HAVE_BCRYPT_H CACHE)
@@ -709,6 +719,7 @@ IF(ENABLE_MBEDTLS)
IF(MBEDTLS_FOUND)
SET(HAVE_LIBMBEDCRYPTO 1)
LIST(APPEND ADDITIONAL_LIBS ${MBEDCRYPTO_LIBRARY})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${MBEDCRYPTO_LIBRARY})
INCLUDE_DIRECTORIES(${MBEDTLS_INCLUDE_DIRS})
LIST(APPEND CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIRS})
@@ -729,6 +740,7 @@ IF(ENABLE_NETTLE)
IF(NETTLE_FOUND)
SET(HAVE_LIBNETTLE 1)
LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES})
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " nettle")
INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR})
LIST(APPEND CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR})
@@ -753,6 +765,11 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
IF(OpenSSL_FOUND)
SET(HAVE_LIBCRYPTO 1)
LIST(APPEND ADDITIONAL_LIBS OpenSSL::Crypto)
+ IF(WIN32 AND NOT MINGW)
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE "libcrypto")
+ ELSE()
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " libcrypto")
+ ENDIF()
message("OPENSSL_CRYPTO_LIBRARY: OpenSSL::Crypto")
ENDIF(OPENSSL_FOUND)
ELSE()
@@ -767,6 +780,7 @@ IF(NOT OPENSSL_FOUND)
SET(CMAKE_REQUIRED_LIBRARIES "md")
FIND_LIBRARY(LIBMD_LIBRARY NAMES md)
LIST(APPEND ADDITIONAL_LIBS ${LIBMD_LIBRARY})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBMD_LIBRARY})
CMAKE_POP_CHECK_STATE() # Restore the state of the variables
ENDIF(LIBMD_FOUND)
ENDIF(NOT OPENSSL_FOUND)
@@ -872,6 +886,11 @@ main(int argc, char **argv)
IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES})
+ IF(WIN32 AND NOT MINGW)
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE "libssl")
+ ELSE()
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " libssl")
+ ENDIF()
ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION})
ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM})
@@ -1045,6 +1060,7 @@ IF(ENABLE_ICONV)
CHECK_ICONV("libiconv" "")
IF (HAVE_ICONV)
LIST(APPEND ADDITIONAL_LIBS ${LIBICONV_PATH})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBICONV_PATH})
ENDIF(HAVE_ICONV)
ENDIF(NOT HAVE_ICONV AND LIBICONV_PATH)
ENDIF(ICONV_INCLUDE_DIR)
@@ -1078,6 +1094,7 @@ IF(ENABLE_ICONV)
ENDIF(WIN32 AND NOT CYGWIN)
IF(HAVE_LOCALE_CHARSET)
LIST(APPEND ADDITIONAL_LIBS ${LIBCHARSET_PATH})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBCHARSET_PATH})
ENDIF(HAVE_LOCALE_CHARSET)
ENDIF(LIBCHARSET_PATH)
ENDIF(LIBICONV_PATH)
@@ -1111,6 +1128,7 @@ IF(LIBXML2_FOUND)
CMAKE_PUSH_CHECK_STATE() # Save the state of the variables
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${LIBXML2_LIBRARIES})
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " libxml-2.0")
SET(HAVE_LIBXML2 1)
# libxml2's include files use iconv.h
SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})
@@ -1140,6 +1158,7 @@ ELSE(LIBXML2_FOUND)
CMAKE_PUSH_CHECK_STATE() # Save the state of the variables
INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${EXPAT_LIBRARIES})
+ STRING(APPEND LIBARCHIVE_REQUIRES_PRIVATE " expat")
SET(HAVE_LIBEXPAT 1)
LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H)
CMAKE_POP_CHECK_STATE() # Restore the state of the variables
@@ -1170,6 +1189,7 @@ IF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$")
CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBREGEX)
IF(HAVE_REGCOMP_LIBREGEX)
LIST(APPEND ADDITIONAL_LIBS ${REGEX_LIBRARY})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${REGEX_LIBRARY})
#
# If regex.h is not found, retry looking for regex.h at
# REGEX_INCLUDE_DIR
@@ -1218,6 +1238,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$"
IF(PCREPOSIX_FOUND)
INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${PCREPOSIX_LIBRARIES})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${PCREPOSIX_LIBRARIES})
# Test if a macro is needed for the library.
TRY_MACRO_FOR_LIBRARY(
"${PCRE_INCLUDE_DIR}" "${PCREPOSIX_LIBRARIES}"
@@ -1229,6 +1250,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$"
ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND PCRE_FOUND)
# Determine if pcre static libraries are to be used.
LIST(APPEND ADDITIONAL_LIBS ${PCRE_LIBRARIES})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${PCRE_LIBRARIES})
SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES})
MESSAGE(STATUS "trying again with -lpcre included")
TRY_MACRO_FOR_LIBRARY(
@@ -1244,6 +1266,7 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$"
# ___chkstk_ms.
MESSAGE(STATUS "Visual Studio build detected, trying again with -lgcc included")
LIST(APPEND ADDITIONAL_LIBS ${LIBGCC_LIBRARIES})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${LIBGCC_LIBRARIES})
SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES} ${LIBGCC_LIBRARIES})
TRY_MACRO_FOR_LIBRARY(
"${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}"
@@ -1762,6 +1785,7 @@ IF(ENABLE_ACL)
SET(CMAKE_REQUIRED_LIBRARIES "acl")
FIND_LIBRARY(ACL_LIBRARY NAMES acl)
LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${ACL_LIBRARY})
ENDIF(HAVE_LIBACL)
CHECK_TYPE_EXISTS(acl_t "sys/types.h;sys/acl.h" HAVE_ACL_T)
@@ -1901,6 +1925,7 @@ int main(void) { return ACL_SYNCHRONIZE; }" HAVE_DECL_ACL_SYNCHRONIZE)
SET(CMAKE_REQUIRED_LIBRARIES "richacl")
FIND_LIBRARY(RICHACL_LIBRARY NAMES richacl)
LIST(APPEND ADDITIONAL_LIBS ${RICHACL_LIBRARY})
+ LIST(APPEND LIBARCHIVE_LIBS_PRIVATE ${RICHACL_LIBRARY})
ENDIF(HAVE_LIBRICHACL)
CHECK_STRUCT_HAS_MEMBER("struct richace" e_type "sys/richacl.h"
diff --git a/build/cmake/CreatePkgConfigFile.cmake b/build/cmake/CreatePkgConfigFile.cmake
index bc5a43f..422b83b 100644
--- a/build/cmake/CreatePkgConfigFile.cmake
+++ b/build/cmake/CreatePkgConfigFile.cmake
@@ -8,7 +8,7 @@ SET(libdir \${exec_prefix}/lib)
SET(includedir \${prefix}/include)
# Now, this is not particularly pretty, nor is it terribly accurate...
# Loop over all our additional libs
-FOREACH(mylib ${ADDITIONAL_LIBS})
+FOREACH(mylib ${LIBARCHIVE_LIBS_PRIVATE})
# Extract the filename from the absolute path
GET_FILENAME_COMPONENT(mylib_name ${mylib} NAME_WE)
# Strip the lib prefix
@@ -16,10 +16,6 @@ FOREACH(mylib ${ADDITIONAL_LIBS})
# Append it to our LIBS string
SET(LIBS "${LIBS} -l${mylib_name}")
ENDFOREACH()
-# libxml2 is easier, since it's already using pkg-config
-FOREACH(mylib ${PC_LIBXML_STATIC_LDFLAGS})
- SET(LIBS "${LIBS} ${mylib}")
-ENDFOREACH()
# FIXME: The order of the libraries doesn't take dependencies into account,
# thus there's a good chance it'll make some binutils versions unhappy...
# This only affects Libs.private (looked up for static builds) though.
diff --git a/build/pkgconfig/libarchive.pc.in b/build/pkgconfig/libarchive.pc.in
index 4b631e6..80198f1 100644
--- a/build/pkgconfig/libarchive.pc.in
+++ b/build/pkgconfig/libarchive.pc.in
@@ -10,3 +10,4 @@ Cflags: -I${includedir}
Cflags.private: -DLIBARCHIVE_STATIC
Libs: -L${libdir} -larchive
Libs.private: @LIBS@
+Requires.private: @LIBARCHIVE_REQUIRES_PRIVATE@

View File

@ -11,6 +11,7 @@ vcpkg_from_github(
fix-buildsystem.patch
fix-cpu-set.patch
fix-dependencies.patch
pkgconfig-modules.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -22,36 +23,15 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
lzo ENABLE_LZO
openssl ENABLE_OPENSSL
zstd ENABLE_ZSTD
# The below features should be added to CONTROL
#pcre ENABLE_PCREPOSIX
#nettle ENABLE_NETTLE
#expat ENABLE_EXPAT
#libgcc ENABLE_LibGCC
#cng ENABLE_CNG
#tar ENABLE_TAR # Tool build option?
#cpio ENABLE_CPIO # Tool build option?
#cat ENABLE_CAT # Tool build option?
#xattr ENABLE_XATTR # Tool support option?
#acl ENABLE_ACL # Tool support option?
#iconv ENABLE_ICONV # iconv support option?
#libb2 ENABLE_LIBB2
)
if(FEATURES MATCHES "pcre")
else()
list(APPEND FEATURE_OPTIONS -DPOSIX_REGEX_LIB=NONE)
endif()
list(APPEND FEATURE_OPTIONS -DENABLE_ZLIB=ON)
# Needed for configure_file
set(ENABLE_ZLIB ON)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DENABLE_ZLIB=ON
-DENABLE_PCREPOSIX=OFF
-DPOSIX_REGEX_LIB=NONE
-DENABLE_NETTLE=OFF
-DENABLE_EXPAT=OFF
-DENABLE_LibGCC=OFF
@ -67,7 +47,7 @@ vcpkg_configure_cmake(
-DENABLE_WERROR=OFF
)
vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_fixup_pkgconfig()
@ -75,17 +55,15 @@ vcpkg_copy_pdbs()
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
foreach(HEADER ${CURRENT_PACKAGES_DIR}/include/archive.h ${CURRENT_PACKAGES_DIR}/include/archive_entry.h)
file(READ ${HEADER} CONTENTS)
string(REPLACE "(!defined LIBARCHIVE_STATIC)" "0" CONTENTS "${CONTENTS}")
file(WRITE ${HEADER} "${CONTENTS}")
foreach(header "${CURRENT_PACKAGES_DIR}/include/archive.h" "${CURRENT_PACKAGES_DIR}/include/archive_entry.h")
vcpkg_replace_string("${header}" "(!defined LIBARCHIVE_STATIC)" "0")
endforeach()
file(INSTALL ${CURRENT_PORT_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,123 +1,65 @@
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0057 NEW)
set(z_vcpkg_libarchive_args "")
if("REQUIRED" IN_LIST ARGS)
list(APPEND z_vcpkg_libarchive_args "REQUIRED")
endif()
if("QUIET" IN_LIST ARGS)
list(APPEND z_vcpkg_libarchive_args "QUIET")
endif()
_find_package(${ARGS})
include(CMakeFindDependencyMacro)
if(@ENABLE_ZLIB@)
find_dependency(ZLIB)
endif()
if(@ENABLE_BZip2@)
find_dependency(BZip2)
endif()
if(@ENABLE_LIBXML2@)
find_dependency(LibXml2)
endif()
if(@ENABLE_LZ4@)
find_dependency(lz4)
endif()
if(@ENABLE_LZMA@)
find_dependency(LibLZMA)
endif()
if(@ENABLE_ZSTD@)
find_dependency(zstd)
endif()
if(@ENABLE_OPENSSL@)
find_dependency(OpenSSL)
endif()
if(@ENABLE_LZO@)
find_library(LZO_LIBRARY_DEBUG NAMES lzo2d lzo2 NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH)
find_library(LZO_LIBRARY_RELEASE NAMES lzo2 NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
endif()
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
if(@ENABLE_ZLIB@)
list(APPEND LibArchive_LIBRARIES ZLIB::ZLIB)
endif()
if(LibArchive_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
set(z_vcpkg_libarchive_libs "")
find_package(ZLIB ${z_vcpkg_libarchive_args})
list(APPEND z_vcpkg_libarchive_libs ZLIB::ZLIB)
if(@ENABLE_BZip2@)
list(APPEND LibArchive_LIBRARIES BZip2::BZip2)
find_package(BZip2 ${z_vcpkg_libarchive_args})
list(APPEND z_vcpkg_libarchive_libs BZip2::BZip2)
endif()
if(@ENABLE_LIBXML2@)
list(APPEND LibArchive_LIBRARIES LibXml2::LibXml2)
find_package(LibXml2 ${z_vcpkg_libarchive_args})
list(APPEND z_vcpkg_libarchive_libs LibXml2::LibXml2)
endif()
if(@ENABLE_LZ4@)
list(APPEND LibArchive_LIBRARIES lz4::lz4)
find_package(lz4 CONFIG ${z_vcpkg_libarchive_args})
list(APPEND z_vcpkg_libarchive_libs lz4::lz4)
endif()
if(@ENABLE_LZMA@)
list(APPEND LibArchive_LIBRARIES LibLZMA::LibLZMA)
find_package(LibLZMA ${z_vcpkg_libarchive_args})
list(APPEND z_vcpkg_libarchive_libs LibLZMA::LibLZMA)
endif()
if(@ENABLE_LZO@)
if(LZO_LIBRARY_RELEASE)
list(APPEND LibArchive_LIBRARIES optimized ${LZO_LIBRARY_RELEASE})
endif()
if(LZO_LIBRARY_DEBUG)
list(APPEND LibArchive_LIBRARIES debug ${LZO_LIBRARY_DEBUG})
include(SelectLibraryConfigurations)
find_library(Z_VCPKG_LZO_LIBRARY_DEBUG NAMES lzo2d lzo2 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
find_library(Z_VCPKG_LZO_LIBRARY_RELEASE NAMES lzo2 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
select_library_configurations(Z_VCPKG_LZO)
if(Z_VCPKG_LZO_LIBRARY)
list(APPEND z_vcpkg_libarchive_libs ${Z_VCPKG_LZO_LIBRARY})
else()
set(LibArchive_FOUND FALSE)
endif()
endif()
if(@ENABLE_ZSTD@)
find_package(zstd ${z_vcpkg_libarchive_args})
if(TARGET zstd::libzstd_shared)
list(APPEND LibArchive_LIBRARIES zstd::libzstd_shared)
list(APPEND z_vcpkg_libarchive_libs zstd::libzstd_shared)
else(TARGET zstd::libzstd_shared)
list(APPEND LibArchive_LIBRARIES zstd::libzstd_static)
list(APPEND z_vcpkg_libarchive_libs zstd::libzstd_static)
endif(TARGET zstd::libzstd_shared)
endif()
if(@ENABLE_OPENSSL@)
list(APPEND LibArchive_LIBRARIES OpenSSL::Crypto)
if(@ENABLE_OPENSSL@ AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_package(OpenSSL ${z_vcpkg_libarchive_args})
list(APPEND z_vcpkg_libarchive_libs OpenSSL::Crypto)
endif()
list(APPEND LibArchive_LIBRARIES ${z_vcpkg_libarchive_libs})
if(TARGET LibArchive::LibArchive)
if(@ENABLE_BZip2@)
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES BZip2::BZip2)
endif()
if(@ENABLE_ZLIB@)
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
endif()
if(@ENABLE_LIBXML2@)
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES LibXml2::LibXml2)
endif()
if(@ENABLE_LZ4@)
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES lz4::lz4)
endif()
if(@ENABLE_LZMA@)
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES LibLZMA::LibLZMA)
endif()
if(@ENABLE_LZO@)
if(LZO_LIBRARY_RELEASE)
list(APPEND interface_lib \$<\$<NOT:\$<CONFIG:DEBUG>>:${LZO_LIBRARY_RELEASE}>)
endif()
if(LZO_LIBRARY_DEBUG)
list(APPEND interface_lib \$<\$<CONFIG:DEBUG>:${LZO_LIBRARY_DEBUG}>)
endif()
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${interface_lib})
endif()
if(@ENABLE_ZSTD@)
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES zstd::libzstd_static)
endif()
if(@ENABLE_OPENSSL@)
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
endif()
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_libarchive_libs})
endif()
unset(z_vcpkg_libarchive_libs)
endif()
# TODO in some future
# if(@ENABLE_PCREPOSIX@)
# endif()
# if(@ENABLE_NETTLE@)
# endif()
# if(@ENABLE_EXPAT@)
# endif()
# if(@ENABLE_LibGCC@)
# endif()
# if(@ENABLE_CNG@)
# endif()
# if(@ENABLE_TAR@)
# endif()
# if(@ENABLE_CPIO@)
# endif()
# if(@ENABLE_CAT@)
# endif()
# if(@ENABLE_XATTR@)
# endif()
# if(@ENABLE_ACL@)
# endif()
# if(@ENABLE_ICONV@)
# endif()
unset(z_vcpkg_libarchive_args)
cmake_policy(POP)

View File

@ -1,10 +1,15 @@
{
"name": "libarchive",
"version-semver": "3.5.2",
"port-version": 1,
"description": "Library for reading and writing streaming archives",
"homepage": "https://github.com/libarchive/libarchive",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
"zlib"
],
"default-features": [
@ -47,9 +52,12 @@
]
},
"openssl": {
"description": "Openssl support",
"description": "OpenSSL support (not available on macOS)",
"dependencies": [
"openssl"
{
"name": "openssl",
"platform": "!osx"
}
]
},
"zstd": {

View File

@ -31,8 +31,8 @@ endforeach()
vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/lz4.pc")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/lz4.pc" " -llz4" " -llz4d")
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/liblz4.pc" " -llz4" " -llz4d")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

View File

@ -1,7 +1,7 @@
{
"name": "lz4",
"version": "1.9.3",
"port-version": 2,
"port-version": 3,
"description": "Lossless compression algorithm, providing compression speed at 400 MB/s per core.",
"homepage": "https://github.com/lz4/lz4",
"dependencies": [

View File

@ -3194,7 +3194,7 @@
},
"libarchive": {
"baseline": "3.5.2",
"port-version": 0
"port-version": 1
},
"libass": {
"baseline": "0.15.1",
@ -4050,7 +4050,7 @@
},
"lz4": {
"baseline": "1.9.3",
"port-version": 2
"port-version": 3
},
"lzfse": {
"baseline": "1.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1fb5fbe606242275316a4368c88327e123ab01ad",
"version-semver": "3.5.2",
"port-version": 1
},
{
"git-tree": "4ce798873a82e4562c34189ec77f1dec3dea047d",
"version-semver": "3.5.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "43957fa49e865966b52c6729db11aa067f790d49",
"version": "1.9.3",
"port-version": 3
},
{
"git-tree": "c73172e611edeb3ef440fd1ea7ef4fe746237cfc",
"version": "1.9.3",