# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=nmap
pkgver=7.95
pkgrel=1
pkgdesc='Utility for network discovery and security auditing'
url='https://nmap.org/'
arch=(x86_64)
license=(LicenseRef-Nmap-Public-Source-License-Version-0.95)
depends=(
  gcc-libs
  glibc
  libpcap
  libssh2
  libssh2.so
  lua
  openssl
  pcre2
  zlib
)
source=(
  "https://nmap.org/dist/${pkgname}-${pkgver}.tar.bz2"
  "https://nmap.org/dist/sigs/${pkgname}-${pkgver}.tar.bz2.asc"
)
sha256sums=('e14ab530e47b5afd88f1c8a2bac7f89cd8fe6b478e22d255c5b9bddb7a1c5778'
            'SKIP')
b2sums=('4ab4912468f6c1cf7517090bc94b1bb34e665fe1b3db973e1c7bb2d05cb885545cdf3ca5c7fb548ff0012b800f5dd60ed2f2010fc9fb62ba7d6a28537287193c'
        'SKIP')
  '436D66AB9A798425FDA0E3F801AF9F036B9355D0' # Nmap Project Signing Key (http://www.insecure.org/)
)

prepare() {
  cd "${pkgname}-${pkgver}"
  # ensure we build devendored deps
  rm -rf liblua libpcap libpcre macosx mwin32 libssh2 libz
  autoreconf -fiv
}

build() {
  cd "${pkgname}-${pkgver}"
  ./configure \
    --prefix=/usr \
    --with-libpcap=/usr \
    --with-libpcre=/usr \
    --with-zlib=/usr \
    --with-libssh2=/usr \
    --with-liblua=/usr \
    --without-ndiff \
    --without-zenmap
  make
}

check() {
  cd "${pkgname}-${pkgver}"
  make check
}

package() {
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  install -Dm 644 README.md docs/nmap.usage.txt -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE docs/3rd-party-licenses.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
