# Get the source
cd
test -f installed/libssh2-1.11.0.tar.xz &&
mv installed/libssh2-1.11.0.tar.xz .
test ! -f libssh2-1.11.0.tar.xz &&
wget https://libssh2.org/download/libssh2-1.11.0.tar.xz
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "a488a22625296342ddae862de1d59633e6d446eff8417398e06674a49be3d7\
c2 libssh2-1.11.0.tar.xz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libssh2-*" -exec rm -r {} \;
tar xJvf ~/libssh2-1.11.0.tar.xz
cd libssh2-1.11.0
test $UID = 0 && chown -R root:root .
# Slackware uses /usr/man, not the default /usr/share/man
# Configure the build - 64-bit with OpenSSL prefix /usr/local/ssl
test $(uname -m) = "x86_64" &&
test -d /usr/local/ssl/lib64 &&
./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man \
--with-libssl-prefix=/usr/local/ssl
# Configure the build - 64-bit with OpenSSL prefix /usr/local
test $(uname -m) = "x86_64" &&
test ! -d /usr/local/ssl/lib64 &&
./configure --libdir=/usr/lib64 --mandir=/usr/man \
--with-libssl-prefix=/usr/local
# Configure the build - not 64-bit
test $(uname -m) != "x86_64" && test -d /usr/local/ssl/lib &&
./configure --mandir=/usr/man --with-libssl-prefix=/usr/local/ssl
test $(uname -m) != "x86_64" && test ! -d /usr/local/ssl/lib &&
./configure --mandir=/usr/man
# Build it
make
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg libssh2
# Install it
make install
ldconfig
# If you installed a newer version over an old one, you may want to check
# for old files in these locations. You can usually tell by the date, if
# it's not today, and you did not customize it yourself, it's old.
# /usr/include/libssh2*.h
# /usr/lib/libssh2.*
# /usr/lib64/libssh2.*
# /usr/man/man3/libssh2_*
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libssh2-*.tar.*
mv libssh2-1.11.0.tar.xz installed/
# If you ever want to uninstall libssh2, this should do it:
cd
su
test -d src/libssh2-* && ( cd src/libssh2-* ; make uninstall )
for pfx in /usr /usr/local;
do
( cd ${pfx}/include
rm -f libssh2.h libssh2_sftp.h libssh2_publickey.h )
rm -f ${pfx}/lib/libssh2.* ${pfx}/man/man3/libssh2_* \
${pfx}/share/man/man3/libssh2_* ${pfx}/lib/pkgconfig/libssh2.pc
test -d ${pfx}/lib64 &&
rm -f ${pfx}/lib64/libssh2.* ${pfx}/lib64/pkgconfig/libssh2.pc
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libssh2-*" -exec rm -r {} \;
rm -f ~/installed/libssh2-*.tar.*