SUMMARY="2D barcode/DataMatrix generator"
DESCRIPTION="With iec16022 you can produce 2D barcodes, also known as \
DataMatrix, as defined in ISO/IEC 16022."
HOMEPAGE="https://rdoeffinger.github.io/"
COPYRIGHT="2006-2010 Stefan Schmidt
	2009-2017 AAISP Development Team"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/rdoeffinger/iec16022/releases/download/v0.3.0/iec16022-$portVersion.tar.xz"
CHECKSUM_SHA256="f36d6472ad1315bf4d0f905b6ce83a811468d90733e758a00c3147b9cdbe33ae"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

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

PROVIDES="
	iec16022$secondaryArchSuffix = $portVersion
	lib:libiec16022$secondaryArchSuffix = $libVersionCompat
	cmd:iec16022$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libpopt$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	iec16022${secondaryArchSuffix}_devel = $portVersion
	devel:libiec16022$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	iec16022$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libpopt$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage iec16022$secondaryArchSuffix \
	"$commandBinDir"/iec16022 \
	"$libDir"/libiec16022.so.$libVersion

BUILD()
{
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install
	rm $libDir/libiec16022.la

	prepareInstalledDevelLib libiec16022
	fixPkgconfig

	packageEntries devel $developDir
}

TEST()
{
	make check
}
