# $Id: Portfile 57758 2009-09-16 07:48:28Z ryandesign@macports.org $

PortSystem          1.0
name                expat
version             2.0.1
categories          textproc devel
maintainers         ryandesign
license             MIT
description         XML 1.0 parser written in C
long_description    Expat is an XML parser library written in C. It is a \
                        stream-oriented parser in which an application \
                        registers handlers for things the parser might find \
                        in the XML document (like start tags). 
platforms           darwin freebsd
homepage            http://expat.sourceforge.net/
master_sites        sourceforge
use_parallel_build  yes

checksums \
	md5 ee8b492592568805593f81f8cdf2a04c \
	sha1 663548c37b996082db1f2f2c32af060d7aa15c2d \
	rmd160 d31bcb152adaff9e358968be1ea901e1b4ed3b2f

configure.args      --mandir=${prefix}/share/man
build.type          gnu

set docdir          ${prefix}/share/doc/${name}-${version}

pre-test {
    copy -force ${worksrcpath}/lib/expat.h ${worksrcpath}/lib/expat_external.h ${worksrcpath}/tests
}
# extract from tests/README.txt: "Expat must be built and installed 
# before "make check" can be executed."
test.run            yes
test.target         check

post-destroot {
    xinstall -m 0755 -d ${destroot}${docdir}/html
    xinstall -m 0644 -W ${worksrcpath} COPYING Changes README ${destroot}${docdir}
    eval xinstall -m 0644 [glob ${worksrcpath}/doc/*] ${destroot}${docdir}/html

    system "cd ${destroot}${prefix}/lib &&
    ln -s libexpat.1.dylib libexpat.0.dylib"
}

variant examples description {Install examples} {
    post-destroot {
        set examplesdir ${docdir}/examples
        xinstall -m 0755 -d ${destroot}${examplesdir}
        xinstall -m 0644 -W ${worksrcpath}/examples elements.c outline.c \
            ${destroot}${examplesdir}
    }
}

livecheck.type      sourceforge
