forked from umlaeute/Gem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevgem.sh.in
executable file
·70 lines (58 loc) · 1.6 KB
/
devgem.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
## simple script to run Gem from the build
# local configuration
conffile="./devgem.conf"
if [ -e "${conffile}" ]; then . "${conffile}"; fi
## Pd binary can be overriden by setting the PD environment
if [ "x${PD}" = "x" ]; then
PD="@PD_EXE@"
if [ "x${PD#@}" != "x${PD}" ]; then
PD=""
fi
fi
if [ "x${PD}" = "x" ]; then
PD=pd
fi
## for running Pd through some external application (e.g. gdb, valgrind, wine,...)
# set the LAUNCHER variable.
: ${LAUNCHER:-}
## provide replacement for realpath
which realpath >/dev/null 2>&1 || realpath() { [ "x${1#/}" != "x$1" ] && echo "$1" || echo "$PWD/${1#.}"; }
## search abstractions (both static ones and built ones)
srcdir=$(realpath @abs_top_srcdir@)
builddir=$(realpath @abs_top_builddir@)
gempath=
if [ -d "${srcdir}/abstractions" ]; then
gempath=${srcdir}/abstractions:${gempath}
fi
if [ -d "${builddir}" ]; then
if [ "x${srcdir}" != "x${builddir}" ]; then
gempath=${builddir}/abstractions:${gempath}
fi
gempath=${builddir}:${gempath}
else
builddir=${0%/*}
fi
gempath=${gempath%:}
# help paths
helppath=""
if [ -d "${srcdir}/help" ]; then
helppath="${helppath}:${srcdir}/help"
fi
for d in $(for pd in "${srcdir}/plugins"/*/*.pd "${builddir}/plugins"/*/*.pd; do
if [ -f "${pd}" ]; then
echo "${pd%/*}"
fi
done | uniq); do
helppath="${helppath}:${d}"
done
helppath=${helppath#:}
helppath=${helppath%:}
if [ -n "${helppath}" ]; then
gempath="${gempath}:${helppath}"
gempath="${gempath#:}"
fi
if [ "x${gempath}" = "x" ]; then
gempath=${builddir}
fi
${LAUNCHER} ${PD} -stderr -nrt -oss -nosound -path "${gempath}" -lib ${builddir}/Gem "$@"