commit:     8562873238086a94ba2a9b9ecad1059fd1cd689c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  5 11:06:26 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct  5 11:10:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85628732

dev-libs/libphonenumber: add 8.13.47

* Replace CMake patch with newer version from Exherbo (original came
  from there too)
* Import another patch from Exherbo for newer abseil-cpp (fixes linking
  w/ lld, mold)
* Drop -Werror
* Wire up tests again (sorry, not rebasing the CMake patch, this is
  good enough ;))

Closes: https://bugs.gentoo.org/889910
Closes: https://bugs.gentoo.org/923946
Closes: https://bugs.gentoo.org/939873
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/libphonenumber/Manifest                   |  1 +
 .../files/libphonenumber-8.13.47-cmake.patch       | 31 +++++++++++
 ...bphonenumber-8.13.47-protobuf-link-abseil.patch | 24 +++++++++
 .../files/libphonenumber-8.13.47-werror.patch      | 23 +++++++++
 .../libphonenumber/libphonenumber-8.13.47.ebuild   | 60 ++++++++++++++++++++++
 5 files changed, 139 insertions(+)

diff --git a/dev-libs/libphonenumber/Manifest b/dev-libs/libphonenumber/Manifest
index 9295664efd96..3145c825dbcd 100644
--- a/dev-libs/libphonenumber/Manifest
+++ b/dev-libs/libphonenumber/Manifest
@@ -1 +1,2 @@
 DIST libphonenumber-8.12.39.tar.gz 11007180 BLAKE2B 
27a47b35497772740da04cb9b79e1a6b4fd6f9b0d4a89768e1ba9212672f1a0fd06c5837aa8858a4680b5c47ef16721c6ef145d8d2cd77dccbe27bb4b0897dcf
 SHA512 
82570c60b132022a713c0664de2c29997cff0ab8c3ab97dbec0f8d1cd1782090ba92ca7d2f044760f523c986660f13b70aacf8a9c247a3b80eb19d35227bc2a8
+DIST libphonenumber-8.13.47.tar.gz 12929410 BLAKE2B 
97af74d0c4c3f01baaeca370f0ad8d71abbff58edbb7209d5809e43f0171b0c3a997aa0a190131e935326ac72702706221429bf166e0726a44126bda36bb0169
 SHA512 
0ad3e59e4972bdb7f3e9abce4f1e2bd2924c21d437e734d6bc752cc86660a8a48b3b15ecd662c406e0279ef1112d9bd53b8ab9a9c4e593d3c8b87f9d6d23a5f7

diff --git a/dev-libs/libphonenumber/files/libphonenumber-8.13.47-cmake.patch 
b/dev-libs/libphonenumber/files/libphonenumber-8.13.47-cmake.patch
new file mode 100644
index 000000000000..7212a5b48428
--- /dev/null
+++ b/dev-libs/libphonenumber/files/libphonenumber-8.13.47-cmake.patch
@@ -0,0 +1,31 @@
+https://gitlab.exherbo.org/exherbo/kde/-/blob/master/packages/dev-libs/libphonenumber/files/Link-the-test-program-to-the-shared-lib-to-allow-bui.patch?ref_type=heads
+https://github.com/google/libphonenumber/pull/2556 (previous version)
+
+Upstream: no
+Reason: fails to link with -DBUILD_STATIC_LIB=OFF
+
+From 0b50dcf8299e3c18cdc158f40aa97cdb0318b08e Mon Sep 17 00:00:00 2001
+From: Bernd Steinhauser <[email protected]>
+Date: Tue, 10 Jan 2023 09:14:44 +0100
+Subject: [PATCH] Link the test program to the shared lib to allow building
+ without static libs
+
+---
+ cpp/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
+index d2d111d5..932b5e63 100644
+--- a/cpp/CMakeLists.txt
++++ b/cpp/CMakeLists.txt
+@@ -599,7 +599,7 @@ if(BUILD_TESTING)
+   # libraries are built properly.
+   if (BUILD_GEOCODER)
+     add_executable (geocoding_test_program 
"test/phonenumbers/geocoding/geocoding_test_program.cc")
+-    target_link_libraries (geocoding_test_program geocoding phonenumber)
++    target_link_libraries (geocoding_test_program geocoding-shared 
phonenumber-shared)
+   endif ()
+ endif()
+
+--
+2.39.0

diff --git 
a/dev-libs/libphonenumber/files/libphonenumber-8.13.47-protobuf-link-abseil.patch
 
