3
## run-octave -- run Octave in the build tree.
5
## Copyright (C) 2006-2013 John W. Eaton
7
## This file is part of Octave.
9
## Octave is free software; you can redistribute it and/or modify it
10
## under the terms of the GNU General Public License as published by the
11
## Free Software Foundation; either version 3 of the License, or (at
12
## your option) any later version.
14
## Octave is distributed in the hope that it will be useful, but WITHOUT
15
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
## You should have received a copy of the GNU General Public License
20
## along with Octave; see the file COPYING. If not, see
21
## <http://www.gnu.org/licenses/>.
27
# FIXME -- is there a better way to handle the possibility of spaces
30
top_srcdir='%abs_top_srcdir%'
33
d1="$top_srcdir/scripts"
34
d2="$builddir/scripts"
35
d3="$builddir/libinterp"
37
d1_list=`$FIND "$d1" -type d -a ! \( \( -name private -o -name '@*' \) -a -prune \) -exec echo '{}' ';' | $SED 's/$/:/'`
38
d2_list=`$FIND "$d2" -type d -a ! \( \( -name private -o -name '@*' \) -a -prune \) -exec echo '{}' ';' | $SED 's/$/:/'`
39
d3_list=`$FIND "$d3" -type d -a ! \( \( -name private -o -name '@*' \) -a -prune \) -exec echo '{}' ';' | $SED 's/$/:/'`
41
d1_path=`echo "$d1_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'`
42
d2_path=`echo "$d2_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'`
43
d3_path=`echo "$d3_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'`
45
octave_executable="$builddir/src/octave"
47
LOADPATH="$d1_path:$d2_path:$d3_path"
48
IMAGEPATH="$top_srcdir/scripts/image"
49
DOCFILE="$builddir/doc/interpreter/doc-cache"
50
BUILT_IN_DOCSTRINGS_FILE="$builddir/libinterp/DOCSTRINGS"
51
TEXIMACROSFILE="$top_srcdir/doc/interpreter/macros.texi"
52
INFOFILE="$top_srcdir/doc/interpreter/octave.info"
54
## Checking for string equality below with prepended x's in order to
55
## handle problems with empty strings.
57
if [ "x$1" = "x-g" ]; then
60
elif [ "x$1" = "x-gud" ]; then
61
## Frontends for gdb (e.g. Emacs's GUD mode) need --annotate=3
62
driver="gdb --annotate=3 --args"
64
elif [ "x$1" = "x-gud2" ]; then
65
## The latest version of gud needs -i=mi. There isn't a good way to check
66
## this at configure time, so we just add a gud2 flag
67
driver="gdb -i=mi --args"
69
elif [ "x$1" = "x-valgrind" ]; then
70
driver="valgrind --tool=memcheck"
72
elif [ "x$1" = "x-strace" ]; then
73
driver="strace -o octave.trace"
75
elif [ "x$1" = "x-cli" ]; then
76
octave_executable="$builddir/src/octave-cli"
81
## We set OCTAVE_ARCHLIBDIR so that the wrapper program can find the
82
## octave-gui program in the build tree. That will fail if we ever
83
## need Octave to find other things in ARCHLIBDIR that are not built
84
## in the $builddir/src directory.
86
OCTAVE_BINDIR="$builddir/src" \
87
OCTAVE_ARCHLIBDIR="$builddir/src" \
88
OCTAVE_SITE_INITFILE="$top_srcdir/scripts/startup/main-rcfile" \
89
OCTAVE_DEFAULT_QT_SETTINGS="$builddir/libgui/default-qt-settings" \
90
OCTAVE_LOCALE_DIR="$builddir/libgui/languages" \
91
OCTAVE_JAVA_DIR="$builddir/scripts/java" \
92
exec $builddir/libtool --mode=execute $driver \
93
"$octave_executable" --no-init-path --path="$LOADPATH" \
94
--image-path="$IMAGEPATH" --doc-cache-file="$DOCFILE" \
95
--built-in-docstrings-file="$BUILT_IN_DOCSTRINGS_FILE" \
96
--texi-macros-file="$TEXIMACROSFILE" --info-file="$INFOFILE" "$@"