SUMMARY="Library to compare files and strings"
DESCRIPTION="This package contains a library used to compare files and \
strings, and is used in Kompare and KDevelop.

This package is part of the KDE Software Development Kit module."
HOMEPAGE="https://github.com/KDE/libkomparediff2/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/libkomparediff2/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="e97b4cbfd58672e109766ad8149c1421cc79e30f3cb51a21742af4ba39cd70fd"

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

PROVIDES="
	libkomparediff2$secondaryArchSuffix = $portVersion
	lib:libkomparediff2$secondaryArchSuffix = 5.2 compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libKF5Auth$secondaryArchSuffix
	lib:libKF5Codecs$secondaryArchSuffix
	lib:libKF5ConfigCore$secondaryArchSuffix
	lib:libKF5ConfigWidgets$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libKF5KIOCore$secondaryArchSuffix
	lib:libKF5Service$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libKF5WindowSystem$secondaryArchSuffix
	lib:libKF5XmlGui$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

PROVIDES_devel="
	libkomparediff2${secondaryArchSuffix}_devel = $portVersion
	devel:libkomparediff2$secondaryArchSuffix = 5.2 compat >= 5
	"
REQUIRES_devel="
	libkomparediff2$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:libKF5I18n$secondaryArchSuffix
	devel:libKF5ItemViews$secondaryArchSuffix
	devel:libKF5JobWidgets$secondaryArchSuffix
	devel:libKF5KIOCore$secondaryArchSuffix
	devel:libKF5Service$secondaryArchSuffix
	devel:libKF5Solid$secondaryArchSuffix
	devel:libKF5WidgetsAddons$secondaryArchSuffix
	devel:libKF5WindowSystem$secondaryArchSuffix
	devel:libKF5XmlGui$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:python2
	cmd:qdbuscpp2xml$secondaryArchSuffix >= 5
	"

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 \
		libkomparediff2

	packageEntries devel \
		$libDir/cmake \
		$developDir
}

TEST()
{
	cd build
	make test
}
