SUMMARY="An extensible shell"
DESCRIPTION="The language was derived from the Plan 9 shell, rc, and was \
influenced by functional programming languages, such as Scheme, and the Tcl \
embeddable programming language."
HOMEPAGE="https://wryun.github.io/es-shell/"
COPYRIGHT="Paul Haahr and Byron Rakitzis
	Soren Dayton
	James Haggerty"
LICENSE="Public Domain"
REVISION="1"
SOURCE_URI="https://github.com/wryun/es-shell/releases/download/v$portVersion/es-$portVersion.tar.gz"
CHECKSUM_SHA256="b0b41fce99b122a173a06b899a4d92e5bd3cc48b227b2736159f596a58fff4ba"
SOURCE_DIR=""
PATCHES="es-$portVersion.patchset"

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

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

PROVIDES="
	es$secondaryArchSuffix = $portVersion
	cmd:es$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libreadline$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libreadline$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:awk
	cmd:bison
	cmd:byacc
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage es$secondaryArchSuffix \
	"$commandBinDir"/es

BUILD()
{
	export LDFLAGS="-lbsd"
	export CFLAGS="-D_BSD_SOURCE"
	runConfigure --omit-dirs binDir ./configure --bindir="$commandBinDir"
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make check
}
