relpipe-data/examples/release-v0.14.sh
branchv_0
changeset 282 ec02133045a3
parent 264 d39cfc926f95
equal deleted inserted replaced
281:0b6b1781a0a5 282:ec02133045a3
       
     1 # Install dependencies as root:
       
     2 su -c "apt install g++ make cmake mercurial pkg-config"
       
     3 su -c "apt install libxerces-c-dev" # needed only for relpipe-in-xml module
       
     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)
       
     5 su -c "apt install gawk"            # needed only for relpipe-tr-awk module
       
     6 su -c "apt install libxml++2.6-dev" # needed only for relpipe-in-xmltable module
       
     7 su -c "apt install libsqlite3-dev"  # needed only for relpipe-tr-sql module
       
     8 
       
     9 # Run rest of installation as a non-root user:
       
    10 export RELPIPE_VERSION="v0.14"
       
    11 export RELPIPE_SRC=~/src
       
    12 export RELPIPE_BUILD=~/build
       
    13 export RELPIPE_INSTALL=~/install
       
    14 export PKG_CONFIG_PATH="$RELPIPE_INSTALL/lib/pkgconfig/:$PKG_CONFIG_PATH"
       
    15 export PATH="$RELPIPE_INSTALL/bin:$PATH"
       
    16 
       
    17 rm -rf "$RELPIPE_BUILD"/relpipe-*
       
    18 mkdir -p "$RELPIPE_SRC" "$RELPIPE_BUILD" "$RELPIPE_INSTALL"
       
    19 
       
    20 # Helper functions:
       
    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; }
       
    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; }
       
    23 
       
    24 # Download all sources:
       
    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
       
    26 
       
    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.
       
    28 
       
    29 # Build and install libraries:
       
    30 relpipe_install lib-protocol lib-reader lib-writer lib-cli lib-xmlwriter
       
    31 
       
    32 # Build and install tools:
       
    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
       
    34 
       
    35 # relpipe_install in-filesystem # requires GCC 8 or patching (see below)
       
    36 
       
    37 # Load Bash completion scripts:
       
    38 for c in "$RELPIPE_SRC"/relpipe-*/bash-completion.sh ; do . "$c"; done
       
    39 
       
    40 # Clean-up:
       
    41 unset -f relpipe_install
       
    42 unset -f relpipe_download
       
    43 unset -v RELPIPE_VERSION
       
    44 unset -v RELPIPE_SRC
       
    45 unset -v RELPIPE_BUILD
       
    46 unset -v RELPIPE_INSTALL
       
    47 
       
    48 # View content of SQL scripts like on an 80s green screen terminal!
       
    49 echo "CREATE TABLE r1 (hello integer, world integer); INSERT INTO r1 VALUES (1,2);" | relpipe-in-sql | relpipe-out-tabular