SUMMARY="A small ASN.1 library"
DESCRIPTION="The Libtasn1 library provides Abstract Syntax Notation One \
(ASN.1, as specified by the X.680 ITU-T recommendation) parsing and \
structures management, and Distinguished Encoding Rules (DER, as per \
X.690) encoding and decoding functions."
HOMEPAGE="https://www.gnu.org/software/libtasn1/"
COPYRIGHT="2002-2019 Free Software Foundation, Inc."
LICENSE="GNU LGPL v2.1
	GNU GPL v3"
REVISION="1"
SOURCE_URI="https://ftp.gnu.org/gnu/libtasn1/libtasn1-$portVersion.tar.gz"
CHECKSUM_SHA256="4365c154953563d64c67a024b607d1ee75c6db76e0d0f65709ea80a334cd1898"
PATCHES="libtasn1-$portVersion.patchset"

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

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

PROVIDES="
	libtasn1$secondaryArchSuffix = $portVersionCompat
	lib:libtasn1$secondaryArchSuffix = $libVersionCompat
	cmd:asn1Coding$secondaryArchSuffix
	cmd:asn1Decoding$secondaryArchSuffix
	cmd:asn1Parser$secondaryArchSuffix
	cmd:corpus2array$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libtasn1${secondaryArchSuffix}_devel = $portVersionCompat
	devel:libtasn1$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libtasn1$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:makeinfo
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libtasn1$secondaryArchSuffix \
	"$libDir"/libtasn1.so.$libVersion

BUILD()
{
	AUTOMAKE=: AUTOCONF=: runConfigure ./configure --disable-gcc-warnings
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libtasn1.la $libDir/libtasn1.a
	rm -f "$infoDir"/dir

	prepareInstalledDevelLibs libtasn1
	fixPkgconfig

	if [ -n "$secondaryArchSuffix" ]; then
		maybe_manDir_man3=
		rm -rf $documentationDir
	else
		maybe_manDir_man3=$manDir/man3
	fi

	# devel package
	packageEntries devel \
		$developDir \
		$maybe_manDir_man3
}

TEST()
{
	make check
}
