From 63d4a360ca41998dfceb8dc4bf0e7c318f6fc6f6dfedc298896a66de4630dbcf Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 5 Jul 2024 06:42:51 +0000 Subject: [PATCH] - Update to version 8.13.40: * Updated metadata - Use mode="manual" in _service OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libphonenumber?expand=0&rev=24 --- .gitattributes | 23 +++ .gitignore | 1 + 0001-Add-support-to-protobuf-3.25.1.patch | 189 ++++++++++++++++++ ...in-arguments-to-add_metadata_gen_tar.patch | 27 +++ ...id-intermediate-proto-object-library.patch | 66 ++++++ _service | 17 ++ libphonenumber-8.13.30.obscpio | 3 + libphonenumber-8.13.40.obscpio | 3 + libphonenumber.changes | 100 +++++++++ libphonenumber.obsinfo | 4 + libphonenumber.spec | 108 ++++++++++ 11 files changed, 541 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Add-support-to-protobuf-3.25.1.patch create mode 100644 0001-Revert-Fix-typo-in-arguments-to-add_metadata_gen_tar.patch create mode 100644 0002-Avoid-intermediate-proto-object-library.patch create mode 100644 _service create mode 100644 libphonenumber-8.13.30.obscpio create mode 100644 libphonenumber-8.13.40.obscpio create mode 100644 libphonenumber.changes create mode 100644 libphonenumber.obsinfo create mode 100644 libphonenumber.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-Add-support-to-protobuf-3.25.1.patch b/0001-Add-support-to-protobuf-3.25.1.patch new file mode 100644 index 0000000..0474dee --- /dev/null +++ b/0001-Add-support-to-protobuf-3.25.1.patch @@ -0,0 +1,189 @@ +From 9137f6d04e3b988dcea0cea7dd6da06509c11533 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= +Date: Sat, 20 Jan 2024 22:43:58 +0000 +Subject: [PATCH] Add support to protobuf 3.25.1 + +new-protobuf-cmake-logic.patch +--- + cpp/CMakeLists.txt | 90 ++++++++++++++++++++++++++------------- + cpp/cmake/config.cmake.in | 4 +- + 2 files changed, 63 insertions(+), 31 deletions(-) + +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 96def5c8f9..e076796365 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -100,7 +100,8 @@ if (USE_ALTERNATE_FORMATS) + endif () + + # Find all the required libraries and programs. +-find_package(absl) ++# Use "CONFIG" as there is no built-in cmake module for absl. ++find_package(absl CONFIG REQUIRED) + + if(NOT absl_FOUND) + # Overide abseil install rules for subprojects +@@ -169,14 +170,24 @@ if (USE_RE2) + find_required_library (RE2 re2/re2.h re2 "Google RE2") + endif () + +-if (USE_PROTOBUF_LITE) +- find_required_library (PROTOBUF google/protobuf/message_lite.h protobuf-lite +- "Google Protocol Buffers") +- check_library_version (PC_PROTOBUF protobuf-lite>=2.4) ++find_package(Protobuf CONFIG) ++if(NOT Protobuf_FOUND) ++ find_package(Protobuf REQUIRED) ++endif() ++ ++if (${Protobuf_VERSION} VERSION_LESS "3.21.0.0") ++ if (USE_PROTOBUF_LITE) ++ set (PROTOBUF_LIB ${Protobuf_LITE_LIBRARIES}) ++ else () ++ set (PROTOBUF_LIB ${Protobuf_LIBRARIES}) ++ endif () ++# find_required_program (PROTOC protoc "Google Protocol Buffers compiler (protoc)") + else () +- find_required_library (PROTOBUF google/protobuf/message_lite.h protobuf +- "Google Protocol Buffers") +- check_library_version (PC_PROTOBUF protobuf>=2.4) ++ if (USE_PROTOBUF_LITE) ++ set (PROTOBUF_LIB protobuf::libprotobuf-lite) ++ else () ++ set (PROTOBUF_LIB protobuf::libprotobuf) ++ endif () + endif () + + find_required_library (ICU_UC unicode/uchar.h icuuc "ICU") +@@ -192,9 +203,6 @@ if (USE_ICU_REGEXP OR BUILD_GEOCODER) + list (APPEND ICU_LIB ${ICU_I18N_LIB}) + endif () + +-find_required_program (PROTOC protoc +- "Google Protocol Buffers compiler (protoc)") +- + if (REGENERATE_METADATA) + find_required_program (JAVA java + "Java Runtime Environment") +@@ -220,24 +228,39 @@ endif () + set (RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../resources") + + set ( +- PROTOBUF_SOURCES "${RESOURCES_DIR}/phonemetadata.proto" +- "${RESOURCES_DIR}/phonenumber.proto" ++ PROTO_FILES "${RESOURCES_DIR}/phonemetadata.proto" ++ "${RESOURCES_DIR}/phonenumber.proto" + ) + +-set ( +- PROTOBUF_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/phonemetadata.pb.cc" +- "${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/phonemetadata.pb.h" +- "${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/phonenumber.pb.cc" +- "${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/phonenumber.pb.h" +-) ++if (${Protobuf_VERSION} VERSION_LESS "3.21.0.0") ++ set ( ++ PROTOBUF_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/phonemetadata.pb.cc" ++ "${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/phonemetadata.pb.h" ++ "${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/phonenumber.pb.cc" ++ "${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/phonenumber.pb.h" ++ ) + +-add_custom_command ( +- COMMAND ${PROTOC_BIN} --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/ +- --proto_path=${RESOURCES_DIR} ${PROTOBUF_SOURCES} ++# COMMAND ${PROTOC_BIN} ++ add_custom_command ( ++ COMMAND ${Protobuf_PROTOC_EXECUTABLE} ++ ARGS --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/src/phonenumbers/ --proto_path=${RESOURCES_DIR} ${PROTO_FILES} ++ VERBATIM + +- OUTPUT ${PROTOBUF_OUTPUT} +- DEPENDS ${PROTOBUF_SOURCES} +-) ++ OUTPUT ${PROTOBUF_OUTPUT} ++ DEPENDS ${PROTO_FILES} ++ ) ++else () ++ set (PROTOBUF_OUTPUT "") ++ add_library (proto-objects OBJECT ${PROTO_FILES}) ++ target_link_libraries (proto-objects PUBLIC protobuf::libprotobuf) ++ set (PROTO_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") ++ target_include_directories (proto-objects PUBLIC "$") ++ protobuf_generate ( ++ TARGET proto-objects ++ IMPORT_DIRS "${RESOURCES_DIR}" ++ PROTOC_OUT_DIR "${PROTO_BINARY_DIR}/phonenumbers" ++ ) ++endif () + + if (BUILD_GEOCODER) + # Geocoding data cpp file generation +@@ -267,9 +290,7 @@ set ( + "src/phonenumbers/base/strings/string_piece.cc" + "src/phonenumbers/default_logger.cc" + "src/phonenumbers/logger.cc" +- "src/phonenumbers/phonemetadata.pb.cc" # Generated by Protocol Buffers. + "src/phonenumbers/phonenumber.cc" +- "src/phonenumbers/phonenumber.pb.cc" # Generated by Protocol Buffers. + "src/phonenumbers/phonenumberutil.cc" + "src/phonenumbers/regex_based_matcher.cc" + "src/phonenumbers/regexp_cache.cc" +@@ -282,6 +303,10 @@ set ( + "src/phonenumbers/utf/unilib.cc" + ) + ++if (${Protobuf_VERSION} VERSION_LESS "3.21.0.0") ++ list (APPEND SOURCES ${PROTOBUF_OUTPUT}) ++endif () ++ + if (BUILD_GEOCODER) + set ( + GEOCODING_SOURCES +@@ -290,7 +315,6 @@ if (BUILD_GEOCODER) + "src/phonenumbers/geocoding/geocoding_data.cc" + "src/phonenumbers/geocoding/mapping_file_provider.cc" + "src/phonenumbers/geocoding/phonenumber_offline_geocoder.cc" +- "src/phonenumbers/phonenumber.pb.h" # Forces proto buffer generation. + ) + endif () + +@@ -450,6 +474,10 @@ if (APPLE) + list (APPEND LIBRARY_DEPS ${COREFOUNDATION_LIB} ${FOUNDATION_LIB}) + endif () + ++if (${Protobuf_VERSION} VERSION_GREATER_EQUAL "3.21.0.0") ++ list (APPEND LIBRARY_DEPS proto-objects) ++endif () ++ + #---------------------------------------------------------------- + # Build libraries + #---------------------------------------------------------------- +@@ -601,7 +629,11 @@ endif() + # Install built libraries + #---------------------------------------------------------------- + +-set (BUILT_LIBS) ++if (${Protobuf_VERSION} VERSION_GREATER_EQUAL "3.21.0.0") ++ set (BUILT_LIBS proto-objects) ++else () ++ set (BUILT_LIBS) ++endif () + set(targets_export_name "${PROJECT_NAME}-targets") + + if (BUILD_STATIC_LIB) +diff --git a/cpp/cmake/config.cmake.in b/cpp/cmake/config.cmake.in +index 05f915659e..b91ce98369 100644 +--- a/cpp/cmake/config.cmake.in ++++ b/cpp/cmake/config.cmake.in +@@ -2,8 +2,8 @@ + + include(CMakeFindDependencyMacro) + +-find_dependency(absl) +-find_dependency(Protobuf) ++find_dependency(absl CONFIG) ++find_dependency(Protobuf CONFIG) + + include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") + check_required_components("@PROJECT_NAME@") diff --git a/0001-Revert-Fix-typo-in-arguments-to-add_metadata_gen_tar.patch b/0001-Revert-Fix-typo-in-arguments-to-add_metadata_gen_tar.patch new file mode 100644 index 0000000..d5476a9 --- /dev/null +++ b/0001-Revert-Fix-typo-in-arguments-to-add_metadata_gen_tar.patch @@ -0,0 +1,27 @@ +From f5684c3a2c220fde377c277dbe7784afbc0013cb Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 14 Jun 2023 09:35:29 +0200 +Subject: [PATCH] Revert "Fix typo in arguments to add_metadata_gen_target() + (#2874)" + +This reverts commit 0ecc3d9af734d96d5b01cdf52f0ecdf848a33d68. +--- + cpp/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index bc331aa..5b7d2b2 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -394,7 +394,7 @@ add_metadata_gen_target ( + ${TEST_METADATA_TARGET} + "${RESOURCES_DIR}/PhoneNumberMetadataForTesting.xml" + "test_metadata" +- "test_metadata" ++ "metadata" + ) + list (APPEND TESTING_LIBRARY_SOURCES "src/phonenumbers/test_metadata.cc") + +-- +2.41.0 + diff --git a/0002-Avoid-intermediate-proto-object-library.patch b/0002-Avoid-intermediate-proto-object-library.patch new file mode 100644 index 0000000..0ba5145 --- /dev/null +++ b/0002-Avoid-intermediate-proto-object-library.patch @@ -0,0 +1,66 @@ +From 2f5789eeff639f0a533a898b729221076fe32334 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Thu, 22 Feb 2024 13:51:45 +0100 +Subject: [PATCH] Avoid intermediate proto-object library + +The use of proto-object breaks building shared libs and it doesn't make +sense to install it. Instead of TARGET, use generate_protobuf with OUT_VAR. +--- + cpp/CMakeLists.txt | 21 ++++----------------- + 1 file changed, 4 insertions(+), 17 deletions(-) + +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index e07679636..f37b29242 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -250,13 +250,10 @@ if (${Protobuf_VERSION} VERSION_LESS "3.21.0.0") + DEPENDS ${PROTO_FILES} + ) + else () +- set (PROTOBUF_OUTPUT "") +- add_library (proto-objects OBJECT ${PROTO_FILES}) +- target_link_libraries (proto-objects PUBLIC protobuf::libprotobuf) + set (PROTO_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") +- target_include_directories (proto-objects PUBLIC "$") + protobuf_generate ( +- TARGET proto-objects ++ PROTOS ${PROTO_FILES} ++ OUT_VAR PROTOBUF_OUTPUT + IMPORT_DIRS "${RESOURCES_DIR}" + PROTOC_OUT_DIR "${PROTO_BINARY_DIR}/phonenumbers" + ) +@@ -303,9 +300,7 @@ set ( + "src/phonenumbers/utf/unilib.cc" + ) + +-if (${Protobuf_VERSION} VERSION_LESS "3.21.0.0") +- list (APPEND SOURCES ${PROTOBUF_OUTPUT}) +-endif () ++list (APPEND SOURCES ${PROTOBUF_OUTPUT}) + + if (BUILD_GEOCODER) + set ( +@@ -474,10 +469,6 @@ if (APPLE) + list (APPEND LIBRARY_DEPS ${COREFOUNDATION_LIB} ${FOUNDATION_LIB}) + endif () + +-if (${Protobuf_VERSION} VERSION_GREATER_EQUAL "3.21.0.0") +- list (APPEND LIBRARY_DEPS proto-objects) +-endif () +- + #---------------------------------------------------------------- + # Build libraries + #---------------------------------------------------------------- +@@ -629,11 +620,7 @@ endif() + # Install built libraries + #---------------------------------------------------------------- + +-if (${Protobuf_VERSION} VERSION_GREATER_EQUAL "3.21.0.0") +- set (BUILT_LIBS proto-objects) +-else () +- set (BUILT_LIBS) +-endif () ++set (BUILT_LIBS) + set(targets_export_name "${PROJECT_NAME}-targets") + + if (BUILD_STATIC_LIB) diff --git a/_service b/_service new file mode 100644 index 0000000..79de92f --- /dev/null +++ b/_service @@ -0,0 +1,17 @@ + + + https://github.com/google/libphonenumber.git + git + v8.13.40 + @PARENT_TAG@ + v(.*) + + */java/* + + + + + *.tar + xz + + diff --git a/libphonenumber-8.13.30.obscpio b/libphonenumber-8.13.30.obscpio new file mode 100644 index 0000000..bc1dee6 --- /dev/null +++ b/libphonenumber-8.13.30.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3aff8ad9022cb70e1d6d413003d6478ca60f604f038d5c32863444f7694dcce7 +size 100088846 diff --git a/libphonenumber-8.13.40.obscpio b/libphonenumber-8.13.40.obscpio new file mode 100644 index 0000000..f474be0 --- /dev/null +++ b/libphonenumber-8.13.40.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06e249b561b85fc731e5ce29828afba0a339c269944369ea2e9f9582cdfb802b +size 97178126 diff --git a/libphonenumber.changes b/libphonenumber.changes new file mode 100644 index 0000000..bade206 --- /dev/null +++ b/libphonenumber.changes @@ -0,0 +1,100 @@ +------------------------------------------------------------------- +Fri Jul 5 06:17:16 UTC 2024 - Fabian Vogt + +- Update to version 8.13.40: + * Updated metadata +- Use mode="manual" in _service + +------------------------------------------------------------------- +Thu Feb 22 11:07:23 UTC 2024 - Antonio Larrosa + +- Update to version 8.13.30: + * Update alternate formatting data, phone metadata, geocoding + data, carrier data + * Updated / refreshed time zone meta data. + * New geocoding data +- Add patch submitted to upstream at gh#google/libphonenumber#3394 + to fix building with protobuf 3.25.1: + * 0001-Add-support-to-protobuf-3.25.1.patch +- Add patch submitted in gh#sergiomb2/libphonenumber#1 by + Fabian Vogt: + * 0002-Avoid-intermediate-proto-object-library.patch + +------------------------------------------------------------------- +Sun Oct 22 13:41:15 UTC 2023 - Andreas Stieger + +- Update to version 8.13.23: + * Updated phone metadata, carrier data, geocoding data, short + number metadata for a number of region and calling codes +- drop 0001-Build-with-C-17.patch now upstream + +------------------------------------------------------------------- +Mon Jun 26 09:00:14 UTC 2023 - Fabian Vogt + +- absl is also needed for using the -devel package + +------------------------------------------------------------------- +Fri Jun 23 06:14:07 UTC 2023 - Fabian Vogt + +- Update to version 8.13.15: + * Updated phone metadata for region code(s): BE, BF, IL, MN, NE, OM, SO, SV + * Updated carrier data for country calling code(s): + 226 (en), 227 (en), 252 (en), 351 (en), 968 (en), 972 (en) + +------------------------------------------------------------------- +Wed Jun 14 06:51:08 UTC 2023 - Fabian Vogt + +- Update to version 8.13.14: + * Many data changes + * Removal of unused leading_zero_possible proto field in + phonemetadata.proto and all generated code + * https://github.com/google/libphonenumber/blob/v8.13.14/release_notes.txt +- Depends on abseil now +- Turn metadata regeneration off explicitly, wasn't done previously + either. This allows dropping the java dependency. +- Add patches to fix building: + * 0001-Build-with-C-17.patch + * 0001-Revert-Fix-typo-in-arguments-to-add_metadata_gen_tar.patch +- protobuf got fixed, builds fine with 22 now + +------------------------------------------------------------------- +Tue Jun 13 16:03:57 UTC 2023 - Dirk Müller + +- prefer protobuf 21 as it is not compatible with v22 + +------------------------------------------------------------------- +Thu May 20 16:16:04 UTC 2021 - Andreas Stieger + +- Update to version 8.12.23: + * Updated phone metadata for region code(s): BF, CI, RW, SG, UG, US, UZ + * Updated short number metadata for region code(s): DZ + * New geocoding data for country calling code(s): 1572 (en) + * Updated geocoding data for country calling code(s): 225 (en) + * Updated carrier data for country calling code(s): + 65 (en), 225 (en), 226 (en), 250 (en), 256 (en), 998 (en) + * Updated / refreshed time zone meta data + +------------------------------------------------------------------- +Thu May 6 09:17:03 UTC 2021 - Fabian Vogt + +- Update to v8.12.22: + * See https://github.com/google/libphonenumber/blob/v8.12.22/release_notes.txt + +------------------------------------------------------------------- +Tue Sep 22 13:16:46 UTC 2020 - Fabian Vogt + +- Update to v8.12.10: + * See https://github.com/google/libphonenumber/blob/v8.12.10/release_notes.txt +- The upstream repo and tarball include binary .jar archives with legally + questionable content. Switch to a _service and exclude those. + +------------------------------------------------------------------- +Sat Sep 19 05:21:08 UTC 2020 - John Vandenberg + +- Update to v8.12.9 + * see https://github.com/google/libphonenumber/blob/v8.12.9/release_notes.txt + +------------------------------------------------------------------- +Wed Jul 24 08:27:42 UTC 2019 - Fabian Vogt + +- Initial commit for v8.10.15 diff --git a/libphonenumber.obsinfo b/libphonenumber.obsinfo new file mode 100644 index 0000000..cd135a3 --- /dev/null +++ b/libphonenumber.obsinfo @@ -0,0 +1,4 @@ +name: libphonenumber +version: 8.13.40 +mtime: 1719573751 +commit: 834474c954f0d5c04b2ab76b448070b65b58d746 diff --git a/libphonenumber.spec b/libphonenumber.spec new file mode 100644 index 0000000..cd33ab2 --- /dev/null +++ b/libphonenumber.spec @@ -0,0 +1,108 @@ +# +# spec file for package libphonenumber +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define lib_ver 8 +%define lib_ver2 8.13 +Name: libphonenumber +Version: 8.13.40 +Release: 0 +Summary: Library for parsing, formatting, and validating international phone numbers +License: Apache-2.0 +Group: Development/Libraries/C and C++ +URL: https://github.com/google/libphonenumber +Source: %{name}-%{version}.tar.xz +# PATCH-FIX-DOWNSTREAM (see https://github.com/google/libphonenumber/pull/2874) +Patch2: 0001-Revert-Fix-typo-in-arguments-to-add_metadata_gen_tar.patch +Patch3: 0001-Add-support-to-protobuf-3.25.1.patch +Patch4: 0002-Avoid-intermediate-proto-object-library.patch +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: libboost_date_time-devel >= 1.40.0 +BuildRequires: libboost_system-devel >= 1.40.0 +BuildRequires: libboost_thread-devel >= 1.40.0 +BuildRequires: pkgconfig +# Actual version requirement unknown +BuildRequires: cmake(absl) +BuildRequires: pkgconfig(gtest) +BuildRequires: pkgconfig(icu-i18n) >= 4.4 +BuildRequires: pkgconfig(icu-uc) >= 4.4 +BuildRequires: pkgconfig(protobuf) >= 2.4 + +%description +Google's common Java, C++ and JavaScript library for parsing, formatting, +and validating international phone numbers. + +%package -n %{name}%{lib_ver} +Summary: Library for parsing, formatting, and validating international phone numbers +Group: System/Libraries + +%description -n %{name}%{lib_ver} +Google's common Java, C++ and JavaScript library for parsing, formatting, +and validating international phone numbers. The Java version is optimized +for running on smartphones, and is used by the Android framework since 4.0 +(Ice Cream Sandwich). + +%package devel +Summary: Library for parsing, formatting, and validating international phone numbers +Group: Development/Libraries/C and C++ +Requires: %{name}%{lib_ver} = %{version} +Requires: cmake(absl) +Requires: pkgconfig(protobuf) >= 2.4 + +%description devel +Google's common Java, C++ and JavaScript library for parsing, formatting, +and validating international phone numbers. The Java version is optimized +for running on smartphones, and is used by the Android framework since 4.0 +(Ice Cream Sandwich). + +This package provides libraries and header files for developing applications +that use libphonenumber. + +%prep +%autosetup -p1 + +%build +cd cpp +# Enabling the geocoder breaks quite a lot due to broken cmakelists +# (https://github.com/google/libphonenumber/pull/2556) +%cmake -DBUILD_STATIC_LIB=OFF -DBUILD_SHARED_LIB=ON -DBUILD_TESTING=ON -DBUILD_GEOCODER=OFF -DREGENERATE_METADATA=OFF +%make_jobs + +%install +cd cpp +%cmake_install + +%check +cd cpp/build +%make_jobs tests + +%post -n %{name}%{lib_ver} -p /sbin/ldconfig +%postun -n %{name}%{lib_ver} -p /sbin/ldconfig + +%files -n %{name}%{lib_ver} +%license LICENSE* +%{_libdir}/libphonenumber.so.%{lib_ver} +%{_libdir}/libphonenumber.so.%{lib_ver2} + +%files devel +%{_libdir}/libphonenumber.so +%{_includedir}/phonenumbers/ +%dir %{_libdir}/cmake/ +%{_libdir}/cmake/libphonenumber/ + +%changelog