net-firewall/iptables: use HTTPS
[gentoo.git] / net-firewall / iptables / iptables-1.6.2-r1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 # Force users doing their own patches to install their own tools
7 AUTOTOOLS_AUTO_DEPEND=no
8
9 inherit ltprune multilib systemd toolchain-funcs autotools flag-o-matic
10
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"
14
15 LICENSE="GPL-2"
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.
18 SLOT="0/12"
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"
21
22 COMMON_DEPEND="
23         conntrack? ( >=net-libs/libnetfilter_conntrack-1.0.6 )
24         netlink? ( net-libs/libnfnetlink )
25         nftables? (
26                 >=net-libs/libmnl-1.0:0=
27                 >=net-libs/libnftnl-1.0.5:0=
28         )
29         pcap? ( net-libs/libpcap )
30 "
31 DEPEND="${COMMON_DEPEND}
32         virtual/os-headers
33         virtual/pkgconfig
34         nftables? (
35                 sys-devel/flex
36                 virtual/yacc
37         )
38 "
39 RDEPEND="${COMMON_DEPEND}
40         nftables? (
41                 !<net-firewall/ebtables-2.0.10.4-r2
42                 !net-misc/ethertypes
43         )
44 "
45
46 src_prepare() {
47         # use the saner headers from the kernel
48         rm -f include/linux/{kernel,types}.h
49
50         # Only run autotools if user patched something
51         eapply_user && eautoreconf || elibtoolize
52 }
53
54 src_configure() {
55         # Some libs use $(AR) rather than libtool to build #444282
56         tc-export AR
57
58         # Hack around struct mismatches between userland & kernel for some ABIs. #472388
59         use amd64 && [[ ${ABI} == "x32" ]] && append-flags -fpack-struct
60
61         sed -i \
62                 -e "/nfnetlink=[01]/s:=[01]:=$(usex netlink 1 0):" \
63                 -e "/nfconntrack=[01]/s:=[01]:=$(usex conntrack 1 0):" \
64                 configure || die
65
66         local myeconfargs=(
67                 --sbindir="${EPREFIX}/sbin"
68                 --libexecdir="${EPREFIX}/$(get_libdir)"
69                 --enable-devel
70                 --enable-shared
71                 $(use_enable nftables)
72                 $(use_enable pcap bpf-compiler)
73                 $(use_enable pcap nfsynproxy)
74                 $(use_enable static-libs static)
75                 $(use_enable ipv6)
76         )
77         econf "${myeconfargs[@]}"
78 }
79
80 src_compile() {
81         # Deal with parallel build errors.
82         use nftables && emake -C iptables xtables-config-parser.h
83         emake V=1
84 }
85
86 src_install() {
87         default
88         dodoc INCOMPATIBILITIES iptables/iptables.xslt
89
90         # all the iptables binaries are in /sbin, so might as well
91         # put these small files in with them
92         into /
93         dosbin iptables/iptables-apply
94         dosym iptables-apply /sbin/ip6tables-apply
95         doman iptables/iptables-apply.8
96
97         insinto /usr/include
98         doins include/iptables.h $(use ipv6 && echo include/ip6tables.h)
99         insinto /usr/include/iptables
100         doins include/iptables/internal.h
101
102         keepdir /var/lib/iptables
103         newinitd "${FILESDIR}"/${PN}.init iptables
104         newconfd "${FILESDIR}"/${PN}-1.4.13.confd iptables
105         if use ipv6 ; then
106                 keepdir /var/lib/ip6tables
107                 newinitd "${FILESDIR}"/iptables.init ip6tables
108                 newconfd "${FILESDIR}"/ip6tables-1.4.13.confd ip6tables
109         fi
110
111         systemd_dounit "${FILESDIR}"/systemd/iptables-{re,}store.service
112         if use ipv6 ; then
113                 systemd_dounit "${FILESDIR}"/systemd/ip6tables-{re,}store.service
114         fi
115
116         # Move important libs to /lib #332175
117         gen_usr_ldscript -a ip{4,6}tc iptc xtables
118
119         prune_libtool_files
120 }