SUMMARY="Reading, creating, and manipulating file archives"
DESCRIPTION="KArchive provides classes for easy reading, creation and \
manipulation of /"archive/" formats like ZIP and TAR.

It also provides transparent compression and decompression of data, like the \
GZip format, via a subclass of QIODevice."
HOMEPAGE="https://github.com/KDE/karchive/"
COPYRIGHT="2010-2022 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/karchive/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="5d6078a0b5fc0667d7d6242ca460289da24de6dcdc925fdf6d33e02614237679"

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

PROVIDES="
	karchive$secondaryArchSuffix = $portVersion
	lib:libkf5archive$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:liblzma$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libbz2$secondaryArchSuffix
	devel:liblzma$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix >= 5.7
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	mkdir -p build
	cd build

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

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libKF5Archive

	fixPkgconfig

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

TEST()
{
	cd build
	make test
}
