From 47969b5f9d01c506fde3ab158c7e24cfddbb42f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rimas=20Misevi=C4=8Dius?= Date: Wed, 18 Sep 2024 23:35:55 +0300 Subject: [PATCH] [upa-url] new port (#40964) --- ports/upa-url/cxx-standard.patch | 32 ++++++++++++++++++++++++++++++ ports/upa-url/portfile.cmake | 34 ++++++++++++++++++++++++++++++++ ports/upa-url/vcpkg.json | 22 +++++++++++++++++++++ versions/baseline.json | 4 ++++ versions/u-/upa-url.json | 9 +++++++++ 5 files changed, 101 insertions(+) create mode 100644 ports/upa-url/cxx-standard.patch create mode 100644 ports/upa-url/portfile.cmake create mode 100644 ports/upa-url/vcpkg.json create mode 100644 versions/u-/upa-url.json diff --git a/ports/upa-url/cxx-standard.patch b/ports/upa-url/cxx-standard.patch new file mode 100644 index 0000000000..745e2e2f2f --- /dev/null +++ b/ports/upa-url/cxx-standard.patch @@ -0,0 +1,32 @@ +diff --git a/include/upa/config.h b/include/upa/config.h +index 46a5bc5..0264380 100644 +--- a/include/upa/config.h ++++ b/include/upa/config.h +@@ -12,14 +12,16 @@ + # endif + #endif + ++#define UPA_CXX_STANDARD @UPA_CXX_STANDARD@ // NOLINT(*-macro-*) ++ + // Define UPA_CPP_20 if compiler supports C++20 or later standard +-#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 202002) : (__cplusplus >= 202002) ++#if UPA_CXX_STANDARD >= 20 + # define UPA_CPP_20 + #endif + + // Define UPA_CPP_17 if compiler supports C++17 or later standard + // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +-#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 201703) : (__cplusplus >= 201703) ++#if UPA_CXX_STANDARD >= 17 + # define UPA_CPP_17 + # define UPA_FALLTHROUGH [[fallthrough]]; + # define UPA_CONSTEXPR_17 constexpr +@@ -32,7 +34,7 @@ + + // Define UPA_CPP_14 if compiler supports C++14 or later + // Note: Visual Studio 2015 (14.0; _MSC_VER == 1900) lacks sufficient C++14 support +-#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 201402 && _MSC_VER > 1900) : (__cplusplus >= 201402) ++#if UPA_CXX_STANDARD >= 14 + # define UPA_CPP_14 + # define UPA_CONSTEXPR_14 constexpr + #else diff --git a/ports/upa-url/portfile.cmake b/ports/upa-url/portfile.cmake new file mode 100644 index 0000000000..926301cb0e --- /dev/null +++ b/ports/upa-url/portfile.cmake @@ -0,0 +1,34 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO upa-url/upa + REF "v${VERSION}" + SHA512 6217d2ec00191d125b94d86ea1bc094d5386ee9ebe7368d5ffa74161ab911d2409833239ff6874b185a7deb838a50a6b06cb79f287d16095227c83494e4fd1b4 + HEAD_REF main + PATCHES + cxx-standard.patch +) + +if("cxx11" IN_LIST FEATURES) + set(UPA_CXX_STANDARD 11) +else() + set(UPA_CXX_STANDARD 17) +endif() + +vcpkg_replace_string(${SOURCE_PATH}/include/upa/config.h + "@UPA_CXX_STANDARD@" "${UPA_CXX_STANDARD}" +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DCMAKE_CXX_STANDARD=${UPA_CXX_STANDARD} + -DCMAKE_CXX_STANDARD_REQUIRED=ON + -DUPA_BUILD_TESTS=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME "upa" CONFIG_PATH "lib/cmake/upa") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/upa-url/vcpkg.json b/ports/upa-url/vcpkg.json new file mode 100644 index 0000000000..ae457e398b --- /dev/null +++ b/ports/upa-url/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "upa-url", + "version": "1.0.0", + "description": "An implementation of the WHATWG URL Standard in C++", + "homepage": "https://github.com/upa-url/upa", + "license": "BSD-2-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "cxx11": { + "description": "Compile library with C++11 (for use in C++11 and C++14 projects)" + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 3c2b5de0d4..a689bce00f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9144,6 +9144,10 @@ "baseline": "7.0.7", "port-version": 0 }, + "upa-url": { + "baseline": "1.0.0", + "port-version": 0 + }, "upb": { "baseline": "4.25.1", "port-version": 1 diff --git a/versions/u-/upa-url.json b/versions/u-/upa-url.json new file mode 100644 index 0000000000..796a48ef5f --- /dev/null +++ b/versions/u-/upa-url.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "cf986c3938d7f479923887f031f0748ee3f81229", + "version": "1.0.0", + "port-version": 0 + } + ] +}