aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Pastor <dg0yt@darc.de>2021-05-26 22:29:02 +0200
committerGitHub <noreply@github.com>2021-05-26 13:29:02 -0700
commitf0b32c558ac5782ab3544a4261ad78a61693047b (patch)
treeaf5467edc93f59be81db81d74f0d6484efa48dfd
parent5c847acb56e4ef228e036e7cd84fb71c84edd456 (diff)
downloadvcpkg-f0b32c558ac5782ab3544a4261ad78a61693047b.tar.gz
vcpkg-f0b32c558ac5782ab3544a4261ad78a61693047b.zip
[geos] Relocatable geos-config; dynamic builds on Unix (#17616)
* Provide geos-config, and fix dynamic builds on Unix * x-add-version * Fix debug suffix handling * Update git-tree * Don't build benchmarks * Revise pc file and geos-config handling Fixup pc files. Add -lgeos to Libs.private to satisfy common usage requirement (already present in geos-config). Install executable geos-config into tools. Rewrite geos-config relocatability as patch. * Port to non-deprecated cmake functions * Add usage * Update git-tree
-rw-r--r--ports/geos/CONTROL4
-rw-r--r--ports/geos/make-geos-config-relocatable.patch16
-rw-r--r--ports/geos/pc-file-libs-private.patch12
-rw-r--r--ports/geos/portfile.cmake45
-rw-r--r--ports/geos/usage10
-rw-r--r--ports/geos/vcpkg.json17
-rw-r--r--versions/baseline.json2
-rw-r--r--versions/g-/geos.json5
8 files changed, 92 insertions, 19 deletions
diff --git a/ports/geos/CONTROL b/ports/geos/CONTROL
deleted file mode 100644
index c3ed21e0f..000000000
--- a/ports/geos/CONTROL
+++ /dev/null
@@ -1,4 +0,0 @@
-Source: geos
-Version: 3.9.1
-Homepage: https://www.osgeo.org/projects/geos/
-Description: Geometry Engine Open Source
diff --git a/ports/geos/make-geos-config-relocatable.patch b/ports/geos/make-geos-config-relocatable.patch
new file mode 100644
index 000000000..f3d97b6c2
--- /dev/null
+++ b/ports/geos/make-geos-config-relocatable.patch
@@ -0,0 +1,16 @@
+diff --git a/tools/geos-config.cmake b/tools/geos-config.cmake
+index 6730e215..4c546b5c 100644
+--- a/tools/geos-config.cmake
++++ b/tools/geos-config.cmake
+@@ -1,7 +1,9 @@
+ #!/bin/sh
+
+-prefix=@ESCAPED_INSTALL_PREFIX@
+-libdir=${prefix}/lib
++DIRNAME=$(dirname $0)
++TOOLS=$(dirname $DIRNAME)
++prefix=$(CDPATH= cd -- "${DIRNAME%/tools/geos/*}" && pwd -P)
++libdir=${prefix}${TOOLS##*/geos}/lib
+
+ usage()
+ {
diff --git a/ports/geos/pc-file-libs-private.patch b/ports/geos/pc-file-libs-private.patch
new file mode 100644
index 000000000..51302aeb1
--- /dev/null
+++ b/ports/geos/pc-file-libs-private.patch
@@ -0,0 +1,12 @@
+diff --git a/tools/geos.pc.cmake b/tools/geos.pc.cmake
+index 0a9df7fb..53f43d90 100644
+--- a/tools/geos.pc.cmake
++++ b/tools/geos.pc.cmake
+@@ -9,3 +9,4 @@ Requires:
+ Version: @GEOS_VERSION@
+ Cflags: -I${includedir}
+ Libs: -L${libdir} -lgeos_c
++Libs.private: -lgeos
+--
+2.17.1
+
diff --git a/ports/geos/portfile.cmake b/ports/geos/portfile.cmake
index f5b9c21ac..a2793f94c 100644
--- a/ports/geos/portfile.cmake
+++ b/ports/geos/portfile.cmake
@@ -7,11 +7,13 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
- ARCHIVE ${ARCHIVE}
+ ARCHIVE "${ARCHIVE}"
REF ${GEOS_VERSION}
PATCHES
dont-build-docs.patch
dont-build-astyle.patch
+ pc-file-libs-private.patch
+ make-geos-config-relocatable.patch
)
# NOTE: GEOS provides CMake as optional build configuration, it might not be actively
@@ -23,30 +25,45 @@ else()
set(_CMAKE_EXTRA_OPTIONS "")
endif()
-vcpkg_configure_cmake(
- SOURCE_PATH ${SOURCE_PATH}
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
PREFER_NINJA
OPTIONS
-DCMAKE_DEBUG_POSTFIX=d
-DBUILD_TESTING=OFF
+ -DBUILD_BENCHMARKS=OFF
${_CMAKE_EXTRA_OPTIONS}
)
-vcpkg_install_cmake()
-vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/GEOS)
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/GEOS)
+vcpkg_fixup_pkgconfig()
-if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+function(geos_add_debug_postfix config_file)
+ file(READ "${config_file}" contents)
+ string(REGEX REPLACE "(-lgeos(_c)?)d?([^-_d])" "\\1d\\3" fixed_contents "${contents}")
+ file(WRITE "${config_file}" "${fixed_contents}")
+endfunction()
+if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/geos.pc")
+ geos_add_debug_postfix("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/geos.pc")
+endif()
+if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/geos-config")
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/bin/geos-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/geos-config")
+endif()
+if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/geos-config")
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bin/geos-config" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/geos-config")
+ geos_add_debug_postfix("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/geos-config")
endif()
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-
-if(EXISTS ${CURRENT_PACKAGES_DIR}/bin/geos-config)
- file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/geos)
- file(RENAME ${CURRENT_PACKAGES_DIR}/bin/geos-config ${CURRENT_PACKAGES_DIR}/share/geos/geos-config)
- file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/geos-config)
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") # vcpkg-cmake-config quirk, cf. GH-18063
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS)
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
# Handle copyright
-configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/geos/copyright COPYONLY)
+configure_file("${SOURCE_PATH}/COPYING" "${CURRENT_PACKAGES_DIR}/share/geos/copyright" COPYONLY)
vcpkg_copy_pdbs()
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
diff --git a/ports/geos/usage b/ports/geos/usage
new file mode 100644
index 000000000..139e40dd2
--- /dev/null
+++ b/ports/geos/usage
@@ -0,0 +1,10 @@
+The package geos provides CMake targets:
+
+ # C API (provides long-term ABI stability)
+ find_package(GEOS CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE GEOS::geos_c)
+
+ # C++ API (will likely change across versions)
+ find_package(GEOS CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE GEOS::geos)
+
diff --git a/ports/geos/vcpkg.json b/ports/geos/vcpkg.json
new file mode 100644
index 000000000..f22f38558
--- /dev/null
+++ b/ports/geos/vcpkg.json
@@ -0,0 +1,17 @@
+{
+ "name": "geos",
+ "version": "3.9.1",
+ "port-version": 1,
+ "description": "Geometry Engine Open Source",
+ "homepage": "https://www.osgeo.org/projects/geos/",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}
diff --git a/versions/baseline.json b/versions/baseline.json
index 5015a9d62..701edb7e7 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -2210,7 +2210,7 @@
},
"geos": {
"baseline": "3.9.1",
- "port-version": 0
+ "port-version": 1
},
"geotrans": {
"baseline": "3.8",
diff --git a/versions/g-/geos.json b/versions/g-/geos.json
index 09e59a000..84f1396ed 100644
--- a/versions/g-/geos.json
+++ b/versions/g-/geos.json
@@ -1,6 +1,11 @@
{
"versions": [
{
+ "git-tree": "19ac6640378da611cbee774dae84e8e2f18cfe82",
+ "version": "3.9.1",
+ "port-version": 1
+ },
+ {
"git-tree": "97c3e5f08174b7f7b4634064f4f2ae6da4351e97",
"version-string": "3.9.1",
"port-version": 0