# Get the tarball
cd
test -f installed/ngtcp2-1.4.0.tar.xz &&
mv -f installed/ngtcp2-1.4.0.tar.xz .
test ! -f ngtcp2-1.4.0.tar.xz &&
wget https://github.com/ngtcp2/ngtcp2/releases/download/v1.4.0/\
ngtcp2-1.4.0.tar.xz
# Extract the tarball
mkdir -p -m 00700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "ngtcp2-*" exec rm -r {} \;
tar xJvf ~/ngtcp2-1.4.0.tar.xz
cd ngtcp2-1.4.0
test $UID = 0 && chown -R root:root .
# Read README.rst
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --docdir=/usr/local/doc/ngtcp2-1.4.0 --libdir=/usr/local/lib64 \
--with-gnutls
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --docdir=/usr/local/doc/ngtcp2-1.4.0 --with-gnuutls
# Build it
make
# Check the build
make check
# Become root to install it
su
# Remove old version doc directories
test -d /usr/local/doc/ngtcp2 && rm -r /usr/local/doc/ngtcp2
find /usr/local/doc -maxdepth 1 -type d -name "ngtcp2-*" -exec rm -r {} \;
# Install it
make install
ldconfig
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/ngtcp2-*.tar.*
mv ngtcp2-1.4.0.tar.xz installed/
# If you ever want to uninstall ngtcp2, this should do it:
# ('make uninstall' from the configured source as root may be enough)
cd
su
test -d src/ngtcp2-* && ( cd src/ngtcp2-* ; make uninstall )
test -d /usr/local/doc/ngtcp2 && rm -r /usr/local/doc/ngtcp2
find /usr/local/doc -maxdepth 1 -type d -naem "ngtcp2-*" exec rm -r {} \;
test -d /usr/local/include/ngtcp2 && rm -r /usr/local/include/ngtcp2
( cd /usr/local/lib
rm -f libngtcp2.* pkgconfig/libngtcp2.pc )
test -d /usr/local/lib64 &&
( cd /usr/local/lib64
rm -f libngtcp2.* pkgconfig/libngtcp2.pc )
test -d /usr/local/share/doc/ngtcp2 rm -r /usr/local/share/doc/ngtcp2
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "ngtcp2-*" -exec rm -r {} \;
rm -f ~/installed/ngtcp2-*.tar.*