# $Id: Portfile 50984 2009-05-14 21:08:43Z and.damore@macports.org $

PortSystem 1.0
name			xercesc
version			2.8.0
revision		1
categories		textproc
maintainers		isode.com:chris.ridd
description		an XML parser
long_description	Xerces-C++ is a validating XML parser written in \
			a portable subset of C++.  Xerces-C++ makes it \
			easy to give your application the ability to read \
			and write XML data.  A shared library is provided \
			for parsing, generating, manipulating, and \
			validating XML documents.
homepage		http://xerces.apache.org/xerces-c/
master_sites		apache:xerces/c/2/sources/
distname		xerces-c-src_[strsed ${version} {g/\./_/}]
checksums		md5 5daf514b73f3e0de9e3fce704387c0d2
platforms		darwin

configure.dir		${worksrcpath}/src/xercesc
configure.env		XERCESCROOT=${worksrcpath}
configure.pre_args	-P "${prefix}"
configure.cmd		./runConfigure

build.dir		${worksrcpath}/src/xercesc
build.env		${configure.env}
build.type		gnu

platform darwin	{
	configure.pre_args-append	-p macosx -n native
}

platform darwin 8 {
	configure.pre_args-append	-c /usr/bin/gcc-4.0 -x /usr/bin/g++-4.0
}

post-build {
	xinstall -m 755 -W ${filespath} makestatic.sh.in ${build.dir}/makestatic.sh
	reinplace s|@CXX@|${configure.cxx}| ${build.dir}/makestatic.sh
	system "cd ${build.dir} && ${build.env} ./makestatic.sh"
}

destroot.env		${configure.env}

post-destroot	{
	xinstall ${worksrcpath}/lib/libxerces-c.a ${destroot}${prefix}/lib
	system "ranlib ${destroot}${prefix}/lib/libxerces-c.a"
	
	xinstall -d -m 755 ${destroot}${prefix}/share/doc
	file copy ${worksrcpath}/doc/html ${destroot}${prefix}/share/doc/${name}
	xinstall -m 644 -W ${worksrcpath} version.incl LICENSE.txt Readme.html \
		credits.txt ${destroot}${prefix}/share/doc/${name}
}
