SUMMARY="A Cloud Rendering Tool for Animation Production"
DESCRIPTION="KumoWorks is a software for making cloud scenery. \
It generates cloud image according to a silhouette you draw. \
We aim to develop a useful tool for creating background art or \
color script for animation production."
HOMEPAGE="https://opentoonz.github.io/e/download/kumoworks.html"
COPYRIGHT="Takumi Tanji"
LICENSE="BSD (3-clause)"
REVISION="1"
srcGitRev="2f9019afb85dd9709ad1bd42e49c1d9be3cc4b9d"
SOURCE_URI="https://github.com/opentoonz/kumoworks/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="306096728b5c37db40620c734942e2f24d6699a4ef496a00134c76691032dbae"
SOURCE_DIR="kumoworks-$srcGitRev"
PATCHES="kumoworks-$portVersion.patchset"
ADDITIONAL_FILES="kumoworks.rdef.in"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	kumoworks$secondaryArchSuffix = $portVersion
	app:KumoWorks$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfreetype$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:cmake
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake ../sources -DCMAKE_INSTALL_PREFIX=$appsDir/KumoWorks
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/KumoWorks/{config/ini,config/loc,licenses}
	cp build/KumoWorks $appsDir/KumoWorks
	cp misc/ini/cloudpreset.ini $appsDir/KumoWorks/config/ini
	cp misc/licenses/* $appsDir/KumoWorks/licenses
	cp sources/loc/* $appsDir/KumoWorks/config/loc

	local APP_SIGNATURE="application/x-vnd.kumoworks"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3 | cut -d~ -f1`"
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/kumoworks.rdef.in > kumoworks.rdef

	addResourcesToBinaries kumoworks.rdef $appsDir/KumoWorks/KumoWorks

	addAppDeskbarSymlink $appsDir/KumoWorks/KumoWorks
}
