SUMMARY="Small C++ XML Parser"
DESCRIPTION="
Tinyxml is a small simple, OS independent XML parser for the C++ language. \
It is a free open source software. Timyxml was first created to solve the common \
text I/O file problem. It parses the XML into a DOM-like tree and is able to \
read and write XML files. It allows you to create your own document mark-ups \
or even construct an XML document from scratch with C++ objects."
HOMEPAGE="http://www.grinninglizard.com/tinyxml/index.html"
COPYRIGHT="2001-2010 Lee Thomason"
LICENSE="Zlib"
SOURCE_URI="http://sourceforge.net/projects/tinyxml/files/tinyxml/$portVersion/tinyxml_2_6_2.tar.gz"
CHECKSUM_SHA256="15bdfdcec58a7da30adc87ac2b078e4417dbe5392f3afb719f9ba6d062645593"
SOURCE_URI_2="http://libtinyxml.googlecode.com/svn/trunk/CMakeLists.txt#noarchive"
CHECKSUM_SHA256_2="12a412abedaf30fff9c75273c1ac7239a7b4b59dd34bdadedd913a9717a3a105"
REVISION="2"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	tinyxml$secondaryArchSuffix = $portVersion compat >= 2
	lib:libtinyxml$secondaryArchSuffix = $portVersion compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	REQUIRES+="
		lib:libgcc_s$secondaryArchSuffix
	"
fi

BUILD_REQUIRES="
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:grep
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:sed
	"
	
SOURCE_DIR="tinyxml"

BUILD()
{
	cp ../../sources-2/CMakeLists.txt ./
	sed -i 's/GLOB_RECURSE/GLOB/' CMakeLists.txt
	cmake -DCMAKE_INSTALL_PREFIX:PATH=$prefix
	make $jobArgs
}

INSTALL()
{
	make install
	
	# move headers to the correct location
	mkdir -p $includeDir $libDir	
	mv $prefix/include/* $includeDir
	[ "$prefix/lib" != "$libDir" ] && mv $prefix/lib/*.so $libDir
	rmdir $prefix/include/
	
	prepareInstalledDevelLibs libtinyxml

	# devel package
	packageEntries devel \
		$developDir
}

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	tinyxml${secondaryArchSuffix}_devel = $portVersion compat >= 2
	devel:libtinyxml${secondaryArchSuffix} = $portVersion compat >= 2
	"
REQUIRES_devel="
	tinyxml${secondaryArchSuffix} == $portVersion base
	"
