127.13. libphonenumber-9.0.42
Google's library for parsing, formatting and validating international phone numbers (C++)
9.0.42-1 · Apache-2.0 AND BSD-3-Clause · 0.3 SBU · 1.3 MiB, 41 files · 41_system, 683 of 1047 · ports/core/i18n/libphonenumber
Homepage: https://github.com/google/libphonenumber
libphonenumber is Google’s library for parsing, formatting and validating international phone numbers, with the per-country metadata compiled in. This port builds the C++ library alone, from the cpp/ directory of a source tree that also holds the Java and JavaScript versions. Its consumer is kitinerary, which finds it through the CMake package libphonenumber and links libphonenumber::phonenumber-shared to read phone numbers out of booking confirmations.
Depends on: cmake, ninja, protobuf, abseil-cpp, icu.
Required by (1): kitinerary.
Sources: libphonenumber-9.0.42.tar.gz (12.4 MiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install libphonenumber'
build.sh:
cmake -S cpp -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_TESTING=OFF \
-D BUILD_GEOCODER=OFF \
-D REGENERATE_METADATA=OFF \
-D BUILD_STATIC_LIB=OFF \
-D USE_BOOST=OFF \
-D USE_STDMUTEX=ON \
-D CMAKE_REQUIRE_FIND_PACKAGE_absl=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
-D CMAKE_INSTALL_LIBDIR=lib— The project usesGNUInstallDirs, whose default on x86-64 islib64, which the package lint refuses.-D BUILD_GEOCODER=OFF— No offline geocoder (libgeocoding), which maps a number to a place name. Building it compiles a generator and a large data table of its own, and no consumer in the tree links it.-D REGENERATE_METADATA=OFF— Use the metadata already compiled into the source tree. Upstream’s default regenerates it from the XML with a Java tool, which needs a JDK at build time.-D BUILD_STATIC_LIB=OFF— Build the shared library only. Upstream builds a static archive from the same sources beside it; nothing in the tree links it statically, and the exported CMake targets then name onlyphonenumber-shared, the one kitinerary looks for first.-D USE_BOOST=OFF— Upstream’s default uses Boost’s threads and date-time for its locks. Off, with-D USE_STDMUTEX=ON, the library usesstd::mutexand links no Boost.-D USE_STDMUTEX=ON— The lock implementation once Boost is off: C++11std::mutex. With neither,lock.hfalls back to its POSIX threads implementation on Linux and the library links the threads library itself.-D CMAKE_REQUIRE_FIND_PACKAGE_absl=ON— Make the system Abseil from abseil-cpp a requirement.find_package(absl)is optional upstream, and when it fails the configure fetches Abseil withFetchContentfrom GitHub, which the offline build cannot reach.
Libraries: libphonenumber.so.
Directories: /usr/include/phonenumbers, /usr/lib/cmake/libphonenumber, /usr/share/licenses/libphonenumber.
protoc from protobuf generates phonemetadata.pb.cc and phonenumber.pb.cc during the build, and the installed headers include protobuf’s and Abseil’s, so both stay in depends for every consumer. The installed libphonenumber-config.cmake calls find_dependency(absl) and find_dependency(Protobuf) for the same reason. ICU’s icuuc and icui18n from icu are found with find_library and are required.
LICENSE.Chromium covers the few files under cpp/src/phonenumbers/base/ taken from Chromium (BSD-3-Clause); kpkg copies it with LICENSE.