commit:     9e66040a0ed9da569a73663026e362c50a492c3a
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 16 10:54:59 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Nov 16 11:03:04 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e66040a

dev-libs/libphonenumber: Fix testing.patch, restrict tests

Set CMAKE_USE_DIR instead of S to make git patches apply.

Closes: https://bugs.gentoo.org/823902
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/libphonenumber-8.12.37-cmake.patch       |  8 +--
 .../files/libphonenumber-8.12.37-testing.patch     | 68 ++++++++++++++++++----
 .../libphonenumber/libphonenumber-8.12.37.ebuild   |  6 +-
 3 files changed, 63 insertions(+), 19 deletions(-)

diff --git a/dev-libs/libphonenumber/files/libphonenumber-8.12.37-cmake.patch 
b/dev-libs/libphonenumber/files/libphonenumber-8.12.37-cmake.patch
index 8e797a867032..bfc7e8701a5d 100644
--- a/dev-libs/libphonenumber/files/libphonenumber-8.12.37-cmake.patch
+++ b/dev-libs/libphonenumber/files/libphonenumber-8.12.37-cmake.patch
@@ -7,13 +7,13 @@ Date: Wed, 27 Mar 2019 21:07:22 +0100
 Subject: [PATCH] Fix build with BUILD_STATIC_LIB=ON
 
 ---
- CMakeLists.txt | 14 +++++++++++---
+ cpp/CMakeLists.txt | 14 +++++++++++---
  1 file changed, 11 insertions(+), 3 deletions(-)
 
-diff --git a/CMakeLists.txt b/CMakeLists.txt
+diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
 index 38ce1f50..dd9399be 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
+--- a/cpp/CMakeLists.txt
++++ b/cpp/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

diff --git a/dev-libs/libphonenumber/files/libphonenumber-8.12.37-testing.patch 
b/dev-libs/libphonenumber/files/libphonenumber-8.12.37-testing.patch
index 8c15a5b0e8cc..0ea039aea2bd 100644
--- a/dev-libs/libphonenumber/files/libphonenumber-8.12.37-testing.patch
+++ b/dev-libs/libphonenumber/files/libphonenumber-8.12.37-testing.patch
@@ -1,18 +1,30 @@
-From b3b0e96e0f62148ee80075fb9d35fe15f4e32612 Mon Sep 17 00:00:00 2001
+From 387f1daf0f9cd25ffa2654cc536e5678dd96a571 Mon Sep 17 00:00:00 2001
 From: Andreas Sturmlechner <[email protected]>
 Date: Mon, 15 Nov 2021 19:13:37 +0100
 Subject: [PATCH] Add BUILD_TESTING option
 
 Signed-off-by: Andreas Sturmlechner <[email protected]>
 ---
- cpp/CMakeLists.txt | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
+ cpp/CMakeLists.txt       | 13 +++++++++++--
+ tools/cpp/CMakeLists.txt | 17 +++++++++--------
+ 2 files changed, 20 insertions(+), 10 deletions(-)
 
