aboutsummaryrefslogtreecommitdiffstats
path: root/main/iptables/APKBUILD
blob: 20aecf705fd988bb58080bb8fffe156ed2d31c4b (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
105
106
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>

pkgname=iptables
pkgver=1.4.21
pkgrel=3
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.4.14-musl-fixes.patch

	iptables.initd
	iptables.confd
	ip6tables.confd
	"

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

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	update_config_sub || return 1
	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
	make || return 1
}

package() {
	cd "$_builddir"
	make -j1 install DESTDIR="$pkgdir" || return 1
	rm "$pkgdir"/usr/lib/*.la || 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="536d048c8e8eeebcd9757d0863ebb0c0  iptables-1.4.21.tar.bz2
cd9f429bf0dbd73be5f95bf0d7169728  iptables-1.4.14-musl-fixes.patch
ce106a4222a174d2e102b1975fe0295c  iptables.initd
c91286c54f8fe0de6ed8950f375cb7a5  iptables.confd
d3f37ebc2cd3fbfc326c3a8df5a79e11  ip6tables.confd"
sha256sums="52004c68021da9a599feed27f65defcfb22128f7da2c0531c0f75de0f479d3e0  iptables-1.4.21.tar.bz2
3ad64af68ea70aa6de0649a68176c2ac68e1c0db567babb472648695dbff8f90  iptables-1.4.14-musl-fixes.patch
6c2da067887658c897a11254e001bfb1510c8b34d759212b51b7630d0e7e4ae8  iptables.initd
421acbcd310f9c51e20e22e59af9452b1ba5d0db33e8960eba0095271060c3db  iptables.confd
31ef5d759c64afd0ecbcb56b3982ed2bdb5ed9c8553c628c13d4a3b5687118a3  ip6tables.confd"
sha512sums="dd4baccdb080284d8620e6ed59beafc2677813f3e099051764b07f8e394f6d94ca11861b181f3cce7c55c66de64c1e2add13dc1a0b64e24050cd9fb7aea0689b  iptables-1.4.21.tar.bz2
bc1cb36957d5afb80b770fe15f951de3074e2b1b28015372fb6f121fd551dd0e86c76c1819022dc468d11750b3969db40ef2dc9651c654c9f99212c0f2746985  iptables-1.4.14-musl-fixes.patch
87a53dfba76c48fc1bb6b92583d47abdcfd232579b45bfbf28284ee18cb589bbc5dba5ccccf06d513fda309efd13f5e034f55d6d8cfa65e0463f3ecd4f24cc03  iptables.initd
cb7fecd5cab2c78bd3f215a41f39ec11c37eb360efbe83982378a0e647e0aa9dc0b7ec915a5b5081aa2f7747464787e69404aa15ba15a063c32cb8fb7dd13d1e  iptables.confd
0897a7a22f8b700f7f1f5c355ad6cbf39740e44d6c962af99e479978d8a2d556ca7fe4e31f238829046b4a871ce0b5fd52e2544f1361d15dd1ea3e33992646c4  ip6tables.confd"