# Maintainer (arch): Gaetan Bisson <bisson@archlinux.org>
# Contributor (arch): Angel Velasquez <angvp@archlinux.org>
# Contributor (arch): Hugo Doria <hugo@archlinux.org>
# Contributor: bill-auger <bill-auger@programmer.net>


# parabola changes and rationale:
# - re-compile upstream java blobs from source
# - this is actually nmap v7.80, reverted per FSDG request
#     see: https://lists.nongnu.org/archive/html/gnu-linux-libre/2021-01/msg00000.html


pkgname=nmap
pkgver=7.91
_fsdgver=7.80
pkgrel=3
pkgrel+=.fsdg${_fsdgver}.parabola1
pkgdesc='Utility for network discovery and security auditing'
pkgdesc+=" (FSDG NOTE: this is actually nmap v${_fsdgver} - issue: #2966)"
url='https://nmap.org/'
arch=('x86_64')
arch+=('armv7h' 'i686')
license=('GPL2')
depends=('pcre' 'openssl' 'lua')
makedepends=('python2')
makedepends+=('jdk-openjdk')
optdepends=('python2: various scripts')
validpgpkeys=('436D66AB9A798425FDA0E3F801AF9F036B9355D0')
source=("https://nmap.org/dist/${pkgname}-${_fsdgver}.tar.bz2"
        "https://nmap.org/dist/sigs/${pkgname}-${_fsdgver}.tar.bz2.asc")
sha256sums=('fcfa5a0e42099e12e4bf7a68ebe6fde05553383a682e816a7ec9256ab4773faa'
            'SKIP')

prepare() {
	cd "${srcdir}/${pkgname}-${_fsdgver}"

  rm nselib/data/jdwp-class/*.class
}

build() {
	cd "${srcdir}/${pkgname}-${_fsdgver}"

  pushd nselib/data/jdwp-class/ ; javac *.java ; popd ;

	export PYTHON=python2
	./configure \
		--prefix=/usr \
		--libexecdir=/usr/lib \
		--mandir=/usr/share/man \
		--with-libpcap=included \
		--without-zenmap \

	make
}

package() {
	cd "${srcdir}/${pkgname}-${_fsdgver}"
	make DESTDIR="${pkgdir}" install
	rm "${pkgdir}"/usr/bin/uninstall_*
	install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
