SUMMARY="A command line option parsing library"
DESCRIPTION="This is the popt(3) command line option parsing library. While it \
is similiar to getopt(3), it contains a number of enhancements, including:
- popt is fully reentrant
- popt can parse arbitrary argv[] style arrays while getopt(3) makes this \
quite difficult
- popt allows users to alias command line arguments
- popt provides convience functions for parsing strings into argv[] style \
arrays"
HOMEPAGE="https://www.linuxfromscratch.org/blfs/view/8.1/general/popt.html"
COPYRIGHT="1998-2010 Red Hat, Inc."
LICENSE="MIT"
REVISION="5"
SOURCE_URI="ftp://anduin.linuxfromscratch.org/BLFS/popt/popt-1.16.tar.gz"
CHECKSUM_SHA256="e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8"
PATCHES="popt-1.16.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86 x86_gcc2"

PROVIDES="
	popt$secondaryArchSuffix = $portVersion
	lib:libpopt$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	"

PROVIDES_devel="
	popt${secondaryArchSuffix}_devel = $portVersion
	devel:libpopt$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	popt$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:sed
	"

defineDebugInfoPackage popt$secondaryArchSuffix \
	"$libDir"/libpopt.so.0.0.0

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

INSTALL()
{
	make install

	rm $libDir/libpopt.la
if [ -n "$secondaryArchSuffix" ]; then
	mkdir -p $libDir/pkgconfig
	mv $prefix/lib/pkgconfig/* $libDir/pkgconfig/
	rmdir $prefix/lib/pkgconfig
fi

	prepareInstalledDevelLibs libpopt
	fixPkgconfig

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

#TEST()
#{
	# missing api-sanity-autotest.pl
	#make check
#}
