SUMMARY="Open-source Japanese dictionary and kanji lookup tool"
DESCRIPTION="Tagaini Jisho is a free, open-source Japanese dictionary and \
kanji lookup tool that is available for Windows, MacOS X and Linux and aims \
at becoming your Japanese study assistant. It allows you to quickly search \
for entries and mark those that you wish to study, along with tags and \
personal notes. It also lets you train entries you are studying and follows \
your progression in remembering them. Finally, it makes it easy to review \
entries you did not remember by listing them on screen or printing them on a \
small booklet. Tagaini Jisho also features complete stroke order animations \
for more than 6000 kanji."
HOMEPAGE="https://www.tagaini.net/"
COPYRIGHT="2008-2013 Alexandre Courbot"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="dde2ad85dc6dc47ac7862e728878a7c8d9d4faf6"
SOURCE_URI="https://github.com/Gnurou/tagainijisho/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="587eb6f5343fd0f88a786937d2850d944685c405077bdb08dcde1e59108d45cd"
SOURCE_FILENAME="tagainijisho-$portVersion.tar.gz"
SOURCE_DIR="tagainijisho-$srcGitRev"
PATCHES="tagainijisho-$portVersion.patchset"
ADDITIONAL_FILES="tagainijisho.rdef.in"

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

PROVIDES="
	tagainijisho$secondaryArchSuffix = $portVersion
	app:TagainiJisho$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:gunzip
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. -DCMAKE_INSTALL_PREFIX:PATH="$appsDir/TagainiJisho"
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	mv $appsDir/TagainiJisho/bin/tagainijisho \
		$appsDir/TagainiJisho/TagainiJisho
	rmdir $appsDir/TagainiJisho/bin

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

	addResourcesToBinaries tagainijisho.rdef \
		$appsDir/TagainiJisho/TagainiJisho

	addAppDeskbarSymlink $appsDir/TagainiJisho/TagainiJisho "Tagaini Jisho"
}
