# Get the source tarball
cd
test -f installed/diffutils-3.10.tar.xz &&
mv installed/diffutils-3.10.tar.xz .
test ! -f diffutils-3.10.tar.xz &&
wget https://ftpmirror.gnu.org/diffutils/diffutils-3.10.tar.xz
# Verify base64-encoded SHA256 checksum w/ cksum from coreutils >= 9.2:
# (this came from the release announcement)
echo "kOXpPMck5OvhLt6A3xY0Bjx6hVaSaFkZv+YLVWyb0J4= diffutils-3.10.tar.\
xz" | cksum -a sha256 -c
# Verify tarball w/ sha256sum:
# [ To match the base64-encoded checksum without cksum from coreutils >= 9.2
# requires some extra handling ]
# kOXpPMck5OvhLt6A3xY0Bjx6hVaSaFkZv+YLVWyb0J4=
# ->
# sha256sum -b diffutils-3.10.tar.xz | cut -d' ' -f 1 | xxd -r -p | base64
# -or-
# shasum -a 256 -b diffutils-3.10.tar.xz | awk '{ print $1 }' | xxd -r -p | base64
# -or-
# openssl sha256 -binary diffutils-3.10.tar.xz | openssl base64
# ->
echo "90e5e93cc724e4ebe12ede80df1634063c7a855692685919bfe60b556c9bd0\
9e diffutils-3.10.tar.xz" | sha256sum -c
# Extract the tarball
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "diffutils-*" -exec rm -r {} \;
tar xJvf ~/diffutils-3.10.tar.xz
cd diffutils-3.10
test $UID = 0 && chown -R root:root .
# Read ./README
# If upgrading, read ./NEWS and/or ./ChangeLog
# If you don't need translations, add --disable-nls
# Configure the build
./configure --prefix=/usr --infodir=/usr/info --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 diff diffutils
# Remove a few things that may cause issues
find /usr/share/locale -type f -name "diffutils.mo" -exec rm {} \;
rm -f /var/man/cat1/cmp.1.gz /var/man/cat1/diff.1.xz \
/var/man/cat1/sdiff.1.gz
# Install it
make install
# See man pages for cmp, diff, diff3, sdiff
# (if you have a /usr/local/man/man1/cmp.1ossl from OpenSSL, you may get that
# with 'man cmp', so use the full path 'man /usr/man/man1/cmp.1')
#
# See 'info diffutils'
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/diffutils-*.tar.*
mv diffutils-3.10.tar.xz installed/
# If you ever want to uninstall diffutils, this should do it:
cd
su
test -d src/diffutils-* && ( cd src/diffutils-* ; make uninstall )
( cd /usr/bin ; rm -f cmp diff diff3 sdiff )
find /usr/doc -maxdepth 1 -type d -name "diffutils-*" -exec rm -r {} \;
( cd /usr/man/man1 ; rm -f cmp.1* diff.1* diff3.1* sdiff.1* )
find /usr/share/locale -type f -name "diffutils.mo" -exec rm {} \;
rm -f /usr/info/diffutils.info*
exit
find ~/src -maxdepth 1 -type d -name "diffutils-*" -exec rm -r {} \;
rm -f ~/installed/diffutils-*.tar.*