# -*- 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
# $Id$

PortSystem          1.0
PortGroup           cmake 1.0
PortGroup           github 1.0

cmake.out_of_source yes

github.setup        googlei18n libphonenumber 7.7.3 libphonenumber-

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 openmaintainer
categories          devel
platforms           darwin

checksums           rmd160  c78c3df96bc701c41eda5b3ed161351a86b4bdc6 \
                    sha256  e5a8aecd93f113e1fa1d6662268197d515cd82662e7a6a430438341d7822a3f2

dist_subdir         ${name}/${version}_1
worksrcdir          ${worksrcdir}/cpp

set gtest_version   1.7.0
set gtest_dir       ${workpath}
set gtest_archive   v${gtest_version}.zip
set gtest_srcdir    ${gtest_dir}/gtest-${gtest_version}
set gtest_url       https://github.com/neloe/gtest/archive

post-extract {
    curl fetch ${gtest_url}/${gtest_archive} ${gtest_dir}/${gtest_archive}
    system "/usr/bin/unzip -d ${gtest_dir} ${gtest_dir}/${gtest_archive}"
}

patchfiles          patch-cpp-CMakeLists.txt.diff

depends_build-append \
                    port:pkgconfig

depends_lib-append  port:boost \
                    port:icu \
                    port:protobuf-cpp

configure.args-append \
                    -DGTEST_SOURCE_DIR=${gtest_srcdir} \
                    -DGTEST_INCLUDE_DIR=${gtest_srcdir}/include

platform darwin {
    if {${configure.cxx_stdlib} eq "libc++"} {
       configure.args-append \
                    -DUSE_STD_MAP=ON
    }
}

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