# Install dependencies as root:
su -c "apt install g++ make cmake mercurial pkg-config"
# Run rest of installation as a non-root user:
export RELPIPE_VERSION="v0.8"
export RELPIPE_SRC=~/src
export RELPIPE_BUILD=~/build
export RELPIPE_INSTALL=~/install
export PKG_CONFIG_PATH="$RELPIPE_INSTALL/lib/pkgconfig/:$PKG_CONFIG_PATH"
export PATH="$RELPIPE_INSTALL/bin:$PATH"
mkdir "$RELPIPE_SRC" "$RELPIPE_BUILD" "$RELPIPE_INSTALL"
# Helper functions:
relpipe_download() { for m in "$@"; do cd "$RELPIPE_SRC" && hg clone -u "$RELPIPE_VERSION" https://hg.globalcode.info/relpipe/relpipe-$m.cpp || break; done; }
relpipe_install() { for m in "$@"; do cd "$RELPIPE_BUILD" && mkdir relpipe-$m.cpp && cd relpipe-$m.cpp && cmake -DCMAKE_INSTALL_PREFIX:PATH="$RELPIPE_INSTALL" "$RELPIPE_SRC/relpipe-$m.cpp" && make && make install || break; done; }
# Download all sources:
relpipe_download lib-protocol lib-reader lib-writer lib-cli in-cli in-fstab out-gui.qt out-nullbyte out-ods out-tabular out-xml tr-cut tr-grep tr-python tr-sed tr-validator
# Build and install libraries:
relpipe_install lib-protocol lib-reader lib-writer lib-cli
# Build and install tools:
relpipe_install in-fstab in-cli tr-cut tr-grep tr-sed out-nullbyte out-ods out-tabular out-xml
# Clean-up:
unset -f relpipe_install
unset -f relpipe_download
unset -v RELPIPE_VERSION
unset -v RELPIPE_SRC
unset -v RELPIPE_BUILD
unset -v RELPIPE_INSTALL
# View your fstab like on an 80s green screen terminal!
relpipe-in-fstab | relpipe-out-tabular