-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")
+diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
+index 44db6834..f8e40978 100644
+--- a/cpp/CMakeLists.txt
++++ b/cpp/CMakeLists.txt
+@@ -32,7 +32,9 @@ endif ()
+ # depends on.
+ 
+ include (GNUInstallDirs)
+-include (../tools/cpp/gtest.cmake)
++if (BUILD_TESTING)
++  include (../tools/cpp/gtest.cmake)
++endif()
+ 
+ function (print_error DESCRIPTION FILE)
+   message (FATAL_ERROR
+@@ -90,6 +92,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")
@@ -20,7 +32,7 @@ index 44db6834..a97da698 100644
  
  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")
+@@ -121,7 +124,9 @@ if (${USE_BOOST} STREQUAL "OFF" AND ${USE_STDMUTEX} 
STREQUAL "OFF")
    find_package (Threads)
  endif()
  
@@ -31,7 +43,7 @@ index 44db6834..a97da698 100644
  
  if (${USE_RE2} STREQUAL "ON")
    find_required_library (RE2 re2/re2.h re2 "Google RE2")
-@@ -492,11 +495,13 @@ if (${BUILD_GEOCODER} STREQUAL "ON")
+@@ -492,11 +497,13 @@ if (${BUILD_GEOCODER} STREQUAL "ON")
  endif ()
  
  # Build a specific library for testing purposes.
@@ -45,7 +57,7 @@ index 44db6834..a97da698 100644
  
  if (${BUILD_GEOCODER} STREQUAL "ON")
    # Test geocoding data cpp files generation.
-@@ -551,6 +556,7 @@ if (${USE_ICU_REGEXP} STREQUAL "ON")
+@@ -551,6 +558,7 @@ if (${USE_ICU_REGEXP} STREQUAL "ON")
  endif ()
  
  # Build the testing binary.
@@ -53,7 +65,7 @@ index 44db6834..a97da698 100644
  include_directories ("test")
  add_executable (libphonenumber_test ${TEST_SOURCES})
  set (TEST_LIBS phonenumber_testing ${GTEST_LIB})
-@@ -575,6 +581,7 @@ else ()
+@@ -575,6 +583,7 @@ else ()
      DEPENDS libphonenumber_test
    )
  endif ()
@@ -61,6 +73,38 @@ index 44db6834..a97da698 100644
  
  # Install rules.
  install (FILES
+diff --git a/tools/cpp/CMakeLists.txt b/tools/cpp/CMakeLists.txt
+index fafa8469..0c3a84e0 100644
+--- a/tools/cpp/CMakeLists.txt
++++ b/tools/cpp/CMakeLists.txt
+@@ -20,11 +20,10 @@ project (generate_geocoding_data)
+ 
+ # Helper functions dealing with finding libraries and programs this library
+ # depends on.
+-
+-include (gtest.cmake)
+-
+-find_or_build_gtest ()
+-
++if (BUILD_TESTING)
++  include (gtest.cmake)
++  find_or_build_gtest ()
++endif ()
+ set (
+   SOURCES
+   "src/cpp-build/generate_geocoding_data.cc"
+@@ -52,6 +51,8 @@ if (NOT WIN32)
+ endif ()
+ 
+ # Build the testing binary.
+-include_directories ("test")
+-add_executable (generate_geocoding_data_test ${TEST_SOURCES})
+-target_link_libraries (generate_geocoding_data_test ${TEST_LIBS})
++if (BUILD_TESTING)
++  include_directories ("test")
++  add_executable (generate_geocoding_data_test ${TEST_SOURCES})
++  target_link_libraries (generate_geocoding_data_test ${TEST_LIBS})
++endif ()
 -- 
 2.33.1
 

diff --git a/dev-libs/libphonenumber/libphonenumber-8.12.37.ebuild 
b/dev-libs/libphonenumber/libphonenumber-8.12.37.ebuild
index 0147d24ac25b..14b1b298ff0b 100644
--- a/dev-libs/libphonenumber/libphonenumber-8.12.37.ebuild
+++ b/dev-libs/libphonenumber/libphonenumber-8.12.37.ebuild
@@ -9,14 +9,14 @@ 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"
+CMAKE_USE_DIR="${WORKDIR}"/${P}/cpp
 
 LICENSE="Apache-2.0"
 SLOT="0"
 KEYWORDS="~amd64"
 IUSE="test"
 
-RESTRICT="!test? ( test )"
+RESTRICT="test !test? ( test )"
 
 DEPEND="
        dev-libs/icu:=
@@ -41,7 +41,7 @@ PATCHES=(
 src_configure() {
        local mycmakeargs=(
                -DBUILD_STATIC_LIB=OFF
-               -DBUILD_TESTING=OFF
+               -DBUILD_TESTING=$(usex test)
                -DREGENERATE_METADATA=OFF # avoid JRE dependency
        )
        cmake_src_configure

Reply via email to