relpipe-data/examples/release-v0.14.sh
author František Kučera <franta-hg@frantovo.cz>
Wed, 30 Oct 2019 18:05:46 +0100
branchv_0
changeset 282 ec02133045a3
parent 264 relpipe-data/examples/release-v0.13.sh@d39cfc926f95
permissions -rw-r--r--
Release v0.14 – SQL, AWK, Bash completion, GPLv3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
# Install dependencies as root:
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
su -c "apt install g++ make cmake mercurial pkg-config"
241
f71d300205b7 Release v0.9
František Kučera <franta-hg@frantovo.cz>
parents: 221
diff changeset
     3
su -c "apt install libxerces-c-dev" # needed only for relpipe-in-xml module
250
d16336d1c61f Release v0.10
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     4
su -c "apt install guile-2.2-dev"   # needed only for relpipe-tr-guile module; guile-2.0-dev also works but requires a patch (see below)
258
2868d772c27e Release v0.12 – AWK
František Kučera <franta-hg@frantovo.cz>
parents: 256
diff changeset
     5
su -c "apt install gawk"            # needed only for relpipe-tr-awk module
264
d39cfc926f95 XMLTable, SQL, v0.13
František Kučera <franta-hg@frantovo.cz>
parents: 258
diff changeset
     6
su -c "apt install libxml++2.6-dev" # needed only for relpipe-in-xmltable module
d39cfc926f95 XMLTable, SQL, v0.13
František Kučera <franta-hg@frantovo.cz>
parents: 258
diff changeset
     7
su -c "apt install libsqlite3-dev"  # needed only for relpipe-tr-sql module
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
# Run rest of installation as a non-root user:
282
ec02133045a3 Release v0.14 – SQL, AWK, Bash completion, GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 264
diff changeset
    10
export RELPIPE_VERSION="v0.14"
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
export RELPIPE_SRC=~/src
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
export RELPIPE_BUILD=~/build
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
export RELPIPE_INSTALL=~/install
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
export PKG_CONFIG_PATH="$RELPIPE_INSTALL/lib/pkgconfig/:$PKG_CONFIG_PATH"
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
export PATH="$RELPIPE_INSTALL/bin:$PATH"
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
241
f71d300205b7 Release v0.9
František Kučera <franta-hg@frantovo.cz>
parents: 221
diff changeset
    17
rm -rf "$RELPIPE_BUILD"/relpipe-*
f71d300205b7 Release v0.9
František Kučera <franta-hg@frantovo.cz>
parents: 221
diff changeset
    18
mkdir -p "$RELPIPE_SRC" "$RELPIPE_BUILD" "$RELPIPE_INSTALL"
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
# Helper functions:
241
f71d300205b7 Release v0.9
František Kučera <franta-hg@frantovo.cz>
parents: 221
diff changeset
    21
relpipe_download() { for m in "$@"; do cd "$RELPIPE_SRC" && ([[ -d "relpipe-$m.cpp" ]] && hg pull -R "relpipe-$m.cpp" && hg update -R "relpipe-$m.cpp" "$RELPIPE_VERSION" || hg clone -u "$RELPIPE_VERSION" https://hg.globalcode.info/relpipe/relpipe-$m.cpp) || break; done; }
f71d300205b7 Release v0.9
František Kučera <franta-hg@frantovo.cz>
parents: 221
diff changeset
    22
relpipe_install()  { for m in "$@"; do cd "$RELPIPE_BUILD" && mkdir -p relpipe-$m.cpp && cd relpipe-$m.cpp && cmake -DCMAKE_INSTALL_PREFIX:PATH="$RELPIPE_INSTALL" "$RELPIPE_SRC/relpipe-$m.cpp" && make && make install || break; done; }
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
# Download all sources:
264
d39cfc926f95 XMLTable, SQL, v0.13
František Kučera <franta-hg@frantovo.cz>
parents: 258
diff changeset
    25
relpipe_download lib-protocol lib-reader lib-writer lib-cli lib-xmlwriter in-cli in-fstab in-xml in-xmltable in-csv in-filesystem in-recfile out-gui.qt out-nullbyte out-ods out-tabular out-xml out-csv out-asn1 out-recfile tr-cut tr-grep tr-python tr-sed tr-validator tr-guile tr-awk tr-sql
250
d16336d1c61f Release v0.10
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
    26
d16336d1c61f Release v0.10
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
    27
# Optional: At this point, we have all dependencies and sources downloaded, so we can disconnect this computer from the internet in order to verify that our build process is sane, deterministic and does not depend on any external resources.
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
# Build and install libraries:
241
f71d300205b7 Release v0.9
František Kučera <franta-hg@frantovo.cz>
parents: 221
diff changeset
    30
relpipe_install lib-protocol lib-reader lib-writer lib-cli lib-xmlwriter
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
# Build and install tools:
264
d39cfc926f95 XMLTable, SQL, v0.13
František Kučera <franta-hg@frantovo.cz>
parents: 258
diff changeset
    33
relpipe_install in-fstab in-cli in-fstab in-xml in-xmltable in-csv in-recfile tr-cut tr-grep tr-sed tr-guile tr-awk tr-sql out-nullbyte out-ods out-tabular out-xml out-csv out-asn1 out-recfile
241
f71d300205b7 Release v0.9
František Kučera <franta-hg@frantovo.cz>
parents: 221
diff changeset
    34
f71d300205b7 Release v0.9
František Kučera <franta-hg@frantovo.cz>
parents: 221
diff changeset
    35
# relpipe_install in-filesystem # requires GCC 8 or patching (see below)
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
282
ec02133045a3 Release v0.14 – SQL, AWK, Bash completion, GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 264
diff changeset
    37
# Load Bash completion scripts:
ec02133045a3 Release v0.14 – SQL, AWK, Bash completion, GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 264
diff changeset
    38
for c in "$RELPIPE_SRC"/relpipe-*/bash-completion.sh ; do . "$c"; done
ec02133045a3 Release v0.14 – SQL, AWK, Bash completion, GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 264
diff changeset
    39
219
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
# Clean-up:
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
unset -f relpipe_install
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
unset -f relpipe_download
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
unset -v RELPIPE_VERSION
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
unset -v RELPIPE_SRC
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
unset -v RELPIPE_BUILD
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
unset -v RELPIPE_INSTALL
a94eb371f77e Release v0.8
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
282
ec02133045a3 Release v0.14 – SQL, AWK, Bash completion, GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 264
diff changeset
    48
# View content of SQL scripts like on an 80s green screen terminal!
ec02133045a3 Release v0.14 – SQL, AWK, Bash completion, GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 264
diff changeset
    49
echo "CREATE TABLE r1 (hello integer, world integer); INSERT INTO r1 VALUES (1,2);" | relpipe-in-sql | relpipe-out-tabular