# Contributor: Dan Theisen <djt@hxx.in>
# Maintainer: Dan Theisen <djt@hxx.in>
pkgname=tcsh
pkgver=6.21.00
_pkgver=${pkgver%.*.*}_${pkgver#*.}
_pkgver=${_pkgver%.*}_${_pkgver#*.}
pkgrel=0
pkgdesc="extended C-shell"
url="https://www.tcsh.org"
arch="all"
license="BSD-3-Clause"
depends=""
checkdepends="diffutils autoconf"
makedepends="ncurses-dev ncurses-terminfo utmps-dev gettext-tiny-dev"
install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall"
subpackages="$pkgname-doc"
options="!checkroot"
source="$pkgname-$pkgver.tar.gz::https://github.com/tcsh-org/tcsh/archive/TCSH${_pkgver}.tar.gz
	001-sysmalloc.patch"

builddir="$srcdir/${pkgname}-TCSH${_pkgver}"
build() {
	cd "$builddir"
	LIBS="-lutmps -lskarnet -ltinfo" ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--bindir=/bin \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
                --enable-nls \
                --enable-nls-catalogs \
		--disable-rpath
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

sha512sums="305380fd065ca4703ffba002358b41727056481573a78301cb8c2390d5fe1a4107af5d482db5abf26f0ce9f7193c8aeb0e34fedcc40971499be2e6dc13bf3405  tcsh-6.21.00.tar.gz
40149d8eb2fc0fe5184f3c24c7a1b728e881cc0048ccd37a986c3b2d2094499ec1c37ae2bae4c209fb8a847aa943e83e81f79e3d2f55c59990bc00d9d07f5a94  001-sysmalloc.patch"