blob: e82e75a5c0ad659ec2701eb8ce9e39ecc61606f3 (
plain)
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
|
#!/bin/bash
set -e
# Assume that this script is called from the Kranc/Bin directory.
# This will not work if someone creates a symlink to the kranc script
# somewhere else
export KRANCDIR=$(dirname $0)/..
if [ ! -r "$KRANCDIR/Tools/CodeGen" ]; then
echo "Cannot find Kranc (the kranc script must be run directly from the Kranc/Bin directory - symbolic links are not currently allowed)"
exit 1
fi
export KRANCVERBOSE=no
echo "Using Kranc installation at $KRANCDIR"
# It would be good to find a portable way to canonicalise KRANCDIR.
while getopts "v" flag
do
case $flag in
"v")
export KRANCVERBOSE=yes
;;
esac
done
shift $(expr $OPTIND - 1)
if [ $# -eq 0 ]
then
echo "Usage: $0 [-v] <script>"
exit 1
fi
MMASCRIPT=$1
shift
MATH_MACOS=/Applications/Mathematica.app/Contents/MacOS/MathKernel
if which math >/dev/null; then
MATH=math
elif [ -x $MATH_MACOS ]; then
MATH=$MATH_MACOS
else
echo "Cannot find math executable. Is Mathematica on your path?"
exit 1
fi
$MATH -run "Get[\"$KRANCDIR/Tools/MathematicaMisc/RunKranc.m\"]" $MMASCRIPT </dev/null
|