SUMMARY="The MirBSD Korn Shell"
DESCRIPTION="An actively developed free implementation of the Korn Shell \
programming language and a successor to the Public Domain Korn Shell (pdksh).

mksh targets users who desire a compact, fast, reliable, secure shell not cut \
off modern extensions; a shell with Unicode support; an actively developed, \
current, and portable product; one with developers that listen to their users’ \
requests and implement them if they actually make sense.

mksh aims to replace pdksh in all but very rare use cases (such as support for \
checking the Unix mbox) and in all operating environments (thus including \
patches from pdksh on e.g. Debian).
"
HOMEPAGE="https://www.mirbsd.org/mksh.htm"
LICENSE="BSD (3-clause)"
COPYRIGHT="2002-2014 Thorsten Glaser"

SOURCE_URI="https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R50c.tgz"
CHECKSUM_SHA256="494ed3339e4d5c490e32b3c27dd3b642e493d86982ac60e15c8d6769e3b598ec"
SOURCE_DIR="mksh"

REVISION="1"
ARCHITECTURES="x86_gcc2"

PROVIDES="
	mksh = $portVersion
	cmd:mksh
	cmd:sh
"

REQUIRES="
	haiku
"

BUILD_PREREQUIRES="
	haiku_devel
	cmd:ed
	cmd:gcc
	cmd:grep
	cmd:install
	cmd:make
	cmd:nroff
	cmd:perl
"

BUILD()
{
	sh Build.sh
}

INSTALL()
{
	mkdir -p $binDir
	mkdir -p $docDir/mksh/examples/
	mkdir -p $manDir/man1

	# Installing the shell:
	install -c -s -m 555 mksh $binDir/mksh
	# grep -x /bin/mksh /etc/shells >/dev/null || echo /bin/mksh >>/etc/shells
	install -c -m 444 dot.mkshrc $docDir/mksh/examples/

	# Installing the manual:
	install -c -m 444 mksh.1 $manDir/man1/mksh.1

	ln -s mksh $binDir/sh 
}

TEST()
{
	./test.sh
}
