Mercurial > octave
annotate run-octave.in @ 28207:ab60e78d235c
maint: merge stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 11 Apr 2020 16:06:19 -0700 |
parents | bd51beb6205e |
children | 0a5b15007766 |
rev | line source |
---|---|
5786 | 1 #! /bin/sh |
7016 | 2 ## |
7017 | 3 ## run-octave -- run Octave in the build tree. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18169
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
7 ## Copyright (C) 2006-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
8 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 ## distribution or <https://octave.org/copyright/>. |
7017 | 11 ## |
7016 | 12 ## This file is part of Octave. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18169
diff
changeset
|
13 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24126
diff
changeset
|
14 ## Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
15 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24126
diff
changeset
|
16 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## (at your option) any later version. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18169
diff
changeset
|
18 ## |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
19 ## Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
20 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
21 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
22 ## GNU General Public License for more details. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18169
diff
changeset
|
23 ## |
7016 | 24 ## You should have received a copy of the GNU General Public License |
25 ## along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24126
diff
changeset
|
26 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
27 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
28 ######################################################################## |
6125 | 29 |
20430
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
30 : ${AWK=%AWK%} |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
31 : ${FIND=%FIND%} |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
32 : ${SED=%SED%} |
20712
4a25c398ffa2
configure option to build with address sanitizer (bugg #46449)
John W. Eaton <jwe@octave.org>
parents:
20479
diff
changeset
|
33 : ${ADDRESS_SANITIZER_OPTIONS="%ADRESS_SANITIZER_OPTIONS%"} |
6125 | 34 |
21092
429f83903400
maint: Use "FIXME:" more places in code base.
Rik <rik@octave.org>
parents:
21036
diff
changeset
|
35 # FIXME: is there a better way to handle the possibility of spaces |
429f83903400
maint: Use "FIXME:" more places in code base.
Rik <rik@octave.org>
parents:
21036
diff
changeset
|
36 # in these names? |
6125 | 37 |
6131 | 38 top_srcdir='%abs_top_srcdir%' |
39 builddir='%builddir%' | |
6125 | 40 |
13187
12814f1fbbd2
Omit $top_srcdir/test directory tree from Octave's path in run-octave script
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
41 d1="$top_srcdir/scripts" |
12814f1fbbd2
Omit $top_srcdir/test directory tree from Octave's path in run-octave script
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
42 d2="$builddir/scripts" |
15195 | 43 d3="$builddir/libinterp" |
19032
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
18169
diff
changeset
|
44 d4="$top_srcdir/examples/data" |
25931
332be8be16eb
dynamically load qt graphics
John W. Eaton <jwe@octave.org>
parents:
25065
diff
changeset
|
45 d5="$builddir/libgui/graphics" |
6125 | 46 |
23856
41a0b750c36e
run-octave.in: Don't put +packages in to the PATH variable.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
47 d1_list=`$FIND "$d1" -type d -a ! \( \( -name private -o -name '@*' -o -name '+*' -o -name '.deps' -o -name '.libs' \) -a -prune \) -exec echo '{}' ';' | $SED 's/$/:/'` |
41a0b750c36e
run-octave.in: Don't put +packages in to the PATH variable.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
48 d2_list=`$FIND "$d2" -type d -a ! \( \( -name private -o -name '@*' -o -name '+*' -o -name '.deps' -o -name '.libs' \) -a -prune \) -exec echo '{}' ';' | $SED 's/$/:/'` |
41a0b750c36e
run-octave.in: Don't put +packages in to the PATH variable.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
49 d3_list=`$FIND "$d3" -type d -a ! \( \( -name private -o -name '@*' -o -name '+*' -o -name '.deps' -o -name '.libs' \) -a -prune \) -exec echo '{}' ';' | $SED 's/$/:/'` |
19032
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
18169
diff
changeset
|
50 d4_list=`$FIND "$d4" -type d -exec echo '{}' ';' | $SED 's/$/:/'` |
6125 | 51 |
6827 | 52 d1_path=`echo "$d1_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'` |
53 d2_path=`echo "$d2_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'` | |
54 d3_path=`echo "$d3_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'` | |
19032
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
18169
diff
changeset
|
55 d4_path=`echo "$d4_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }'` |
6125 | 56 |
15137
16a6b0a6855d
GUI: support for octave arguments and integrate with run-octave.
John W. Eaton <jwe@octave.org>
parents:
14614
diff
changeset
|
57 octave_executable="$builddir/src/octave" |
16a6b0a6855d
GUI: support for octave arguments and integrate with run-octave.
John W. Eaton <jwe@octave.org>
parents:
14614
diff
changeset
|
58 |
25931
332be8be16eb
dynamically load qt graphics
John W. Eaton <jwe@octave.org>
parents:
25065
diff
changeset
|
59 LOADPATH="$d1_path:$d2_path:$d3_path:$d4_path:$d5" |
24046
230613ece415
Add the working directory to IMAGE_PATH when running in build tree
Mike Miller <mtmiller@octave.org>
parents:
23856
diff
changeset
|
60 IMAGEPATH=".:$top_srcdir/scripts/image" |
8940
6994961bf1f4
use doc-cache instead of DOC for doc cache file name
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
61 DOCFILE="$builddir/doc/interpreter/doc-cache" |
22077
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
62 BUILT_IN_DOCSTRINGS_FILE="$builddir/libinterp/DOCSTRINGS" |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
63 TEXIMACROSFILE="$top_srcdir/doc/interpreter/macros.texi" |
9794
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9613
diff
changeset
|
64 INFOFILE="$top_srcdir/doc/interpreter/octave.info" |
6125 | 65 |
11452
e1a5bf3ea1d9
Add a GUD mode option to run-octave.in
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
9794
diff
changeset
|
66 ## Checking for string equality below with prepended x's in order to |
e1a5bf3ea1d9
Add a GUD mode option to run-octave.in
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
9794
diff
changeset
|
67 ## handle problems with empty strings. |
21036
b432e7bb3cbd
run-octave.in: Allow passing multiple arguments to run-octave. (bug #46690)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
20712
diff
changeset
|
68 while [ $# -gt 0 ]; do |
5786 | 69 if [ "x$1" = "x-g" ]; then |
6987 | 70 driver="gdb --args" |
5786 | 71 shift |
11452
e1a5bf3ea1d9
Add a GUD mode option to run-octave.in
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
9794
diff
changeset
|
72 elif [ "x$1" = "x-gud" ]; then |
e1a5bf3ea1d9
Add a GUD mode option to run-octave.in
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
9794
diff
changeset
|
73 ## Frontends for gdb (e.g. Emacs's GUD mode) need --annotate=3 |
e1a5bf3ea1d9
Add a GUD mode option to run-octave.in
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
9794
diff
changeset
|
74 driver="gdb --annotate=3 --args" |
e1a5bf3ea1d9
Add a GUD mode option to run-octave.in
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
9794
diff
changeset
|
75 shift |
15335
5187c3ea5a68
run-octave.in: Add -gud2 option to support new versions of gud
Max Brister <max@2bass.com>
parents:
15249
diff
changeset
|
76 elif [ "x$1" = "x-gud2" ]; then |
5187c3ea5a68
run-octave.in: Add -gud2 option to support new versions of gud
Max Brister <max@2bass.com>
parents:
15249
diff
changeset
|
77 ## The latest version of gud needs -i=mi. There isn't a good way to check |
16036
dd583c258cf9
Fix trivial typo in run-octave.in comment
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15971
diff
changeset
|
78 ## this at configure time, so we just add a gud2 flag |
15335
5187c3ea5a68
run-octave.in: Add -gud2 option to support new versions of gud
Max Brister <max@2bass.com>
parents:
15249
diff
changeset
|
79 driver="gdb -i=mi --args" |
5187c3ea5a68
run-octave.in: Add -gud2 option to support new versions of gud
Max Brister <max@2bass.com>
parents:
15249
diff
changeset
|
80 shift |
5786 | 81 elif [ "x$1" = "x-valgrind" ]; then |
82 driver="valgrind --tool=memcheck" | |
83 shift | |
19159
eeb22763138b
Add --callgrind option to run-octave to run with profiling.
Rik <rik@octave.org>
parents:
19032
diff
changeset
|
84 elif [ "x$1" = "x-callgrind" ]; then |
eeb22763138b
Add --callgrind option to run-octave to run with profiling.
Rik <rik@octave.org>
parents:
19032
diff
changeset
|
85 driver="valgrind --tool=callgrind" |
eeb22763138b
Add --callgrind option to run-octave to run with profiling.
Rik <rik@octave.org>
parents:
19032
diff
changeset
|
86 shift |
5786 | 87 elif [ "x$1" = "x-strace" ]; then |
88 driver="strace -o octave.trace" | |
89 shift | |
15139
bfc220d1de67
include gui in default Octave binary
John W. Eaton <jwe@octave.org>
parents:
15137
diff
changeset
|
90 elif [ "x$1" = "x-cli" ]; then |
bfc220d1de67
include gui in default Octave binary
John W. Eaton <jwe@octave.org>
parents:
15137
diff
changeset
|
91 octave_executable="$builddir/src/octave-cli" |
15137
16a6b0a6855d
GUI: support for octave arguments and integrate with run-octave.
John W. Eaton <jwe@octave.org>
parents:
14614
diff
changeset
|
92 shift |
21036
b432e7bb3cbd
run-octave.in: Allow passing multiple arguments to run-octave. (bug #46690)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
20712
diff
changeset
|
93 else |
b432e7bb3cbd
run-octave.in: Allow passing multiple arguments to run-octave. (bug #46690)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
20712
diff
changeset
|
94 break |
5786 | 95 fi |
21036
b432e7bb3cbd
run-octave.in: Allow passing multiple arguments to run-octave. (bug #46690)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
20712
diff
changeset
|
96 done |
6125 | 97 |
22077
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
98 ## DOCSTRINGS and doc-cache files may exist in the current (build) directory |
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
99 ## or in the source directory when building from a release. |
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
100 if ! [ -e $DOCFILE ]; then |
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
101 DOCFILE="$top_srcdir/doc/interpreter/doc-cache" |
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
102 fi |
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
103 if ! [ -e $BUILT_IN_DOCSTRINGS_FILE ]; then |
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
104 BUILT_IN_DOCSTRINGS_FILE="$top_srcdir/libinterp/DOCSTRINGS" |
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
105 fi |
df50d42d4b1b
build: build doc-cache and DOCSTRINGS files in the build dir
Mike Miller <mtmiller@octave.org>
parents:
21664
diff
changeset
|
106 |
18169
525af54479eb
allow run-octave to find octave-gui program
John W. Eaton <jwe@octave.org>
parents:
17778
diff
changeset
|
107 ## We set OCTAVE_ARCHLIBDIR so that the wrapper program can find the |
525af54479eb
allow run-octave to find octave-gui program
John W. Eaton <jwe@octave.org>
parents:
17778
diff
changeset
|
108 ## octave-gui program in the build tree. That will fail if we ever |
525af54479eb
allow run-octave to find octave-gui program
John W. Eaton <jwe@octave.org>
parents:
17778
diff
changeset
|
109 ## need Octave to find other things in ARCHLIBDIR that are not built |
525af54479eb
allow run-octave to find octave-gui program
John W. Eaton <jwe@octave.org>
parents:
17778
diff
changeset
|
110 ## in the $builddir/src directory. |
525af54479eb
allow run-octave to find octave-gui program
John W. Eaton <jwe@octave.org>
parents:
17778
diff
changeset
|
111 |
20430
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
112 OCTAVE_ARCHLIBDIR="$builddir/src"; export OCTAVE_ARCHLIBDIR |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
113 OCTAVE_BINDIR="$builddir/src"; export OCTAVE_BINDIR |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
114 OCTAVE_DEFAULT_QT_SETTINGS="$builddir/libgui/default-qt-settings"; export OCTAVE_DEFAULT_QT_SETTINGS |
24899
1a46d174a483
include a proper definition of Octave's private font fallback directory
Mike Miller <mtmiller@octave.org>
parents:
24875
diff
changeset
|
115 OCTAVE_FONTS_DIR="$top_srcdir/etc/fonts"; export OCTAVE_FONTS_DIR |
20430
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
116 OCTAVE_JAVA_DIR="$builddir/scripts/java"; export OCTAVE_JAVA_DIR |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
117 OCTAVE_LOCALE_DIR="$builddir/libgui/languages"; export OCTAVE_LOCALE_DIR |
25065
74ece2b45b4f
Revert unintended changes in cset 1cd3aeda7598
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25060
diff
changeset
|
118 OCTAVE_QTHELP_COLLECTION="$builddir/doc/interpreter/octave_interpreter.qhc"; export OCTAVE_QTHELP_COLLECTION |
20479
ac0f7acdc3fd
avoid executing startup file twice when using run-octave script (bug #45872)
John W. Eaton <jwe@octave.org>
parents:
20430
diff
changeset
|
119 OCTAVE_SITE_INITFILE="$top_srcdir/scripts/startup/site-rcfile"; export OCTAVE_SITE_INITFILE |
ac0f7acdc3fd
avoid executing startup file twice when using run-octave script (bug #45872)
John W. Eaton <jwe@octave.org>
parents:
20430
diff
changeset
|
120 OCTAVE_VERSION_INITFILE="$top_srcdir/scripts/startup/version-rcfile"; export OCTAVE_VERSION_INITFILE |
20430
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
121 |
20712
4a25c398ffa2
configure option to build with address sanitizer (bugg #46449)
John W. Eaton <jwe@octave.org>
parents:
20479
diff
changeset
|
122 if [ "$ADDRESS_SANITIZER_ENABLED" = yes ]; then |
4a25c398ffa2
configure option to build with address sanitizer (bugg #46449)
John W. Eaton <jwe@octave.org>
parents:
20479
diff
changeset
|
123 ASAN_OPTIONS=symbolize=1; export ASAN_OPTIONS |
4a25c398ffa2
configure option to build with address sanitizer (bugg #46449)
John W. Eaton <jwe@octave.org>
parents:
20479
diff
changeset
|
124 fi |
4a25c398ffa2
configure option to build with address sanitizer (bugg #46449)
John W. Eaton <jwe@octave.org>
parents:
20479
diff
changeset
|
125 |
20430
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
126 exec $builddir/libtool --mode=execute $driver \ |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
127 "$octave_executable" --no-init-path --path="$LOADPATH" \ |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
128 --image-path="$IMAGEPATH" --doc-cache-file="$DOCFILE" \ |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
129 --built-in-docstrings-file="$BUILT_IN_DOCSTRINGS_FILE" \ |
a63f9cb609a1
run-octave: Use portable shell constructs
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
130 --texi-macros-file="$TEXIMACROSFILE" --info-file="$INFOFILE" "$@" |