5786
|
1 #! /bin/sh |
7016
|
2 ## |
7017
|
3 ## run-octave -- run Octave in the build tree. |
7016
|
4 ## |
7017
|
5 ## Copyright (C) 2006, 2007 John W. Eaton |
|
6 ## |
7016
|
7 ## This file is part of Octave. |
|
8 ## |
|
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. |
|
13 ## |
|
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 |
|
17 ## for more details. |
|
18 ## |
|
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/>. |
6125
|
22 |
|
23 AWK=${AWK:-'awk'} |
|
24 |
|
25 # FIXME -- is there a better way to handle the possibility of spaces |
|
26 # in these names? |
|
27 |
6131
|
28 top_srcdir='%abs_top_srcdir%' |
|
29 builddir='%builddir%' |
6125
|
30 |
6155
|
31 liboctinterp="$builddir/src/%liboctinterp%" |
|
32 liboctave="$builddir/liboctave/%liboctave%" |
|
33 libcruft="$builddir/libcruft/%libcruft%" |
|
34 |
6125
|
35 d1="$top_srcdir/test" |
|
36 d2="$top_srcdir/scripts" |
|
37 d3="$builddir/scripts" |
|
38 d4="$builddir/src" |
|
39 |
6827
|
40 d1_list=`find "$d1" -type d -a ! \( \( -name CVS -o -name private \) -a -prune \) -exec echo '{}': ';'` |
|
41 d2_list=`find "$d2" -type d -a ! \( \( -name CVS -o -name private \) -a -prune \) -exec echo '{}': ';'` |
|
42 d3_list=`find "$d3" -type d -a ! \( \( -name CVS -o -name private \) -a -prune \) -exec echo '{}': ';'` |
|
43 d4_list=`find "$d4" -type d -a ! \( \( -name CVS -o -name private \) -a -prune \) -exec echo '{}': ';'` |
6125
|
44 |
6827
|
45 d1_path=`echo "$d1_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'` |
|
46 d2_path=`echo "$d2_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'` |
|
47 d3_path=`echo "$d3_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'` |
|
48 d4_path=`echo "$d4_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'` |
6125
|
49 |
|
50 LOADPATH="$d1_path:$d2_path:$d3_path:$d4_path" |
5814
|
51 IMAGEPATH="$top_srcdir/scripts/image" |
6538
|
52 INFOFILE="$builddir/doc/interperter/octave.info" |
6125
|
53 |
5786
|
54 if [ $# -gt 0 ]; then |
|
55 if [ "x$1" = "x-g" ]; then |
6987
|
56 driver="gdb --args" |
5786
|
57 shift |
|
58 elif [ "x$1" = "x-valgrind" ]; then |
|
59 driver="valgrind --tool=memcheck" |
|
60 shift |
|
61 elif [ "x$1" = "x-strace" ]; then |
|
62 driver="strace -o octave.trace" |
|
63 shift |
|
64 fi |
|
65 fi |
6125
|
66 |
7001
|
67 OCTAVE_SITE_INITFILE="$top_srcdir/scripts/startup/main-rcfile" \ |
|
68 LD_PRELOAD="$liboctinterp $liboctave $libcruft" \ |
|
69 %library_path_var%="$builddir/src:$builddir/liboctave:$builddir/libcruft:$%library_path_var%" \ |
7016
|
70 exec $driver "$builddir/src/octave" --no-initial-path --path="$LOADPATH" --image-path="$IMAGEPATH" --info-file="$INFOFILE" "$@" |
7001
|
71 |