Skip to content

Commit

Permalink
libphonenumber: use Homebrew abseil
Browse files Browse the repository at this point in the history
This downloads its own `abseil` during the build, and then gets confused
about where to find `abseil` headers when you try to link with it.

Let's fix that by relying on our version of `abseil` instead.

This should help unblock #105712 and previous attempts to bump this
formula's version (e.g. #105188, #101703, #98994, #96834).
  • Loading branch information
carlocab committed Jul 14, 2022
1 parent 0c54423 commit 12b16e7
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions Formula/libphonenumber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,36 @@ 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"

on_linux do
depends_on "gcc"
end

fails_with gcc: "5" # For abseil and C++17

# Use Homebrew abseil. Patch from Arch. Debian uses a similar patch.
# A version is being upstreamed at:
# https://github.com/google/libphonenumber/pull/2772
#
# We're not using the upstream patch because it doesn't work yet.
# https://github.com/google/libphonenumber/pull/2772#issuecomment-1184289820
patch do
url "https://raw.githubusercontent.com/archlinux/svntogit-packages/864f0cf5874088d76e9e7309fb3da1eeed8b701d/trunk/absl.diff"
sha256 "f6bceb2409ff7cba1e6947e6fdce3fe82b511b04fefcd1f597eceb13af67a8a4"
end

def install
ENV.cxx11
system "cmake", "cpp", "-DGTEST_INCLUDE_DIR=#{Formula["googletest"].include}",
*std_cmake_args
system "make", "install"
system "cmake", "-S", "cpp", "-B", "build",
"-DCMAKE_CXX_STANDARD=17", # keep in sync with C++ standard in abseil.rb
"-DGTEST_INCLUDE_DIR=#{Formula["googletest"].opt_include}",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
Expand All @@ -57,7 +77,7 @@ def install
}
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp", "-L#{lib}", "-lphonenumber", "-o", "test"
system ENV.cxx, "-std=c++17", "test.cpp", "-L#{lib}", "-lphonenumber", "-o", "test"
system "./test"
end
end

0 comments on commit 12b16e7

Please sign in to comment.