# If you ever want to uninstall gawk (?!) or want to clean up files from
# old versions before installing a new one, skip down to the bottom for
# instructions. Do NOT remove the 'awk' binary, you can't run configure
# without it.
# Prerequisites:
# Itself - the configure script will run 'awk'
# grep
# bison
# sed
# gettext (if you do not use --disable-nls)
# readline
# MPFR and GMP
# Get the source tarball
cd
test -f installed/gawk-5.3.0.tar.xz && mv installed/gawk-5.3.0.tar.xz .
test ! -f gawk-5.3.0.tar.xz &&
wget https://ftpmirror.gnu.org/gawk/gawk-5.3.0.tar.xz
# Per the release announcement, it should be 3,436,180 bytes
test "3436180" = $(stat -c %s gawk-5.3.0.tar.xz) && echo "Yey!" || echo Boo
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "ca9c16d3d11d0ff8c69d79dc0b47267e1329a69b39b799895604ed447d3ca9\
0b gawk-5.3.0.tar.xz" | sha256sum -c
## Below you can try to get only the required one, or just import all
## GNU pgp/gpg keys (there are a lot)
# wget -nc https://ftpmirror.gnu.org/gnu-keyring.gpg -O - | gpg --import
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "gawk-*" -exec rm -r {} \;
tar xJvf ~/gawk-5.3.0.tar.xz
cd gawk-5.3.0
test $UID = 0 && chown -R root:root .
# Read README, INSTALL, and if upgrading NEWS and/or ChangeLog
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --sysconfdir=/etc --bindir=/bin \
--infodir=/usr/info --libdir=/usr/lib64 --mandir=/usr/man
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --sysconfdir=/etc --bindir=/bin \
--infodir=/usr/info --mandir=/usr/man
# Build it
make
# Check the build
make check
# Become root to install it
su
# If you are currently running a Slackware package gawk, you
# may want to keep a copy of /bin/gawk or /usr/bin/gawk
# (whichever is a real executable, not a symlink)
# test -x /bin/gawk && cp -a /root/gawk
# test -x /bin/gawk-* && cp -a /root/gawk-*
# test -x /usr/bin/gawk && test ! -e /root/gawk &&
# cp -a /usr/bin/gawk /root/gawk
# Install it, even though we'll partly remove it after this
# (or use 'make install-strip')
make install
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg gawk
# If there is a /bin/gawk, but no /bin/awk symlink, create it
test -x /bin/gawk -a ! -L /bin/awk && ln -sf /bin/gawk /bin/awk
# Between the Slackware package or older source-installed versions of gawk,
# or old binaries that they don't include any more, make sure you do not
# have conflicting files in conflicting locations.
( cd /bin ; rm -f awk dgawk igawk pgawk )
( cd /usr/bin ; rm -f dgawk gawk igawk pgawk )
test -d /usr/doc/gawk && rm -r /usr/doc/gawk
find /usr/doc -maxdepth 1 -type d -name "gawk-*" -exec rm -r {} \;
( cd /usr/info
rm -f gawk.info* gawkinet.info* gawkworkflow.info* pm-gawk.info* \
gawk_api-figure1.png gawk_api-figure2.png gawk_api-figure3.png \
gawk_array-elements.png gawk_general-program.png gawk_process-flow.png \
gawk_statist.jpg )
( cd /usr/man/man1
rm -f awk.1* gawk.1* gawkbug.1* igawk.1* pgawk.1* pm-gawk.1* )
( cd /usr/man/man3
rm -f filefuncs.3am* fnmatch.3am* fork.3am* inplace.3am* ordchr.3am* \
readdir.3am* readfile.3am* revoutput.3am* revtwoway.3am* rwarray.3am* \
time.3am* )
find /usr/share/locale -type f -name gawk.mo -exec rm {} \;
# Install it again
# (or use 'make install-strip')
make install
# Create common symlinks in case scripts are hard-set to a /usr/bin path
test ! -L /bin/awk && ln -sf /bin/gawk /bin/awk
test ! -L /usr/bin/awk && ln -sf /bin/gawk /usr/bin/awk
test ! -L /usr/bin/gawk && ln -sf /bin/gawk /usr/bin/gawk
# In case we want to be able to run 'man awk'
ln -sf /usr/man/man1/gawk.1 /usr/man/man1/awk.1
# Be aware that you may have different versions named for their version,
# including this new one: /bin/gawk-4.1.3, /bin/gawk-5.3.0, etc.
# Look through /usr/share/awk for files with an older date/time, those can
# be removed
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+rw .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/gawk-*.tar.*
mv gawk-5.3.0.tar.xz installed/
# If you ever want to uninstall gawk, this should do it:
# (as root removepkg and 'make uninstall' from source should do it, the rest
# is just in case)
cd
su
test -x /sbin/removepkg && /sbin/removepkg gawk
test -d src/gawk-* && ( cd src/gawk-* ; make uninstall )
( cd /bin
rm -f dgawk gawk gawkbug igawk pgawk gawk-* igawk-* pgawk-* )
( cd /usr/bin
rm -f dgawk gawk gawkbug igawk pgawk gawk-* igawk-* pgawk-* )
test -d /etc/profile.d &&
( cd /etc/profile.d
rm -f gawk.sh gawk.csh )
test -d /usr/doc/gawk && rm -r /usr/doc/gawk
find /usr/doc -type d -name "gawk-*" -exec rm -r {} \;
rm -f /usr/include/gawkapi.h
( cd /usr/info
rm -f gawk.info gawkinet.info gawkworkflow.info pm-gawk.info \
gawk_api-figure1.png gawk_api-figure2.png gawk_api-figure3.png \
gawk_array-elements.png gawk_general-program.png gawk_process-flow.png \
gawk_statist.jpg )
test -d /usr/lib/gawk && rm -r /usr/lib/gawk
test -d /usr/lib64/gawk && rm -r /usr/lib64/gawk
test -d /usr/libexec/awk && rm -r /usr/libexec/awk
( cd /usr/man/man1
rm -f gawk.1* gawkbug.1* igawk.1* pgawk.1* pm-gawk.1* )
( cd /usr/man/man3
rm -f filefuncs.3am* fnmatch.3am* fork.3am* inplace.3am* ordchr.3am* \
readdir.3am* readfile.3am* revoutput.3am* revtwoway.3am* rwarray.3am* \
time.3am* )
test -d /usr/share/awk && rm -r /usr/share/awk
find /usr/share/locale -type f -name "gawk.mo" -exec rm {} \;
( cd /usr/share/man/man1
rm -f gawk.1* gawkbug.1* igawk.1* pgawk.1* pm-gawk.1* )
( cd /usr/share/man/man3
rm -f filefuncs.3am* fnmatch.3am* fork.3am* inplace.3am* ordchr.3am* \
readdir.3am* readfile.3am* revoutput.3am* revtwoway.3am* rwarray.3am* \
time.3am* )
test -L /bin/awk && rm /bin/awk
test -L /usr/bin/awk && rm /usr/bin/awk
test -L /usr/man/man1/awk.1 && rm /usr/man/man1/awk.1
exit
find ~/src -maxdepth 1 -type d -name "gawk-*" -exec rm -r {} \;
rm -f ~/installed/gawk-*.tar.*