# Contributor: Alexander Belkov <msun00@yandex.ru>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=at
pkgver=3.2.1
pkgrel=0
pkgdesc="Delayed job execution and batch processing daemon"
url="http://blog.calhariz.com/tag/at"
arch="all"
options="!check suid"  # No test suite.
license="GPL-2.0+"
depends="cmd:sendmail"
makedepends="byacc flex-dev ssmtp"
install="${pkgname}.pre-install"
pkgusers="at"
pkggroups="at"
subpackages="$pkgname-doc $pkgname-openrc"
source="http://software.calhariz.com/at/at_3.2.1.orig.tar.gz
	10-parsetime.y-1.patch
	10-Makefile.in-1.patch
	at.allow
	atd.initd
	"

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

prepare() {
	default_prepare
	update_config_guess
	update_config_sub
}

build() {
	LEXLIB=-lfl \
	PATH=$PATH:/usr/sbin \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--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() {
	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="8109b2acf220ffc14ea78e7d5671507e8cad41a163c1d7f96de18aae05c8617071c6306e04446450190f492a65ca31f51ed040fba5719b67625a58f738fc9c9e  at_3.2.1.orig.tar.gz
ea663b4ad95761812d31333d0d75b20f7981932e5f2c2144d0aea14753534c240992c647a0d4edb55268f47a8f019da6ab3b9fc53807355a270338e2cd24bbc6  10-parsetime.y-1.patch
2db77ab2a8e252993f46d3f4f839ec79118008d2adc7daa22faab715f39b002c85284d68d9ad8b6a36f70bfd783a9018d50b5e495908871341444499419ee262  10-Makefile.in-1.patch
21e1bc024bd76c76b68e04614c6def5b03fd4b658e59bfde065b464b520f463711b795455e3a5c81a8a1946b2bca2f83d6c19300a4d3326ce17959a7cbc0846a  at.allow
fe5c075566ef1955e0eb4b4446fe1ea401940df6e0f29e4e2f1baf93e231214db58c707e99b16bb3a3c8c288a05fc390a44c6f09fde50d31f0ac631a98d86c2d  atd.initd"