aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2019-05-08 05:50:54 +0800
committerVictor Romero <romerosanchezv@gmail.com>2019-05-07 14:50:54 -0700
commit6bbecf378821d3bc6d0c5be1548fa638a24dbb07 (patch)
treee4fe513ea0759372d0b563df1fd43919ffc0ee5a
parentf40b738108debddce5176d88c32db6a815863f4c (diff)
downloadvcpkg-6bbecf378821d3bc6d0c5be1548fa638a24dbb07.tar.gz
vcpkg-6bbecf378821d3bc6d0c5be1548fa638a24dbb07.zip
[uriparser] Update to 0.9.3, add tool feature (#6303)
* [uriparser] Update to 0.9.3 * [uriparser] Fix static build * [uriparser] Handle URI_STATIC_BUILD * [uriparser] Add support for --head option * [uriparser] Simplify * [uriparser] Use file COPY to USE_SOURCE_PERMISSIONS
-rw-r--r--ports/uriparser/CONTROL5
-rw-r--r--ports/uriparser/portfile.cmake62
2 files changed, 59 insertions, 8 deletions
diff --git a/ports/uriparser/CONTROL b/ports/uriparser/CONTROL
index b6a8cc5fe..a0e37aeba 100644
--- a/ports/uriparser/CONTROL
+++ b/ports/uriparser/CONTROL
@@ -1,3 +1,6 @@
Source: uriparser
-Version: 0.9.2-1
+Version: 0.9.3-4
Description: uriparser is a strictly RFC 3986 compliant URI parsing and handling library written in C89 ("ANSI C"). uriparser is cross-platform, fast, supports Unicode, and is licensed under the New BSD license.
+
+Feature: tool
+Description: Builds tools (e.g. CLI "uriparse")
diff --git a/ports/uriparser/portfile.cmake b/ports/uriparser/portfile.cmake
index b18492ff9..aafd0ae6a 100644
--- a/ports/uriparser/portfile.cmake
+++ b/ports/uriparser/portfile.cmake
@@ -3,25 +3,73 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO uriparser/uriparser
- REF uriparser-0.9.2
- SHA512 58c1c473b33a2a5ffa2b3eb02f527de0efea228d84e2189b764515c3b884b73f36bb8baf143b719cd43006ef23f116cd7b2368bf828fe3e5b839c674daf5ea3f
+ REF uriparser-0.9.3
+ SHA512 5740e2405566c17c4467a677d83596d86398b64778ad2b5234e9390d8ab817d1b5231988d120b1d19b099788e38814825a438beed991e49b242b8a5de8c51d03
+ HEAD_REF master
)
+if("tool" IN_LIST FEATURES)
+ set(URIPARSER_BUILD_TOOLS ON)
+else()
+ set(URIPARSER_BUILD_TOOLS OFF)
+endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
- OPTIONS
- -DURIPARSER_BUILD_DOCS=OFF
- -DURIPARSER_BUILD_TESTS=OFF
- -DURIPARSER_BUILD_TOOLS=OFF
+ OPTIONS
+ -DURIPARSER_BUILD_DOCS=OFF
+ -DURIPARSER_BUILD_TESTS=OFF
+ OPTIONS_DEBUG
+ -DURIPARSER_BUILD_TOOLS=OFF
+ OPTIONS_RELEASE
+ -DURIPARSER_BUILD_TOOLS=${URIPARSER_BUILD_TOOLS}
)
vcpkg_install_cmake()
-vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/uriparser-0.9.2")
+
vcpkg_copy_pdbs()
+if(URIPARSER_BUILD_TOOLS)
+ if(CMAKE_HOST_WIN32)
+ set(EXECUTABLE_SUFFIX ".exe")
+ else()
+ set(EXECUTABLE_SUFFIX "")
+ endif()
+
+ file(COPY ${CURRENT_PACKAGES_DIR}/bin/uriparse${EXECUTABLE_SUFFIX}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT})
+ vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
+
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
+ else()
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/uriparse${EXECUTABLE_SUFFIX})
+ endif()
+endif()
+
+set(_package_version_re "#define[ ]+PACKAGE_VERSION[ ]+\"([0-9]+.[0-9]+.[0-9]+)\"")
+file(STRINGS
+ "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config.h"
+ _package_version_define REGEX "${_package_version_re}"
+)
+string(REGEX REPLACE "${_package_version_re}" "\\1" _package_version ${_package_version_define})
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}-${_package_version})
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_replace_string(
+ ${CURRENT_PACKAGES_DIR}/include/uriparser/UriBase.h
+ "defined(URI_STATIC_BUILD)"
+ "1 // defined(URI_STATIC_BUILD)"
+ )
+endif()
+
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/uriparser RENAME copyright)
# Remove duplicate info
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME ${PORT})