SUMMARY="Database connectivity and creation framework for various database vendors"
DESCRIPTION="KDb is a database connectivity and creation framework for various database vendors.

KDb is consisted of a general-purpose C++/Qt-only library and a set of plugins. Because there \
is no dependency on Kexi, Calligra or even on KDE libraries, KDb is developed for a wider \
audience. Kexi since the version 3 uses it too, thus deprecating KexiDB.

Unlike QtSQL, KDb 'knows' how to create database and new tables. It has a Qt/C++ API for that. \
There is no need to pass SQL at all but you can pass if you wish (it will silently parse your \
statements before contacting the database). KDb is developed as a next generation database \
handling layer for Kexi and similar complex apps."
HOMEPAGE="https://community.kde.org/KDb"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/KDE/kdb/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="c651d240c641b5cdd882a99c5ec6345387d0a4e05f8ca1d59f4daaf08c3f7141"
SOURCE_DIR="kdb-$portVersion"

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

PROVIDES="
	kdb$secondaryArchSuffix = $portVersion
	cmd:kdb3_sqlite3_dump$secondaryArchSuffix = $portVersion
	lib:libKDb3$secondaryArchSuffix = 4.2.0 compat >= 4
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libicudata$secondaryArchSuffix
	lib:libicui18n$secondaryArchSuffix
	lib:libicuuc$secondaryArchSuffix
	lib:libKF5Codecs$secondaryArchSuffix
	lib:libKF5ConfigCore$secondaryArchSuffix
	lib:libKF5ConfigGui$secondaryArchSuffix
	lib:libKF5ConfigWidgets$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libmysqlclient$secondaryArchSuffix
	lib:libpq$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	"

PROVIDES_devel="
	kdb${secondaryArchSuffix}_devel = $portVersion
	devel:libKDb3$secondaryArchSuffix = 4.2.0 compat >= 4
	"
REQUIRES_devel="
	kdb$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= 5.77
	devel:libicuuc$secondaryArchSuffix
	devel:libKF5Codecs$secondaryArchSuffix
	devel:libKF5ConfigCore$secondaryArchSuffix
	devel:libKF5ConfigWidgets$secondaryArchSuffix
	devel:libKF5CoreAddons$secondaryArchSuffix
	devel:libKF5I18n$secondaryArchSuffix
	devel:libmysqlclient$secondaryArchSuffix
	devel:libpq$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix >= 5.15
	devel:libsqlite3$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:python2
	cmd:qdbuscpp2xml$secondaryArchSuffix >= 5
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-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

	fixPkgconfig

	prepareInstalledDevelLibs \
		libKDb3

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

TEST()
{
	cd build
	make test
}
