SUMMARY="Helper library to speed up start of applications on KDE workspaces"
DESCRIPTION="kdeinit is a process launcher somewhat similar to the famous \
init used for booting UNIX.

It launches processes by forking and then loading a dynamic library which \
should contain a 'kdemain(...)' function.

Using kdeinit to launch KDE applications makes starting a typical KDE \
applications 2.5 times faster (100ms instead of 250ms on a P-III 500) \
It reduces memory consumption by approx. 350Kb per application."
HOMEPAGE="https://github.com/KDE/kinit/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/kinit/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="be304a54ce9fc869e091ba049e59ec4b7c64e7410f187188bf06e30e23277f77"
PATCHES="kinit-$portVersion.patchset"

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

PROVIDES="
	kinit$secondaryArchSuffix = $portVersion
	cmd:kdeinit5$secondaryArchSuffix = $portVersion
	cmd:kdeinit5_shutdown$secondaryArchSuffix = $portVersion
	cmd:kdeinit5_wrapper$secondaryArchSuffix = $portVersion
	cmd:kshell5$secondaryArchSuffix = $portVersion
	cmd:kwrapper5$secondaryArchSuffix = $portVersion
	lib:libkdeinit5_klauncher$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libKF5Completion$secondaryArchSuffix
	lib:libKF5ConfigCore$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5Crash$secondaryArchSuffix
	lib:libKF5DBusAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libKF5JobWidgets$secondaryArchSuffix
	lib:libKF5KIOCore$secondaryArchSuffix
	lib:libKF5KIOWidgets$secondaryArchSuffix
	lib:libKF5Service$secondaryArchSuffix
	lib:libKF5Solid$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libKF5WindowSystem$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5DBus$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

PROVIDES_devel="
	kinit${secondaryArchSuffix}_devel = $portVersion
	devel:libkdeinit5_klauncher$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	kinit$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libKF5Auth$secondaryArchSuffix == $portVersion
	devel:libKF5Bookmarks$secondaryArchSuffix == $portVersion
	devel:libKF5Codecs$secondaryArchSuffix == $portVersion
	devel:libKF5Completion$secondaryArchSuffix == $portVersion
	devel:libKF5ConfigCore$secondaryArchSuffix == $portVersion
	devel:libKF5ConfigWidgets$secondaryArchSuffix == $portVersion
	devel:libKF5CoreAddons$secondaryArchSuffix == $portVersion
	devel:libKF5Crash$secondaryArchSuffix == $portVersion
	devel:libKF5DBusAddons$secondaryArchSuffix == $portVersion
	devel:libKF5I18n$secondaryArchSuffix == $portVersion
	devel:libKF5ItemViews$secondaryArchSuffix == $portVersion
	devel:libKF5JobWidgets$secondaryArchSuffix == $portVersion
	devel:libKF5KIOCore$secondaryArchSuffix == $portVersion
	devel:libKF5Service$secondaryArchSuffix == $portVersion
	devel:libKF5Solid$secondaryArchSuffix == $portVersion
	devel:libKF5WidgetsAddons$secondaryArchSuffix == $portVersion
	devel:libKF5WindowSystem$secondaryArchSuffix == $portVersion
	devel:libKF5XmlGui$secondaryArchSuffix == $portVersion
	devel:libQt5Core$secondaryArchSuffix >= 5.7
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix
	cmd:make
	cmd:python2
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libkdeinit5_klauncher

	packageEntries devel \
		$libDir/cmake \
		$developDir

}

TEST()
{
	cd build
	make test
}
