# xxHash 0.8.0
# ============
# If the web site URL does not work, try www.xhash.com
# Get the source
cd
test -f installed/xxHash-0.8.0.tar.gz &&
mv -f installed/xxHash-0.8.0.tar.gz .
test ! -f xxHash-0.8.0.tar.gz &&
wget https://github.com/Cyan4973/xxHash/archive/refs/tags/v0.8.0.tar.gz \
-O xxHash-0.8.0.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -type d -name "xxHash-*" -exec rm -r {} \;
tar xzvf ~/xxHash-0.8.0.tar.gz
cd xxHash-0.8.0
test $UID = 0 && chown -R root:root .
# Build it for 64-bit
test $(uname -m) = 'x86_64' &&
PREFIX=/usr LIBDIR=/usr/lib64 MANDIR=/usr/man/man1 make
# Build it for anything else
test $(uname -m) != 'x86_64' &&
PREFIX=/usr LIBDIR=/usr/lib MANDIR=/usr/man/man1 make
# Become root to install it
su
# Install it for 64-bit
# Use 'install -s' to strip binaries
test $(uname -m) = 'x86_64' &&
PREFIX=/usr LIBDIR=/usr/lib64 MANDIR=/usr/man/man1 \
INSTALL_PROGRAM="install -s" make install
# Install it for anything else
# Use 'install -s' to strip binaries
test $(uname -m) != 'x86_64' &&
PREFIX=/usr MANDIR=/usr/man/man1 \
INSTALL_PROGRAM="install -s" make install
ldconfig
# Shared and static libraries are installed
# If you don't want the static library, zap that:
rm -f /usr/lib*/libxxhash.a
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/xxHash-*.tar.*
mv -f xxHash-0.8.0.tar.gz installed/
# If you ever want to uninstall xxHash, this should do it
# Running 'make uninstall' as root in the source directory may
# be enough (with PREFIX= LIBDIR=, etc.), the rest is just in case
# anything is left over from old versions
cd
su
test -d src/xxHash-* &&
( cd src/xxHash-*
test $(uname -m) = 'x86_64' &&
PREFIX=/usr LIBDIR=/usr/lib64 MANDIR=/usr/man/man1 \
INSTALL_PROGRAM="install -s" make install
test $(uname -m) != 'x86_64' &&
PREFIX=/usr LIBDIR=/usr/lib64 MANDIR=/usr/man/man1 \
INSTALL_PROGRAM="install -s" make install )
( cd /usr/bin
rm -f xxh32sum xxh64sum xxh128sum xxhsum )
( cd /usr/include
rm -f xxhash.h xxh3.h )
test -d /usr/lib &&
( cd /usr/lib
rm -f libxxhash.* pkgconfig/libxxhash.pc )
test -d /usr/lib64 &&
( cd /usr/lib64
rm -f libxxhash.* pkgconfig/libxxhash.pc )
( cd /usr/man/man1
rm -f xxh32sum.1 xxh64sum.1 xxh128sum.1 xxhsum.1 )
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "xxHash-*" -exec rm -r {} \;
rm -f ~/installed/xxHash-*.tar.*