1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 # Force users doing their own patches to install their own tools
7 AUTOTOOLS_AUTO_DEPEND=no
9 inherit ltprune multilib systemd toolchain-funcs autotools flag-o-matic
11 DESCRIPTION="Linux kernel (2.4+) firewall, NAT and packet mangling tools"
12 HOMEPAGE="https://www.netfilter.org/projects/iptables/"
13 SRC_URI="https://www.netfilter.org/projects/iptables/files/${P}.tar.bz2"
16 # Subslot tracks libxtables as that's the one other packages generally link
17 # against and iptables changes. Will have to revisit if other sonames change.
19 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
20 IUSE="conntrack ipv6 netlink nftables pcap static-libs"
23 conntrack? ( >=net-libs/libnetfilter_conntrack-1.0.6 )
24 netlink? ( net-libs/libnfnetlink )
26 >=net-libs/libmnl-1.0:0=
27 >=net-libs/libnftnl-1.0.5:0=
29 pcap? ( net-libs/libpcap )
31 DEPEND="${COMMON_DEPEND}
39 RDEPEND="${COMMON_DEPEND}
41 !<net-firewall/ebtables-2.0.10.4-r2
47 # use the saner headers from the kernel
48 rm -f include/linux/{kernel,types}.h
50 # Only run autotools if user patched something
51 eapply_user && eautoreconf || elibtoolize
55 # Some libs use $(AR) rather than libtool to build #444282
58 # Hack around struct mismatches between userland & kernel for some ABIs. #472388
59 use amd64 && [[ ${ABI} == "x32" ]] && append-flags -fpack-struct
62 -e "/nfnetlink=[01]/s:=[01]:=$(usex netlink 1 0):" \
63 -e "/nfconntrack=[01]/s:=[01]:=$(usex conntrack 1 0):" \
67 --sbindir="${EPREFIX}/sbin"
68 --libexecdir="${EPREFIX}/$(get_libdir)"
71 $(use_enable nftables)
72 $(use_enable pcap bpf-compiler)
73 $(use_enable pcap nfsynproxy)
74 $(use_enable static-libs static)
77 econf "${myeconfargs[@]}"
81 # Deal with parallel build errors.
82 use nftables && emake -C iptables xtables-config-parser.h
88 dodoc INCOMPATIBILITIES iptables/iptables.xslt
90 # all the iptables binaries are in /sbin, so might as well
91 # put these small files in with them
93 dosbin iptables/iptables-apply
94 dosym iptables-apply /sbin/ip6tables-apply
95 doman iptables/iptables-apply.8
98 doins include/iptables.h $(use ipv6 && echo include/ip6tables.h)
99 insinto /usr/include/iptables
100 doins include/iptables/internal.h
102 keepdir /var/lib/iptables
103 newinitd "${FILESDIR}"/${PN}.init iptables
104 newconfd "${FILESDIR}"/${PN}-1.4.13.confd iptables
106 keepdir /var/lib/ip6tables
107 newinitd "${FILESDIR}"/iptables.init ip6tables
108 newconfd "${FILESDIR}"/ip6tables-1.4.13.confd ip6tables
111 systemd_dounit "${FILESDIR}"/systemd/iptables-{re,}store.service
113 systemd_dounit "${FILESDIR}"/systemd/ip6tables-{re,}store.service
116 # Move important libs to /lib #332175
117 gen_usr_ldscript -a ip{4,6}tc iptc xtables