1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#!/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
|