annotate installer-files/octave.vbs @ 6234:97c5f8da5036 release

* src/librsb.mk: update to 1.2.0.11
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 27 May 2022 12:24:32 +0200
parents d02b5d26ac28
children ae320ffbbbe0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
1 ' script to run octave in gui/command mode
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
2
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
3 Set wshShell = CreateObject( "WScript.Shell" )
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
4
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
5 ' If running with wscript.exe, "Exec" will flash a window for a split second.
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
6 ' Relaunch with cscript.exe which doesn't show that window.
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
7 If InStr(1, WScript.FullName, "wscript.exe", vbTextCompare) > 0 Then
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
8 WScript.Quit wshShell.Run("cscript.exe """ & WScript.ScriptFullName & """", 0, True)
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
9 End If
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
10
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
11 ' get the directory that script resides in
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
12 Set fso = CreateObject("Scripting.FileSystemObject")
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
13 OctavePath = fso.GetParentFolderName(WScript.ScriptFullName)
4793
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
14
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
15 ' OctavePath is now the root of the install folder, but for msys2,
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
16 ' OctavePath should be OctavePath/mingw64 or OctavePath/mingw32
4793
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
17 MSysType = "MSYS"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
18 MSysPath = OctavePath
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
19 Set objFSO = CreateObject("Scripting.FileSystemObject")
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
20 If objFSO.FileExists(OctavePath & "\mingw64\bin\octave-cli.exe") Then
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
21 MSysPath = OctavePath & "\usr"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
22 MSysType = "MINGW64"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
23 OctavePath = OctavePath & "\mingw64"
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
24 ElseIf objFSO.FileExists(OctavePath & "\mingw32\bin\octave-cli.exe") Then
4793
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
25 MSysPath = OctavePath & "\usr"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
26 MSysType = "MINGW32"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
27 OctavePath = OctavePath & "\mingw32"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
28 End If
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
29
4258
a45374f7d9a3 Use 8.3 format for octave path
John D
parents: 4222
diff changeset
30 ' get path as a 8.3 path
a45374f7d9a3 Use 8.3 format for octave path
John D
parents: 4222
diff changeset
31 Set fo = fso.GetFolder(OctavePath)
a45374f7d9a3 Use 8.3 format for octave path
John D
parents: 4222
diff changeset
32 OctavePath = fo.ShortPath
a45374f7d9a3 Use 8.3 format for octave path
John D
parents: 4222
diff changeset
33 Set fo = Nothing
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
34
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
35 ' set up path to ensure octave bin comes first
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
36 Set wshSystemEnv = wshShell.Environment( "PROCESS" )
4793
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
37 if OctavePath <> MSysPath Then
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
38 wshSystemEnv("PATH") = MSysPath & "\bin;" & wshSystemEnv("PATH")
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
39 End If
3831
1191cff7f132 nsis installer: change file registrations to use octave.vbs
John D
parents: 3817
diff changeset
40 wshSystemEnv("PATH") = OctavePath & "\bin;" & wshSystemEnv("PATH")
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
41
4793
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
42 wshSystemEnv("MSYSTEM") = MSysType
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
43
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
44 ' set terminal type
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
45 wshSystemEnv("TERM") = "cygwin"
4472
0fdeee4cfe11 gnuplot: enable Qt terminal and set default to wxt
Mike Miller <mtmiller@octave.org>
parents: 4276
diff changeset
46 wshSystemEnv("GNUTERM") = "wxt"
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
47
4183
cc549d1865cb pstoedit: use GS environment var if set in windows
John D
parents: 4153
diff changeset
48 wshSystemEnv("GS") = "gs.exe"
cc549d1865cb pstoedit: use GS environment var if set in windows
John D
parents: 4153
diff changeset
49
4276
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
50 If wshShell.ExpandEnvironmentStrings("%HOME%") = "%HOME%" Then
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
51 Home = wshSystemEnv("USERPROFILE")
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
52 Set fo = fso.GetFolder(Home)
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
53 wshSystemEnv("HOME") = fo.ShortPath
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
54 Set fo = Nothing
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
55 End If
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
56
4222
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
57 ' set Qt plugin directory and path
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
58 If objFSO.FolderExists(OctavePath & "\qt5\bin") Then
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
59 wshSystemEnv("PATH") = OctavePath & "\qt5\bin;" & wshSystemEnv("PATH")
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
60 wshSystemEnv("QT_PLUGIN_PATH") = OctavePath & "\qt5\plugins"
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
61 Else
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
62 wshSystemEnv("QT_PLUGIN_PATH") = OctavePath & "\plugins"
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
63 End If
3909
586b26b09042 set QT_PLUGIN_PATH in octave.vbs
John W. Eaton <jwe@octave.org>
parents: 3859
diff changeset
64
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
65 ' pkgconfig .pc files path
6177
4ba9eb3f70c9 * installer-files/cmdshell.bat, installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 5493
diff changeset
66 wshSystemEnv("PKG_CONFIG_PATH") = OctavePath & "\lib\pkgconfig"
4ba9eb3f70c9 * installer-files/cmdshell.bat, installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 5493
diff changeset
67
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
68 If wshShell.ExpandEnvironmentStrings("%OPENBLAS_NUM_THREADS%") = "%OPENBLAS_NUM_THREADS%" Then
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
69 ' Set OPENBLAS_NUM_THREADS to number of physical processor cores.
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
70 Set wshExec = wshShell.Exec("wmic CPU Get NumberOfCores")
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
71 If Not wshExec.Stdout.atEndOfStream then
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
72 ' Check that first line contains "NumberOfCores".
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
73 If (InStr(1, wshExec.StdOut.ReadLine(), "NumberOfCores") = 1) And (Not wshExec.Stdout.atEndOfStream) then
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
74 ' The next line should contain the number of cores.
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
75 wshSystemEnv("OPENBLAS_NUM_THREADS") = wshExec.StdOut.ReadLine()
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
76 End If
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
77 End If
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
78 End If
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6177
diff changeset
79
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
80 ' check args to see if told to run gui or command line
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
81 ' and build other args to use
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
82 GUI_MODE=1
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
83 AllArgs = ""
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
84 Set wshArgs = WScript.Arguments
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
85 For I = 0 to wshArgs.Count - 1
4644
c3950e2b4066 Fix vbs scripts to launch with '--gui' option (bug #53369).
Rik <rik@octave.org>
parents: 4643
diff changeset
86 If wshArgs(I) = "--no-gui" Then GUI_MODE=0
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
87 AllArgs = AllArgs & " " & chr(34) & wshArgs(I) & chr(34)
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
88 Next
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
89
3859
74f53761f74d GUI: run octave-gui for both gui and non gui options
John Donoghue <john.donoghue@ieee.org>
parents: 3831
diff changeset
90 ' start octave-gui, either with console shown or hidden
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
91 If GUI_MODE = 1 then
4644
c3950e2b4066 Fix vbs scripts to launch with '--gui' option (bug #53369).
Rik <rik@octave.org>
parents: 4643
diff changeset
92 AllArgs = AllArgs & " " & chr(34) & "--gui" & chr(34)
c3950e2b4066 Fix vbs scripts to launch with '--gui' option (bug #53369).
Rik <rik@octave.org>
parents: 4643
diff changeset
93 wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 0
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
94 Else
3859
74f53761f74d GUI: run octave-gui for both gui and non gui options
John Donoghue <john.donoghue@ieee.org>
parents: 3831
diff changeset
95 wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 1
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
96 End If
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
97
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
98 ' free our objects
4276
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
99 Set fso = Nothing
3817
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
100 Set wshShell = Nothing
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
101 Set wshSystemEnv = Nothing
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
102 Set wshArgs = Nothing
6daa158a7018 nsis installer: use octave.vbs as laucher (Bug #41074)
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
103