# Argon2 20190702
# ===============
# As this is written, a Slackware package is available for Slackware-current,
# but no previous release
# Get the source
cd
test -f installed/argon2-20190702.tar.gz &&
mv -f installed/argon2-20190702.tar.gz .
test ! -f argon2-20190702.tar.gz &&
wget -O argon2-20190702.tar.gz \
https://github.com/P-H-C/phc-winner-argon2/archive/refs/tags/20190702.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "phc-winner-argon2-*" -exec rm -r {} \;
tar xzvf ~/argon2-20190702.tar.gz
cd phc-winner-argon2-20190702
test $UID = 0 && chown -R root:root .
# Build it for 64-bit with /usr/lib64
# You have to specify LIBRARY_REL here due to the generated libargon2.pc
test $(uname -m) = 'x86_64' && LIBRARY_REL=lib64 make
# Build it for anything else
test $(uname -m) != 'x86_64' && make
# Become root to install it
su
# Test the build
make test
# Remove the Slackware package if there is one
test -x /sbin/removepkg && /sbin/removepkg argon2
# Install for 64-bit
test $(uname -m) = 'x86_64' && LIBRARY_REL=lib64 make install && ldconfig
# Install for anything else
test $(uname -m) != 'x86_64' && LIBRARY_REL=lib make install && ldconfig
# 'make install' installed shared and static libraries
# If you do not want the static library, remove it
# rm /usr/lib*/libargon2.a
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/argon2-*.tar.gz
mv -f argon2-20190702.tar.gz installed/
# If you ever want to uninstall Argon2, this should do it:
su
rm -f /usr/bin/argon2
rm -f /usr/include/argon2.h
rm -f /usr/lib*/libargon2.*
rm -f /usr/lib*/pkgconfig/libargon2.pc
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "phc-winner-argon2-*" -exec rm -r {} \;
rm -f ~/installed/argon2-*.tar.*