# Contributor: Steffen Nurpmeso <steffen@sdaoden.eu>
# Contributor: Ivan Tham <pickfire@riseup.net>
# Maintainer: Ivan Tham <pickfire@riseup.net>
pkgname=s-nail
pkgver=14.9.6
pkgrel=0
pkgdesc="SysV mail/BSD Mail/POSIX mailx: send and receive Internet mail"
url="https://www.sdaoden.eu/code.html#s-mailx"
arch="all"
license="BSD"
makedepends="libressl-dev libidn-dev ncurses-dev krb5-dev"
options="suid"
replaces="mailx"
subpackages="$pkgname-doc"
source="https://ftp.sdaoden.eu/s-nail-$pkgver.tar.xz"
builddir="$srcdir/"$pkgname-$pkgver

# LD_LIBRARY_PATH is included via -rpath, so use system defaults only.
# And ensure no other paths sneak in.
unset LIBRARY_PATH LD_RUN_PATH
PATH=/sbin:/usr/sbin:/bin:/usr/bin
C_INCLUDE_PATH=/usr/include
LD_LIBRARY_PATH=/lib:/usr/lib
export PATH C_INCLUDE_PATH LD_LIBRARY_PATH

build() {
	cd "$builddir"
	make \
		VAL_SID= VAL_MAILX=mail \
		VAL_PREFIX=/usr \
		VAL_SYSCONFDIR=/etc \
		OPT_AUTOCC=no \
		config &&
	make build # XXX unite with config in v14.9.7
}

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

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

	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}

sha512sums="3f9e5007b3a831c2f57148e8a4344cf08b9e625e04c50adc5e3cce90a466f417c3a7336e35f928680e2e97b4543cdf31a1d729ea5a880075c70d463e56fbb792  s-nail-14.9.6.tar.xz"
