SUMMARY="A small utility to allow the editing of keyboard input for any command"
DESCRIPTION="You should consider using rlwrap especially when you need \
user-defined completion (by way of completion word lists) and persistent history, \
or if you want to program 'special effects' using the filter mechanism."
HOMEPAGE="https://github.com/hanslub42/rlwrap"
LICENSE="GNU GPL v2"
COPYRIGHT="2000-2022 Hans Lub and others"
REVISION="1"
SOURCE_URI="https://github.com/hanslub42/rlwrap/releases/download/v0.45.2/rlwrap-0.45.2.tar.gz"
CHECKSUM_SHA256="9f8870deb46e473d21b5db89d709b6497f4ef9fa06d44eebc5f821daa00c8eca"
PATCHES="rlwrap-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]
then
	commandBinDir=$prefix/bin
	commandSuffix=
fi

PROVIDES="
	rlwrap$secondaryArchSuffix = $portVersion
	cmd:rlwrap$commandSuffix = $portVersion
	"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libreadline$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
        "

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libreadline$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
        "

BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gawk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"
BUILD()
{
	autoreconf -vfi
	runConfigure --omit-dirs binDir ./configure \
		--bindir=$commandBinDir
        make $jobArgs
}

INSTALL()
{
	make $jobArgs install-strip
}

TEST()
{
	make check
}
