SUMMARY="D-Bus Menu library for Qt"
DESCRIPTION="This library provides a Qt implementation of the DBusMenu \
protocol. The DBusMenu protocol makes it possible for applications to \
export and import their menus over DBus."
HOMEPAGE="https://launchpad.net/libdbusmenu-qt"
SOURCE_URI="https://launchpad.net/libdbusmenu-qt/trunk/0.9.2/+download/libdbusmenu-qt-0.9.2.tar.bz2"
CHECKSUM_SHA256="ae6c1cb6da3c683aefed39df3e859537a31d80caa04f3023315ff09e5e8919ec"
SOURCE_DIR="libdbusmenu-qt-$portVersion"
REVISION="1"
LICENSE="GNU LGPL v2.1"
COPYRIGHT="2009 Canonical"
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="
	libdbusmenu_qt${secondaryArchSuffix} = $portVersion
	lib:libdbusmenu_qt$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	libqt4${secondaryArchSuffix} >= 4.8
	lib:libqjson$secondaryArchSuffix
	lib:libdbus_1$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:pkg_config$secondaryArchSuffix
	cmd:make
	cmd:g++${secondaryArchSuffix}
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel >= 4.8
	devel:libqjson$secondaryArchSuffix
	devel:libdbus_1$secondaryArchSuffix
	"
	
PROVIDES_devel="
	libdbusmenu_qt${secondaryArchSuffix}_devel = $portVersion
	devel:libdbusmenu_qt$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	libqt4${secondaryArchSuffix}_devel >= 4.8
	libdbusmenu_qt${secondaryArchSuffix} == $portVersion base
	"

BUILD()
{		
	cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE=Release \
		-Wno-dev -DWITH_DOC=Off
	make $jobArgs
}

INSTALL()
{
	make install
	
	# clean up after CMake
	mkdir -p $includeDir/dbusmenu-qt/
	rm -rf $prefix/include/dbusmenu-qt/CMakeFiles/
	mv $prefix/include/dbusmenu-qt/* $includeDir/dbusmenu-qt/
	rm -rf $prefix/include/
	
	mkdir -p $developLibDir/pkgconfig/
	mv $prefix/lib/pkgconfig/* $developLibDir/pkgconfig/
	rm -rf $prefix/lib/pkgconfig/
	
	mkdir -p $libDir
	mv $prefix/lib/*.so* $libDir
	
	prepareInstalledDevelLibs \
		libdbusmenu-qt
	packageEntries devel \
		$developDir
}
