SUMMARY="Sigrok drivers for logic analyzers and IO file formats"
DESCRIPTION="Analysis software suite that supports various device types \
(e.g. logic analyzers, oscilloscopes, and many more).
* Broad hardware support. Supports many different devices (logic analyzers, \
oscilloscopes, multimeters, data loggers etc.) from various vendors.
* Scriptable protocol decoding. Extendable with stackable protocol decoders.
* Various input/output file formats.

This package contains libsigrok, the library with code shared between the
different frontends."
HOMEPAGE="https://sigrok.org"
COPYRIGHT="2011-2019 sigrok contributors"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="http://sigrok.org/download/source/libsigrok/libsigrok-$portVersion.tar.gz"
CHECKSUM_SHA256="4d341f90b6220d3e8cb251dacf726c41165285612248f2c52d15df4590a1ce3c"
PATCHES="libsigrok-$portVersion.patchset"

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

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

PROVIDES="
	libsigrok$secondaryArchSuffix = $portVersion
	lib:libsigrok$secondaryArchSuffix = $libVersionCompat
	lib:libsigrokcxx$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libftdi1$secondaryArchSuffix
	lib:libzip$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libglibmm$secondaryArchSuffix
	lib:libsigc_2.0$secondaryArchSuffix
	lib:libusb_1.0$secondaryArchSuffix
	"

PROVIDES_devel="
	libsigrok${secondaryArchSuffix}_devel = $portVersion
	devel:libsigrok$secondaryArchSuffix = $libVersionCompat
	devel:libsigrokcxx$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libsigrok$secondaryArchSuffix == $portVersion base
	devel:libglibmm$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libftdi1$secondaryArchSuffix
	devel:libzip$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libusb_1.0$secondaryArchSuffix
	devel:libftdi1$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libglibmm$secondaryArchSuffix
	devel:libzip$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:cmp
	cmd:doxygen
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:python3
	"

BUILD()
{
	export CFLAGS=-D_BSD_SOURCE
	autoreconf -vfi
	runConfigure ./configure --disable-static
	make $jobArgs
}

INSTALL()
{
	make install

	# remove libtool file
	rm $libDir/*.la

	# remove not needed data files
	rm -rf $dataDir/icons

	prepareInstalledDevelLibs libsigrok libsigrokcxx
	fixPkgconfig

	packageEntries devel $developDir
}

TEST()
{
	make check
}
