# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:sw=4:ts=4:sts=4

PortSystem 1.0

name		nmap
version		7.97
revision	0
categories	net
maintainers	{darkart.com:opendarwin.org @ghosthound} {geeklair.net:dluke @danielluke}
description	Port scanning utility for large networks
# NPSL - https://nmap.org/npsl/
# gpl-2 with additional restrictions, so not actually gpl-2
license		{GPL-2 OpenSSLException} Restrictive/Distributable
homepage	https://nmap.org/
platforms	darwin freebsd

long_description Nmap is a utility for port scanning large networks, although \
		 it works fine for single hosts. The guiding philosophy for \
		 the creation of nmap was TMTOWTDI (There's More Than One Way \
		 To Do It). This is the Perl slogan, but it is equally \
		 applicable to scanners. Sometimes you need speed, other \
		 times you may need stealth. In some cases, bypassing \
		 firewalls may be required. Not to mention the fact that you \
		 may want to scan different protocols (UDP, TCP, ICMP, etc.). \
		 You just can't do all this with one scanning mode. And you \
		 don't want to have 10 different scanners around, all with \
		 different interfaces and capabilities.

master_sites	https://nmap.org/dist/

checksums           rmd160  dd45f83104155cd97b8468856b3fcf724567cb44 \
                    sha256  af98f27925c670c257dd96a9ddf2724e06cb79b2fd1e0d08c9206316be1645c0 \
                    size    12142624
# see https://trac.macports.org/ticket/68543
patchfiles  nmap-7.94-fix-32bit.patch
if {${os.platform} eq "darwin" && ${os.major} < 11} {
  patchfiles-append pre-cxx11-workarounds.patch
}

depends_build port:automake \
			  port:autoconf

depends_lib	port:libpcap \
            port:zlib \
            port:libssh2

use_bzip2	yes

configure.args	--without-zenmap \
                --without-ndiff \
                --mandir=\\\${prefix}/share/man \
                --infodir=\\\${prefix}/share/info \
                --with-liblua=included
		
# https://trac.macports.org/ticket/58837
# build system does not pass the stdlib on the link line resulting in link errors
# for some build configurations using non-default stdlib settings
if {${os.platform} eq "darwin" && ${os.major} < 13} {
  if {[string match *clang* ${configure.cxx}] && ${configure.cxx_stdlib} ne ""} {
    configure.ldflags-append -stdlib=${configure.cxx_stdlib}
  }
}

# nmap's configure script in nselib-bin does not respect --with-liblua=included
configure.env ac_cv_header_lua_h=no

default_variants +ssl +pcre

variant ssl description {build with ssl support} {
    PortGroup openssl 1.0

    openssl.branch 3
    configure.args-append --with-openssl=[openssl::install_area]
}

variant pcre description {build with pcre support} {
    configure.args-append --with-pcre=${prefix}
    depends_lib-append port:pcre2
}

notes "Zenmap is now provided by a separate port."
