# You can also get it from GitHub as tar.xz, zip, and tar.gz if you prefer
# Get the tarball
cd
test -f installed/re2c-4.0.2.tar.lz && mv installed/re2c-4.0.2.tar.lz .
test ! -f re2c-4.0.2.tar.lz &&
wget https://github.com/skvadrik/re2c/releases/download/4.0.2/\
re2c-4.0.2.tar.lz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "re2c-*" -exec rm -r {} \;
tar -xv --lzip -f ~/re2c-4.0.2.tar.lz
cd re2c-4.0.2
test $UID = 0 && chown -R root:root .
# You can also use CMake instead if you prefer
# See the "Build (CMake)" section of this page:
# http://re2c.org/build/build.html
# (or ./BUILD.md)
# Add --enable-libs if you want libre2c
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 \
--mandir=/usr/man
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/man
# Build it
make -j $(nproc)
# Test the build
make check
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg re2c
# Install it
make install
# If you installed libre2c (--enable-libs)
ldconfig
# 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-4.0.2.tar.lz installed/
# If you ever want to uninstall re2c, this should do it:
cd
su
test -d src/re2c-* && ( cd src/re2c-* ; make uninstall )
( cd /usr/bin
rm -f re2c re2d re2go re2hs re2java re2js re2ocaml re2py re2rust re2v \
re2zig )
rm -f /ustr/lib/libre2c.*
test -d /usr/lib64 && rm -f /usr/lib64/libre2c.*
( cd /usr/man/man1
rm -f re2c.1 re2d.1 re2go.1 re2hs.1 re2java.1 re2js.1 re2ocaml.1 re2py.1 \
re2rust.1 re2v.1 re2zig.1 )
test -d /usr/share/re2c && rm -r /usr/share/re2c
exit
find ~/src -maxdepth 1 -type d -name "re2c-*" -exec rm -r {} \;
rm -f ~/installed/re2c-*.tar.*