# Contributor: Alexander Belkov <msun00@yandex.ru>
# Maintainer: Alexander Belkov <msun00@yandex.ru>
pkgname=at
pkgver=3.1.20
pkgrel=2
pkgdesc="AT and batch delayed command scheduling utility and daemon"
url="https://packages.qa.debian.org/a/at.html"
arch="all"
options="!check suid"  # No test suite.
license="GPL-2.0+"
makedepends="ssmtp flex-dev byacc"
depends_dev=""
install="${pkgname}.pre-install"
subpackages="at-doc"
source="http://http.debian.net/debian/pool/main/a/at/at_$pkgver.orig.tar.gz
	10-parsetime.l-1.patch
	10-parsetime.y-1.patch
	10-Makefile.in-1.patch
	at.allow
	atd.initd
	"

builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare
	update_config_guess
}

build() {
	cd "$builddir"
	LEXLIB=-lfl \
	./configure --prefix=/usr \
	            --sbindir=/usr/sbin \
		    --runstatedir=/var/run \
		    --with-daemon_username=at \
		    --with-daemon_groupname=at \
	            --with-jobdir=/var/spool/atd \
		    --with-atspool=/var/spool/atd
	make
}

package() {
	cd "$builddir"
	install -D -o root -g at -m 640 "$srcdir"/at.allow \
		"$pkgdir"/etc/at.allow
	make IROOT="$pkgdir" install
	install -m 755 -D "$srcdir"/atd.initd \
		"$pkgdir"/etc/init.d/atd
}

sha512sums="20a13512a86f988728f590712f5bf8a23f4dc44f4b42521a4dd4783dc1ba7ac2016ee87b4c2c14f2346a5839168a983d99c3195e947014aea3096a3db16d176f  at_3.1.20.orig.tar.gz
ec24581fd59de62a93a5914f57b811baaf00fcc8fe969a4c8d0eb0cb2fd939762871725fec406eb127763935ab95ea10e23f314144a5d08ede78ba3bcf231e4a  10-parsetime.l-1.patch
9c06a4e92f3820a85ba75be8c14cb02762f6a5d4f0182bb2faafe51f5de2e35b0ce91e7e81f6e5b3127732c36c8e23e276a103aa0419661a602df93df274f855  10-parsetime.y-1.patch
ba57e93c9c90dc989e8ac299c12de13de0005b28fd934620a9a5b47af89db3c0dc63e39043ab3a50d313ed2bb4f4832b1f68db971b3f515c500a2b74ed18acbd  10-Makefile.in-1.patch
21e1bc024bd76c76b68e04614c6def5b03fd4b658e59bfde065b464b520f463711b795455e3a5c81a8a1946b2bca2f83d6c19300a4d3326ce17959a7cbc0846a  at.allow
fe5c075566ef1955e0eb4b4446fe1ea401940df6e0f29e4e2f1baf93e231214db58c707e99b16bb3a3c8c288a05fc390a44c6f09fde50d31f0ac631a98d86c2d  atd.initd"
