# -*- 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
# $Id: Portfile 107444 2013-06-29 12:11:26Z hum@macports.org $

PortSystem          1.0

name                re2
version             20130622
categories          devel textproc
maintainers         hum openmaintainer

description         an efficient, principled regular expression library

long_description    RE2 is a fast, safe, thread-friendly alternative to \
                    backtracking regular expression engines like those \
                    used in PCRE, Perl, and Python. It is a C++ library.

homepage            http://code.google.com/p/re2/
platforms           darwin
license             BSD

master_sites        googlecode
checksums           rmd160  4327e5f8c84c92b04de59a05fa4f4adb0fc7f8cb \
                    sha256  eee28bac36d47df9b0b62cf0959cb919fc23389431e26d5ee44b42c35e36fb0d

extract.suffix      .tgz

worksrcdir          ${name}

patchfiles          patch-Makefile.diff

post-patch {
    reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/Makefile
}

use_configure       no

variant universal   {}

build.args          CXX="${configure.cxx}" \
                    CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \
                    LDFLAGS="${configure.ldflags} [get_canonical_archflags cxx]"

post-destroot {
    set libpath ${prefix}/lib/libre2.0.dylib
    system "install_name_tool -id ${libpath} ${destroot}${libpath}"
    # install additional documents.
    set docdir ${prefix}/share/doc/re2
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS CONTRIBUTORS LICENSE README doc/syntax.html doc/syntax.txt \
        ${destroot}${docdir}
}
