annotate bin/check-prerequisites.sh @ 159:205f9a6240f5

Use sord-single build
author Chris Cannam <cannam@all-day-breakfast.com>
date Thu, 15 Jun 2017 09:50:30 +0100
parents d55e8f37eacf
children 577e5e55cc21
rev   line source
cannam@153 1 #!/bin/bash
cannam@153 2
cannam@153 3 set -eu
cannam@153 4
cannam@153 5 mydir=$(dirname "$0")
cannam@153 6
cannam@153 7 case "$mydir" in
cannam@153 8 /*) ;;
cannam@153 9 *) mydir=$(pwd)/"$mydir";;
cannam@153 10 esac
cannam@153 11
cannam@153 12 parent_dir=$(echo "$mydir/../..")
cannam@153 13
cannam@153 14 sibling_dir() {
cannam@153 15 local name="$1"
cannam@153 16 local dir=$parent_dir/"$name"
cannam@153 17 local simplified=""
cannam@153 18 while true; do
cannam@153 19 simplified=$(echo "$dir" | sed 's,/[a-z][a-z-]*/../,/,')
cannam@153 20 simplified=$(echo "$simplified" | sed 's,/./,/,')
cannam@153 21 if [ "$simplified" = "$dir" ]; then break
cannam@153 22 else dir="$simplified"
cannam@153 23 fi
cannam@153 24 done
cannam@153 25 echo "$dir"
cannam@153 26 }
cannam@153 27
cannam@153 28 explain_and_exit() {
cannam@153 29 cat 1>&2 <<EOF
cannam@153 30
cannam@153 31 To build the examples and the generator program found here, you
cannam@153 32 will need the following sibling directories. (That is, other
cannam@153 33 repositories of code checked out in the same place locally as the
cannam@153 34 piper-vamp-js repository is.)
cannam@153 35
cannam@153 36 * vamp-plugin-sdk - The Vamp plugin SDK and example plugins
cannam@153 37 * piper - The Piper protocol schema
cannam@153 38 * piper-vamp-cpp - C++ classes for Piper/Vamp adaptation
cannam@153 39 * vamp-test-plugin - Vamp Test Plugin, used as one of our examples
cannam@153 40
cannam@153 41 You will also need the Emscripten compiler (em++) to build the
cannam@153 42 example modules, the node.js environment to test loading them,
cannam@153 43 and any further C/C++ libraries needed for the generator program
cannam@153 44 such as the Sord RDF store.
cannam@153 45
cannam@153 46 EOF
cannam@153 47 exit 2
cannam@153 48 }
cannam@153 49
cannam@153 50 for sibling in vamp-plugin-sdk piper piper-vamp-cpp vamp-test-plugin ; do
cannam@153 51 dir=$(sibling_dir "$sibling")
cannam@153 52 if [ ! -d "$parent_dir/$sibling" ]; then
cannam@153 53 echo 1>&2
cannam@153 54 echo "*** Failed to find sibling directory $sibling" 1>&2
cannam@153 55 echo "*** (expected in full path: $dir)" 1>&2
cannam@153 56 explain_and_exit
cannam@153 57 fi
cannam@153 58 done
cannam@153 59
cannam@153 60 for program in em++ node ; do
cannam@153 61 if ! "$program" -v >/dev/null 2>&1 ; then
cannam@153 62 "$program" -v
cannam@153 63 echo 1>&2
cannam@153 64 echo "*** Failed to find or run required program $program" 1>&2
cannam@153 65 explain_and_exit
cannam@153 66 fi
cannam@153 67 done
cannam@153 68
cannam@153 69