SUMMARY="A Qt API for generating QRCode & DataMatrix barcodes"
DESCRIPTION="prison is a Qt-based barcode abstraction layer/library that \
provides uniform access to generation of barcodes with data. The API supports \
two types of barcodes: QRCode and DataMatrix."
HOMEPAGE="https://api.kde.org/frameworks/prison/html/index.html"
COPYRIGHT="2010-2019 KDE Foundations"
LICENSE="GNU LGPL v3"
REVISION="1"
SOURCE_URI="https://download.kde.org/stable/frameworks/${portVersion%.*}/prison-$portVersion.tar.xz"
CHECKSUM_SHA256="8dd4400817b4863597eb87fafce27f6cb11ad8a1f4da7491e4c9e4dcaa2fdff1"

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

GLOBAL_WRITABLE_FILES="
	settings/xdg/prison.categories keep-old
	"

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

PROVIDES="
	prison$secondaryArchSuffix = $portVersion
	lib:libkf5prison$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libdmtx$secondaryArchSuffix
	lib:libqrencode$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	"

PROVIDES_devel="
	prison${secondaryArchSuffix}_devel = $portVersion
	devel:libkf5prison$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	prison$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= 5.65
	devel:libdmtx$secondaryArchSuffix
	devel:libqrencode$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix >= 5.8
	devel:libQt5Gui$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	constantSystemDataDir="`finddir B_SYSTEM_DATA_DIRECTORY`"
	cmake . \
		-DECM_DIR="$constantSystemDataDir"/cmake/Modules/ECM/cmake \
		-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
		-DCMAKE_INSTALL_PREFIX:PATH=$prefix \
		-DCMAKE_INSTALL_LIBDIR:PATH=$libDir \
		-DCMAKE_INSTALL_INCLUDEDIR:PATH=$includeDir \
		-DKDE_INSTALL_LOGGINGCATEGORIESDIR=$settingsDir/xdg
	make
}

INSTALL()
{
	make install
	prepareInstalledDevelLib libKF5Prison

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