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@161
|
60 if ! em++ -v >/dev/null 2>&1 ; then
|
cannam@161
|
61 em++ -v
|
cannam@161
|
62 echo 1>&2
|
cannam@161
|
63 echo "*** Failed to find or run required program em++" 1>&2
|
cannam@161
|
64 explain_and_exit
|
cannam@161
|
65 fi
|
cannam@161
|
66
|
cannam@161
|
67 if ! nodejs -v >/dev/null 2>&1 ; then
|
cannam@161
|
68 if ! node -v >/dev/null 2>&1 ; then
|
cannam@161
|
69 nodejs -v
|
cannam@161
|
70 node -v
|
cannam@153
|
71 echo 1>&2
|
cannam@161
|
72 echo "*** Failed to find or run required program node (as either nodejs or node)" 1>&2
|
cannam@153
|
73 explain_and_exit
|
cannam@153
|
74 fi
|
cannam@161
|
75 fi
|
cannam@153
|
76
|
cannam@153
|
77
|