# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=monitoring-plugins
pkgver=2.4.0
pkgrel=0
pkgdesc="Plugins for Icinga, Naemon, Nagios, Shinken, Sensu and other monitoring applications"
url="https://www.monitoring-plugins.org"
arch="all"
license="GPL-3.0-or-later"
options="suid !check" # Tests require interactive output and connecting to various URLs
depends="iputils procps bind-tools"
makedepends="
	gettext-dev
	libdbi-dev
	libpq-dev
	linux-headers
	mariadb-connector-c-dev
	net-snmp-tools
	openssl-dev
	perl-dev
	perl-net-snmp
	"
checkdepends="cmd:ksh"
subpackages="$pkgname-doc"
source="https://www.monitoring-plugins.org/download/monitoring-plugins-$pkgver.tar.gz"

build() {
	 ./configure \
		--prefix=/usr \
		--libexecdir=/usr/lib/monitoring-plugins \
		--with-perl="$(which perl)" \
		--with-ping-command="/bin/ping -n -U -w %d -c %d %s" \
		--with-ping6-command="/bin/ping6 -n -U -w %d -c %d %s" \
		--with-sudo-command="/usr/bin/sudo" \
		--with-mailq-command="/usr/bin/mailq" \
		--with-ssh-command="/usr/bin/ssh" \
		--with-openssl \
		--with-pgsql=/usr \
		--with-dbi \
		--with-mysql \
		--with-ipv6 \
		--without-systemd
	make
}

package() {
	make DESTDIR="$pkgdir" install

	for i in ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog \
		FAQ NEWS README REQUIREMENTS SUPPORT THANKS; do
		install -Dm644 $i "$pkgdir"/usr/share/doc/$pkgname/$i
	done
}

sha512sums="
7e9aae7768ed9fccbaf377fc54a70374f6a41e8e8ef95cf7440e44fca1080eb23e6b3d737214c96d772eb9a32cdfdbf1b88e0eb35eda0690047d5fe1b485a6b2  monitoring-plugins-2.4.0.tar.gz
"
