# -*- 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 106554 2013-05-30 23:03:55Z cal@macports.org $

PortSystem      1.0
PortGroup       cmake 1.0

name            zorba
version         2.2.0
revision        2
set branch      [join [lrange [split ${version} .] 0 1] .]
license         Apache-2
categories      textproc devel
platforms       darwin
maintainers     nomaintainer
description     The XQuery Processor

long_description \
    Zorba is a general purpose XQuery processor implementing in C++ the W3C \
    family of specifications. It is not an XML database. The query processor \
    has been designed to be embeddable in a variety of environments such as \
    other programming languages extended with XML processing capabilities, \
    browsers, database servers, XML message dispatchers, or smartphones. Its \
    architecture employes a modular design, which allows customizing the Zorba \
    query processor to the environment’s needs. In particular the architecture \
    of the query processor allows a pluggable XML store (e.g. main memory, DOM \
    stores, persistent disk-based large stores, S3 stores).

homepage        http://www.zorba-xquery.com/
master_sites    https://launchpad.net/zorba/trunk/${branch}/+download

checksums       rmd160  976147777830a883d6a459b818a67d3279540045 \
                sha256  124929aa0dbf2ec444667c83067b5b27921d8f8043dbdde83674b981c6fb244e

# In-source-builds are not allowed
configure.dir   ${worksrcpath}/build
build.dir       ${configure.dir}

post-extract {
    xinstall -d ${build.dir}
}

patchfiles      patch-docdir.diff \
                patch-src-types-schema-SchemaValidatorFilter.h.diff

depends_build-append \
    port:bison \
    port:flex

depends_lib \
    port:boost \
    port:curl \
    port:icu \
    port:libiconv \
    port:libxml2 \
    port:libxslt \
    port:xercesc3 \
    port:tidy

configure.post_args ..
configure.args-append \
    -DCURL_FOUND=YES \
    -DCURL_INCLUDE_DIR=${prefix}/include \
    -DCURL_LIBRARY=${prefix}/lib/libcurl.dylib \
    -DZORBA_SUPPRESS_SWIG=YES \
    -DZORBA_XQUERYX=YES

test.env DYLD_LIBRARY_PATH=${worksrcpath}/src
test.run yes

livecheck.type  regex
livecheck.url   https://launchpad.net/zorba/+download
livecheck.regex zorba-(\[0-9.\]+)${extract.suffix}
