# Get the tarball
cd
test -f installed/libsodium-1.0.20.tar.gz &&
mv -f installed/libsodium-1.0.20.tar.gz .
test ! -f libsodium-1.0.20.tar.gz &&
wget https://download.libsodium.org/libsodium/releases/\
libsodium-1.0.20.tar.gz
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "ebb65ef6ca439333c2bb41a0c1990587288da07f6c7fd07cb3a18cc18d30ce\
19 libsodium-1.0.20.tar.gz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libsodium-*" -exec rm -r {} \;
tar xzvf ~/libsodium-1.0.20.tar.gz
cd libsodium-1.0.20
test $UID = 0 && chown -R root:root .
# To match the prefix that Slackware uses in it's package, use
# --prefix=/usr
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --libdir=/usr/lib64 --disable-static
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --disable-static
# Build it
# If the build fails with assembler errors, try upgrading binutils
make
# Check the build
make check
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg libsodium
# If you used --disable-static above, remove old static library
test -f /usr/lib/libsodium.a && rm /usr/lib/libsodium.a
test -f /usr/lib64/libsodium.a && rm /usr/lib64/libsodium.a
# Install it
make install
ldconfig
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libsodium-*.tar.*
mv -f libsodium-1.0.20.tar.gz installed/
# If you ever want to uninstall libsodium, this should do it:
cd
su
test -d src/libsodium-* && ( cd src/libsodium-* ; make uninstall )
for pfx in /usr /usr/local; do
test -d ${pfx}/include/sodium && rm -r ${pfx}/include/sodium
for libdir in ${pfx}/lib ${pfx}/lib64;
do
test -d $libdir &&
( cd $libdir
rm -f libsodium.*
test -d pkgconfig && rm -f pkgconfig/libsodium.pc )
done
done
exit
find ~/src -maxdepth 1 -type d -name "libsodium-*" -exec rm -r {} \;
rm -f ~/installed/libsodium-*.tar.*