Use https by default
[gentoo.git] / net-analyzer / nmap / nmap-6.47-r3.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8 PYTHON_REQ_USE="sqlite,xml"
9 inherit eutils flag-o-matic python-single-r1 toolchain-funcs
10
11 MY_P=${P/_beta/BETA}
12
13 DESCRIPTION="A utility for network discovery and security auditing"
14 HOMEPAGE="http://nmap.org/"
15 SRC_URI="
16         http://nmap.org/dist/${MY_P}.tar.bz2
17         https://dev.gentoo.org/~jer/nmap-logo-64.png
18 "
19
20 LICENSE="GPL-2"
21 SLOT="0"
22 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
23
24 IUSE="ipv6 +nse system-lua ncat ndiff nls nmap-update nping ssl zenmap"
25 NMAP_LINGUAS=( de fr hr it ja pl pt_BR ru )
26 IUSE+=" ${NMAP_LINGUAS[@]/#/linguas_}"
27
28 REQUIRED_USE="
29         system-lua? ( nse )
30         ndiff? ( ${PYTHON_REQUIRED_USE} )
31         zenmap? ( ${PYTHON_REQUIRED_USE} )
32 "
33
34 RDEPEND="
35         dev-libs/liblinear
36         dev-libs/libpcre
37         net-libs/libpcap[ipv6?]
38         zenmap? (
39                 dev-python/pygtk:2[${PYTHON_USEDEP}]
40                 ${PYTHON_DEPS}
41         )
42         system-lua? ( >=dev-lang/lua-5.2[deprecated] )
43         ndiff? ( ${PYTHON_DEPS} )
44         nls? ( virtual/libintl )
45         nmap-update? ( dev-libs/apr dev-vcs/subversion )
46         ssl? ( dev-libs/openssl:0= )
47 "
48 DEPEND="
49         ${RDEPEND}
50         nls? ( sys-devel/gettext )
51 "
52
53 S="${WORKDIR}/${MY_P}"
54
55 pkg_setup() {
56         if use ndiff || use zenmap; then
57                 python-single-r1_pkg_setup
58         fi
59 }
60
61 src_unpack() {
62         # prevent unpacking the logo
63         unpack ${MY_P}.tar.bz2
64 }
65
66 src_prepare() {
67         epatch \
68                 "${FILESDIR}"/${PN}-4.75-nolua.patch \
69                 "${FILESDIR}"/${PN}-5.10_beta1-string.patch \
70                 "${FILESDIR}"/${PN}-5.21-python.patch \
71                 "${FILESDIR}"/${PN}-6.01-make.patch \
72                 "${FILESDIR}"/${PN}-6.25-liblua-ar.patch \
73                 "${FILESDIR}"/${PN}-6.46-uninstaller.patch \
74                 "${FILESDIR}"/${PN}-6.47-no-libnl.patch \
75                 "${FILESDIR}"/${PN}-6.47-no-FORTIFY_SOURCE.patch \
76                 "${FILESDIR}"/${PN}-6.47-ncat-lua.patch
77
78         if use nls; then
79                 local lingua=''
80                 for lingua in ${NMAP_LINGUAS[@]}; do
81                         if ! use linguas_${lingua}; then
82                                 rm -r zenmap/share/zenmap/locale/${lingua} || die
83                                 rm zenmap/share/zenmap/locale/${lingua}.po || die
84                         fi
85                 done
86         else
87                 # configure/make ignores --disable-nls
88                 for lingua in ${NMAP_LINGUAS[@]}; do
89                         rm -r zenmap/share/zenmap/locale/${lingua} || die
90                         rm zenmap/share/zenmap/locale/${lingua}.po || die
91                 done
92         fi
93
94         sed -i \
95                 -e '/^ALL_LINGUAS =/{s|$| id|g;s|jp|ja|g}' \
96                 Makefile.in || die
97
98         # Fix desktop files wrt bug #432714
99         sed -i \
100                 -e '/^Encoding/d' \
101                 -e 's|^Categories=.*|Categories=Network;System;Security;|g' \
102                 zenmap/install_scripts/unix/zenmap-root.desktop \
103                 zenmap/install_scripts/unix/zenmap.desktop || die
104
105         epatch_user
106 }
107
108 src_configure() {
109         # The bundled libdnet is incompatible with the version available in the
110         # tree, so we cannot use the system library here.
111         econf \
112                 $(use_enable ipv6) \
113                 $(use_enable nls) \
114                 $(use_with zenmap) \
115                 $(usex nse --with-liblua=$(usex system-lua /usr included '' '') --without-liblua) \
116                 $(use_with ncat) \
117                 $(use_with ndiff) \
118                 $(use_with nmap-update) \
119                 $(use_with nping) \
120                 $(use_with ssl openssl) \
121                 --with-libdnet=included \
122                 --with-pcre=/usr
123         #       --with-liblinear=/usr \
124         #       Commented because configure does weird things, while autodetection works
125 }
126
127 src_compile() {
128         emake \
129                 AR=$(tc-getAR) \
130                 RANLIB=$(tc-getRANLIB )
131 }
132
133 src_install() {
134         LC_ALL=C emake -j1 \
135                 DESTDIR="${D}" \
136                 STRIP=: \
137                 nmapdatadir="${EPREFIX}"/usr/share/nmap \
138                 install
139         if use nmap-update;then
140                 LC_ALL=C emake -j1 \
141                         -C nmap-update \
142                         DESTDIR="${D}" \
143                         STRIP=: \
144                         nmapdatadir="${EPREFIX}"/usr/share/nmap \
145                         install
146         fi
147
148         dodoc CHANGELOG HACKING docs/README docs/*.txt
149
150         if use zenmap; then
151                 doicon "${DISTDIR}/nmap-logo-64.png"
152                 python_optimize
153         fi
154 }