From aa973d4a600dff5137eb0fa9daf3a4611b778afa Mon Sep 17 00:00:00 2001 From: Dirk Vanden Boer Date: Wed, 24 Apr 2024 14:54:01 +0200 Subject: [PATCH] [shapelib] 1.6.0 --- ports/shapelib/CONTROL | 3 - ports/shapelib/option-build-test.patch | 13 ---- ports/shapelib/portfile.cmake | 98 +++++++++++++++++--------- ports/shapelib/vcpkg.json | 23 ++++++ 4 files changed, 86 insertions(+), 51 deletions(-) delete mode 100644 ports/shapelib/CONTROL delete mode 100644 ports/shapelib/option-build-test.patch create mode 100644 ports/shapelib/vcpkg.json diff --git a/ports/shapelib/CONTROL b/ports/shapelib/CONTROL deleted file mode 100644 index ca76d3a5..00000000 --- a/ports/shapelib/CONTROL +++ /dev/null @@ -1,3 +0,0 @@ -Source: shapelib -Version: 1.5.0 -Description: Shapefile C Library is simple C API for reading and writing ESRI Shapefiles diff --git a/ports/shapelib/option-build-test.patch b/ports/shapelib/option-build-test.patch deleted file mode 100644 index fcad78db..00000000 --- a/ports/shapelib/option-build-test.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c3ef935..845ec06 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -148,7 +148,7 @@ set(executables - find_program(BASH_EXECUTABLE bash) - find_program(SED_EXECUTABLE sed) - if(BASH_EXECUTABLE AND SED_EXECUTABLE) -- set(BUILD_TEST ON) -+ option(BUILD_TEST "" ON) - else(BASH_EXECUTABLE AND SED_EXECUTABLE) - message(STATUS "WARNING: sed or bash not available so disabling testing") - endif(BASH_EXECUTABLE AND SED_EXECUTABLE) diff --git a/ports/shapelib/portfile.cmake b/ports/shapelib/portfile.cmake index 14c6d0f2..e2079840 100644 --- a/ports/shapelib/portfile.cmake +++ b/ports/shapelib/portfile.cmake @@ -1,50 +1,78 @@ - -set(SHAPELIB_VERSION 1.5.0) -set(SHAPELIB_HASH 230939afb33aee042808a32b38ee9dfc7ec1f39432e5a4ebe3fda99c2f87bfbebc91830d4e21691c51aae3f4bb65d7e71e7061472bb08124dcd3402c46800d6c) - vcpkg_download_distfile(ARCHIVE - URLS "http://download.osgeo.org/shapelib/shapelib-${SHAPELIB_VERSION}.zip" - FILENAME "shapelib-${SHAPELIB_VERSION}.zip" - SHA512 ${SHAPELIB_HASH} + URLS "http://download.osgeo.org/shapelib/shapelib-${VERSION}.zip" + "https://github.com/OSGeo/shapelib/releases/download/v${VERSION}/shapelib-${VERSION}.zip" + FILENAME "shapelib-${VERSION}.zip" + SHA512 f3f43f2028fe442e020558de2559b24eae9c7a1d0c84cc242f23ea985cf1fb5ff39fbfef7738f9b8ef5df9a5d0b9f3e891a61b3d5fbbe5b224f41a46589723a3 +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${ARCHIVE}" ) -vcpkg_extract_source_archive_ex( - OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} - PATCHES option-build-test.patch + +vcpkg_check_features(OUT_FEATURE_OPTIONS options + FEATURES + contrib BUILD_SHAPELIB_CONTRIB ) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -DBUILD_TEST=OFF - -DUSE_RPATH=OFF + ${options} + -DBUILD_TESTING=OFF ) -vcpkg_install_cmake() +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup() -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(GLOB EXES "${CURRENT_PACKAGES_DIR}/bin/*.exe") -if(EXES) - file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/shapelib) - file(REMOVE ${EXES}) +vcpkg_copy_tools( + TOOL_NAMES + dbfadd + dbfcreate + dbfdump + shpadd + shpcreate + shpdump + shprewind + shptreedump + AUTO_CLEAN +) +if(BUILD_SHAPELIB_CONTRIB) + vcpkg_copy_tools( + TOOL_NAMES + csv2shp + dbfcat + dbfinfo + Shape_PointInPoly + shpcat + shpcentrd + shpdata + shpdxf + shpfix + shpinfo + shpsort + shpwkb + AUTO_CLEAN + ) endif() -file(GLOB DEBUG_EXES "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe") -if(DEBUG_EXES) - file(REMOVE ${DEBUG_EXES}) -endif() +vcpkg_install_copyright( + FILE_LIST "${SOURCE_PATH}/LICENSE-LGPL" "${SOURCE_PATH}/LICENSE-MIT" + # Cf. web/license.html + COMMENT [[ +The core portions of the library are made available under two +possible licenses. The licensee can choose to use the code under +either the Library GNU Public License described in LICENSE-LGPL +or under the MIT license described in LICENSE-MIT. -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) -endif() +Some auxiliary portions of Shapelib, notably some of the components +in the contrib directory come under slightly different license restrictions. +Check the source files that you are actually using for conditions. +]]) -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/FindShapelib.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/cmake) - vcpkg_test_cmake(PACKAGE_NAME Shapelib MODULE REQUIRED_HEADER shapefil.h TARGETS Shapelib::Shapelib) -vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/shapelib) -vcpkg_copy_pdbs() diff --git a/ports/shapelib/vcpkg.json b/ports/shapelib/vcpkg.json new file mode 100644 index 00000000..99eaaff0 --- /dev/null +++ b/ports/shapelib/vcpkg.json @@ -0,0 +1,23 @@ +{ + "name": "shapelib", + "version": "1.6.0", + "description": "Shapefile C Library is simple C API for reading and writing ESRI Shapefiles", + "homepage": "https://download.osgeo.org/shapelib", + "license": "MIT OR LGPL-2.0-or-later", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "contrib": { + "description": "Build utilities (from contrib)", + "license": null + } + } +}