diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libphonenumber | |
Diffstat (limited to 'vcpkg/ports/libphonenumber')
| -rw-r--r-- | vcpkg/ports/libphonenumber/disable-werror.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/libphonenumber/enable-cpp17.patch | 34 | ||||
| -rw-r--r-- | vcpkg/ports/libphonenumber/fix-find-protobuf.patch | 12 | ||||
| -rw-r--r-- | vcpkg/ports/libphonenumber/fix-icui18n-lib-name.patch | 17 | ||||
| -rw-r--r-- | vcpkg/ports/libphonenumber/fix-re2-identifiers.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/libphonenumber/portfile.cmake | 38 | ||||
| -rw-r--r-- | vcpkg/ports/libphonenumber/re2-2023-07-01-compat.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/libphonenumber/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/libphonenumber/vcpkg.json | 24 |
9 files changed, 168 insertions, 0 deletions
diff --git a/vcpkg/ports/libphonenumber/disable-werror.patch b/vcpkg/ports/libphonenumber/disable-werror.patch new file mode 100644 index 0000000..41c5432 --- /dev/null +++ b/vcpkg/ports/libphonenumber/disable-werror.patch @@ -0,0 +1,13 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 27e4680..ab4c404 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -418,7 +418,7 @@ if (USE_ICU_REGEXP) + endif () + + if (NOT WIN32) +- add_definitions ("-Wall -Werror") ++ add_definitions ("-Wall") + endif () + + include_directories ("src") diff --git a/vcpkg/ports/libphonenumber/enable-cpp17.patch b/vcpkg/ports/libphonenumber/enable-cpp17.patch new file mode 100644 index 0000000..f582afa --- /dev/null +++ b/vcpkg/ports/libphonenumber/enable-cpp17.patch @@ -0,0 +1,34 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 27e4680..88df056 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -459,11 +459,13 @@ if (BUILD_STATIC_LIB) + add_library (phonenumber STATIC ${SOURCES}) + target_link_libraries (phonenumber ${LIBRARY_DEPS}) + target_include_directories(phonenumber PUBLIC $<INSTALL_INTERFACE:include>) ++ target_compile_features(phonenumber PUBLIC cxx_std_17) + + if (BUILD_GEOCODER) + add_library (geocoding STATIC ${GEOCODING_SOURCES}) + target_link_libraries (geocoding ${LIBRARY_DEPS}) + target_include_directories(geocoding PUBLIC $<INSTALL_INTERFACE:include>) ++ target_compile_features(geocoding PUBLIC cxx_std_17) + add_dependencies (geocoding generate_geocoding_data) + add_dependencies (phonenumber generate_geocoding_data) + endif () +@@ -479,6 +481,7 @@ if (BUILD_SHARED_LIBS) + add_library (phonenumber-shared SHARED ${SOURCES}) + target_link_libraries (phonenumber-shared ${LIBRARY_DEPS}) + target_include_directories(phonenumber-shared PUBLIC $<INSTALL_INTERFACE:include>) ++ target_compile_features(phonenumber-shared PUBLIC cxx_std_17) + + set_target_properties (phonenumber-shared + PROPERTIES +@@ -495,6 +498,7 @@ if (BUILD_SHARED_LIBS) + add_library (geocoding-shared SHARED ${GEOCODING_SOURCES}) + target_link_libraries (geocoding-shared ${LIBRARY_DEPS}) + target_include_directories(geocoding-shared PUBLIC $<INSTALL_INTERFACE:include>) ++ target_compile_features(geocoding-shared PUBLIC cxx_std_17) + add_dependencies (geocoding-shared generate_geocoding_data) + add_dependencies (phonenumber-shared generate_geocoding_data) + diff --git a/vcpkg/ports/libphonenumber/fix-find-protobuf.patch b/vcpkg/ports/libphonenumber/fix-find-protobuf.patch new file mode 100644 index 0000000..6dd1dca --- /dev/null +++ b/vcpkg/ports/libphonenumber/fix-find-protobuf.patch @@ -0,0 +1,12 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 10b6dce7..50f06eda 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -46,6 +46,7 @@ function (print_error DESCRIPTION FILE) + "Can't find ${DESCRIPTION}: can't locate ${FILE}. Please read the README.") + endfunction () + ++set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES};lib") + # Find a library. If it has not been found, stop CMake with a fatal error + # message. + function (find_required_library NAME HEADER LIBRARY DESCRIPTION) diff --git a/vcpkg/ports/libphonenumber/fix-icui18n-lib-name.patch b/vcpkg/ports/libphonenumber/fix-icui18n-lib-name.patch new file mode 100644 index 0000000..1cc5a41 --- /dev/null +++ b/vcpkg/ports/libphonenumber/fix-icui18n-lib-name.patch @@ -0,0 +1,17 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index cdd7a081..10b6dce7 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -192,7 +192,11 @@ set (ICU_INCLUDE_DIR ${ICU_UC_INCLUDE_DIR}) + set (ICU_LIB ${ICU_UC_LIB}) + # If ICU regexp engine is used or if the geocoder is built, use icui18n as well. + if (USE_ICU_REGEXP OR BUILD_GEOCODER) +- find_required_library (ICU_I18N unicode/regex.h icui18n "ICU") ++ if (NOT WIN32) ++ find_required_library (ICU_I18N unicode/regex.h "icui18n" "ICU") ++ else () ++ find_required_library (ICU_I18N unicode/regex.h "icuin" "ICU") ++ endif () + check_library_version (PC_ICU_I18N icu-i18n>=4.4) + list (APPEND ICU_INCLUDE_DIR ${ICU_I18N_INCLUDE_DIR}) + list (APPEND ICU_LIB ${ICU_I18N_LIB}) diff --git a/vcpkg/ports/libphonenumber/fix-re2-identifiers.patch b/vcpkg/ports/libphonenumber/fix-re2-identifiers.patch new file mode 100644 index 0000000..41de0be --- /dev/null +++ b/vcpkg/ports/libphonenumber/fix-re2-identifiers.patch @@ -0,0 +1,13 @@ +diff --git a/cpp/src/phonenumbers/regexp_adapter_re2.cc b/cpp/src/phonenumbers/regexp_adapter_re2.cc +index bb542234..398f369b 100644 +--- a/cpp/src/phonenumbers/regexp_adapter_re2.cc ++++ b/cpp/src/phonenumbers/regexp_adapter_re2.cc +@@ -31,6 +31,8 @@ + namespace i18n { + namespace phonenumbers { + ++using re2::StringPiece; ++ + // Implementation of RegExpInput abstract class. + class RE2RegExpInput : public RegExpInput { + public: diff --git a/vcpkg/ports/libphonenumber/portfile.cmake b/vcpkg/ports/libphonenumber/portfile.cmake new file mode 100644 index 0000000..250af6b --- /dev/null +++ b/vcpkg/ports/libphonenumber/portfile.cmake @@ -0,0 +1,38 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO google/libphonenumber
+ REF "v${VERSION}"
+ SHA512 3cffb631805e119afd3d17326ae216813198183ca33a941a2b1eeedd9aabbb624d835bf922c569d0f15c8bb2643aafd80802e893af67eb1a58f27fa9ca5051fe
+ HEAD_REF master
+ PATCHES
+ # fix compilation error due to deprecated warnings in protobuf generated files
+ disable-werror.patch
+ fix-re2-identifiers.patch
+ fix-icui18n-lib-name.patch
+ fix-find-protobuf.patch
+ re2-2023-07-01-compat.patch
+ # enable C++17 for re2
+ enable-cpp17.patch
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}/cpp"
+ OPTIONS
+ -DREGENERATE_METADATA=OFF
+ -DUSE_RE2=ON
+ -DBUILD_GEOCODER=OFF
+ -DUSE_PROTOBUF_LITE=ON
+ -DBUILD_SHARED_LIBS=OFF
+ -DBUILD_TESTING=OFF)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
+
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
diff --git a/vcpkg/ports/libphonenumber/re2-2023-07-01-compat.patch b/vcpkg/ports/libphonenumber/re2-2023-07-01-compat.patch new file mode 100644 index 0000000..2ba8ea6 --- /dev/null +++ b/vcpkg/ports/libphonenumber/re2-2023-07-01-compat.patch @@ -0,0 +1,13 @@ +diff --git a/cpp/src/phonenumbers/regexp_adapter_re2.cc b/cpp/src/phonenumbers/regexp_adapter_re2.cc +index 398f369b..3dd5d854 100644 +--- a/cpp/src/phonenumbers/regexp_adapter_re2.cc ++++ b/cpp/src/phonenumbers/regexp_adapter_re2.cc +@@ -41,7 +41,7 @@ class RE2RegExpInput : public RegExpInput { + utf8_input_(string_) {} + + virtual string ToString() const { +- return utf8_input_.ToString(); ++ return string(utf8_input_.data(), utf8_input_.size()); + } + + StringPiece* Data() { diff --git a/vcpkg/ports/libphonenumber/usage b/vcpkg/ports/libphonenumber/usage new file mode 100644 index 0000000..d54aaf8 --- /dev/null +++ b/vcpkg/ports/libphonenumber/usage @@ -0,0 +1,4 @@ +libphonenumber provides CMake targets: + + find_package(libphonenumber CONFIG REQUIRED) + target_link_libraries(main PRIVATE libphonenumber::phonenumber) diff --git a/vcpkg/ports/libphonenumber/vcpkg.json b/vcpkg/ports/libphonenumber/vcpkg.json new file mode 100644 index 0000000..9ca33ab --- /dev/null +++ b/vcpkg/ports/libphonenumber/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "libphonenumber", + "version": "9.0.18", + "description": "Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers.", + "homepage": "https://github.com/google/libphonenumber", + "license": "Apache-2.0", + "dependencies": [ + "abseil", + "boost-date-time", + "boost-system", + "boost-thread", + "icu", + "protobuf", + "re2", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |