[zziplib] Uses upstream CMakeLists.txt (#15215)

This commit is contained in:
Long Nguyen 2020-12-24 08:12:03 +07:00 committed by GitHub
parent a8ac047e6c
commit 6654632423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 112 additions and 102 deletions

View File

@ -1,89 +0,0 @@
cmake_minimum_required(VERSION 3.0)
include(GNUInstallDirs)
project(zziplib C)
find_package(zlib)
include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
endif()
if(UNIX)
# Find autotools output
set(ZZLIB_AUTOOLS_INCLUDE_DIRS)
file(GLOB CHILDREN RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/*")
foreach(CHILD ${CHILDREN})
string(REGEX MATCH "x86_64*" ZZLIB_AUTOOLS_OUTPUT_FOLDER "${CHILD}")
if (ZZLIB_AUTOOLS_OUTPUT_FOLDER)
set(ZZLIB_AUTOOLS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${CHILD})
include_directories(${ZZLIB_AUTOOLS_INCLUDE_DIRS})
include_directories(${ZZLIB_AUTOOLS_INCLUDE_DIRS}/zzip)
endif()
endforeach()
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/config.h.in" "${CMAKE_CURRENT_LIST_DIR}/zzip/config.h")
# List the header files
set(HEADERS zzip/__debug.h
zzip/__dirent.h
zzip/__fnmatch.h
zzip/__hints.h
zzip/__mmap.h
zzip/config.h
zzip/_msvc.h
zzip/autoconf.h
zzip/conf.h
zzip/fetch.h
zzip/file.h
zzip/format.h
zzip/fseeko.h
zzip/info.h
zzip/lib.h
zzip/memdisk.h
zzip/mmapped.h
zzip/plugin.h
zzip/stdint.h
zzip/types.h
zzip/write.h
zzip/zzip.h
)
if(UNIX)
file(GLOB OTHER_HEADERS ${ZZLIB_AUTOOLS_INCLUDE_DIRS}/zzip/*.h)
list(APPEND HEADERS ${OTHER_HEADERS})
else()
list(APPEND HEADERS zzip/_msvc.h)
endif()
# List the source files
set(SRCS zzip/dir.c
zzip/err.c
zzip/fetch.c
zzip/file.c
zzip/info.c
zzip/plugin.c
zzip/stat.c
zzip/zip.c
)
add_library(zziplib ${SRCS} ${HEADERS})
if(BUILD_SHARED_LIBS)
target_compile_definitions(zziplib PRIVATE -DZZIPLIB_EXPORTS)
endif()
target_link_libraries(zziplib ${ZLIB_LIBRARIES})
install(TARGETS zziplib
COMPONENT runtime
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib)
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip)

View File

@ -1,5 +1,6 @@
Source: zziplib
Version: 0.13.71
Port-Version: 1
Build-Depends: zlib
Homepage: https://github.com/gdraheim/zziplib
Description: library providing read access on ZIP-archives

View File

@ -0,0 +1,13 @@
diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
index 52555d4..de06eae 100644
--- a/zzip/CMakeLists.txt
+++ b/zzip/CMakeLists.txt
@@ -27,7 +27,7 @@ set(ZZIP_VERSION "${PROJECT_VERSION}")
set(ZZIP_PACKAGE_NAME "${PROJECT_NAME}lib")
set(ZZIP_PACKAGE_VERSION "${PROJECT_VERSION}")
-if(ZZIPCOMPAT)
+if(UNIX)
find_package ( UnixCommands REQUIRED ) # bash cp mv rm gzip tar
endif()

View File

@ -0,0 +1,13 @@
diff --git a/zzip/conf.h b/zzip/conf.h
index 27b834a..7f01456 100644
--- a/zzip/conf.h
+++ b/zzip/conf.h
@@ -203,7 +203,7 @@
# endif
-#if defined ZZIP_EXPORTS || defined ZZIPLIB_EXPORTS
+#if defined ZZIP_EXPORTS || defined ZZIPLIB_EXPORTS || defined libzzip_EXPORTS // CMake export defines
# undef ZZIP_DLL
#define ZZIP_DLL 1
#endif

View File

@ -0,0 +1,27 @@
diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
index a9f6e3a..f3a758b 100644
--- a/zzip/CMakeLists.txt
+++ b/zzip/CMakeLists.txt
@@ -247,12 +247,14 @@ endif()
install(FILES ${libzzip_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip )
install(TARGETS libzzip
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(ZZIPFSEEKO)
install(FILES ${libzzipfseeko_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip )
install(TARGETS libzzipfseeko
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
@@ -260,6 +262,7 @@ endif()
if(ZZIPMMAPPED)
install(FILES ${libzzipmmapped_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip )
install(TARGETS libzzipmmapped
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -0,0 +1,24 @@
diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
index a9f6e3a..407827b 100644
--- a/zzip/CMakeLists.txt
+++ b/zzip/CMakeLists.txt
@@ -180,16 +180,16 @@ target_link_libraries(libzzipmmapped ZLIB::ZLIB )
target_include_directories (libzzipmmapped PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
endif()
-set_target_properties(libzzip PROPERTIES OUTPUT_NAME "zzip" RELEASE_POSTFIX "-${RELNUM}")
+set_target_properties(libzzip PROPERTIES OUTPUT_NAME "zzip")
SET_TARGET_PROPERTIES(libzzip PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM})
if(ZZIPFSEEKO)
-set_target_properties(libzzipfseeko PROPERTIES OUTPUT_NAME "zzipfseeko" RELEASE_POSTFIX "-${RELNUM}")
+set_target_properties(libzzipfseeko PROPERTIES OUTPUT_NAME "zzipfseeko")
SET_TARGET_PROPERTIES(libzzipfseeko PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM})
endif()
if(ZZIPMMAPPED)
-set_target_properties(libzzipmmapped PROPERTIES OUTPUT_NAME "zzipmmapped" RELEASE_POSTFIX "-${RELNUM}")
+set_target_properties(libzzipmmapped PROPERTIES OUTPUT_NAME "zzipmmapped")
SET_TARGET_PROPERTIES(libzzipmmapped PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM})
endif()

View File

@ -3,25 +3,47 @@ vcpkg_from_github(
REPO gdraheim/zziplib
REF 24a6c6de1956189bffcd8dffd2ef3197c6f3df29 # v0.13.71
SHA512 246ee1d93f3f8a6889e9ab362e04e6814813844f2cdea0a782910bf07ca55ecd6d8b1c456b4180935464cebf291e7849af27ac0ed5cc080de5fb158f9f3aeffb
PATCHES
install-dll-to-proper-folder.patch
no-release-postfix.patch
fix-export-define.patch
always-find-unixcommands-on-unix.patch
)
# Run configure
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
message(STATUS "Configuring zziplib")
vcpkg_execute_required_process(
COMMAND "./configure" --prefix=${CURRENT_INSTALLED_DIR} --with-zlib
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "autotools-config-${TARGET_TRIPLET}"
)
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(MSVC_STATIC_RUNTIME ON)
else()
set(MSVC_STATIC_RUNTIME OFF)
endif()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(BUILD_STATIC_LIBS ON)
else()
set(BUILD_STATIC_LIBS OFF)
endif()
if(VCPKG_TARGET_IS_WINDOWS)
set(ZZIPLIBTOOL OFF)
endif()
set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS")
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
OPTIONS -DZLIB_INCLUDE_DIRS=${CURRENT_INSTALLED_DIR}/include
OPTIONS
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DMSVC_STATIC_RUNTIME=${MSVC_STATIC_RUNTIME}
-DZZIPMMAPPED=OFF
-DZZIPFSEEKO=OFF
-DZZIPWRAP=OFF
-DZZIPSDL=OFF
-DZZIPBINS=OFF
-DZZIPTEST=OFF
-DZZIPDOCS=OFF
-DZZIPCOMPAT=OFF
-DZZIPLIBTOOL=${ZZIPLIBTOOL}
)
vcpkg_install_cmake()
@ -29,5 +51,4 @@ vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/zziplib)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/zziplib/COPYING.LIB ${CURRENT_PACKAGES_DIR}/share/zziplib/copyright)
file(INSTALL ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)