SUMMARY="A Qt-based library that maps JSON data to QVariant objects"
DESCRIPTION="JSON (JavaScript Object Notation) is a lightweight data-\
interchange format. It can represents integer, real number, string, an \
ordered sequence of value, and a collection of name/value pairs.

QJson is a Qt-based library that maps JSON data to QVariant objects. \
JSON arrays will be mapped to QVariantList instances, while JSON's objects \
will be mapped to QVariantMap.
"
HOMEPAGE="http://qjson.sourceforge.net/"
SOURCE_URI="https://github.com/flavio/qjson/archive/0.8.1.tar.gz"
CHECKSUM_SHA256="920c94166cb91b1cf11c7d2745bdbcc8c0ea82411ca7b3732ce0b00ee2d56e98"
SOURCE_DIR="qjson-$portVersion"
REVISION="1"
LICENSE="GNU LGPL v2.1"
COPYRIGHT="2008 Flavio Castelli"
ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi

SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	qjson${secondaryArchSuffix} = $portVersion
	lib:libqjson$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	libqt4${secondaryArchSuffix} >= 4.8
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:make
	cmd:g++${secondaryArchSuffix}
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel >= 4.8
	"
PROVIDES_devel="
	qjson${secondaryArchSuffix}_devel = $portVersion
	devel:libqjson$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	libqt4${secondaryArchSuffix}_devel >= 4.8
	qjson${secondaryArchSuffix} == $portVersion base
	"

BUILD()
{		
	cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE=Release
	make $jobArgs
}

INSTALL()
{
	make install
	
	# clean up after CMake
	mkdir -p $includeDir/qjson/
	mv $prefix/include/qjson/* $includeDir/qjson/
	rm -rf $prefix/include/
	
	mkdir -p $dataDir/cmake/Modules/
	mv $prefix/lib/cmake/qjson/* $dataDir/cmake/Modules/
	rm -rf $prefix/lib/cmake/
	
	mkdir -p $developLibDir/pkgconfig/
	mv $prefix/lib/pkgconfig/* $developLibDir/pkgconfig/
	rm -rf $prefix/lib/pkgconfig/
	
	mkdir -p $libDir
	mv $prefix/lib/*.so* $libDir
	
	prepareInstalledDevelLibs \
		libqjson
	packageEntries devel \
		$developDir \
		$dataDir/cmake/
}
