SUMMARY="Marble is a virtual globe and world atlas"
DESCRIPTION="
Marble is a geographical atlas and a virtual globe which lets you \
quickly explore places on our home planet.

You can use Marble to look up addresses, to easily create maps, \
measure distances and to retrieve detail information about locations \
that you have just heard about in the news or on the Internet.

The user interface is clean, simple and easy to use."

HOMEPAGE="http://marble.kde.org"
SOURCE_URI="git://anongit.kde.org/marble#9e116170"
REVISION="1"
LICENSE="GNU LGPL v2.1"
COPYRIGHT="2007-2014 by the authors of Marble Virtual Globe"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	marble$secondaryArchSuffix = $portVersion
	app:Marble$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku${secondaryArchSuffix}
	libqt4$secondaryArchSuffix >= 4.8.0
	lib:libstdc++$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:qmake$secondaryArchSuffix
	cmd:make
	cmd:g++$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:cmake
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel >= 4.8.0
	"

PATCHES="marble_x86-1.9.2.patchset"

BUILD()
{
	mkdir -p build
	cd build

	cmake -DCMAKE_BUILD_TYPE=Release \
		-DQTONLY=TRUE \
		-DWITH_DESIGNER_PLUGIN=FALSE \
		-DCMAKE_INSTALL_PREFIX=$appsDir/Marble \
		-DMARBLE_DATA_PATH=$appsDir/Marble/data \
		..
	# Disable Phonon
	echo "#undef HAVE_PHONON" > src/lib/marble/config-phonon.h
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	mv $appsDir/Marble/bin/marble-qt $appsDir/Marble/Marble

	rm -rf $appsDir/Marble/bin
	rm -rf $appsDir/Marble/include
	rm -rf $appsDir/Marble/share

	addResourcesToBinaries ../haiku/marble.rdef $appsDir/Marble/Marble

	addAppDeskbarSymlink $appsDir/Marble/Marble "Marble"
}
