# Template file for 'ksh'
pkgname=ksh
reverts="2020.0.0_1"
version=1.0.10
revision=1
short_desc="AT&T's Korn shell (community branch ksh93u+m)"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="EPL-1.0"
homepage="https://github.com/ksh93/ksh"
distfiles="https://github.com/ksh93/ksh/archive/v${version}.tar.gz"
checksum=9f4c7a9531cec6941d6a9fd7fb70a4aeda24ea32800f578fd4099083f98b4e8a
nocross=yes

register_shell="/bin/ksh"
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

do_build() {
	bin/package make CCFLAGS="$CFLAGS" NPROC="$XBPS_MAKEJOBS"
}
do_check() {
	# run inside own pty
	script -qfc bin/shtests /dev/null
}
do_install() {
	vlicense LICENSE.md LICENSE

	bin/package install ${DESTDIR}/usr
	mv ${DESTDIR}/usr/bin/ksh ${DESTDIR}/usr/bin/ksh93
	mv ${DESTDIR}/usr/share/man/man1/ksh.1 ${DESTDIR}/usr/share/man/man1/ksh93.1
	#cd arch/*/
	#vbin bin/ksh ksh93
	#vbin bin/shcomp
	#vmkdir usr/share/ksh
	#vcopy fun usr/share/ksh/functions
	#vman man/man1/sh.1 ksh93.1
}

ksh-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/share/man/man3
		vmove usr/lib/*.so
	}
}
