# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=inetutils-syslogd
_pkgname=inetutils
pkgver=1.9.4
pkgrel=2
pkgdesc="A small syslogd for logging to multiple files"
url="https://www.gnu.org/software/inetutils/"
arch="all"
license="GPL-3.0"
depends_dev="readline-dev ncurses-dev"
makedepends="$depends_dev"
install="$pkgname.post-install $pkgname.post-deinstall"
subpackages="$pkgname-doc"
options="!check"
source="http://ftp.gnu.org/gnu/inetutils/${_pkgname}-${pkgver}.tar.gz
	$pkgname.initd
	$pkgname.confd
	syslog.conf
	$pkgname.logrotate
	$pkgname.setup
	"

_builddir="$srcdir"/$_pkgname-$pkgver

build() {
	cd "$_builddir"

        ./configure \
                --build=$CBUILD \
                --host=$CHOST \
                --prefix=/usr \
		--libexec=/usr/sbin \
                --sysconfdir=/etc \
                --mandir=/usr/share/man \
                --infodir=/usr/share/info \
                --localstatedir=/var \
		--without-wrap --without-pam \
		--disable-ftp --disable-ftpd \
		--disable-telnet --disable-telnetd \
		--disable-talk --disable-talkd \
		--disable-rlogin --disable-rlogind \
		--disable-rsh --disable-rshd \
		--disable-rexec --disable-rexecd \
		--disable-rcp --disable-hostname \
		--disable-tftp --disable-tftpd \
		--disable-ping --disable-ping6 \
		--disable-logger --enable-syslogd \
		--disable-inetd --disable-whois --disable-dnsdomainname \
		--disable-uucpd --disable-ifconfig --disable-traceroute \
		|| return 1
        make || return 1
}

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

package() {
	cd "$_builddir"
	make DESTDIR="${pkgdir}" install || return 1
	#binary installed to /usr/sbin not bin
	rm -rf "$pkgdir"/usr/bin \
		"$pkgdir"/usr/lib/charset.alias \
		|| return 1

	#install init script & config defaults
        install -m755 -D "$srcdir"/$pkgname.initd \
                "$pkgdir"/etc/init.d/$pkgname || return 1
        install -m644 -D "$srcdir"/$pkgname.confd \
                "$pkgdir"/etc/conf.d/$pkgname || return 1
	install -m644 -D "$srcdir"/syslog.conf \
                "$pkgdir"/etc/syslog.conf || return 1
	install -m644 -D "$srcdir"/inetutils-syslogd.logrotate \
                "$pkgdir"/etc/logrotate.d/inetutils-syslogd || return 1
	install -m755 -D "$srcdir"/inetutils-syslogd.setup \
                "$pkgdir"/sbin/setup-inetutils-syslogd || return 1
	mkdir -p "$pkgdir/usr/share/apk-tools/$pkgname"
}

md5sums="04852c26c47cc8c6b825f2b74f191f52  inetutils-1.9.4.tar.gz
4a5ed84baf026fe2e686b9e915d140e3  inetutils-syslogd.initd
edf3f502d9f2bf49c5da8cb37a927d06  inetutils-syslogd.confd
9c9998ff341c48322ffdc8f48fa018cf  syslog.conf
842e971153c19cb328db2cc6e22a7baf  inetutils-syslogd.logrotate
82d3bf51747654410b2dbd4075e940b4  inetutils-syslogd.setup"
sha256sums="be8f75eff936b8e41b112462db51adf689715658a1b09e0d6b05d11ec92cc616  inetutils-1.9.4.tar.gz
a0bc678a83103ee412c6c57a5f5e0bc4c66f579f7e839f71aac99d329719c80f  inetutils-syslogd.initd
86105f0a0105f50275f7381b5d7fe603b8d854a0e6753c2f06f6d0c234562948  inetutils-syslogd.confd
0b3f080466437a068d1627a00a5abdf494fdefa2e17821b993462d0310e60cc3  syslog.conf
f2afe7dad8cd933fbd213b20f09127096f8798698874b2ead2d47a6509f95f6c  inetutils-syslogd.logrotate
f293c6221c89f6d3eb4a557fe68ca66cc92696c95b48182821aa5aa61f9a2c8f  inetutils-syslogd.setup"
sha512sums="8074eb230c64d8fb0f3a20825b9329e5648b81941bb3441c5ffe2661c428f93fe2bac222d5334e75ef182083124c4bc5d7ebf8090ed667e4ae33b9aaacbc6dcb  inetutils-1.9.4.tar.gz
75d5681d08a391956e0f0510eadb20c3ba74de4026f76ea0a54c3e34bb53655ff6cbe3087c0953343fdef3b05864a4dc7d9d12ed26836f8986859868f0076c79  inetutils-syslogd.initd
82968692b4fe79706aacaeb1021b343288dc4f1d86925481796dac1f743a8269976ce86bf446cd0c16d246b918e5822e312660b201407eb7031a17cb398c9513  inetutils-syslogd.confd
d9c61aee1a3f2c7cf7b06dfda08599c08f1f618ba092e60adff11e9cbe5be847544780eaa9e4bb54a70c5e5bc243fed3d6ff8111878f073b41629db4245b135c  syslog.conf
ffe2b1fd6b9d4dc9e378f0c857be318ec86e48aee17ede865656bdf9a5da3d2f3a8ffe788cd62794132839577ab6ce1ce7fe3a964bc21e0f8b698827a9ee5817  inetutils-syslogd.logrotate
a3c54be2c2154adec3b5d8cf68e43f274eb42ac2e02f3ea39235a11f333d1cc88ea2d0af93daf5095c8de7dfbbc147c53d97bbfce3944f50858ee97907270bf7  inetutils-syslogd.setup"
