libphonenumber, new recipe (#13236)

optional requirement for newer kitinerary
This commit is contained in:
Schrijvers Luc
2025-11-19 17:27:15 +01:00
committed by GitHub
parent 40a27d8cc3
commit 991f3c8da2
2 changed files with 254 additions and 0 deletions

View File

@@ -0,0 +1,95 @@
SUMMARY="Library for parsing, formatting, and validating international phone numbers"
DESCRIPTION="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)."
HOMEPAGE="https://github.com/google/libphonenumber"
COPYRIGHT="2014 The Chromium Authors"
LICENSE="Apache v2"
REVISION="1"
SOURCE_URI="https://github.com/google/libphonenumber/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="fdcf2677367b93595d3c7ccbbd58e8e086bbdd5fd58bc01400b445786f9544f7"
PATCHES="libphonenumber-$portVersion.patchset"
ARCHITECTURES="?all ?x86_gcc2"
SECONDARY_ARCHITECTURES="?x86"
libVersion="9.0"
libVersionCompat="$libVersion compat >= ${libVersion%.*}"
PROVIDES="
libphonenumber$secondaryArchSuffix = $portVersion
lib:libgeocoding$secondaryArchSuffix = $libVersionCompat
lib:libphonenumber$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libabsl_base$secondaryArchSuffix # don't list all abseil libraries
lib:libboost_date_time$secondaryArchSuffix
lib:libboost_system$secondaryArchSuffix
lib:libboost_thread$secondaryArchSuffix
lib:libgtest$secondaryArchSuffix
lib:libicuuc$secondaryArchSuffix
lib:libicui18n$secondaryArchSuffix
lib:libprotobuf$secondaryArchSuffix
"
PROVIDES_devel="
libphonenumber${secondaryArchSuffix}_devel = $portVersion
devel:libgeocoding$secondaryArchSuffix = $libVersionCompat
devel:libphonenumber$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
libphonenumber$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libabsl_base$secondaryArchSuffix >= 2301.0.0
devel:libboost_system$secondaryArchSuffix >= 1.88.0
devel:libgtest$secondaryArchSuffix
devel:libicuuc$secondaryArchSuffix >= 74
devel:libicui18n$secondaryArchSuffix >= 74
devel:libprotobuf$secondaryArchSuffix >= 31
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:javac
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
defineDebugInfoPackage libphonenumber$secondaryArchSuffix \
"$libDir"/libgeocoding.so.$libVersion \
"$libDir"/libphonenumber.so.$libVersion
BUILD()
{
cmake -B build -S cpp -DCMAKE_BUILD_TYPE=RelWWithDebInfo \
$cmakeDirArgs \
-DBUILD_STATIC_LIB=OFF \
-DUSE_STDMUTEX=ON \
-DBUILD_TESTING=OFF \
-Wno-dev
make -C build $jobArgs
}
INSTALL()
{
make -C build install
prepareInstalledDevelLibs \
libgeocoding \
libphonenumber
fixPkgconfig
packageEntries devel \
$developDir \
$libDir/cmake
}
TEST()
{
cmake --build build --target tests
}

View File

@@ -0,0 +1,159 @@
From 0144b83711aa1736ae31183b197f8cd72d53781b Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Wed, 8 Oct 2025 19:54:16 +0200
Subject: Fix BUILD_STATIC_LIB=OFF
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 27e4680..6924469 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -593,7 +593,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.51.0
From 08a7e30eed10ae9e320fd8e02c18980be9536810 Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
Date: Wed, 19 Nov 2025 10:13:09 +0100
Subject: Fix includedir
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 6924469..65377c6 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -458,12 +458,12 @@ if (BUILD_STATIC_LIB)
# Build a static library (without -fPIC).
add_library (phonenumber STATIC ${SOURCES})
target_link_libraries (phonenumber ${LIBRARY_DEPS})
- target_include_directories(phonenumber PUBLIC $<INSTALL_INTERFACE:include>)
+ target_include_directories(phonenumber PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
if (BUILD_GEOCODER)
add_library (geocoding STATIC ${GEOCODING_SOURCES})
target_link_libraries (geocoding ${LIBRARY_DEPS})
- target_include_directories(geocoding PUBLIC $<INSTALL_INTERFACE:include>)
+ target_include_directories(geocoding PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
add_dependencies (geocoding generate_geocoding_data)
add_dependencies (phonenumber generate_geocoding_data)
endif ()
@@ -478,7 +478,7 @@ if (BUILD_SHARED_LIBS)
# Build a shared library (with -fPIC).
add_library (phonenumber-shared SHARED ${SOURCES})
target_link_libraries (phonenumber-shared ${LIBRARY_DEPS})
- target_include_directories(phonenumber-shared PUBLIC $<INSTALL_INTERFACE:include>)
+ target_include_directories(phonenumber-shared PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
set_target_properties (phonenumber-shared
PROPERTIES
@@ -494,7 +494,7 @@ if (BUILD_SHARED_LIBS)
if (BUILD_GEOCODER)
add_library (geocoding-shared SHARED ${GEOCODING_SOURCES})
target_link_libraries (geocoding-shared ${LIBRARY_DEPS})
- target_include_directories(geocoding-shared PUBLIC $<INSTALL_INTERFACE:include>)
+ target_include_directories(geocoding-shared PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
add_dependencies (geocoding-shared generate_geocoding_data)
add_dependencies (phonenumber-shared generate_geocoding_data)
@@ -593,7 +593,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-shared phonenumber-shared)
+ target_link_libraries (geocoding_test_program geocoding-shared phonenumber-shared )
endif ()
endif()
@@ -641,11 +641,11 @@ install (FILES
"src/phonenumbers/region_code.h"
"src/phonenumbers/shortnumberinfo.h"
"src/phonenumbers/unicodestring.h"
- DESTINATION include/phonenumbers/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/phonenumbers/
)
install (FILES "src/phonenumbers/utf/unicodetext.h"
- DESTINATION include/phonenumbers/utf/)
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/phonenumbers/utf/)
if (USE_ICU_REGEXP)
# Install the phone number matcher headers.
@@ -653,14 +653,14 @@ if (USE_ICU_REGEXP)
"src/phonenumbers/phonenumbermatch.h"
"src/phonenumbers/phonenumbermatcher.h"
"src/phonenumbers/regexp_adapter.h"
- DESTINATION include/phonenumbers/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/phonenumbers/
)
endif ()
if (BUILD_GEOCODER)
install (FILES
"src/phonenumbers/geocoding/phonenumber_offline_geocoder.h"
- DESTINATION include/phonenumbers/geocoding
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/phonenumbers/geocoding
)
endif ()
@@ -670,7 +670,7 @@ install (
"src/phonenumbers/base/template_util.h"
"src/phonenumbers/base/logging.h"
"src/phonenumbers/base/thread_checker.h"
- DESTINATION include/phonenumbers/base/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/phonenumbers/base/
)
install (FILES
@@ -681,7 +681,7 @@ install (FILES
"src/phonenumbers/base/memory/singleton_stdmutex.h"
"src/phonenumbers/base/memory/singleton_unsafe.h"
"src/phonenumbers/base/memory/singleton_win32.h"
- DESTINATION include/phonenumbers/base/memory/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/phonenumbers/base/memory/
)
install (FILES
@@ -691,7 +691,7 @@ install (FILES
"src/phonenumbers/base/synchronization/lock_stdmutex.h"
"src/phonenumbers/base/synchronization/lock_unsafe.h"
"src/phonenumbers/base/synchronization/lock_win32.h"
- DESTINATION include/phonenumbers/base/synchronization/)
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/phonenumbers/base/synchronization/)
#----------------------------------------------------------------
# Build and install cmake config files
--
2.51.0
From c54fe25316b9e5efb355014250384901477740df Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
Date: Wed, 19 Nov 2025 12:52:49 +0100
Subject: Fix for building with boost
diff --git a/cpp/src/phonenumbers/base/thread_checker.h b/cpp/src/phonenumbers/base/thread_checker.h
index 6679d9b..7dd83d0 100644
--- a/cpp/src/phonenumbers/base/thread_checker.h
+++ b/cpp/src/phonenumbers/base/thread_checker.h
@@ -25,7 +25,7 @@
#if !defined(__linux__) && !defined(__APPLE__) && !defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD) && \
!defined(I18N_PHONENUMBERS_NO_THREAD_SAFETY) && \
!((__cplusplus >= 201103L) && defined(I18N_PHONENUMBERS_USE_STDMUTEX)) && \
- !defined(WIN32)
+ !defined(WIN32) && !defined(__HAIKU__)
#error Building without Boost, please provide \
-DI18N_PHONENUMBERS_NO_THREAD_SAFETY
#endif
--
2.51.0