From 5ba45ffd9bb450da020e3694f38c78387d5270ec Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 24 Mar 2018 13:26:48 -0700 Subject: [PATCH] [shapelib] Add option to disable tests --- ports/shapelib/CONTROL | 2 +- ports/shapelib/option-build-test.patch | 13 +++++++++++++ ports/shapelib/portfile.cmake | 25 ++++++++++++++++++------- 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 ports/shapelib/option-build-test.patch diff --git a/ports/shapelib/CONTROL b/ports/shapelib/CONTROL index 7d37eb8aaf..57fbecb53f 100644 --- a/ports/shapelib/CONTROL +++ b/ports/shapelib/CONTROL @@ -1,3 +1,3 @@ Source: shapelib -Version: 1.4.1 +Version: 1.4.1-1 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 new file mode 100644 index 0000000000..c91410f386 --- /dev/null +++ b/ports/shapelib/option-build-test.patch @@ -0,0 +1,13 @@ +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 0f27876893..eed76736f0 100644 --- a/ports/shapelib/portfile.cmake +++ b/ports/shapelib/portfile.cmake @@ -11,10 +11,17 @@ vcpkg_download_distfile(ARCHIVE ) vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/option-build-test.patch +) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS -DBUILD_TEST=OFF) + OPTIONS + -DBUILD_TEST=OFF +) vcpkg_install_cmake() @@ -22,15 +29,19 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(GLOB EXES "${CURRENT_PACKAGES_DIR}/bin/*.exe") -file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/shapelib) -file(REMOVE ${EXES}) +if(EXES) + file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/shapelib) + file(REMOVE ${EXES}) +endif() file(GLOB DEBUG_EXES "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe") -file(REMOVE ${DEBUG_EXES}) +if(DEBUG_EXES) + file(REMOVE ${DEBUG_EXES}) +endif() -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) endif() file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/shapelib)