Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[libarchive] Fix dependencies, combine patches" #14571

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ports/libarchive/CONTROL
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Source: libarchive
Version: 3.4.3
Port-Version: 1
Homepage: https://github.com/libarchive/libarchive
Description: Library for reading and writing streaming archives
Build-Depends: zlib
Expand Down
156 changes: 13 additions & 143 deletions ports/libarchive/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -1,143 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39b5333..8164d8f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -433,7 +433,7 @@ MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY)
# Find BZip2
#
IF(ENABLE_BZip2)
- FIND_PACKAGE(BZip2)
+ FIND_PACKAGE(BZip2 REQUIRED)
ELSE()
SET(BZIP2_FOUND FALSE) # Override cached value
ENDIF()
@@ -462,27 +462,15 @@ MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES)
# Find LZMA
#
IF(ENABLE_LZMA)
- FIND_PACKAGE(LibLZMA)
+ FIND_PACKAGE(LibLZMA CONFIG REQUIRED)
ELSE()
SET(LIBLZMA_FOUND FALSE) # Override cached value
ENDIF()

-IF(LIBLZMA_FOUND)
+IF(LibLZMA_FOUND)
SET(HAVE_LIBLZMA 1)
SET(HAVE_LZMA_H 1)
- CMAKE_PUSH_CHECK_STATE()
- INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS})
- LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES})
- # Test if a macro is needed for the library.
- TRY_MACRO_FOR_LIBRARY(
- "${LIBLZMA_INCLUDE_DIRS}" "${LIBLZMA_LIBRARIES}"
- COMPILES
- "#include <lzma.h>\nint main() {return (int)lzma_version_number(); }"
- "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC")
- IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC)
- ADD_DEFINITIONS(-DLZMA_API_STATIC)
- ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC)
- CMAKE_POP_CHECK_STATE()
+ LIST(APPEND ADDITIONAL_LIBS LibLZMA::LibLZMA)
ELSE(LIBLZMA_FOUND)
# LZMA not found and will not be used.
ENDIF(LIBLZMA_FOUND)
@@ -555,22 +543,14 @@ IF(ENABLE_LZ4)
SET(LZ4_FIND_QUIETLY TRUE)
ENDIF (LZ4_INCLUDE_DIR)

- FIND_PATH(LZ4_INCLUDE_DIR lz4.h)
- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4)
- INCLUDE(FindPackageHandleStandardArgs)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR)
+ FIND_PACKAGE(lz4 CONFIG REQUIRED)
ELSE(ENABLE_LZ4)
SET(LZ4_FOUND FALSE) # Override cached value
ENDIF(ENABLE_LZ4)
-IF(LZ4_FOUND)
+IF(lz4_FOUND)
SET(HAVE_LIBLZ4 1)
SET(HAVE_LZ4_H 1)
- CMAKE_PUSH_CHECK_STATE() # Save the state of the variables
- SET(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR})
- CHECK_INCLUDE_FILES("lz4hc.h" HAVE_LZ4HC_H)
- CMAKE_POP_CHECK_STATE() # Restore the state of the variables
- INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR})
- LIST(APPEND ADDITIONAL_LIBS ${LZ4_LIBRARY})
+ LIST(APPEND ADDITIONAL_LIBS lz4::lz4)
#
# TODO: test for static library.
#
@@ -586,25 +566,14 @@ IF(ENABLE_ZSTD)
SET(ZSTD_FIND_QUIETLY TRUE)
ENDIF (ZSTD_INCLUDE_DIR)

