# Template file for 'Ghidrathon'
pkgname=Ghidrathon
version=4.0.0
revision=1
hostmakedepends="gradle openjdk17 unzip jep"
makedepends="ghidra python3-devel"
depends="ghidra jep"
short_desc="Ghidra extension for Python3 support"
maintainer="Andrew Benson <abenson+void@gmail.com>"
license="Apache-2.0"
homepage="https://github.com/mandiant/Ghidrathon"
changelog="https://github.com/mandiant/Ghidrathon/releases"
distfiles="https://github.com/mandiant/Ghidrathon/archive/v${version}.tar.gz"
checksum=6157811acc0bd833b4071b5dea25b2d45aa4040f286d2afc0ac4ec8c2063cca3
nocross=yes # ghidra cannot be cross-compiled

post_extract() {
	cp /${py3_sitelib}/jep/jep-*.jar ${wrksrc}/lib
}

do_build() {
	gradle -PGHIDRA_INSTALL_DIR=${XBPS_CROSS_BASE}/usr/libexec/ghidra
}

do_install() {
	vmkdir usr/libexec/ghidra/Ghidra/Extensions
	unzip dist/*Ghidrathon*.zip -d ${DESTDIR}/usr/libexec/ghidra/Ghidra/Extensions
	python3 util/ghidrathon_configure.py ${DESTDIR}/usr/libexec/ghidra
}
