diff options
| author | Kai Pastor <dg0yt@darc.de> | 2021-06-10 00:17:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-09 15:17:07 -0700 |
| commit | c867e68ca880feb5fd01f65c39657b64084b2c2a (patch) | |
| tree | ae2d4ce2d04207b883c92bc82a24f8837e9cf308 /ports/szip | |
| parent | 58ce192f0fdd6721d89e248713d44fade6d38768 (diff) | |
| download | vcpkg-c867e68ca880feb5fd01f65c39657b64084b2c2a.tar.gz vcpkg-c867e68ca880feb5fd01f65c39657b64084b2c2a.zip | |
[szip, hdf5] Fix mingw import lib names, control linkage (#17941)
* Format manifest, make port version explicit
* Use standard mingw import lib names
* Choose either static or shared binaries
* Insert macro for dynamic linkage
* Add szip pc file
* Quote path expressions
* Port away from deprecated cmake functions
* x-add-version
* Begin of hdf5 changes
* Remove obsolete variables (complements 23eadeae)
* Fix indentation and quoting expressions
* Handle single-linkage szip configuration
* Use mingw import lib names for hdf5
* Move dependencies to Requires in pc file
* Port away from deprecated cmake functions
* x-add-version hdf5
* Apply szip review comments
* Update version
* Improve pkgconfig patch to handle lists
* Update git-tree
Diffstat (limited to 'ports/szip')
| -rw-r--r-- | ports/szip/CONTROL | 4 | ||||
| -rw-r--r-- | ports/szip/fix-linkage-config.patch | 47 | ||||
| -rw-r--r-- | ports/szip/fix-szip-config-to-set-szip-found.patch | 11 | ||||
| -rw-r--r-- | ports/szip/mingw-lib-names.patch | 30 | ||||
| -rw-r--r-- | ports/szip/portfile.cmake | 62 | ||||
| -rw-r--r-- | ports/szip/szip.pc.in | 16 | ||||
| -rw-r--r-- | ports/szip/vcpkg.json | 17 |
7 files changed, 160 insertions, 27 deletions
diff --git a/ports/szip/CONTROL b/ports/szip/CONTROL deleted file mode 100644 index 54ebf9b7b..000000000 --- a/ports/szip/CONTROL +++ /dev/null @@ -1,4 +0,0 @@ -Source: szip -Version: 2.1.1-6 -Homepage: https://support.hdfgroup.org/ftp/lib-external/szip -Description: Szip compression software, providing lossless compression of scientific data diff --git a/ports/szip/fix-linkage-config.patch b/ports/szip/fix-linkage-config.patch new file mode 100644 index 000000000..6d862e418 --- /dev/null +++ b/ports/szip/fix-linkage-config.patch @@ -0,0 +1,47 @@ +diff -urN a/config/cmake/szip-config.cmake.in b/config/cmake/szip-config.cmake.in +--- a/config/cmake/szip-config.cmake.in 2017-01-09 16:14:35.000000000 +0100 ++++ b/config/cmake/szip-config.cmake.in 2021-05-14 21:26:09.490134839 +0200 +@@ -39,8 +39,13 @@ + + # Handle default component(static) : + if (NOT ${SZIP_PACKAGE_NAME}_FIND_COMPONENTS) ++ if(@BUILD_SHARED_LIBS@) ++ set (${SZIP_PACKAGE_NAME}_FIND_COMPONENTS shared) ++ set (${SZIP_PACKAGE_NAME}_FIND_REQUIRED_shared true) ++ else() + set (${SZIP_PACKAGE_NAME}_FIND_COMPONENTS static) + set (${SZIP_PACKAGE_NAME}_FIND_REQUIRED_static true) ++ endif() + endif () + + # Handle requested components: +diff -urN a/src/CMakeLists.txt b/src/CMakeLists.txt +--- a/src/CMakeLists.txt 2017-02-03 20:42:43.000000000 +0100 ++++ b/src/CMakeLists.txt 2021-05-14 22:20:28.237632925 +0200 +@@ -22,6 +22,7 @@ + ${SZIP_SRC_SOURCE_DIR}/szlib.h + ) + ++if(NOT BUILD_SHARED_LIBS) + add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) + #set_target_properties (${SZIP_LIB_TARGET} + # PROPERTIES +@@ -36,6 +37,7 @@ + set_global_variable (SZIP_LIBRARIES_TO_EXPORT ${SZIP_LIB_TARGET}) + SZIP_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC) + set (install_targets ${SZIP_LIB_TARGET}) ++endif(NOT BUILD_SHARED_LIBS) + + if (BUILD_SHARED_LIBS) + add_library (${SZIP_LIBSH_TARGET} SHARED ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS}) +@@ -62,8 +64,9 @@ + if (SZIP_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) + INSTALL_TARGET_PDB (${SZIP_LIBSH_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries) +- endif (BUILD_SHARED_LIBS) ++ else() + INSTALL_TARGET_PDB (${SZIP_LIB_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries) ++ endif() + + install ( + TARGETS diff --git a/ports/szip/fix-szip-config-to-set-szip-found.patch b/ports/szip/fix-szip-config-to-set-szip-found.patch deleted file mode 100644 index f662916f9..000000000 --- a/ports/szip/fix-szip-config-to-set-szip-found.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -urN szip-2.1.1-a/config/cmake/szip-config.cmake.in szip-2.1.1-b/config/cmake/szip-config.cmake.in ---- szip-2.1.1-a/config/cmake/szip-config.cmake.in 2018-02-10 11:06:46.890685077 +0900 -+++ szip-2.1.1-b/config/cmake/szip-config.cmake.in 2018-02-10 11:11:25.369274127 +0900 -@@ -51,6 +51,7 @@ - set (${SZIP_PACKAGE_NAME}_${comp}_FOUND 0) - else () - set (${SZIP_PACKAGE_NAME}_${comp}_FOUND 1) -+ set (${SZIP_PACKAGE_NAME}_FOUND 1) - string(TOUPPER ${SZIP_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) - set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @SZIP_LIB_CORENAME@-${comp}) - endif () diff --git a/ports/szip/mingw-lib-names.patch b/ports/szip/mingw-lib-names.patch new file mode 100644 index 000000000..c9d2c249f --- /dev/null +++ b/ports/szip/mingw-lib-names.patch @@ -0,0 +1,30 @@ +diff -urN a/config/cmake/SZIPMacros.cmake b/config/cmake/SZIPMacros.cmake +--- a/config/cmake/SZIPMacros.cmake 2021-05-15 09:06:50.546455249 +0200 ++++ b/config/cmake/SZIPMacros.cmake 2021-05-15 09:01:24.933765423 +0200 +@@ -126,7 +126,7 @@ + macro (SZIP_SET_BASE_OPTIONS libtarget libname libtype) + # message (STATUS "${libname} libtype: ${libtype}") + if (${libtype} MATCHES "SHARED") +- if (WIN32) ++ if (WIN32 AND NOT MINGW) + set (LIB_RELEASE_NAME "${libname}") + set (LIB_DEBUG_NAME "${libname}_D") + else () +@@ -134,7 +134,7 @@ + set (LIB_DEBUG_NAME "${libname}_debug") + endif () + else () +- if (WIN32) ++ if (WIN32 AND NOT MINGW) + set (LIB_RELEASE_NAME "lib${libname}") + set (LIB_DEBUG_NAME "lib${libname}_D") + else () +@@ -164,7 +164,7 @@ + endif () + + #----- Use MSVC Naming conventions for Shared Libraries +- if (MINGW AND ${libtype} MATCHES "SHARED") ++ if (FALSE AND MINGW AND ${libtype} MATCHES "SHARED") + set_target_properties (${libtarget} + PROPERTIES + IMPORT_SUFFIX ".lib" diff --git a/ports/szip/portfile.cmake b/ports/szip/portfile.cmake index f62e72bd7..038736e7a 100644 --- a/ports/szip/portfile.cmake +++ b/ports/szip/portfile.cmake @@ -1,30 +1,68 @@ +set(SZIP_VERSION "2.1.1") vcpkg_download_distfile(ARCHIVE - URLS "https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz" - FILENAME "szip-2.1.1.tar.gz" + URLS "https://support.hdfgroup.org/ftp/lib-external/szip/${SZIP_VERSION}/src/szip-${SZIP_VERSION}.tar.gz" + FILENAME "szip-${SZIP_VERSION}.tar.gz" SHA512 ada6406efb096cd8a2daf8f9217fe9111a96dcae87e29d1c31f58ddd2ad2aa7bac03f23c7205dc9360f3b62d259461759330c7189ef0c2fe559704b1ea9d40dd ) vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} - REF szip-2.1.1 + ARCHIVE "${ARCHIVE}" + REF szip-${SZIP_VERSION} PATCHES - fix-szip-config-to-set-szip-found.patch # This patch is required for linux on osx; It does not matter for windows + fix-linkage-config.patch + mingw-lib-names.patch ) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" PREFER_NINJA OPTIONS -DSZIP_INSTALL_DATA_DIR=share/szip/data -DSZIP_INSTALL_CMAKE_DIR=share/szip ) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() -vcpkg_fixup_cmake_targets() +vcpkg_cmake_config_fixup() -file(RENAME ${CURRENT_PACKAGES_DIR}/share/szip/data/COPYING ${CURRENT_PACKAGES_DIR}/share/szip/copyright) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/szip_adpt.h" + "\n#ifdef SZ_BUILT_AS_DYNAMIC_LIB" + "\n#if 1 // SZ_BUILT_AS_DYNAMIC_LIB") +endif() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW) + set(SZIP_LIB_RELEASE "-lszip") + set(SZIP_LIB_DEBUG "-lszip_debug") + set(SZIP_LIBS_PRIVATE "-lm") +elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(SZIP_LIB_RELEASE "-llibszip") + set(SZIP_LIB_DEBUG "-llibszip_D") + set(SZIP_LIBS_PRIVATE "") +else() + set(SZIP_LIB_RELEASE "-lszip") + set(SZIP_LIB_DEBUG "-lszip_D") + set(SZIP_LIBS_PRIVATE "") +endif() +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(SZIP_LINKAGE_FLAGS "-DSZ_BUILT_AS_DYNAMIC_LIB=1") +else() + set(SZIP_LINKAGE_FLAGS "") +endif() +if(EXISTS "${CURRENT_PACKAGES_DIR}/lib") + set(SZIP_LIB "${SZIP_LIB_RELEASE}") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") + configure_file("${CMAKE_CURRENT_LIST_DIR}/szip.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/szip.pc" @ONLY) +endif() +if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib") + set(SZIP_LIB "${SZIP_LIB_DEBUG}") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") + configure_file("${CMAKE_CURRENT_LIST_DIR}/szip.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/szip.pc" @ONLY) +endif() +vcpkg_fixup_pkgconfig() + +file(RENAME "${CURRENT_PACKAGES_DIR}/share/szip/data/COPYING" "${CURRENT_PACKAGES_DIR}/share/szip/copyright") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/ports/szip/szip.pc.in b/ports/szip/szip.pc.in new file mode 100644 index 000000000..b89c9a1dd --- /dev/null +++ b/ports/szip/szip.pc.in @@ -0,0 +1,16 @@ +prefix=${pcfiledir}/../.. + +exec_prefix=${prefix} +libdir=${prefix}/lib +sharedlibdir=${prefix}/lib +includedir=${prefix}/include + +Name: szip +Description: Szip compression software +Version: @SZIP_VERSION@ + +Requires: +Cflags: -I"${includedir}" @SZIP_LINKAGE_FLAGS@ +Libs: -L"${libdir}" @SZIP_LIB@ +Libs.private: @SZIP_LIBS_PRIVATE@ + diff --git a/ports/szip/vcpkg.json b/ports/szip/vcpkg.json new file mode 100644 index 000000000..7c83b1a15 --- /dev/null +++ b/ports/szip/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "szip", + "version": "2.1.1", + "port-version": 7, + "description": "Szip compression software, providing lossless compression of scientific data", + "homepage": "https://support.hdfgroup.org/ftp/lib-external/szip", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |
