#!/bin/bash # Slackware build script for hashcat # Originally written by Andre Fernando, Indonesia. # Modified and now maintained by B. Watson (urchlay@slackware.uk). # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. # 20251010 bkw: # - get rid of USE_SYSTEM_ZLIB=1. what it actually controls is use of # system libminizip, which is *not the same thing* as zlib, and would # require libminizip as a dep. # - fix compilation on 32-bit x86. # 20250929 bkw: # - take over maintenance. # - update for v7.1.2. # - install modules to /usr/lib(64), not /usr/share. # - install bash completion properly. # - remove some cruft from the package (.gitkeep and empty /usr/share). # 20220211 bkw: Modified by SlackBuilds.org: updated for v6.2.4. The # old version wouldn't build on 15.0, and it was getting a bit long # in the tooth anyway. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=hashcat VERSION=${VERSION:-7.1.2} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" -o "$ARCH" = "aarch64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} + ULIB=/usr/lib$LIBDIRSUFFIX DOC=/usr/doc/$PRGNAM-$VERSION PKGDOC=$PKG/$DOC # 20251010 bkw: include cpuid.h, even on 32-bit. fixes 32-bit build. sed -i '/__x86_64__/s,$, || defined(__i386__),' include/cpu_features.h # 20220211 bkw: build stripped. SLKCFLAGS+=" -Wl,-s" # 20220211 bkw: lots of make arguments, deduplicate. runmake() { make "$@" \ CC="gcc $SLKCFLAGS" \ CXX="g++ $SLKCFLAGS" \ PREFIX=/usr \ LIBRARY_FOLDER=$ULIB \ SHARED_FOLDER=$ULIB/$PRGNAM \ DOCUMENT_FOLDER=$DOC \ USE_SYSTEM_ZLIB=0 \ DESTDIR=$PKG } runmake runmake install # 20250930 bkw: make sbopkglint happy chmod +x $PKG/$ULIB/$PRGNAM/*/*.so # 20250930 bkw: include the bash completion correctly, not in the doc dir. install -D -m0644 extra/tab_completion/hashcat.sh \ $PKG/etc/bash_completion.d/hashcat rm -rf $PKGDOC/extra # 20250930 bkw: don't include this cruft: rm -f $PKG/$ULIB/hashcat/*/.gitkeep # 20250930 bkw: or this: rmdir $PKG/usr/share || true chmod -x $PKGDOC/*.sh cp -a README.md $PKGDOC cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE