# -*- 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               compiler_blacklist_versions 1.0

name                    capnproto
version                 0.6.1
checksums               rmd160  0e8efcdb45e2d4da6d800d82bf7aa4e5225b3054 \
                        sha256  8082040cd8c3b93c0e4fc72f2799990c72fdcf21c2b5ecdae6611482a14f1a04

maintainers             cal openmaintainer
platforms               darwin
categories              devel

homepage                http://capnproto.org/
description             \
    Cap’n Proto is an insanely fast data interchange format and \
    capability-based RPC system. Think JSON, except binary. Or think Protocol \
    Buffers, except faster.
long_description        ${description}
license                 BSD

master_sites            ${homepage}
distname                ${name}-c++-${version}

use_autoreconf          yes

# clang 3.2 - clang-3.5 and all clangs from Xcode < 5 crash while compiling this.
# see http://llvm.org/bugs/show_bug.cgi?id=18340
compiler.blacklist-append \
                        {clang < 500.2.75} \
                        macports-clang-3.3 \
                        macports-clang-3.4 \
                        macports-clang-3.5 \
                        *gcc*

# The bundled libtool doesn't pass -stdlib to the linker, needs:
# http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=commit;h=c0c49f289f22ae670066657c60905986da3b555f
pre-configure {
    if {${configure.compiler} ne "clang" || [compiler_blacklist_versions._version_matches clang < 500.2.75]} {
        ui_error "capnproto will crash all compilers but clang from Xcode 5; please upgrade your Xcode installation."
        error "no suitable compiler"
    }
    system -W ${worksrcpath} "autoreconf -fvi"
}

configure.cppflags-replace \
                        -I${prefix}/include "-isystem ${prefix}/include"

configure.cxx_stdlib    libc++
if {[string match *clang* ${configure.cxx}]} {
    configure.ldflags-append    -stdlib=libc++
}

livecheck.type              regex
livecheck.url               http://capnproto.org/install.html
livecheck.regex             "[quotemeta ${name}]-c\\+\\+-(\\d+(\\.\\d+)*)[quotemeta ${extract.suffix}]"