# $Id: Portfile,v 1.4 2006/01/27 08:04:37 olegb Exp $

PortSystem 1.0
name              xmlwrapp
version           0.5.0
revision          3
categories        devel
maintainers       andre@splunk.com
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.8
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.env \
	CPPFLAGS="-I${prefix}/include -I${prefix}/include/libxml2"

configure {
	cd ${worksrcpath}

	system "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#" src/libxml/Makefile
	reinplace "s#libxmlwrapp.so#libxmlwrapp.dylib#g" src/libxml/Makefile

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

	reinplace "s#libxmlwrapp.so.5#libxmlwrapp.5.dylib#g" Makefile
	reinplace "s#libxmlwrapp.so#libxmlwrapp.dylib#g" Makefile

	reinplace "s#libxsltwrapp.so.2#libxsltwrapp.2.dylib#g" Makefile
	reinplace "s#libxsltwrapp.so#libxsltwrapp.dylib#g" Makefile
}
