SUMMARY="A library to encode and decode internationalized domain names"
DESCRIPTION="
GNU Libidn is a fully documented implementation of the Stringprep, Punycode \
and IDNA specifications. Libidn's purpose is to encode and decode internationalized domain names.
"
HOMEPAGE="http://www.gnu.org/software/libidn/"
SRC_URI="http://ftpmirror.gnu.org/libidn/libidn-1.9.tar.gz"
CHECKSUM_MD5="f4d794639564256a367566302611224e"

ARCHITECTURES="x86_gcc2 x86 ?x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

REVISION="1"

LICENSE="
	GNU GPL v3
	GNU LGPL v2.1
	"
COPYRIGHT="
	2004-2008 Simon Josefsson
	1998, 1999 Tom Tromey
	2001 Red Hat Software
	1994-2007 Free Software Foundation
	"
	
PROVIDES="
	libidn = $portVersion
	lib:libidn$secondaryArchSuffix = $portVersion
	cmd:idn$secondaryArchSuffix = $portVersion
	"
	
REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libiconv$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	devel:libiconv$secondaryArchSuffix
	gettext${secondaryArchSuffix}_libintl
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:gnulib_tool$secondaryArchSuffix
	cmd:gperf
	cmd:help2man$secondaryArchSuffix
	cmd:libtoolize
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:make
	cmd:makeinfo
	"
	
PATCHES="libidn-1.9.patch"

BUILD()
{
	gnulib_tool --import --local-dir=gl/override --source-base=gl \
	--m4-base=gl/m4 --libtool --no-vc-files \
	csharpcomp-script error fdl gendocs getopt gnupload gpl-3.0 lgpl-2.1 \
	maintainer-makefile progname version-etc
	
	gnulib_tool --import --local-dir=lib/gl/override --source-base=lib/gl \
	--m4-base=lib/gl/m4 --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files \
	gettext-h stdint striconv strverscmp
	
	libtoolize --force --copy --install
	
	# Libtoolize is going to ask us to add the contents of some files
	# to aclocal.m4
	for i in m4/{libtool,lt{options,sugar,version,~obsolete}}.m4; do cat $i >> aclocal.m4; done
	
	aclocal -I m4 -I gl/m4 -I lib/gl/m4
	autoconf
	automake --add-missing
	
	runConfigure ./configure --enable-shared
	make
}

INSTALL()
{
	make install
	
	prepareInstalledDevelLib libidn
	fixPkgconfig
	
	packageEntries devel \
		$developDir \
		$documentationDir
}

# ------ devel package ------------------------------------------------------

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