# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           cmake 1.1
PortGroup           github 1.0
PortGroup           boost 1.0
PortGroup           legacysupport 1.1

boost.version       1.81

github.setup        googlei18n libphonenumber 8.13.49 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2
name                libphonenumber-cpp
license             Apache-2
description         Google's C++ library for parsing, formatting, storing \
                    and validating international phone numbers.
long_description    {*}${description}
maintainers         {devans @dbevans} openmaintainer
categories          devel

checksums           rmd160  d60561108306cc273b258f737ab5e7f040f533fb \
                    sha256  5caaa08b65c2d8076b00ae4f8c30c563b825f422e1b80ca7603ed5d4c112980a \
                    size    12932625

worksrcdir          google-libphonenumber-39a5b86/cpp

set gtest_srcdir    ${prefix}/src/googletest

depends_build-append \
                    port:gtest \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:abseil \
                    path:lib/pkgconfig/icu-uc.pc:icu \
                    port:protobuf3-cpp

configure.args-append \
                    -DABSL_PROPAGATE_CXX_STD=ON \
                    -DBUILD_TESTING=OFF \
                    -DGTEST_SOURCE_DIR=${gtest_srcdir} \
                    -DGTEST_INCLUDE_DIR=${gtest_srcdir}/include \
                    -DREGENERATE_METADATA=OFF \
                    -DUSE_STD_MAP=ON

compiler.cxx_standard       2017
configure.cxxflags-append   -std=c++17

# force protobuf3-cpp into the no_threadlocal mode on older systems
if { ${os.platform} eq "darwin" && ${os.major} < 11 } {
    configure.cppflags-append \
                    -DGOOGLE_PROTOBUF_NO_THREADLOCAL
}

test.run            yes
test.cmd            ./libphonenumber_test
test.target
