# Get it or re-use the tarball if you already have it
cd
test -f installed/re2c-0.16.tar.gz && mv installed/re2c-0.16.tar.gz .
test ! -f re2c-0.16.tar.gz &&
wget http://downloads.sf.net/re2c/re2c-0.16.tar.gz
# Extract it
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "re2c-*" -exec rm -r {} \;
tar xzvf ~/re2c-0.16.tar.gz
cd re2c-0.16
test $UID = 0 && chown -R root:root .
# Configure the build
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/man
# Build it
make
# Become root to install it
su
# Install it
make install
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become your non-root user again
exit
# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/re2c-*.tar.*
mv re2c-0.16.tar.gz installed/
# If you ever want to uninstall re2c, this should do it:
cd
su
test -d src/re2c-* && ( cd src/re2c-* ; make uninstall )
rm -f /usr/bin/re2c /usr/man/man1/re2c.1
exit
find ~/src -maxdepth 1 -type d -name "re2c-*" -exec rm -r {} \;
rm -f ~/installed/re2c-*.tar.*