# Template file for 'ksh'
pkgname=ksh
version=2018.01.19
revision=1
_githash=0280d4fdadd3ad690c7b69b795a2f0621b29c445
wrksrc="ast-${_githash}"
build_style=meson
register_shell="/bin/ksh"
short_desc="AT&T's Korn shell (ksh93)"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="EPL-1.0"
homepage="http://www.kornshell.com/"
distfiles="https://github.com/att/ast/archive/${_githash}.tar.gz"
checksum=5088ec1a726180e28ffbce5a6c31489100c37d913fd381e534db2607117fc3f7
nocross=yes

alternatives="
 ksh:ksh:/usr/bin/ksh93
 ksh:ksh.1:/usr/share/man/man1/ksh93.1
"

build_options="static"
if [ "$build_option_static" ]; then
	LDFLAGS+=" -static"
fi

post_extract() {
	sed -i -e 's/= library/= static_library/'  \
		-e 's/install: true/install: false/' src/lib/*/meson.build
}
post_install() {
	mv ${DESTDIR}/usr/bin/ksh ${DESTDIR}/usr/bin/ksh93
	gunzip ${DESTDIR}/usr/share/man/man*/*.gz
	mv ${DESTDIR}/usr/share/man/man1/ksh.1 ${DESTDIR}/usr/share/man/man1/ksh93.1
	vmkdir usr/share/ksh
	vcopy src/cmd/ksh93/fun usr/share/ksh/functions
	vlicense ${FILESDIR}/LICENSE
}
