# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=iputils
pkgver=20161105
pkgrel=0
pkgdesc="IP Configuration Utilities (and Ping)"
url="https://github.com/iputils/iputils/"
arch="all"
license="BSD-3-Clause GPL-2.0-or-later"
makedepends="libcap-dev libressl-dev"
replaces="bbsuid"
source="https://github.com/iputils/$pkgname/archive/s$pkgver.tar.gz
	time.patch
	fix-init-of-cmsg.patch
	"
options="!check suid"
builddir="$srcdir/$pkgname-s$pkgver"

build() {
	cd "$builddir"
	make all ninfod USE_IDN=no USE_NETTLE=no KERNEL_INCLUDE=/usr/include
}

package() {
	local name
	cd "$builddir"

	for name in arping clockdiff ipg rarpd rdisc tftpd tracepath; do
		install -D -m755 $name "$pkgdir"/usr/sbin/$name
	done
	install -D -m755 ninfod/ninfod "$pkgdir"/usr/sbin/ninfod

	for name in ping traceroute6; do
		install -D -m4755 $name "$pkgdir"/bin/$name
	done

	ln -s tracepath "$pkgdir"/usr/sbin/tracepath6
	ln -s ping "$pkgdir"/bin/ping6
}

sha512sums="1593077b6eff1e57eb8a32897dd9624a745d0c87db1501a96436b168b109ef22d41ee69406a4a2154d8d72c823c1df723b4c52eeec8d82ba2762fb01dc0d4797  s20161105.tar.gz
530532d16574921d0789af6a82706915e8103e712195c4f2eb6379192cc7126ba6bc9f33e8454118628d59f8932ffd2bb5aaba3b61fa93df83088e3b0d93d227  time.patch
2779b9d987089a2a9a39c27a092f16da85881e9dfbc99edcca6baea42912b8a1a7e16b00c19684d2ea1a6123d66f78be12bef43398e63be7d7c97d3d6269a5bf  fix-init-of-cmsg.patch"