b/dev-libs/libphonenumber/files/libphonenumber-8.13.47-protobuf-link-abseil.patch
new file mode 100644
index 000000000000..1efe13a0394f
--- /dev/null
+++ 
b/dev-libs/libphonenumber/files/libphonenumber-8.13.47-protobuf-link-abseil.patch
@@ -0,0 +1,24 @@
+https://gitlab.exherbo.org/exherbo/kde/-/raw/master/packages/dev-libs/libphonenumber/files/libphonenumber-Update-CMakeLists.txt.patch
+
+Upstream: under review (approved), 
https://github.com/google/libphonenumber/pull/3215
+Reason: Fix build with recent protobuf
+
+From d420534a727c43fa251a1e09b77ed4cd6b615395 Mon Sep 17 00:00:00 2001
+From: katbohm <[email protected]>
+Date: Mon, 18 Sep 2023 12:25:11 +0200
+Subject: [PATCH] Update CMakeLists.txt
+
+Temporary fix for b/283987730 (failing build due to new protobuf having absl 
dependencies).
+--- a/cpp/CMakeLists.txt
++++ b/cpp/CMakeLists.txt
+@@ -433,7 +433,7 @@ include_directories ("src")
+ # Collate dependencies
+ #----------------------------------------------------------------
+ 
+-set (LIBRARY_DEPS ${ICU_LIB} ${PROTOBUF_LIB} absl::node_hash_set 
absl::strings absl::synchronization)
++set (LIBRARY_DEPS ${ICU_LIB} ${PROTOBUF_LIB} absl::node_hash_set 
absl::strings absl::synchronization absl::log_internal_message 
absl::log_internal_check_op)
+ 
+ if (USE_BOOST)
+   list (APPEND LIBRARY_DEPS ${Boost_LIBRARIES})
+-- 
+2.42.0

diff --git a/dev-libs/libphonenumber/files/libphonenumber-8.13.47-werror.patch 
b/dev-libs/libphonenumber/files/libphonenumber-8.13.47-werror.patch
new file mode 100644
index 000000000000..e1c220167a73
--- /dev/null
+++ b/dev-libs/libphonenumber/files/libphonenumber-8.13.47-werror.patch
@@ -0,0 +1,23 @@
+https://bugs.gentoo.org/889910
+--- 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")
+--- a/tools/cpp/CMakeLists.txt
++++ b/tools/cpp/CMakeLists.txt
+@@ -25,7 +25,7 @@ set (
+ )
+ 
+ if (NOT WIN32)
+-  add_definitions ("-Wall -Werror")
++  add_definitions ("-Wall")
+ endif ()
+ 
+ include_directories ("src")

diff --git a/dev-libs/libphonenumber/libphonenumber-8.13.47.ebuild 
b/dev-libs/libphonenumber/libphonenumber-8.13.47.ebuild
new file mode 100644
index 000000000000..2f57fc019ea3
--- /dev/null
+++ b/dev-libs/libphonenumber/libphonenumber-8.13.47.ebuild
@@ -0,0 +1,60 @@
+# Copyright 2021-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+#CMAKE_MAKEFILE_GENERATOR="emake" # broken w/ ninja
+inherit cmake
+
+DESCRIPTION="Library for parsing, formatting, and validating international 
phone numbers"
+HOMEPAGE="https://github.com/google/libphonenumber";
+SRC_URI="https://github.com/google/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+CMAKE_USE_DIR="${WORKDIR}"/${P}/cpp
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+IUSE="test"
+
+RESTRICT="!test? ( test )"
+
+DEPEND="
+       dev-libs/icu:=
+       dev-libs/protobuf:=
+       dev-libs/boost:=
+"
+RDEPEND="${DEPEND}"
+BDEPEND="
+       virtual/pkgconfig
+       test? ( dev-cpp/gtest )
+"
+
+PATCHES=(
+       # it is either this, or disable BUILD_GEOCODER
+       # https://github.com/google/libphonenumber/pull/2556
+       "${FILESDIR}"/${PN}-8.13.47-cmake.patch
+       # bug #923946
+       "${FILESDIR}"/${PN}-8.13.47-protobuf-link-abseil.patch
+       # bug #889910
+       "${FILESDIR}"/${PN}-8.13.47-werror.patch
+)
+
+src_prepare() {
+       # 
https://github.com/google/libphonenumber/pull/2860#issuecomment-1402766427
+       touch "${CMAKE_USE_DIR}"/src/phonenumbers/test_metadata.h || die
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_STATIC_LIB=OFF
+               -DBUILD_TESTING=$(usex test)
+               -DREGENERATE_METADATA=OFF # avoid JRE dependency
+       )
+       cmake_src_configure
+}
+
+src_test() {
+       "${BUILD_DIR}"/libphonenumber_test || die
+}

Reply via email to