SUMMARY="Multi-language spell checker"
DESCRIPTION="Sonnet is a plugin-based spell checking library for Qt-based \
applications. It supports several different plugins, including HSpell, \
Enchant, ASpell and HUNSPELL.

It also supports automated language detection, based on a combination of \
different algorithms.

The simplest way to use Sonnet in your application is to use the \
SpellCheckDecorator class on your QTextEdit."
HOMEPAGE="https://github.com/KDE/sonnet/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/sonnet/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="a971bc7c381dc0e44375fc3696ff7cfbf0592983924c6d298c7b14255ae37d7d"
PATCHES="sonnet-$portVersion.patchset"

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

PROVIDES="
	sonnet$secondaryArchSuffix = $portVersion
	cmd:gentrigrams$secondaryArchSuffix = $portVersion
	cmd:parsetrigrams$secondaryArchSuffix = $portVersion
	lib:libKF5SonnetCore$secondaryArchSuffix = $portVersion compat >= 5
	lib:libKF5SonnetUi$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	aspell_en
	haiku$secondaryArchSuffix
	lib:libaspell$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

PROVIDES_devel="
	sonnet${secondaryArchSuffix}_devel = $portVersion
	devel:libKF5SonnetCore$secondaryArchSuffix = $portVersion compat >= 5
	devel:libKF5SonnetUi$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES_devel="
	sonnet$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libaspell$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix >= 5.13
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DKDE_INSTALL_PLUGINDIR=$addOnsDir/Qt5 \
		-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libKF5SonnetCore \
		libKF5SonnetUi

	packageEntries devel \
		$libDir/cmake \
		$dataDir/Qt5/mkspecs \
		$developDir
}

TEST()
{
	cd build
	make test
}
