aboutsummaryrefslogtreecommitdiff
path: root/ports/netcdf-c/fix-pkgconfig.patch
diff options
context:
space:
mode:
authorKai Pastor <dg0yt@darc.de>2021-06-29 02:58:35 +0200
committerGitHub <noreply@github.com>2021-06-28 17:58:35 -0700
commite2d10224003824e48356b1d80055a6b4c1ffbf87 (patch)
tree825d63cf7059c7ac0f553ecfe45bb342cece2fb5 /ports/netcdf-c/fix-pkgconfig.patch
parent6cdc26c884ac1c7c4cf2d480b364b773765622a3 (diff)
downloadvcpkg-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
Diffstat (limited to 'ports/netcdf-c/fix-pkgconfig.patch')
-rw-r--r--ports/netcdf-c/fix-pkgconfig.patch37
1 files changed, 37 insertions, 0 deletions
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@