diff options
| author | Kai Pastor <dg0yt@darc.de> | 2021-06-29 02:58:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-28 17:58:35 -0700 |
| commit | e2d10224003824e48356b1d80055a6b4c1ffbf87 (patch) | |
| tree | 825d63cf7059c7ac0f553ecfe45bb342cece2fb5 | |
| parent | 6cdc26c884ac1c7c4cf2d480b364b773765622a3 (diff) | |
| download | vcpkg-e2d10224003824e48356b1d80055a6b4c1ffbf87.tar.gz vcpkg-e2d10224003824e48356b1d80055a6b4c1ffbf87.zip | |
[netcdf-c] Fix pc files; use features (#18120)
* Format manifest
* New port-version
* Quote filepath expressions
* Port to vcpkg-cmake ports
* Remove invalid nc-config file
* Fix pc files
* Use features
* Add feature 'tools'
* x-add-version
* Fix build with msys2 mingw
* Update git-tree
| -rw-r--r-- | ports/netcdf-c/CONTROL | 6 | ||||
| -rw-r--r-- | ports/netcdf-c/config-pkg-location.patch | 15 | ||||
| -rw-r--r-- | ports/netcdf-c/fix-dependency-zlib.patch | 13 | ||||
| -rw-r--r-- | ports/netcdf-c/fix-manpage-msys.patch | 13 | ||||
| -rw-r--r-- | ports/netcdf-c/fix-pkgconfig.patch | 37 | ||||
| -rw-r--r-- | ports/netcdf-c/portfile.cmake | 45 | ||||
| -rw-r--r-- | ports/netcdf-c/vcpkg.json | 43 | ||||
| -rw-r--r-- | versions/baseline.json | 2 | ||||
| -rw-r--r-- | versions/n-/netcdf-c.json | 5 |
9 files changed, 143 insertions, 36 deletions
diff --git a/ports/netcdf-c/CONTROL b/ports/netcdf-c/CONTROL deleted file mode 100644 index f770d3020..000000000 --- a/ports/netcdf-c/CONTROL +++ /dev/null @@ -1,6 +0,0 @@ -Source: netcdf-c -Version: 4.7.4 -Port-Version: 2 -Build-Depends: hdf5, curl -Homepage: https://github.com/Unidata/netcdf-c -Description: a set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. diff --git a/ports/netcdf-c/config-pkg-location.patch b/ports/netcdf-c/config-pkg-location.patch deleted file mode 100644 index 13f0aeaa6..000000000 --- a/ports/netcdf-c/config-pkg-location.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index bd7c4f8..e4e92c6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2050,7 +2050,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ncdap_test/pingurl.c ${CMAKE_CURRENT_ - # Create CMake package configuration files. With these, other packages using - # cmake should be able to find netcdf using find_package and find_library. - # The EXPORT call is paired with one in liblib. --set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/netCDF) -+if(NOT DEFINED ConfigPackageLocation) -+ set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/netCDF) -+endif(NOT DEFINED ConfigPackageLocation) - - install(EXPORT netCDFTargets - DESTINATION ${ConfigPackageLocation} diff --git a/ports/netcdf-c/fix-dependency-zlib.patch b/ports/netcdf-c/fix-dependency-zlib.patch new file mode 100644 index 000000000..52c5d2ecd --- /dev/null +++ b/ports/netcdf-c/fix-dependency-zlib.patch @@ -0,0 +1,13 @@ +diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt +index 5b578f7..0731460 100644 +--- a/liblib/CMakeLists.txt ++++ b/liblib/CMakeLists.txt +@@ -58,7 +58,7 @@ ENDIF() + + SET(TLL_LIBS "") + +-SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM} ZLIB::ZLIB) ++SET(TLL_LIBS ${TLL_LIBS} ${HAVE_LIBM}) + + # Add extra dependencies specified via NC_EXTRA_DEPS + SET(TLL_LIBS ${TLL_LIBS} ${EXTRA_DEPS}) diff --git a/ports/netcdf-c/fix-manpage-msys.patch b/ports/netcdf-c/fix-manpage-msys.patch new file mode 100644 index 000000000..24374c95e --- /dev/null +++ b/ports/netcdf-c/fix-manpage-msys.patch @@ -0,0 +1,13 @@ +diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt +index 65a3f87..30a008d 100644 +--- a/libsrc/CMakeLists.txt ++++ b/libsrc/CMakeLists.txt +@@ -61,7 +61,7 @@ IF(HAVE_M4) + IF(NOT MSVC) + ADD_CUSTOM_TARGET(manpage ALL + +- COMMAND ${NC_M4} ${ARGS_MANPAGE} '${CMAKE_CURRENT_BINARY_DIR}/netcdf.m4' > '${CMAKE_CURRENT_BINARY_DIR}/netcdf.3' ++ COMMAND ${NC_M4} ${ARGS_MANPAGE} "${CMAKE_CURRENT_BINARY_DIR}/netcdf.m4" > "${CMAKE_CURRENT_BINARY_DIR}/netcdf.3" VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + diff --git a/ports/netcdf-c/fix-pkgconfig.patch b/ports/netcdf-c/fix-pkgconfig.patch new file mode 100644 index 000000000..f7827d6cb --- /dev/null +++ b/ports/netcdf-c/fix-pkgconfig.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 57d2d4b..3de6f8c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1892,6 +1892,20 @@ LIST(REMOVE_DUPLICATES LINKFLAGS) + SET(LIBS ${NC_LIBS}) + SET(NC_LIBS "-lnetcdf") + ++set(NC_LIBS_PRIVATE " ${LIBS} ") ++set(NC_REQUIRES_PRIVATE "") ++macro(replace_pkgconfig_module PATTERN MODULE) ++ if(NC_LIBS_PRIVATE MATCHES " ${PATTERN} ") ++ string(REPLACE "${CMAKE_MATCH_0}" " " NC_LIBS_PRIVATE "${NC_LIBS_PRIVATE}") ++ string(APPEND NC_REQUIRES_PRIVATE " ${MODULE}") ++ endif() ++endmacro() ++replace_pkgconfig_module("-lhdf5_hl" "hdf5_hl") ++replace_pkgconfig_module("-lhdf5" "hdf5") ++replace_pkgconfig_module("-lmpi" "ompi-c") ++replace_pkgconfig_module("-lCURL[^ ]*" "libcurl") ++replace_pkgconfig_module("-lZLIB[^ ]*" "zlib") ++ + configure_file( + ${netCDF_SOURCE_DIR}/netcdf.pc.in + ${netCDF_BINARY_DIR}/netcdf.pc @ONLY) +diff --git a/netcdf.pc.in b/netcdf.pc.in +index 22b5594..a48b7c2 100644 +--- a/netcdf.pc.in ++++ b/netcdf.pc.in +@@ -9,5 +9,6 @@ Description: NetCDF Client Library for C + URL: http://www.unidata.ucar.edu/netcdf + Version: @PACKAGE_VERSION@ + Libs: -L${libdir} @NC_LIBS@ +-Libs.private: @LIBS@ ++Libs.private: @NC_LIBS_PRIVATE@ + Cflags: -I${includedir} ++Requires.private: @NC_REQUIRES_PRIVATE@ diff --git a/ports/netcdf-c/portfile.cmake b/ports/netcdf-c/portfile.cmake index 23e20f462..468237d2c 100644 --- a/ports/netcdf-c/portfile.cmake +++ b/ports/netcdf-c/portfile.cmake @@ -6,10 +6,12 @@ vcpkg_from_github( HEAD_REF master PATCHES no-install-deps.patch - config-pkg-location.patch use_targets.patch fix-dependency-libmath.patch fix-linkage-error.patch + fix-pkgconfig.patch + fix-dependency-zlib.patch + fix-manpage-msys.patch ) #Remove outdated find modules @@ -23,31 +25,46 @@ else() set(NC_USE_STATIC_CRT OFF) endif() -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + dap ENABLE_DAP + netcdf-4 ENABLE_NETCDF_4 + netcdf-4 USE_HDF5 + tools BUILD_UTILITIES + INVERTED_FEATURES + dap CMAKE_DISABLE_FIND_PACKAGE_CURL + netcdf-4 CMAKE_DISABLE_FIND_PACKAGE_HDF5 +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" DISABLE_PARALLEL_CONFIGURE # netcdf-c configures in the source! - PREFER_NINJA OPTIONS - -DBUILD_UTILITIES=OFF -DBUILD_TESTING=OFF -DENABLE_EXAMPLES=OFF -DENABLE_TESTS=OFF -DENABLE_FILTER_TESTING=OFF - -DUSE_HDF5=ON -DENABLE_DAP_REMOTE_TESTS=OFF -DDISABLE_INSTALL_DEPENDENCIES=ON -DNC_USE_STATIC_CRT=${NC_USE_STATIC_CRT} - -DConfigPackageLocation=share/netcdf + ${FEATURE_OPTIONS} ) -vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH share/netcdf TARGET_PATH share/netcdf) +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME "netcdf" CONFIG_PATH "lib/cmake/netCDF") +vcpkg_fixup_pkgconfig() -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/bin) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin/nc-config" "${CURRENT_PACKAGES_DIR}/bin/nc-config") # invalid +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools( + TOOL_NAMES nccopy ncdump ncgen ncgen3 + AUTO_CLEAN + ) +elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin") endif() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") -file(INSTALL ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
\ No newline at end of file +file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/netcdf-c/vcpkg.json b/ports/netcdf-c/vcpkg.json new file mode 100644 index 000000000..6e6523608 --- /dev/null +++ b/ports/netcdf-c/vcpkg.json @@ -0,0 +1,43 @@ +{ + "name": "netcdf-c", + "version-string": "4.7.4", + "port-version": 3, + "description": "A set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.", + "homepage": "https://github.com/Unidata/netcdf-c", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "dap", + "netcdf-4" + ], + "features": { + "dap": { + "description": "Build with DAP remote access client support", + "dependencies": [ + "curl" + ] + }, + "netcdf-4": { + "description": "Build with netCDF-4/HDF5 support", + "dependencies": [ + { + "name": "hdf5", + "features": [ + "zlib" + ] + } + ] + }, + "tools": { + "description": "Build utilities" + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index be3a64328..3fc871b86 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4290,7 +4290,7 @@ }, "netcdf-c": { "baseline": "4.7.4", - "port-version": 2 + "port-version": 3 }, "netcdf-cxx4": { "baseline": "4.3.1", diff --git a/versions/n-/netcdf-c.json b/versions/n-/netcdf-c.json index d30a4c2ad..75fcc46b1 100644 --- a/versions/n-/netcdf-c.json +++ b/versions/n-/netcdf-c.json @@ -1,6 +1,11 @@ { "versions": [ { + "git-tree": "069ccb40f8ce75d6ec88b8fe31966c11fcf6906b", + "version-string": "4.7.4", + "port-version": 3 + }, + { "git-tree": "aa42781f00db0c2de52798f0345801b667977c79", "version-string": "4.7.4", "port-version": 2 |
