SUMMARY="POSIX-compliant implementation of /bin/sh"
DESCRIPTION="Dash is a POSIX-compliant implementation of /bin/sh that aims to \
be as small as possible. It does this without sacrificing speed where \
possible. In fact, it is significantly faster than bash (the GNU Bourne-Again \
Shell) for most tasks."
HOMEPAGE="http://gondor.apana.org/~herbert/dash/"
COPYRIGHT="1989-1994 The Regents of the University of California
	1997 Christos Zoulas
	1997-2005 Herbert Xu"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="http://gondor.apana.org.au/~herbert/dash/files/dash-$portVersion.tar.gz"
CHECKSUM_SHA256="3c663919dc5c66ec991da14c7cf7e0be8ad00f3db73986a987c118862b5f6071"

SOURCE_FILENAME_2="dash-0.5.9.1-format-security.patch"
srcGitRev_2="12ee15be33783573e73ab0ad27629daf88788121"
SOURCE_URI_2="https://gitweb.gentoo.org/repo/gentoo.git/plain/app-shells/dash/files/$SOURCE_FILENAME_2?id=$srcGitRev_2#noarchive"
CHECKSUM_SHA256_2="0ce7a1417b4e780f184588e761b4bea5d068c2312b23d954183076edf2f9432d"

SOURCE_FILENAME_3="dash-0.5.10-dumb-echo.patch"
srcGitRev_3="12ee15be33783573e73ab0ad27629daf88788121"
SOURCE_URI_3="https://gitweb.gentoo.org/repo/gentoo.git/plain/app-shells/dash/files/$SOURCE_FILENAME_3?id=$srcGitRev_3#noarchive"
CHECKSUM_SHA256_3="48c275bffa3504a9e8367fef742bb3a8d9c8bf0e221fb75ebcad14fc4d25bf9b"

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

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

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

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

defineDebugInfoPackage dash$secondaryArchSuffix \
	"$commandBinDir"/dash

PATCH()
{
	patch -p1 -i "$sourceDir2"/$SOURCE_FILENAME_2
	patch -p1 -i "$sourceDir3"/$SOURCE_FILENAME_3
}

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

INSTALL()
{
	make install
}

TEST()
{
	make check
}
