SUMMARY="A configuration file parser library"
DESCRIPTION="libConfuse is a configuration file parser library, licensed \
under the terms of the ISC license, and written in C. It supports sections \
and (lists of) values (strings, integers, floats, booleans or other \
sections), as well as some other features (such as single/double-quoted \
strings, environment variable expansion, functions and nested include \
statements). It makes it very easy to add configuration file capability to \
a program using a simple API.
The goal of libConfuse is not to be the configuration file parser library \
with a gazillion of features. Instead, it aims to be easy to use and quick to \
integrate with your code. libConfuse was called libcfg before, but its name \
was changed to not confuse itself with other similar libraries."
HOMEPAGE="http://www.nongnu.org/confuse/"
COPYRIGHT="2002-2017 Martin Hedenfalk
	2015 Peter Rosin"
LICENSE="ISC"
REVISION="1"
SOURCE_URI="https://github.com/martinh/libconfuse/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="2cf7e032980aff8f488efba61510dc3fb95e9a4b9183f985dea457a5651b0e2c"
SOURCE_FILENAME="confuse-$portVersion.tar.gz"
SOURCE_DIR="libconfuse-$portVersion"
PATCHES="confuse-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

PROVIDES="
	confuse$secondaryArchSuffix = $portVersion
	lib:libconfuse$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autom4te
	cmd:automake
	cmd:flex
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage confuse$secondaryArchSuffix \
	"$libDir"/libconfuse.so.$libVersion

BUILD()
{
	export CFLAGS="-D_BSD_SOURCE"
	export LDFLAGS="-lbsd"
	./autogen.sh
	runConfigure ./configure
	make
}

INSTALL()
{
	make install
	prepareInstalledDevelLib libconfuse
	packageEntries devel $developDir
}

TEST()
{
	make check
}
