PortSystem          1.0

name                sablotron
version             1.0.3
revision            3
categories          textproc
license             {MPL-1.1 GPL-2+}
maintainers         nomaintainer
homepage            http://sablotron.sourceforge.net/
description         XSLT, DOM and XPath processor
long_description    Sablotron is a fast, compact and portable XML toolkit \
    implementing XSLT 1.0, DOM Level2 and XPath 1.0. Sablotron is an open \
    project. The goal of this project is to create a \
    lightweight, reliable and fast XML library processor conforming to the W3C \
    specification, which is available for public and can be used as a base for \
    multi-platform XML applications.

platforms           darwin
distname            Sablot-${version}
master_sites        sourceforge

checksums           md5     72654c4b832e7562f8240ea675577f5e \
                    sha1    4e60a6aef32b661d7887b3ffd28339f47e2565e1 \
                    rmd160  bbf2b57d95efbe1fce0ba42813560df4dbde9e3a

depends_build       port:libtool

depends_lib         port:libiconv port:expat port:spidermonkey

# Unfortunately, we have to set an internal configure script variable to stop
# it auto-detecting whether or not to build the API documentation; no configure
# switch is provided.
configure.env       BUILD_APIDOCS=no
configure.args      --mandir=${prefix}/share/man --enable-javascript
configure.cppflags-append   -I${prefix}/include/js

post-configure {
    # Ensure -arch flags are also used when building the dynamic library;
    # fixes universal and non-default-build_arch builds.
    copy -force ${prefix}/bin/glibtool ${worksrcpath}/libtool
}

variant apidocs description {Install HTML documentation of Sablotron's API} {
    depends_build-append    path:bin/perl:perl5 port:p5-xml-parser
    configure.env-append    PERL_PROG=${prefix}/bin/perl
    configure.env-delete    BUILD_APIDOCS=no
    configure.env-append    BUILD_APIDOCS=yes
}
variant debugger description \
    {Enable XSLT debugger features; user must accept GPL on all of Sablotron} {
    # Strictly speaking, sablotron's debugger still works without readline, but
    # it's worth having the features that readline provides (like command-line
    # history) to keep users of the debugger sane :-)
    depends_lib-append      port:ncurses port:readline
    configure.args-append   --enable-debugger --with-readline
    configure.env-append    SABLOT_GPL=1
}
