From 29f0414dbe277aa7f17a54b44d3456b877d6e033 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Mon, 16 May 2022 17:08:54 -0400 Subject: [PATCH 1/3] libphonenumber 8.12.48 Signed-off-by: Rui Chen update build Signed-off-by: Rui Chen --- Formula/libphonenumber.rb | 68 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/Formula/libphonenumber.rb b/Formula/libphonenumber.rb index 705421e8bed8a..a48851e2e02b4 100644 --- a/Formula/libphonenumber.rb +++ b/Formula/libphonenumber.rb @@ -1,10 +1,9 @@ class Libphonenumber < Formula desc "C++ Phone Number library by Google" homepage "https://github.com/google/libphonenumber" - url "https://github.com/google/libphonenumber/archive/v8.12.44.tar.gz" - sha256 "02337c60e3a055e0a4bc4e0a60e8ae31aa567adce59f266cfd37961fceea74c2" + url "https://github.com/google/libphonenumber/archive/v8.12.48.tar.gz" + sha256 "4bd2b7c89f1cba8dc78038395f4cc3236dd5aa62118feb4c354a8890634faea9" license "Apache-2.0" - revision 1 livecheck do url :stable @@ -22,11 +21,17 @@ class Libphonenumber < Formula depends_on "cmake" => :build depends_on "googletest" => :build + + depends_on "abseil" depends_on "boost" depends_on "icu4c" depends_on "protobuf" depends_on "re2" + # remove builtin abseil download step + # build patch ref, https://github.com/archlinux/svntogit-packages/blob/packages/libphonenumber/trunk/absl.diff + patch :DATA + def install ENV.cxx11 system "cmake", "cpp", "-DGTEST_INCLUDE_DIR=#{Formula["googletest"].include}", @@ -61,3 +66,60 @@ def install system "./test" end end + +__END__ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 57261a6..8686f5a 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -18,7 +18,7 @@ cmake_minimum_required (VERSION 3.11) + + # Pick the C++ standard to compile with. + # Abseil currently supports C++11, C++14, and C++17. +-set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + + project (libphonenumber) +@@ -126,6 +126,7 @@ if (${USE_BOOST} STREQUAL "OFF" AND ${USE_STDMUTEX} STREQUAL "OFF") + find_package (Threads) + endif() + ++find_package (absl REQUIRED) + find_or_build_gtest () + + if (${USE_RE2} STREQUAL "ON") +diff --git a/tools/cpp/CMakeLists.txt b/tools/cpp/CMakeLists.txt +index b094165..58a9b3b 100644 +--- a/tools/cpp/CMakeLists.txt ++++ b/tools/cpp/CMakeLists.txt +@@ -26,29 +26,6 @@ project (generate_geocoding_data) + # Helper functions dealing with finding libraries and programs this library + # depends on. + include (gtest.cmake) +-include (FetchContent) +- +-# Downloading the abseil sources. +-FetchContent_Declare( +- abseil-cpp +- GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git +- GIT_TAG origin/master +-) +- +-# Building the abseil binaries +-FetchContent_GetProperties(abseil-cpp) +-if (NOT abseil-cpp_POPULATED) +- FetchContent_Populate(abseil-cpp) +-endif () +- +-if (NOT abseil-cpp_POPULATED) +- message (FATAL_ERROR "Could not build abseil-cpp binaries.") +-endif () +- +-# Safeguarding against any potential link errors as mentioned in +-# https://github.com/abseil/abseil-cpp/issues/225 +-set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) +-add_subdirectory(${abseil-cpp_SOURCE_DIR} ${abseil-cpp_BINARY_DIR}) + + find_or_build_gtest () + set ( From 3d43f74548219168c66985b3239b5f670376ebe1 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Mon, 16 May 2022 18:52:58 -0400 Subject: [PATCH 2/3] update linux build Signed-off-by: Rui Chen --- Formula/libphonenumber.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Formula/libphonenumber.rb b/Formula/libphonenumber.rb index a48851e2e02b4..126160b11fba8 100644 --- a/Formula/libphonenumber.rb +++ b/Formula/libphonenumber.rb @@ -28,6 +28,12 @@ class Libphonenumber < Formula depends_on "protobuf" depends_on "re2" + on_linux do + depends_on "gcc" + end + + fails_with gcc: "5" # C++17 + # remove builtin abseil download step # build patch ref, https://github.com/archlinux/svntogit-packages/blob/packages/libphonenumber/trunk/absl.diff patch :DATA From 189c5bd98e5126d816e37757445f1492a8eb2396 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Fri, 20 May 2022 10:24:25 -0400 Subject: [PATCH 3/3] add comment for the upstream patch --- Formula/libphonenumber.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Formula/libphonenumber.rb b/Formula/libphonenumber.rb index 126160b11fba8..89beb4049a62f 100644 --- a/Formula/libphonenumber.rb +++ b/Formula/libphonenumber.rb @@ -36,6 +36,7 @@ class Libphonenumber < Formula # remove builtin abseil download step # build patch ref, https://github.com/archlinux/svntogit-packages/blob/packages/libphonenumber/trunk/absl.diff + # upstream PR to conditionally download abseil package patch :DATA def install