aboutsummaryrefslogtreecommitdiffstats
path: root/main/iproute2/APKBUILD
blob: 96e5fa2e1178bad35509d4d5f5b35bb70b8da030 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=iproute2
pkgver=5.11.0
pkgrel=0
pkgdesc="IP Routing Utilities"
options="!check" # Requires namespaces support and root
url="https://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2"
arch="all"
license="GPL-2.0-or-later"
install="$pkgname.post-install"
makedepends="bison flex bash iptables-dev elfutils-dev"
subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch $pkgname-minimal $pkgname-tc $pkgname-ss"
source="https://kernel.org/pub/linux/utils/net/iproute2/iproute2-$pkgver.tar.xz"

# secfixes:
#   5.1.0-r0:
#     - CVE-2019-20795

prepare() {
	default_prepare
	sed -i '/^TARGETS=/s: arpd : :' misc/Makefile
	sed -i 's:/usr/local:/usr:' tc/m_ipt.c include/iptables.h
	sed -i -e 's:=/share:=/usr/share:' \
		-e 's:-Werror::' Makefile
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make CCOPTS="-D_GNU_SOURCE $CFLAGS" V=1
}

package() {
	make -j1 DESTDIR="$pkgdir" install
}

minimal() {
	replaces="$pkgname"
	pkgdesc="IP Routing Utilities (/sbin/ip only)"
	install_if="$pkgname=$pkgver-r$pkgrel"

	install -d -m755 "$subpkgdir"/sbin

	mv "$pkgdir"/sbin/ip "$subpkgdir"/sbin/
	mv "$pkgdir"/etc "$subpkgdir"/etc
}

tc() {
	replaces="$pkgname"
	pkgdesc="IP Routing Utilities (traffic control and XDP support)"
	install_if="$pkgname=$pkgver-r$pkgrel"

	install -d -m755 "$subpkgdir"/sbin

	mv "$pkgdir"/sbin/tc "$subpkgdir"/sbin/
	mv "$pkgdir"/usr "$subpkgdir"/usr
}

ss() {
	replaces="$pkgname"
	pkgdesc="IP Routing Utilities (socket statistics tool)"
	install_if="$pkgname=$pkgver-r$pkgrel"

	install -d -m755 "$subpkgdir"/sbin

	mv "$pkgdir"/sbin/ss "$subpkgdir"/sbin/
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	mkdir -p "$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/share/bash-completion \
		"$subpkgdir"/usr/share

	rmdir -p "$pkgdir"/usr/share 2>/dev/null || true
}

sha512sums="8d0e7efc20db70af2d344962610b7fb7f464da567f63e094a2e2a9915f6e9087a2282163d2c73eb2065aaec4f0b0cf19614253798153b31e34b06f57e704f3ed  iproute2-5.11.0.tar.xz"