# Template file for 'hashcat'
pkgname=hashcat
version=7.1.2
revision=1
archs="x86_64* aarch64*"
build_style=gnu-makefile
build_helper="rust"
make_build_args="
 PRODUCTION=1
 USE_SYSTEM_OPENCL=1
 USE_SYSTEM_XXHASH=1
 USE_SYSTEM_ZLIB=1
 DEPS_OPENCL_PATH=${XBPS_CROSS_BASE}/usr/include
 DEPS_XXHASH_PATH=${XBPS_CROSS_BASE}/usr/include
 DEPS_ZLIB_PATH=${XBPS_CROSS_BASE}/usr/include
 SHARED_FOLDER=/usr/lib/hashcat
 ENABLE_UNRAR=$(vopt_if unrar 1 0)"
make_use_env=yes
make_install_args="$make_build_args"
hostmakedepends="cargo python3 python3-pybind11"
makedepends="OpenCL-Headers xxHash-devel minizip-devel zlib-devel python3-devel rust-std"
checkdepends="perl"
short_desc="Advanced CPU-based password recovery utility"
maintainer="Duncaen <duncaen@voidlinux.org>"
license="MIT"
homepage="https://hashcat.net/hashcat/"
changelog="https://raw.githubusercontent.com/hashcat/hashcat/master/docs/changes.txt"
distfiles="https://hashcat.net/files/hashcat-${version}.tar.gz"
checksum=9546a6326d747530b44fcc079babad40304a87f32d3c9080016d58b39cfc8b96

build_options="unrar"
desc_option_unrar="Enable support for unrar"
# unrar option disabled by default because of license issues

case "${XBPS_TARGET_MACHINE}" in
aarch64*) make_build_args+=" IS_AARCH64=1" ;;
esac

if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
	broken="Not supported on big endian"
fi

post_extract() {
	vsed '/^\(CC\|CXX\)/d' -i src/Makefile
}

post_install() {
	rm -f ${DESTDIR}/usr/share/docs/hashcat/license.txt
	vlicense docs/license.txt
}