- FIND_PATH(ZSTD_INCLUDE_DIR zstd.h)
- FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd)
- INCLUDE(FindPackageHandleStandardArgs)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
+ FIND_PACKAGE(zstd CONFIG REQUIRED)
ELSE(ENABLE_ZSTD)
SET(ZSTD_FOUND FALSE) # Override cached value
ENDIF(ENABLE_ZSTD)
-IF(ZSTD_FOUND)
+IF(zstd_FOUND)
SET(HAVE_ZSTD_H 1)
- INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR})
- LIST(APPEND ADDITIONAL_LIBS ${ZSTD_LIBRARY})
- CMAKE_PUSH_CHECK_STATE()
- SET(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY})
- SET(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR})
- CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD)
- #
- # TODO: test for static library.
- #
- CMAKE_POP_CHECK_STATE()
+ LIST(APPEND ADDITIONAL_LIBS libzstd)
+ SET(CMAKE_REQUIRED_LIBRARIES libzstd)
ENDIF(ZSTD_FOUND)
MARK_AS_ADVANCED(CLEAR ZSTD_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR ZSTD_LIBRARY)
@@ -773,11 +742,11 @@ ENDIF(ENABLE_NETTLE)
# (Except on Mac, where OpenSSL is deprecated.)
#
IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
- FIND_PACKAGE(OpenSSL)
- IF(OPENSSL_FOUND)
+ FIND_PACKAGE(OpenSSL REQUIRED)
+ IF(OpenSSL_FOUND)
SET(HAVE_LIBCRYPTO 1)
- INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
- LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
+ LIST(APPEND ADDITIONAL_LIBS OpenSSL::Crypto)
+ message("OPENSSL_CRYPTO_LIBRARY: OpenSSL::Crypto")
ENDIF(OPENSSL_FOUND)
ELSE()
SET(OPENSSL_FOUND FALSE) # Override cached value
@@ -896,7 +865,6 @@ main(int argc, char **argv)
IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES})
- LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS)
ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION})
ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM})
@@ -1128,7 +1096,7 @@ ENDIF(ENABLE_ICONV)
# Find Libxml2
#
IF(ENABLE_LIBXML2)
- FIND_PACKAGE(LibXml2)
+ FIND_PACKAGE(LibXml2 REQUIRED)
ELSE()
SET(LIBXML2_FOUND FALSE)
ENDIF()
@@ -1432,8 +1400,7 @@ CHECK_C_SOURCE_COMPILES(
MAJOR_IN_SYSMACROS)

CMAKE_PUSH_CHECK_STATE()
-SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR})
-SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES})
+SET(CMAKE_REQUIRED_LIBRARIES LibLZMA::LibLZMA)
IF(ENABLE_LZMA)
CHECK_C_SOURCE_COMPILES(
"#include <lzma.h>\n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2634da..8608efc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -914,7 +914,7 @@ main(int argc, char **argv)
IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES})
- LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS)
+ #LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS)
ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION})
ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM})
16 changes: 16 additions & 0 deletions ports/libarchive/fix-lz4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2634da..3b6da5d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -574,7 +574,10 @@ IF(ENABLE_LZ4)
ENDIF (LZ4_INCLUDE_DIR)

FIND_PATH(LZ4_INCLUDE_DIR lz4.h)
- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4)
+ FIND_LIBRARY(LZ4_LIBRARY_DEBUG NAMES lz4d liblz4d)
+ FIND_LIBRARY(LZ4_LIBRARY_RELEASE NAMES lz4 liblz4)
+ INCLUDE(SelectLibraryConfigurations)
+ SELECT_LIBRARY_CONFIGURATIONS(LZ4)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR)
ELSE(ENABLE_LZ4)
16 changes: 16 additions & 0 deletions ports/libarchive/fix-zstd.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2634da..e43b041 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -605,7 +605,10 @@ IF(ENABLE_ZSTD)
ENDIF (ZSTD_INCLUDE_DIR)

FIND_PATH(ZSTD_INCLUDE_DIR zstd.h)
- FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd)
+ FIND_LIBRARY(ZSTD_LIBRARY_DEBUG NAMES zstdd libzstdd)
+ FIND_LIBRARY(ZSTD_LIBRARY_RELEASE NAMES zstd libzstd)
+ INCLUDE(SelectLibraryConfigurations)
+ SELECT_LIBRARY_CONFIGURATIONS(ZSTD)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
ELSE(ENABLE_ZSTD)
2 changes: 2 additions & 0 deletions ports/libarchive/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ vcpkg_from_github(
PATCHES
fix-buildsystem.patch
fix-dependencies.patch
fix-lz4.patch
fix-zstd.patch
fix-cpu-set.patch
disable-warnings.patch
)
Expand Down