]> Pileus Git - ~andy/sunrise/blob - net-misc/autoupnp/autoupnp-0.4.4.ebuild
net-misc/miniupnpc: Introduce USE=static-libs, use clean libdir. Thanks to Nikoli...
[~andy/sunrise] / net-misc / autoupnp / autoupnp-0.4.4.ebuild
1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EMULTILIB_PKG=true
6 inherit multilib toolchain-funcs
7
8 DESCRIPTION="Automatic open port forwarder using UPnP"
9 HOMEPAGE="http://github.com/mgorny/autoupnp/"
10 SRC_URI="http://github.com/downloads/mgorny/${PN}/${P}.tar.bz2"
11
12 LICENSE="BSD"
13 SLOT="0"
14 KEYWORDS="~amd64"
15 IUSE="libnotify multilib suid"
16
17 RDEPEND="net-misc/miniupnpc
18         libnotify? ( x11-libs/libnotify )"
19 DEPEND="${RDEPEND}"
20
21 src_compile() {
22         tc-export CC
23         emake LIBPREFIX= \
24                 WANT_LIBNOTIFY=$(use libnotify && echo true || echo false) \
25                 all $(use suid || echo dummy) || die
26
27         if has_multilib_profile && use multilib; then
28                 local abi
29                 for abi in $(get_install_abis); do
30                         multilib_toolchain_setup ${abi}
31                         if ! is_final_abi; then
32                                 einfo "Building the dummy lib for ${abi}"
33                                 mkdir "${S}"/${abi} || die
34                                 cd "${S}"/${abi} || die
35                                 emake -f ../Makefile DUMMYLIB=${PN}.so dummy || die
36                         fi
37                 done
38         fi
39 }
40
41 src_install() {
42         emake LIBPREFIX= DESTDIR="${D}" LIBDIRNAME=$(get_libdir) \
43                 $(use suid && echo install-suid || echo install-dummy) || die
44
45         if has_multilib_profile && use multilib; then
46                 local abi
47                 for abi in $(get_install_abis); do
48                         ABI=${abi}
49                         is_final_abi || dolib ${abi}/${PN}.so || die
50                 done
51         fi
52
53         dodoc NEWS README || die
54 }
55
56 pkg_postinst() {
57         elog "Please notice that AutoUPnP was rewritten in the form of a C LD_PRELOAD"
58         elog "library, and thus it has to be enabled for a particular program to have"
59         elog "its ports redirected. To enable it for the current user, call:"
60         elog "  $ autoupnp install"
61         if use suid; then
62                 elog
63                 ewarn "You have chosen to install ${PN}.so setuid & setgid. Please notice that this"
64                 ewarn "is discouraged in the terms of security. You have been warned."
65
66                 # need to work-around Portage behavior to make ld.so happy (bug #334473)
67                 chmod o+r "${ROOT}"usr/$(get_libdir)/${PN}.so || die
68         else
69                 chmod o+r "${ROOT}"$(get_libdir)/${PN}.so || die
70         fi
71
72         if has_multilib_profile && use multilib; then
73                 elog
74                 elog "A dummy libraries were installed for your additional ABIs. They will"
75                 elog "silence the ld.so complaints when running alternate ABI applications"
76                 elog "but won't bring real UPnP support to them."
77         fi
78 }