aboutsummaryrefslogtreecommitdiffstats
path: root/main/iptables/APKBUILD
blob: 12a8a95a61463312bf5a38f1cd52798a6112dc46 (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

pkgname=iptables
pkgver=1.6.0
pkgrel=0
pkgdesc="Linux kernel firewall, NAT and packet mangling tools"
url="http://www.netfilter.org/projects/iptables/index.html"
arch="all"
license="GPL2+"
source="http://ftp.netfilter.org/pub/iptables/iptables-$pkgver.tar.bz2
	iptables-1.6.0-musl-fixes.patch

	iptables.initd
	iptables.confd
	ip6tables.confd
	"

depends_dev="linux-headers"
makedepends="$depends_dev libnftnl-dev bison flex autoconf automake"
subpackages="ip6tables $pkgname-doc $pkgname-dev"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	local i
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	sed -i -e '/if_packet/i#define __aligned_u64 __u64 __attribute__((aligned(8)))' \
		extensions/libxt_pkttype.c || return 1
}

build() {
	cd "$_builddir"
	export CFLAGS="$CFLAGS -D_GNU_SOURCE"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--sbindir=/sbin \
		--without-kernel \
		--enable-devel \
		--enable-libipq \
		--enable-shared \
		|| return 1
	# do not use rpath
	sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
	sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
	MAKEFLAGS="$MAKEFLAGS -j2" make || return 1
}

package() {
	cd "$_builddir"
	make -j1 install DESTDIR="$pkgdir" || return 1

	mkdir -p "$pkgdir"/usr/include/libiptc \
		"$pkgdir"/usr/lib \
		"$pkgdir"/var/lib/iptables \
		"$pkgdir"/etc/init.d \
		"$pkgdir"/etc/conf.d \
		"$pkgdir"/etc/iptables \
		|| return 1
	install -m644 include/iptables.h include/ip6tables.h \
		"$pkgdir"/usr/include/ || return 1
	install include/libiptc/*.h "$pkgdir"/usr/include/libiptc/
	install -m644 libiptc/libiptc.a "$pkgdir"/usr/lib
	install -m755 "$startdir"/iptables.initd "$pkgdir"/etc/init.d/iptables
	install -m644 "$startdir"/iptables.confd "$pkgdir"/etc/conf.d/iptables
}

ip6tables() {
	depends="iptables"
	mkdir -p "$subpkgdir"/sbin \
		"$subpkgdir"/etc/init.d/ \
		"$subpkgdir"/etc/conf.d \
		"$subpkgdir"/var/lib/ip6tables \
		"$subpkgdir"/usr/lib/xtables

	mv "$pkgdir"/sbin/ip6* "$subpkgdir"/sbin/
	mv "$pkgdir"/usr/lib/xtables/libip6* \
		"$subpkgdir"/usr/lib/xtables/
	install -m755 "$startdir"/iptables.initd \
		"$subpkgdir"/etc/init.d/ip6tables
	install -m644 "$startdir"/ip6tables.confd "$subpkgdir"/etc/conf.d/ip6tables
}

md5sums="27ba3451cb622467fc9267a176f19a31  iptables-1.6.0.tar.bz2
92fcad4dc7b3e34d5bf944f53e34563b  iptables-1.6.0-musl-fixes.patch
2e8175456a98221c0be9b758d064ee09  iptables.initd
c91286c54f8fe0de6ed8950f375cb7a5  iptables.confd
d3f37ebc2cd3fbfc326c3a8df5a79e11  ip6tables.confd"
sha256sums="4bb72a0a0b18b5a9e79e87631ddc4084528e5df236bc7624472dcaa8480f1c60  iptables-1.6.0.tar.bz2
0b7c73ebbb1f207ff6a1d36cb460b654eda7993eda9053fd469a493cae310d80  iptables-1.6.0-musl-fixes.patch
f297f985ad35fe45800f0c1c7aaf348c3fa920b97be2020c76983ab54e384ba0  iptables.initd
421acbcd310f9c51e20e22e59af9452b1ba5d0db33e8960eba0095271060c3db  iptables.confd
31ef5d759c64afd0ecbcb56b3982ed2bdb5ed9c8553c628c13d4a3b5687118a3  ip6tables.confd"
sha512sums="60360910db76e3265fb7b6456a55b91708263bde9c4e5b9cadf3832d2e2a9db3e6cb60c82e278ea0672618bd5c9566c374e00d19d35a2e8f330116c3ab6aaf51  iptables-1.6.0.tar.bz2
e79344cab67c4fa0449dfeef6d1504bcd41d16d595010a18a7d9e75eba46021617d31fbb79c62894fd35898ec643b542a6111b06d405c79ffff41a3078327b62  iptables-1.6.0-musl-fixes.patch
059b3bd8dd7dec60060ec5eb1e639fe8203207629f3a7dd4fdbe5ebca3f7e9b80df5592ebb27542e31830fd15a53cffac5772567053c104dfccf9b78613a31a1  iptables.initd
cb7fecd5cab2c78bd3f215a41f39ec11c37eb360efbe83982378a0e647e0aa9dc0b7ec915a5b5081aa2f7747464787e69404aa15ba15a063c32cb8fb7dd13d1e  iptables.confd
0897a7a22f8b700f7f1f5c355ad6cbf39740e44d6c962af99e479978d8a2d556ca7fe4e31f238829046b4a871ce0b5fd52e2544f1361d15dd1ea3e33992646c4  ip6tables.confd"