SUMMARY="Legacy support for kdelibs 4 compatibility"
DESCRIPTION="This framework provides code and utilities to ease the \
transition from kdelibs 4 to KDE Frameworks 5. This includes CMake \
macros and C++ classes whose functionality has been replaced by code \
in CMake, Qt and other frameworks.

Code should aim to port away from this framework eventually. The API \
documentation of the classes in this framework and the notes at \
http://community.kde.org/Frameworks/Porting_Notes should help with this.

Note that some of the classes in this framework, especially KStandardDirs, \
may not work correctly unless any libraries and other software using the \
KDELibs 4 Support framework are installed to the same location as \
KDELibs4Support, although it may be sufficient to set the KDEDIRS environment \
variable correctly."
HOMEPAGE="https://github.com/KDE/kdelibs4support/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/kdelibs4support/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="a209f3c238e55bd87f632d065c05c91cfcd97188b50ed0f9306d6c625b2df1fd"
PATCHES="kdelibs4support-$portVersion.patchset"

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

GLOBAL_WRITABLE_FILES="
	settings/xdg/colors/40.colors keep-old
	settings/xdg/colors/Oxygen.colors keep-old
	settings/xdg/colors/Rainbow.colors keep-old
	settings/xdg/colors/Royal.colors keep-old
	settings/xdg/colors/Web.colors keep-old
	settings/xdg/kdebug.areas keep-old
	settings/xdg/kdebugrc keep-old
	settings/xdg/ksslcalist keep-old
	"

PROVIDES="
	kdelibs4support$secondaryArchSuffix = $portVersion
	cmd:kdebugdialog5$secondaryArchSuffix = $portVersion
	cmd:kf5_config$secondaryArchSuffix = $portVersion
	lib:libKF5KDELibs4Support$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:libKF5Crash$secondaryArchSuffix
	lib:libKF5GlobalAccel$secondaryArchSuffix
	lib:libKF5GuiAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libKF5IconThemes$secondaryArchSuffix
	lib:libKF5ItemViews$secondaryArchSuffix
	lib:libKF5JobWidgets$secondaryArchSuffix
	lib:libKF5KIOCore$secondaryArchSuffix
	lib:libKF5KIOFileWidgets$secondaryArchSuffix
	lib:libKF5KIOWidgets$secondaryArchSuffix
	lib:libKF5Notifications$secondaryArchSuffix
	lib:libKF5Parts$secondaryArchSuffix
	lib:libKF5Service$secondaryArchSuffix
	lib:libKF5Solid$secondaryArchSuffix
	lib:libKF5SonnetUi$secondaryArchSuffix
	lib:libKF5TextWidgets$secondaryArchSuffix
	lib:libKF5UnitConversion$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libKF5WindowSystem$secondaryArchSuffix
	lib:libKF5XmlGui$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5DBus$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Test$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	uri
	devel:libkdeinit5_kded5$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:libKF5DesignerPlugin$secondaryArchSuffix == $portVersion
	devel:libKF5DocTools$secondaryArchSuffix == $portVersion
	devel:libKF5Emoticons$secondaryArchSuffix == $portVersion
	devel:libKF5GlobalAccel$secondaryArchSuffix == $portVersion
	devel:libKF5GuiAddons$secondaryArchSuffix == $portVersion
	devel:libKF5I18n$secondaryArchSuffix == $portVersion
	devel:libKF5IconThemes$secondaryArchSuffix == $portVersion
	devel:libKF5ItemViews$secondaryArchSuffix == $portVersion
	devel:libKF5JobWidgets$secondaryArchSuffix == $portVersion
	devel:libKF5KioCore$secondaryArchSuffix == $portVersion
	devel:libKF5Notifications$secondaryArchSuffix == $portVersion
	devel:libKF5Parts$secondaryArchSuffix == $portVersion
	devel:libKF5Service$secondaryArchSuffix == $portVersion
	devel:libKF5Solid$secondaryArchSuffix == $portVersion
	devel:libKF5SonnetUi$secondaryArchSuffix == $portVersion
	devel:libKF5TextWidgets$secondaryArchSuffix == $portVersion
	devel:libKF5UnitConversion$secondaryArchSuffix == $portVersion
	devel:libKF5WidgetsAddons$secondaryArchSuffix == $portVersion
	devel:libKF5WindowSystem$secondaryArchSuffix == $portVersion
	devel:libKF5XmlGui$secondaryArchSuffix == $portVersion
	devel:libQt5Core$secondaryArchSuffix >= 5.7
	devel:libQt5DBus$secondaryArchSuffix >= 5.7
	devel:libQt5Gui$secondaryArchSuffix >= 5.7
	devel:libQt5Network$secondaryArchSuffix >= 5.7
	devel:libQt5PrintSupport$secondaryArchSuffix >= 5.7
	devel:libQt5Svg$secondaryArchSuffix >= 5.7
	devel:libQt5Test$secondaryArchSuffix >= 5.7
	devel:libQt5Widgets$secondaryArchSuffix >= 5.7
	devel:libQt5Xml$secondaryArchSuffix >= 5.7
	devel:libssl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix
	cmd:make
	cmd:perl
	cmd:python2
	"

BUILD()
{
	# disable docs generation until libxml package is fixed
	sed -i s/add/#add/g docs/CMakeLists.txt
	sed -i s/kdoctools/#kdoctool/g CMakeLists.txt

	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DKDE_INSTALL_PLUGINDIR=$addOnsDir/Qt5 \
		-DKDE_INSTALL_QTPLUGINDIR=$addOnsDir/Qt5 \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake \
		-DBUILD_TESTING:BOOL=OFF
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
	prepareInstalledDevelLibs \
		libKF5KDELibs4Support \

	packageEntries devel \
		$libDir/cmake \
		$developDir
}

TEST()
{
	cd build
	make test
}
