SUMMARY="A small self-contained alternative to readline and libedit"
DESCRIPTION="A minimal, zero-config, BSD licensed, readline replacement.

- Single and multi line editing mode with the usual key bindings implemented.
- History handling.
- Completion.
- Hints (suggestions at the right of the prompt as you type).
- About 1,100 lines of BSD license source code.
- Only uses a subset of VT100 escapes (ANSI.SYS compatible).
- UTF-8 support."
HOMEPAGE="https://github.com/rain-1/linenoise-mob"
COPYRIGHT="2010-2014 Salvatore Sanfilippo
	2010-2013, Pieter Noordhuis"
LICENSE="BSD (2-clause)"
REVISION="1"
srcGitRev="a898fd484982f29354d32a2a1afe01a01024d99f"
SOURCE_URI="https://github.com/rain-1/linenoise-mob/archive/$srcGitRev.zip"
CHECKSUM_SHA256="b15c63acb135855e68f49117b54d0f38592a4e68202ac072e005c6902e9d6c73"
SOURCE_DIR="linenoise-mob-$srcGitRev"

ARCHITECTURES="?all"
SECONDARY_ARCHITECTURES="?x86_gcc2 ?x86"

PROVIDES="
	linenoise$secondaryArchSuffix = $portVersion compat >= 1
	lib:liblinenoise$secondaryArchSuffix = 1.0 compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	linenoise${secondaryArchSuffix}_devel = $portVersion
	devel:liblinenoise$secondaryArchSuffix = 1.0 compat >= 1
	"
REQUIRES_devel="
	linenoise$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	make $jobArgs \
		CFLAGS="-Os -Wall" \
		PREFIX="$prefix" \
		LIBDIR="$libDir" \
		INCDIR="$includeDir" \
		MANDIR="$manDir"
}

INSTALL()
{
	make $jobArgs \
		CFLAGS="-Os -Wall" \
		PREFIX="$prefix" \
		LIBDIR="$libDir" \
		INCDIR="$includeDir" \
		MANDIR="$manDir" \
		install

	prepareInstalledDevelLibs liblinenoise

	# devel package
	packageEntries devel \
		$developDir \
		$documentationDir
}
