Mercurial > mxe-octave
annotate installer-files/octave.bat @ 5094:ca7d09e9d8c3
* installer-files/octave.bat: add missing \ from msys path
author | John Donoghue |
---|---|
date | Wed, 12 Jun 2019 12:26:26 -0400 |
parents | d18546e3db74 |
children | 3c10ce089d7c |
rev | line source |
---|---|
4767
a800e350d88b
use .bat file for octave.exe/octave-version.exe (Bug #53938)
John Donoghue
parents:
4704
diff
changeset
|
1 :; # if running from bash, recall using cmd.exe |
a800e350d88b
use .bat file for octave.exe/octave-version.exe (Bug #53938)
John Donoghue
parents:
4704
diff
changeset
|
2 :; cmd.exe //c "$0" "$@"; exit $? |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
3 @echo off |
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
4 Rem Find Octave's install directory through cmd.exe variables. |
4767
a800e350d88b
use .bat file for octave.exe/octave-version.exe (Bug #53938)
John Donoghue
parents:
4704
diff
changeset
|
5 Rem This batch file should reside in Octaves installation bin dir! |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
6 Rem |
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
7 Rem This trick finds the location where the batch file resides. |
4645
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
8 Rem Note: the result ends with a backslash. |
4767
a800e350d88b
use .bat file for octave.exe/octave-version.exe (Bug #53938)
John Donoghue
parents:
4704
diff
changeset
|
9 set OCT_HOME=%~dp0\.\..\ |
5076
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
10 set ROOT_PATH=%~dp0\.\..\..\ |
4645
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
11 Rem Convert to 8.3 format so we don't have to worry about spaces. |
4258 | 12 for %%I in ("%OCT_HOME%") do set OCT_HOME=%%~sI |
5076
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
13 for %%I in ("%ROOT_PATH%") do set ROOT_PATH=%%~sI |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
14 |
5076
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
15 set MSYSTEM=MSYS |
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
16 set MSYSPATH=%OCT_HOME% |
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
17 IF EXIST "%ROOT_PATH%mingw64\bin\octave.bat" ( |
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
18 set MSYSTEM=MINGW64 |
5094
ca7d09e9d8c3
* installer-files/octave.bat: add missing \ from msys path
John Donoghue
parents:
5076
diff
changeset
|
19 set MSYSPATH=%ROOT_PATH%usr\ |
5076
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
20 ) ELSE ( |
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
21 IF EXIST "%ROOT_PATH%mingw32\bin\octave.bat" ( |
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
22 set MSYSTEM=MINGW64 |
5094
ca7d09e9d8c3
* installer-files/octave.bat: add missing \ from msys path
John Donoghue
parents:
5076
diff
changeset
|
23 set MSYSPATH=%ROOT_PATH%usr\ |
5076
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
24 ) |
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
25 ) |
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
26 |
4645
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
27 Rem Set up PATH. Make sure the octave bin dir comes first. |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
28 |
5076
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
29 set PATH=%OCT_HOME%qt5\bin;%OCT_HOME%bin;%MSYSPATH%bin;%PATH% |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
30 |
4645
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
31 Rem Set up any environment vars we may need. |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
32 |
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
33 set TERM=cygwin |
4472
0fdeee4cfe11
gnuplot: enable Qt terminal and set default to wxt
Mike Miller <mtmiller@octave.org>
parents:
4276
diff
changeset
|
34 set GNUTERM=wxt |
4183 | 35 set GS=gs.exe |
5076
d18546e3db74
* installer-files/octave.bat: set msys env values and path
John Donoghue
parents:
4767
diff
changeset
|
36 |
4645
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
37 Rem QT_PLUGIN_PATH must be set to avoid segfault (bug #53419). |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
38 IF EXIST "%OCT_HOME%\qt5\bin\" ( |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
39 set QT_PLUGIN_PATH=%OCT_HOME%\qt5\plugins |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
40 ) ELSE ( |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
41 set QT_PLUGIN_PATH=%OCT_HOME%\plugins |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
42 ) |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
43 |
4276 | 44 Rem set home if not already set |
45 if "%HOME%"=="" set HOME=%USERPROFILE% | |
46 if "%HOME%"=="" set HOME=%HOMEDRIVE%%HOMEPATH% | |
47 Rem set HOME to 8.3 format | |
48 for %%I in ("%HOME%") do set HOME=%%~sI | |
49 | |
4646
89a9c9a80669
octave.bat: Start CLI by default and don't close terminal window (bug #53419).
Rik <rik@octave.org>
parents:
4645
diff
changeset
|
50 Rem Check for args to determine if GUI (--gui, --force-gui) |
89a9c9a80669
octave.bat: Start CLI by default and don't close terminal window (bug #53419).
Rik <rik@octave.org>
parents:
4645
diff
changeset
|
51 Rem or CLI (--no-gui) should be started. |
89a9c9a80669
octave.bat: Start CLI by default and don't close terminal window (bug #53419).
Rik <rik@octave.org>
parents:
4645
diff
changeset
|
52 Rem If nothing is specified, start the CLI. |
89a9c9a80669
octave.bat: Start CLI by default and don't close terminal window (bug #53419).
Rik <rik@octave.org>
parents:
4645
diff
changeset
|
53 set GUI_MODE=0 |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
54 :checkargs |
4645
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
55 if -%1-==-- goto args_done |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
56 |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
57 if %1==--gui ( |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
58 set GUI_MODE=1 |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
59 ) else ( |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
60 if %1==--force-gui ( |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
61 set GUI_MODE=1 |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
62 ) else ( |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
63 if %1==--no-gui ( |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
64 set GUI_MODE=0 |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
65 ))) |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
66 |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
67 Rem move to next argument and continue processing |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
68 shift |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
69 goto checkargs |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
70 |
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
71 :args_done |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
72 |
4646
89a9c9a80669
octave.bat: Start CLI by default and don't close terminal window (bug #53419).
Rik <rik@octave.org>
parents:
4645
diff
changeset
|
73 Rem Start Octave (this detaches and immediately returns). |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
74 if %GUI_MODE%==1 ( |
4645
56a712112482
octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).
Rik <rik@octave.org>
parents:
4643
diff
changeset
|
75 start octave-gui.exe --gui %* |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
76 ) else ( |
4704
d1d36bdbc1ae
* installer-files/octave.bat: dont use 'start' when calling octave-cli (Bug #53938)
John Donoghue
parents:
4646
diff
changeset
|
77 octave-cli.exe %* |
3717
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
78 ) |
70480095b6ed
Use a bat file to run octave in windows (Bug #43164)
John Donoghue
parents:
diff
changeset
|
79 |