From cbe057935ddf919ac17693a46234d7c8673dc7e4 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Mon, 15 Nov 2021 19:00:26 +0100
Subject: dev-libs/libphonenumber: New package at version 8.12.37

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 dev-libs/libphonenumber/Manifest                   |  1 +
 .../files/libphonenumber-8.12.37-cmake.patch       | 54 ++++++++++++++++++
 .../files/libphonenumber-8.12.37-testing.patch     | 66 ++++++++++++++++++++++
 .../libphonenumber/libphonenumber-8.12.37.ebuild   | 48 ++++++++++++++++
 dev-libs/libphonenumber/metadata.xml               | 12 ++++
 5 files changed, 181 insertions(+)
 create mode 100644 dev-libs/libphonenumber/Manifest
 create mode 100644 dev-libs/libphonenumber/files/libphonenumber-8.12.37-cmake.patch
 create mode 100644 dev-libs/libphonenumber/files/libphonenumber-8.12.37-testing.patch
 create mode 100644 dev-libs/libphonenumber/libphonenumber-8.12.37.ebuild
 create mode 100644 dev-libs/libphonenumber/metadata.xml

(limited to 'dev-libs')

diff --git a/dev-libs/libphonenumber/Manifest b/dev-libs/libphonenumber/Manifest
new file mode 100644
index 000000000000..151f74f75bdc
--- /dev/null
+++ b/dev-libs/libphonenumber/Manifest
@@ -0,0 +1 @@
+DIST libphonenumber-8.12.37.tar.gz 11005274 BLAKE2B 2bcffe898ca7aa667a35e9a7340a54f880cdb9f290e807e9ff7f6ee778df83dd80023703595781a97355a43a8096bdc957a7f79336b5bf9d892ada26e35ae025 SHA512 420ea841679c1ff420289b3fea0bb6d86d4d1e99525fce00cc90025c8ade99e56e2dcbb7fca64190437ff0a889cdc7373f182e7699db20a072c32e984b8dff33
diff --git a/dev-libs/libphonenumber/files/libphonenumber-8.12.37-cmake.patch b/dev-libs/libphonenumber/files/libphonenumber-8.12.37-cmake.patch
new file mode 100644
index 000000000000..8e797a867032
--- /dev/null
+++ b/dev-libs/libphonenumber/files/libphonenumber-8.12.37-cmake.patch
@@ -0,0 +1,54 @@
+Upstream: no, I probably should, although this patch isn't nice, but
+          neither is their cmake code
+
+From a0c72f32b3c318f66975400af81b9b44d8a8d9c7 Mon Sep 17 00:00:00 2001
+From: Heiko Becker <heirecka@exherbo.org>
+Date: Wed, 27 Mar 2019 21:07:22 +0100
+Subject: [PATCH] Fix build with BUILD_STATIC_LIB=ON
+
+---
+ CMakeLists.txt | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 38ce1f50..dd9399be 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -441,7 +441,9 @@ if (${BUILD_GEOCODER} STREQUAL "ON")
+   list (APPEND GEOCODER_DEPS ${COMMON_DEPS})
+   # Note that the subset of base/ on which the geocoder relies is implemented
+   # on top of Boost header-only libraries (e.g. scoped_ptr.hpp).
+-  target_link_libraries (geocoding ${LIBRARY_DEPS})
++  if (${BUILD_STATIC_LIB} STREQUAL "ON")
++    target_link_libraries (geocoding ${LIBRARY_DEPS})
++  endif()
+   target_link_libraries (geocoding-shared ${LIBRARY_DEPS})
+ endif ()
+ 
+@@ -599,7 +601,9 @@ if (BUILD_SHARED_LIB)
+ endif ()
+ 
+ if (${BUILD_GEOCODER} STREQUAL "ON")
+-  install (TARGETS geocoding LIBRARY DESTINATION ${LIBDIR} ARCHIVE DESTINATION ${LIBDIR})
++  if (${BUILD_STATIC_LIB} STREQUAL "ON")
++    install (TARGETS geocoding LIBRARY DESTINATION ${LIBDIR} ARCHIVE DESTINATION ${LIBDIR})
++  endif()
+   install (TARGETS geocoding-shared LIBRARY DESTINATION ${LIBDIR} ARCHIVE
+            DESTINATION ${LIBDIR})
+ endif ()
+@@ -611,7 +615,11 @@ if (${BUILD_GEOCODER} STREQUAL "ON")
+     geocoding_test_program
+     "test/phonenumbers/geocoding/geocoding_test_program.cc"
+   )
+-  target_link_libraries (geocoding_test_program geocoding phonenumber)
++  if (${BUILD_STATIC_LIB} STREQUAL "ON")
++    target_link_libraries (geocoding_test_program geocoding phonenumber)
++  else ()
++    target_link_libraries (geocoding_test_program geocoding-shared phonenumber-shared)
++  endif ()
+ endif ()
+ 
+ # Build an RPM
+-- 
+2.21.0
+
diff --git a/dev-libs/libphonenumber/files/libphonenumber-8.12.37-testing.patch b/dev-libs/libphonenumber/files/libphonenumber-8.12.37-testing.patch
new file mode 100644
index 000000000000..8c15a5b0e8cc
--- /dev/null
+++ b/dev-libs/libphonenumber/files/libphonenumber-8.12.37-testing.patch
@@ -0,0 +1,66 @@
+From b3b0e96e0f62148ee80075fb9d35fe15f4e32612 Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <asturm@gentoo.org>
+Date: Mon, 15 Nov 2021 19:13:37 +0100
+Subject: [PATCH] Add BUILD_TESTING option
+
+Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
+---
+ cpp/CMakeLists.txt | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 44db6834..a97da698 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -90,6 +90,7 @@ option ("USE_STD_MAP" "Force the use of std::map" "OFF")
+ option ("BUILD_STATIC_LIB" "Build static libraries" "ON")
+ option ("USE_STDMUTEX" "Use C++ 2011 std::mutex for multi-threading" "OFF")
+ option ("USE_POSIX_THREAD" "Use Posix api for multi-threading" "OFF")
++option ("BUILD_TESTING" "Build unit tests (gtest sources are needed)" "ON")
+ 
+ if (${USE_ALTERNATE_FORMATS} STREQUAL "ON")
+   add_definitions ("-DI18N_PHONENUMBERS_USE_ALTERNATE_FORMATS")
+@@ -121,7 +122,9 @@ if (${USE_BOOST} STREQUAL "OFF" AND ${USE_STDMUTEX} STREQUAL "OFF")
+   find_package (Threads)
+ endif()
+ 
+-find_or_build_gtest ()
++if (BUILD_TESTING)
++  find_or_build_gtest ()
++endif()
+ 
+ if (${USE_RE2} STREQUAL "ON")
+   find_required_library (RE2 re2/re2.h re2 "Google RE2")
+@@ -492,11 +495,13 @@ if (${BUILD_GEOCODER} STREQUAL "ON")
+ endif ()
+ 
+ # Build a specific library for testing purposes.
++if (BUILD_TESTING)
+ add_library (phonenumber_testing STATIC ${TESTING_LIBRARY_SOURCES})
+ if (${BUILD_GEOCODER} STREQUAL "ON")
+   add_dependencies (phonenumber_testing generate_geocoding_data)
+ endif ()
+ target_link_libraries (phonenumber_testing ${LIBRARY_DEPS})
++endif()
+ 
+ if (${BUILD_GEOCODER} STREQUAL "ON")
+   # Test geocoding data cpp files generation.
+@@ -551,6 +556,7 @@ if (${USE_ICU_REGEXP} STREQUAL "ON")
+ endif ()
+ 
+ # Build the testing binary.
++if (BUILD_TESTING)
+ include_directories ("test")
+ add_executable (libphonenumber_test ${TEST_SOURCES})
+ set (TEST_LIBS phonenumber_testing ${GTEST_LIB})
+@@ -575,6 +581,7 @@ else ()
+     DEPENDS libphonenumber_test
+   )
+ endif ()
++endif ()
+ 
+ # Install rules.
+ install (FILES
+-- 
+2.33.1
+
diff --git a/dev-libs/libphonenumber/libphonenumber-8.12.37.ebuild b/dev-libs/libphonenumber/libphonenumber-8.12.37.ebuild
new file mode 100644
index 000000000000..0147d24ac25b
--- /dev/null
+++ b/dev-libs/libphonenumber/libphonenumber-8.12.37.ebuild
@@ -0,0 +1,48 @@
+# Copyright 2021 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"
+S="${WORKDIR}/${P}/cpp"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+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}"/${P}-cmake.patch
+	# see also https://github.com/google/libphonenumber/pull/2459
+	# using a stripped-down patch w/ BUILD_TESTING
+	"${FILESDIR}"/${P}-testing.patch
+)
+
+src_configure() {
+	local mycmakeargs=(
+		-DBUILD_STATIC_LIB=OFF
+		-DBUILD_TESTING=OFF
+		-DREGENERATE_METADATA=OFF # avoid JRE dependency
+	)
+	cmake_src_configure
+}
diff --git a/dev-libs/libphonenumber/metadata.xml b/dev-libs/libphonenumber/metadata.xml
new file mode 100644
index 000000000000..d9319561d8a1
--- /dev/null
+++ b/dev-libs/libphonenumber/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="project">
+		<email>kde@gentoo.org</email>
+		<name>Gentoo KDE Project</name>
+	</maintainer>
+	<upstream>
+		<bugs-to>https://issuetracker.google.com/issues?q=componentid:192347</bugs-to>
+		<remote-id type="github">google/libphonenumber</remote-id>
+	</upstream>
+</pkgmetadata>
-- 
cgit v1.2.3-65-gdbad