# Template file for 'john'
pkgname=john
version=1.8.0
_jumbover=1
revision=3
wrksrc="${pkgname}-${version}-jumbo-${_jumbover}/src"
build_style=gnu-configure
configure_args="--disable-native-tests --disable-native-macro"
hostmakedepends="libgomp-devel pkg-config"
makedepends="zlib-devel libgomp-devel libressl-devel libpcap-devel gmp-devel"
conf_files="/etc/john/john.conf"
short_desc="John the Ripper password cracker (jumbo-${_jumbover} patch included)"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
homepage="http://www.openwall.com/john/"
distfiles="$homepage/j/$pkgname-${version}-jumbo-${_jumbover}.tar.xz"
checksum=bac93d025995a051f055adbd7ce2f1975676cac6c74a6c7a3ee4cfdd9c160923

pre_configure() {
	sed -i 's|des_|DES_|g' KRB4*.c
	export AS= LD=
	export OPENSSL_LIBS="-lssl -lcrypto"
	CFLAGS+=" -DJOHN_SYSTEMWIDE=1"
}

do_install() {
	cd ..

	# config file
	sed -i 's|$JOHN|/usr/share/john|g' run/john.conf
	install -Dm644 run/john.conf ${DESTDIR}/etc/john/john.conf
	# docs
	vmkdir usr/share/doc/john
	vmkdir usr/share/licenses/john
	install -m644 doc/* ${DESTDIR}/usr/share/doc/john
	vmkdir usr/share/john
	mv ${DESTDIR}/usr/share/doc/$pkgname/LICENSE ${DESTDIR}/usr/share/licenses/$pkgname
	# install password list and charset files
	install -m644 run/*.chr run/*.lst ${DESTDIR}/usr/share/john
	install -m644 run/*.conf ${DESTDIR}/usr/share/john
	# install binaries
	vbin run/john
	vbin run/mailer john-mailer
	vbin run/vncpcap2john
	vbin run/luks2john

	cd ${DESTDIR}/usr/bin
	ln -s john unafs
	ln -s john unique
	ln -s john unshadow
	ln -s john undrop
	ln -s john gpg2john
	ln -s john pdf2john
	ln -s john rar2john
	ln -s john ssh2john
	ln -s john zip2john
}
