Use https by default
[gentoo.git] / net-analyzer / nmap / nmap-6.47-r1.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 +lua system-lua ncat ndiff nls nmap-update nping ssl zenmap"
25 NMAP_LINGUAS=( de es fr hr hu id it ja pl pt_BR pt_PT ro ru sk zh )
26 IUSE+=" ${NMAP_LINGUAS[@]/#/linguas_}"
27
28 REQUIRED_USE="
29         system-lua? ( lua )
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
77         if use nls; then
78                 local lingua=''
79                 for lingua in ${NMAP_LINGUAS}; do
80                         if ! use linguas_${lingua}; then
81                                 rm -rf zenmap/share/zenmap/locale/${lingua}
82                                 rm -f zenmap/share/zenmap/locale/${lingua}.po
83                         fi
84                 done
85         else
86                 # configure/make ignores --disable-nls
87                 for lingua in ${NMAP_LINGUAS}; do
88                         rm -rf zenmap/share/zenmap/locale/${lingua}
89                         rm -f zenmap/share/zenmap/locale/${lingua}.po
90                 done
91         fi
92
93         sed -i \
94                 -e '/^ALL_LINGUAS =/{s|$| id|g;s|jp|ja|g}' \
95                 Makefile.in || die
96
97         # Fix desktop files wrt bug #432714
98         sed -i \
99                 -e '/^Encoding/d' \
100                 -e 's|^Categories=.*|Categories=Network;System;Security;|g' \
101                 zenmap/install_scripts/unix/zenmap-root.desktop \
102                 zenmap/install_scripts/unix/zenmap.desktop || die
103
104         epatch_user
105 }
106
107 src_configure() {
108         # The bundled libdnet is incompatible with the version available in the
109         # tree, so we cannot use the system library here.
110         econf \
111                 $(use_enable ipv6) \
112                 $(use_enable nls) \
113                 $(use_with zenmap) \
114                 $(usex lua --with-liblua=$(usex system-lua /usr included '' '') --without-liblua) \
115                 $(use_with ncat) \
116                 $(use_with ndiff) \
117                 $(use_with nmap-update) \
118                 $(use_with nping) \
119                 $(use_with ssl openssl) \
120                 --with-libdnet=included \
121                 --with-pcre=/usr
122         #       --with-liblinear=/usr \
123         #       Commented because configure does weird things, while autodetection works
124 }
125
126 src_compile() {
127         emake \
128                 AR=$(tc-getAR) \
129                 RANLIB=$(tc-getRANLIB )
130 }
131
132 src_install() {
133         LC_ALL=C emake -j1 \
134                 DESTDIR="${D}" \
135                 STRIP=: \
136                 nmapdatadir="${EPREFIX}"/usr/share/nmap \
137                 install
138         if use nmap-update;then
139                 LC_ALL=C emake -j1 \
140                         -C nmap-update \
141                         DESTDIR="${D}" \
142                         STRIP=: \
143                         nmapdatadir="${EPREFIX}"/usr/share/nmap \
144                         install
145         fi
146
147         dodoc CHANGELOG HACKING docs/README docs/*.txt
148
149         if use zenmap; then
150                 doicon "${DISTDIR}/nmap-logo-64.png"
151                 python_optimize
152         fi
153 }