1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit toolchain-funcs
8 DESCRIPTION="MiniUPnP IGD Daemon"
9 HOMEPAGE="http://miniupnp.free.fr/"
10 SRC_URI="http://miniupnp.free.fr/files/${P}.tar.gz"
14 KEYWORDS="~amd64 ~arm ~x86"
15 IUSE="+leasefile igd2 ipv6 nftables pcp-peer portinuse strict"
22 >=net-firewall/iptables-1.4.6:0=[ipv6?]
23 net-libs/libnfnetlink:=
37 # Prevent overriding CFLAGS.
38 sed -i -e '/^CFLAGS =/d' Makefile.linux_nft || die
40 mv "Makefile.linux$(usex nftables _nft '')" Makefile || die
42 # Prevent gzipping manpage.
43 sed -i -e '/gzip/d' Makefile || die
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' '')
58 CONFIG_OPTIONS="${opts[*]}" emake config.h
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
68 emake PREFIX="${ED}" STRIP=true install
72 confd_seds+=( -e 's/^iptables_scripts=/#&/' )
74 confd_seds+=( -e 's/^nftables_scripts=/#&/' )
76 if ! use ipv6 || use nftables; then
77 confd_seds+=( -e 's/^ip6tables_scripts=/#&/' )
80 newinitd "${FILESDIR}"/${PN}-init.d-r2 ${PN}
81 newconfd - ${PN} < <(sed "${confd_seds[@]}" \
82 "${FILESDIR}"/${PN}-conf.d-r2 || die)
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"