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

PortSystem      1.0
PortGroup       github 1.0

name            protobuf2-cpp
version         2.6.1
revision        1
github.setup    google protobuf ${version} v
github.tarball_from releases

categories      devel
license         BSD
maintainers     {mascguy @mascguy} openmaintainer

description     Encode data in an efficient yet extensible format.
long_description \
                Google Protocol Buffers are a flexible, efficient, \
                automated mechanism for serializing structured data -- \
                think XML, but smaller, faster, and simpler.  You \
                define how you want your data to be structured once, \
                then you can use special generated source code to \
                easily write and read your structured data to and from \
                a variety of data streams and using a variety of \
                languages.  You can even update your data structure \
                without breaking deployed programs that are compiled \
                against the "old" format.  You specify how you want \
                the information you're serializing to be structured by \
                defining protocol buffer message types in .proto \
                files.  Each protocol buffer message is a small \
                logical record of information, containing a series of \
                name-value pairs.
homepage        https://github.com/google/protobuf

distname        protobuf-${version}
dist_subdir     protobuf-cpp
worksrcdir      protobuf-${version}
use_bzip2       yes

checksums       rmd160  654acfce84b4ba738a0332d0c967d1399ff6e4c2 \
                sha256  ee445612d544d885ae240ffbcbf9267faa9f593b7b101f21d58beceb92661910 \
                size    2021416

depends_lib-append \
                port:zlib

# 2.6.1's glibtool doesn't pass -stdlib=libc++ to the linker
use_autoreconf  yes
autoreconf.args -fvi

configure.cflags-append     -g
configure.cppflags-append   -g
configure.args-append       --prefix=${prefix}/libexec/${name}

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}

    xinstall -d ${docdir}

    foreach f {CHANGES.txt CONTRIBUTORS.txt INSTALL.txt LICENSE README.md editors examples} {
        copy ${worksrcpath}/${f} ${docdir}
    }
}

test.run    yes
test.cmd    "ulimit -c 0; make"
test.target check
