comparison bin/check-prerequisites.sh @ 153:38675dcea44f

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