1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
7 PYTHON_REQ_USE="sqlite,xml"
8 inherit autotools flag-o-matic python-single-r1 toolchain-funcs
12 DESCRIPTION="A utility for network discovery and security auditing"
13 HOMEPAGE="http://nmap.org/"
15 http://nmap.org/dist/${MY_P}.tar.bz2
16 https://dev.gentoo.org/~jer/nmap-logo-64.png
21 KEYWORDS="alpha amd64 arm ~arm64 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 IUSE="ipv6 libressl +nse system-lua ncat ndiff nls nmap-update nping ssl zenmap"
24 NMAP_LINGUAS=( de fr hi hr it ja pl pt_BR ru zh )
28 ndiff? ( ${PYTHON_REQUIRED_USE} )
29 zenmap? ( ${PYTHON_REQUIRED_USE} )
37 dev-python/pygtk:2[${PYTHON_USEDEP}]
40 system-lua? ( >=dev-lang/lua-5.2:*[deprecated] )
41 ndiff? ( ${PYTHON_DEPS} )
42 nls? ( virtual/libintl )
43 nmap-update? ( dev-libs/apr dev-vcs/subversion )
45 !libressl? ( dev-libs/openssl:0= )
46 libressl? ( dev-libs/libressl:= )
51 nls? ( sys-devel/gettext )
54 S="${WORKDIR}/${MY_P}"
56 "${FILESDIR}"/${PN}-5.10_beta1-string.patch
57 "${FILESDIR}"/${PN}-5.21-python.patch
58 "${FILESDIR}"/${PN}-6.46-uninstaller.patch
59 "${FILESDIR}"/${PN}-6.25-liblua-ar.patch
60 "${FILESDIR}"/${PN}-7.25-no-FORTIFY_SOURCE.patch
61 "${FILESDIR}"/${PN}-7.25-CXXFLAGS.patch
62 "${FILESDIR}"/${PN}-7.25-libpcre.patch
63 "${FILESDIR}"/${PN}-7.31-libnl.patch
67 if use ndiff || use zenmap; then
68 python-single-r1_pkg_setup
73 # prevent unpacking the logo
74 unpack ${MY_P}.tar.bz2
80 cat "${FILESDIR}"/nls.m4 >> "${S}"/acinclude.m4 || die
86 for lingua in ${NMAP_LINGUAS[@]}; do
87 if ! has ${lingua} ${LINGUAS-${lingua}}; then
88 rm -r zenmap/share/zenmap/locale/${lingua} || die
89 rm zenmap/share/zenmap/locale/${lingua}.po || die
93 # configure/make ignores --disable-nls
94 for lingua in ${NMAP_LINGUAS[@]}; do
95 rm -r zenmap/share/zenmap/locale/${lingua} || die
96 rm zenmap/share/zenmap/locale/${lingua}.po || die
101 -e '/^ALL_LINGUAS =/{s|$| id|g;s|jp|ja|g}' \
106 $(find . -name Makefile.in) \
109 # Fix desktop files wrt bug #432714
112 -e 's|^Categories=.*|Categories=Network;System;Security;|g' \
113 zenmap/install_scripts/unix/zenmap-root.desktop \
114 zenmap/install_scripts/unix/zenmap.desktop || die
116 cp libdnet-stripped/include/config.h.in{,.nmap-orig} || die
118 if [[ ${CHOST} == *-darwin* ]] ; then
119 # we need the original for a Darwin-specific fix, bug #604432
120 mv libdnet-stripped/include/config.h.in{.nmap-orig,} || die
125 # The bundled libdnet is incompatible with the version available in the
126 # tree, so we cannot use the system library here.
131 $(usex nse --with-liblua=$(usex system-lua /usr included '' '') --without-liblua) \
134 $(use_with nmap-update) \
136 $(use_with ssl openssl) \
137 --with-libdnet=included \
139 # --with-liblinear=/usr \
140 # Commented because configure does weird things, while autodetection works
145 for directory in . libnetutil nsock/src \
146 $(usex ncat ncat '') \
147 $(usex nmap-update nmap-update '') \
148 $(usex nping nping '')
150 emake -C "${directory}" makefile.dep
155 RANLIB=$(tc-getRANLIB)
162 nmapdatadir="${EPREFIX}"/usr/share/nmap \
164 if use nmap-update;then
169 nmapdatadir="${EPREFIX}"/usr/share/nmap \
173 dodoc CHANGELOG HACKING docs/README docs/*.txt
176 doicon "${DISTDIR}/nmap-logo-64.png"