# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
pkgname=apt-dater
pkgver=0.9.0
pkgrel=0
pkgdesc="terminal-based remote package update manager"
url="https://github.com/DE-IBH/apt-dater"
arch="all"
license="GPL-2.0-or-later"
depends="lockfile-progs screen openssh-client"
makedepends="automake autoconf popt-dev glib-dev ncurses-dev tcl-dev libconfig-dev libxml2-dev"
install=""
subpackages="$pkgname-doc $pkgname-lang"
source="apt-dater-$pkgver.tar.gz::https://github.com/DE-IBH/apt-dater/archive/v$pkgver.tar.gz
	apt-dater-fix-includes.patch
	02-refresh-ssh-flags.patch"
# 02-refresh-ssh-flags.patch is 02-refresh-ssh-flags.diff from Debian Jessie
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	cd "$builddir"
	default_prepare
	update_config_sub
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-tclfilter \
		--enable-xmlreport \
		--enable-autoref \
		--enable-history \
		--enable-debug

	make
}

check() {
	cd "$builddir"
	HOME="$builddir" ./src/apt-dater -v
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install
	rm -f "$pkgdir"/usr/share/man/man1/apt-dater-host.1
}

sha512sums="9bb4ecec27e10dc45a16a472b0765917885acd62cc573ab823666fd2a1196b36a7019486458b2f5e4fdccde31c08ed5dd2fceaba8d297eea99929062e8a5ef99  apt-dater-0.9.0.tar.gz
562631999cbcf0dcfeb987705c3ec66b274b0f6914527229adbe9281b2a791f601052ed51dff9004220c376b3de9e3da812e0961b3e999174c9c4fb75593499c  apt-dater-fix-includes.patch
f934b74453eb08709684ab277abd24a904d702242300b22a89e2b5a79a641647a7be2341ea871520d2ee1ba8d1359bb0c5700393c6025b4dbf15b346397a8c35  02-refresh-ssh-flags.patch"
