SUMMARY="A BSD licensed replacement for the GNU readline library"
DESCRIPTION="
This is an autotool- and libtoolized port of the NetBSD Editline library \
(libedit). This Berkeley-style licensed command line editor library provides \
generic line editing, history, and tokenization functions, similar to those \
found in GNU Readline.
"
HOMEPAGE="http://www.thrysoee.dk/editline/"
COPYRIGHT="1992-2014 The NetBSD Foundation, Inc."
LICENSE="BSD (3-clause)"
REVISION="9"
SOURCE_URI="http://www.thrysoee.dk/editline/libedit-20150325-3.1.tar.gz"
CHECKSUM_SHA256="c88a5e4af83c5f40dda8455886ac98923a9c33125699742603a88a0253fcc8c5"
SOURCE_DIR="libedit-20150325-3.1"
PATCHES="libedit-2015_03_25_3.1.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	libedit$secondaryArchSuffix = $portVersion
	lib:libedit$secondaryArchSuffix = 0.0.53 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	"

PROVIDES_devel="
	libedit${secondaryArchSuffix}_devel = $portVersion
	devel:libedit$secondaryArchSuffix = 0.0.53 compat >= 0
	"
REQUIRES_devel="
	libedit$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	devel:libncurses$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:m4
	cmd:make
	cmd:sed
	"

BUILD()
{
	mkdir m4
	autoreconf --force --install
	runConfigure ./configure --enable-examples=no --enable-widec
	make $jobArgs
}

INSTALL()
{
	make install

	# remove libtool file
	rm $libDir/libedit.la

	prepareInstalledDevelLibs libedit
	fixPkgconfig

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

TEST()
{
	make check
}
