SUMMARY="Internationalized Domain Names (IDN) implementation"
DESCRIPTION="Libidn is a package for internationalized string handling based \
on the Stringprep, Punycode, IDNA and TLD specifications."
HOMEPAGE="https://www.gnu.org/software/libidn/"
COPYRIGHT="2002-2018 Simon Josefsson"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://ftpmirror.gnu.org/libidn/libidn-$portVersion.tar.gz
	https://ftp.gnu.org/gnu/libidn/libidn-$portVersion.tar.gz"
CHECKSUM_SHA256="de00b840f757cd3bb14dd9a20d5936473235ddcba06d4bc2da804654b8bbf0f6"
PATCHES="libidn-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

PROVIDES="
	libidn$secondaryArchSuffix = $portVersion
	cmd:idn$secondaryArchSuffix
	lib:libidn$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:automake
	cmd:autoreconf
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:gettext >= 0.19.3
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libidn$secondaryArchSuffix \
	$libDir/libidn.so.$libVersion

BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f "$libDir"/libidn.la "$libDir"/libidn.a

	prepareInstalledDevelLib libidn
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir" \
		"$manDir"/man3
}

TEST()
{
	make check
}
