#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer		: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=s-nail
pkgver=14.9.24
pkgrel=02
pkgdesc='Environment for sending and receiving mail'
url='https://www.sdaoden.eu/code.html#s-nail'
arch=('x86_64')
depends=('openssl' 'krb5' 'libidn2')
optdepends=('smtp-forwarder: for sending mail')
source=("https://www.sdaoden.eu/downloads/${pkgname}-${pkgver}.tar.xz"{,.asc})

backup=('etc/mail.rc')
replaces=('mailx' 'mailx-heirloom' 'heirloom-mailx')
provides=('mailx' 'mailx-heirloom' 'heirloom-mailx')
conflicts=('mailx' 'mailx-heirloom' 'heirloom-mailx')

build() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	export CFLAGS+=" $CPPFLAGS"
	make \
		VAL_PREFIX=/usr \
		VAL_SYSCONFDIR=/etc \
		VAL_LIBEXECDIR=/usr/lib \
		VAL_MAIL=/var/spool/mail \
		VAL_SID= VAL_MAILX=mail \
		OPT_AUTOCC=0 \
		config

	make build
}

check() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	make test
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	make DESTDIR="${pkgdir}" install
	ln -sf mail "${pkgdir}"/usr/bin/mailx
	ln -sf mail.1.gz "${pkgdir}"/usr/share/man/man1/mailx.1.gz
	install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}

#---- license gpg-key sha256sums ----

license=('custom:BSD')

validpgpkeys=('EE19E1C1F2F7054F8D3954D8308964B51883A0DD')

sha256sums=(2714d6b8fb2af3b363fc7c79b76d058753716345d1b6ebcd8870ecd0e4f7ef8c # s-nail-14.9.24.tar.xz
	f6c5772fc4c14c92748c5d915c4d7371f734e6f62e88f724d86c6f8aabd5dfb1) # s-nail-14.9.24.tar.xz.asc


