SUMMARY="SANE Library interface for KDE"
DESCRIPTION="Libksane is a KDE interface for SANE library to control flat scanners."
HOMEPAGE="https://github.com/KDE/libksane/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/libksane/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="f445ba8bdd5e8f3ad8a1be66cbed1ba4f96f3d4a42d1dee08b1a208f19e73db7"
SOURCE_DIR="libksane-$portVersion"

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

PROVIDES="
	libksane$secondaryArchSuffix = $portVersion
	lib:libKF5Sane$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libKF5Auth$secondaryArchSuffix
	lib:libKF5Bookmarks$secondaryArchSuffix
	lib:libKF5Codecs$secondaryArchSuffix
	lib:libKF5Completion$secondaryArchSuffix
	lib:libKF5ConfigCore$secondaryArchSuffix
	lib:libKF5ConfigGui$secondaryArchSuffix
	lib:libKF5ConfigWidgets$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libKF5IconThemes$secondaryArchSuffix
	lib:libKF5ItemViews$secondaryArchSuffix
	lib:libKF5JobWidgets$secondaryArchSuffix
	lib:libKF5KIOCore$secondaryArchSuffix
	lib:libKF5KIOWidgets$secondaryArchSuffix
	lib:libKF5Parts$secondaryArchSuffix
	lib:libKF5Service$secondaryArchSuffix
	lib:libKF5Solid$secondaryArchSuffix
	lib:libKF5SonnetUi$secondaryArchSuffix
	lib:libKF5TextWidgets$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libKF5XmlGui$secondaryArchSuffix
	lib:libQt5DBus$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Script$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	lib:libsane$secondaryArchSuffix
	"

PROVIDES_devel="
	libksane${secondaryArchSuffix}_devel = $portVersion
	devel:libKF5Sane$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES_devel="
	libksane$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= 5.86
	devel:libKF5Auth$secondaryArchSuffix
	devel:libKF5Bookmarks$secondaryArchSuffix
	devel:libKF5Codecs$secondaryArchSuffix
	devel:libKF5Completion$secondaryArchSuffix
	devel:libKF5ConfigCore$secondaryArchSuffix
	devel:libKF5ConfigWidgets$secondaryArchSuffix
	devel:libKF5CoreAddons$secondaryArchSuffix
	devel:libKF5DocTools$secondaryArchSuffix
	devel:libKF5I18n$secondaryArchSuffix
	devel:libKF5IconThemes$secondaryArchSuffix
	devel:libKF5ItemViews$secondaryArchSuffix
	devel:libKF5JobWidgets$secondaryArchSuffix
	devel:libKF5KIOCore$secondaryArchSuffix
	devel:libKF5Parts$secondaryArchSuffix
	devel:libKF5Service$secondaryArchSuffix
	devel:libKF5Solid$secondaryArchSuffix
	devel:libKF5SonnetUi$secondaryArchSuffix
	devel:libKF5TextWidgets$secondaryArchSuffix
	devel:libKF5WidgetsAddons$secondaryArchSuffix
	devel:libKF5XmlGui$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix >= 5.15
	devel:libsane$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:python2
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DKDE_INSTALL_PLUGINDIR=$addOnsDir/Qt5 \
		-DKDE_INSTALL_QTPLUGINDIR=$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 \
		libKF5Sane

	packageEntries devel \
		$libDir/cmake \
		$developDir
}

TEST()
{
	cd build
	make test
}
