SUMMARY="A software for reading and writing Data Matrix barcodes"
DESCRIPTION="This is open source software for reading and writing Data Matrix \
barcodes on Linux, Unix, OS X, Windows, and mobile devices. At its core \
libdmtx is a native shared library, allowing C/C++ programs to use \
its capabilities without extra restrictions or overhead."
HOMEPAGE="http://libdmtx.sourceforge.net/
	https://github.com/dmtx/dmtx-utils"
COPYRIGHT="2009-2018 Mike Laughton, Vadim Misbakh-Soloviov and others"
LICENSE="GNU GPL v2
	GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/dmtx/dmtx-utils/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="0d396ec14f32a8cf9e08369a4122a16aa2e5fa1675e02218f16f1ab777ea2a28"
SOURCE_FILENAME="dmtx-utils-v$portVersion.tar.gz"
SOURCE_DIR="dmtx-utils-$portVersion"

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

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

PROVIDES="
	dmtx_utils$secondaryArchSuffix = $portVersion
	cmd:dmtxquery = $portVersion
	cmd:dmtxread = $portVersion
	cmd:dmtxwrite = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libdmtx$secondaryArchSuffix
	lib:libMagickCore_6.Q16$secondaryArchSuffix
	lib:libMagickWand_6.Q16$secondaryArchSuffix
	lib:libgomp$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libdmtx$secondaryArchSuffix
	devel:libMagickCore_6.Q16$secondaryArchSuffix
	devel:libMagickWand_6.Q16$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	export CFLAGS="-D_BSD_SOURCE"
	autoreconf -vfi
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make check
}
