SUMMARY="Simple C\+\+ wrapper over Gilles Vollant\'s ZIP/UNZIP package"
DESCRIPTION="QuaZIP is the C++ wrapper for Gilles Vollant\'s ZIP/UNZIP \
package (AKA Minizip) using Trolltech's Qt library."
HOMEPAGE="https://github.com/stachenov/quazip"
COPYRIGHT="2005-2020 Sergey A. Tachenov"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/stachenov/quazip/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="2dfb911d6b27545de0b98798d967c40430312377e6ade57096d6ec80c720cb61"
SOURCE_FILENAME="quazip1-v$portVersion.tar.gz"
SOURCE_DIR="quazip-$portVersion"

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

libVersion="1.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	quazip1$secondaryArchSuffix = $portVersion
	lib:libquazip1_qt5$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	quazip1${secondaryArchSuffix}_devel = $portVersion
	devel:libquazip1_qt5$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	quazip1$secondaryArchSuffix == $portVersion base
	devel:libQt5Core$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libQt5Core$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	"

defineDebugInfoPackage quazip1$secondaryArchSuffix \
	"$libDir"/libquazip1-qt5.so.$libVersion

BUILD()
{
	cmake -B build -S . \
		$cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=None

	make -C build $jobArgs
}

INSTALL()
{
	make -C build install

	# prepare develop/lib
	prepareInstalledDevelLib libquazip1-qt5
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir \
		$libDir/cmake
}

TEST()
{
	make -C build check
	# There is no cmake compatible test.
}
