# $Id: Portfile 56061 2009-08-24 00:33:19Z ryandesign@macports.org $

PortSystem 1.0
name              xmlwrapp
version           0.5.0
revision          3
categories        devel
platforms         darwin
maintainers       stechert openmaintainer
description       xmlwrapp is a modern style C++ library for working with XML data
long_description  xmlwrapp is a modern style C++ library for working with XML data. \
                  It provides a simple and easy to use interface for the very \
                  powerful libxml2 XML parser and the libxslt XSLT engine.  It used \
		  to be hosted at pmade.org, but the author no longer wants to support \
		  his work, so it's now hosted at sourceforge.  This Portfile also \
		  installs libxsltwrapp which is part of the xmlwrapp package.
homepage          http://sourceforge.net/project/showfiles.php?group_id=142403
master_sites      sourceforge
extract.suffix    .tgz
depends_build     bin:perl5:perl5
depends_lib       lib:libxml2:libxml2 \
                  bin:xml2-config:libxml2 \
                  lib:libxslt:libxslt \
                  bin:xslt-config:libxslt
checksums         md5 99ba63b283762e749e1663014e5cb0fd

patch.pre_args    -p1
patchfiles        patch-mkmf

configure.cppflags-append	"-I${prefix}/include/libxml2"

configure {
	system "cd ${worksrcpath} && perl configure.pl --xml2-config=${prefix}/bin/xml2-config --xslt-config=${prefix}/bin/xslt-config --prefix=${prefix}"

	reinplace "s#POST_LDFLAGS=#POST_LDFLAGS=-L${prefix}/lib -lxml2 -lz -lpthread -liconv -lm -lxslt#" ${worksrcpath}/src/libxml/Makefile
	reinplace "s#libxmlwrapp.so#libxmlwrapp.dylib#g" ${worksrcpath}/src/libxml/Makefile

	reinplace "s#POST_LDFLAGS=#POST_LDFLAGS=-L${prefix}/lib -lxml2 -lz -lpthread -liconv -lm -lxslt -lexslt -L../libxml -lxmlwrapp#" ${worksrcpath}/src/libxslt/Makefile
	reinplace "s#libxsltwrapp.so#libxsltwrapp.dylib#g" ${worksrcpath}/src/libxslt/Makefile

	reinplace "s#libxmlwrapp.so.5#libxmlwrapp.5.dylib#g" ${worksrcpath}/Makefile
	reinplace "s#libxmlwrapp.so#libxmlwrapp.dylib#g" ${worksrcpath}/Makefile

	reinplace "s#libxsltwrapp.so.2#libxsltwrapp.2.dylib#g" ${worksrcpath}/Makefile
	reinplace "s#libxsltwrapp.so#libxsltwrapp.dylib#g" ${worksrcpath}/Makefile
}
