dev-python/csv23: arm64 keyworded (bug #719700)
[gentoo.git] / net-misc / miniupnpd / miniupnpd-2.1.20200329.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit toolchain-funcs
7
8 DESCRIPTION="MiniUPnP IGD Daemon"
9 HOMEPAGE="http://miniupnp.free.fr/"
10 SRC_URI="http://miniupnp.free.fr/files/${P}.tar.gz"
11
12 LICENSE="BSD"
13 SLOT="0"
14 KEYWORDS="~amd64 ~arm ~x86"
15 IUSE="+leasefile igd2 ipv6 nftables pcp-peer portinuse strict"
16
17 RDEPEND="
18         dev-libs/gmp:0=
19         sys-apps/util-linux:=
20         dev-libs/openssl:0=
21         !nftables? (
22                 >=net-firewall/iptables-1.4.6:0=[ipv6?]
23                 net-libs/libnfnetlink:=
24                 net-libs/libmnl:=
25         )
26         nftables? (
27                 net-firewall/nftables
28                 net-libs/libnftnl:=
29                 net-libs/libmnl:=
30         )"
31 DEPEND="${RDEPEND}
32         sys-apps/lsb-release"
33
34 src_prepare() {
35         default
36
37         # Prevent overriding CFLAGS.
38         sed -i -e '/^CFLAGS =/d' Makefile.linux_nft || die
39
40         mv "Makefile.linux$(usex nftables _nft '')" Makefile || die
41
42         # Prevent gzipping manpage.
43         sed -i -e '/gzip/d' Makefile || die
44 }
45
46 src_configure() {
47         local -a opts
48         opts=(
49                 --vendorcfg
50                 $(usex igd2 '--igd2' '')
51                 $(usex ipv6 '--ipv6' '')
52                 $(usex leasefile '--leasefile' '')
53                 $(usex portinuse '--portinuse' '')
54                 $(usex pcp-peer '--pcp-peer' '')
55                 $(usex strict '--strict' '')
56         )
57
58         CONFIG_OPTIONS="${opts[*]}" emake config.h
59 }
60
61 src_compile() {
62         # By default, it builds a bunch of unittests that are missing wrapper
63         # scripts in the tarball
64         emake CC="$(tc-getCC)" STRIP=true miniupnpd
65 }
66
67 src_install() {
68         emake PREFIX="${ED}" STRIP=true install
69
70         local confd_seds=()
71         if use nftables; then
72                 confd_seds+=( -e 's/^iptables_scripts=/#&/' )
73         else
74                 confd_seds+=( -e 's/^nftables_scripts=/#&/' )
75         fi
76         if ! use ipv6 || use nftables; then
77                 confd_seds+=( -e 's/^ip6tables_scripts=/#&/' )
78         fi
79
80         newinitd "${FILESDIR}"/${PN}-init.d-r2 ${PN}
81         newconfd - ${PN} < <(sed "${confd_seds[@]}" \
82                 "${FILESDIR}"/${PN}-conf.d-r2 || die)
83 }
84
85 pkg_postinst() {
86         elog "Please correct the external interface in the top of the two"
87         elog "scripts in /etc/miniupnpd and edit the config file in there too"
88 }