# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: # /var/cvsroot/gentoo-x86/app-crypt/johntheripper/johntheripper-9999.ebuild, v1.0 2012/06/24 18:24:00 peratu Exp $ EAPI="4" inherit eutils flag-o-matic toolchain-funcs pax-utils git-2 DESCRIPTION="fast password cracker" HOMEPAGE="http://www.openwall.com/john/" #EGIT_REPO_URI="https://github.com/magnumripper/magnum-jumbo.git" LICENSE="GPL-2" SLOT="0" KEYWORDS="" IUSE="cuda custom-cflags mmx mpi openmp sse2" #IUSE="cuda custom-cflags mmx mpi opencl openmp sse2" RDEPEND=">=dev-libs/openssl-0.9.7:0 cuda? ( dev-util/nvidia-cuda-toolkit ) mpi? ( virtual/mpi )" #RDEPEND=">=dev-libs/openssl-0.9.7:0 # cuda? ( dev-util/nvidia-cuda-toolkit ) # opencl? ( virtual/opencl ) # mpi? ( virtual/mpi )" DEPEND="${RDEPEND}" S="${WORKDIR}/magnum-jumbo" has_xop() { echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep -q "#define __XOP__ 1" } has_avx() { echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep -q "#define __AVX__ 1" } get_target() { if use alpha; then echo "linux-alpha" elif use amd64; then # if use cuda && use opencl; then # echo "linux-x86-64-gpu" # elif use cuda; then # echo "linux-x86-64-cuda" # elif use opencl; then # echo "linux-x86-64-opencl" if use cuda; then echo "linux-x86-64-cuda" elif has_xop; then echo "linux-x86-64-xop" elif has_avx; then echo "linux-x86-64-avx" else echo "linux-x86-64" fi elif use ppc; then #if use altivec; then # echo "linux-ppc32-altivec" #else echo "linux-ppc32" #fi elif use ppc64; then #if use altivec; then # echo "linux-ppc32-altivec" #else echo "linux-ppc64" #fi # linux-ppc64-altivec is slightly slower than linux-ppc32-altivec for most hash types. # as per the Makefile comments elif use sparc; then echo "linux-sparc" elif use x86; then # if use cuda && use opencl; then # echo "linux-x86-gpu" # elif use cuda; then # echo "linux-x86-cuda" # elif use opencl; then # echo "linux-x86-opencl" if use cuda; then echo "linux-x86-cuda" elif has_xop; then echo "linux-x86-xop" elif has_avx; then echo "linux-x86-avx" elif use sse2; then echo "linux-x86-sse2" elif use mmx; then echo "linux-x86-mmx" else echo "linux-x86-any" fi elif use ppc-macos; then # force AltiVec, the non-altivec profile contains ancient compiler cruft # if use altivec; then echo "macosx-ppc32-altivec" # else # echo "macosx-ppc32" # fi # for Tiger this can be macosx-ppc64 elif use x86-macos; then if use sse2; then echo "macosx-x86-sse2" else echo "macosx-x86" fi elif use x86-solaris; then echo "solaris-x86-any" elif use x86-fbsd; then if use sse2; then echo "freebsd-x86-sse2" elif use mmx; then echo "freebsd-x86-mmx" else echo "freebsd-x86-any" fi elif use amd64-fbsd; then echo "freebsd-x86-64" else echo "generic" fi } pkg_setup() { if use openmp ; then tc-has-openmp || die "Please switch to an openmp compatible compiler" fi } src_unpack() { git clone https://github.com/magnumripper/magnum-jumbo.git } src_prepare() { if use mpi ; then sed -e "s/^#CC = mpicc/CC = mpicc/" \ -e "s/^#MPIOBJ =/MPIOBJ =/" \ -i src/Makefile || die fi cd src if use cuda ; then sed -e "s/\/usr\/local\/cuda/\/opt\/cuda/" -i Makefile || die "sed Makefile failed" VAR=$(echo $PATH | grep '/opt/cuda/bin' -o) if [ ! -n "$VAR" ] ; then PATH=${PATH}:/opt/cuda/bin ; fi fi } src_compile() { local OMP use custom-cflags || strip-flags echo "#define JOHN_SYSTEMWIDE 1" >> config.gentoo echo "#define JOHN_SYSTEMWIDE_HOME \"${EPREFIX}/etc/john\"" >> config.gentoo echo "#define JOHN_SYSTEMWIDE_EXEC \"${EPREFIX}/usr/libexec/john\"" >> config.gentoo append-flags -fPIC -fPIE gcc-specs-pie && append-ldflags -nopie use openmp && OMP="-fopenmp" CPP="$(tc-getCXX)" CC="$(tc-getCC)" AS="$(tc-getCC)" LD="$(tc-getCC)" use mpi && CPP=mpicxx CC=mpicc AS=mpicc LD=mpicc # emake -C src/ \ # CPP="${CPP}" CC="${CC}" AS="${AS}" LD="${LD}" \ # CFLAGS="-c -Wall -include \\\"${S}\\\"/config.gentoo ${CFLAGS} ${OMP}" \ # LDFLAGS="${LDFLAGS}" \ # OPT_NORMAL="" \ # OMPFLAGS="${OMP}" \ # $(get_target) emake -C src/ \ CPP="${CPP}" CC="${CC}" AS="${AS}" LD="${LD}" \ CFLAGS="-c -Wall -include \\\"${S}\\\"/config.gentoo ${CFLAGS} ${OMP}" \ OPT_NORMAL="" \ OMPFLAGS="${OMP}" \ $(get_target) } src_test() { cd run if [[ -f "${EPREFIX}/etc/john/john.conf" || -f "${EPREFIX}/etc/john/john.ini" ]] ; then # This requires that MPI is actually 100% online on your system, which might not # be the case, depending on which MPI implementation you are using. #if use mpi; then # mpirun -np 2 ./john --test || die "self test failed" #else ./john --test || die 'self test failed' else ewarn "Tests require '${EPREFIX}/etc/john/john.conf' or '${EPREFIX}/etc/john/john.ini'" fi } src_install() { # executables dosbin run/john newsbin run/mailer john-mailer pax-mark -m "${ED}usr/sbin/john" || die dosym john /usr/sbin/unafs dosym john /usr/sbin/unique dosym john /usr/sbin/unshadow # jumbo-patch additions dosym john /usr/sbin/undrop dosbin run/calc_stat dosbin run/genmkvpwd dosbin run/mkvcalcproba dosbin run/tgtsnarf insinto /etc/john doins run/genincstats.rb run/stats #python scripts doins run/*.py #perl scripts doins run/*.pl # config files insinto /etc/john doins run/*.chr run/password.lst doins run/*.conf # documentation dodoc doc/* }