annotate installer-files/octave-firsttime.vbs @ 7207:9ed6500e56d3 default tip @

maint: Merge release to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 17 May 2024 20:16:41 +0200
parents 6adeb47401d6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
1 ' script to run octave in gui/command mode
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
2
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
3 Set wshShell = CreateObject( "WScript.Shell" )
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
4
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
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: 6174
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: 6174
diff changeset
7 If InStr(1, WScript.FullName, "wscript.exe", vbTextCompare) > 0 Then
6371
ae320ffbbbe0 * installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 6184
diff changeset
8 AllArgs = ""
ae320ffbbbe0 * installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 6184
diff changeset
9 Set wshArgs = WScript.Arguments
ae320ffbbbe0 * installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 6184
diff changeset
10 For I = 0 to wshArgs.Count - 1
ae320ffbbbe0 * installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 6184
diff changeset
11 AllArgs = AllArgs & " " & chr(34) & wshArgs(I) & chr(34)
ae320ffbbbe0 * installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 6184
diff changeset
12 Next
ae320ffbbbe0 * installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 6184
diff changeset
13 WScript.Quit wshShell.Run("cscript.exe """ & WScript.ScriptFullName & """" & AllArgs, 0, True)
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
14 End If
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
15
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
16
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
17 ' get the directory that script resides in
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
18 Set fso = CreateObject("Scripting.FileSystemObject")
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
19 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
20
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
21 ' OctavePath is now the root of the install folder, but for msys2,
4793
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
22 ' OctavePath should be OctavePath/mingw64 or OctavePath/ming32
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
23 MSysType = "MSYS"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
24 MSysPath = OctavePath
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
25 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
26 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
27 MSysPath = OctavePath & "\usr"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
28 MSysType = "MINGW64"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
29 OctavePath = OctavePath & "\mingw64"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
30 ElseIf objFSO.FileExists(OctavePath & "\mingw32\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
31 MSysPath = OctavePath & "\usr"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
32 MSysType = "MINGW32"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
33 OctavePath = OctavePath & "\mingw32"
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
34 End If
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
35
4258
a45374f7d9a3 Use 8.3 format for octave path
John D
parents: 4222
diff changeset
36 ' get path as a 8.3 path
a45374f7d9a3 Use 8.3 format for octave path
John D
parents: 4222
diff changeset
37 Set fo = fso.GetFolder(OctavePath)
a45374f7d9a3 Use 8.3 format for octave path
John D
parents: 4222
diff changeset
38 OctavePath = fo.ShortPath
a45374f7d9a3 Use 8.3 format for octave path
John D
parents: 4222
diff changeset
39 Set fo = Nothing
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
40
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
41 ' set up path to ensure octave bin comes first
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
42 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
43 if OctavePath <> MSysPath Then
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
44 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
45 End If
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
46 wshSystemEnv("PATH") = OctavePath & "\bin;" & wshSystemEnv("PATH")
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
47
4793
202fa20cf559 add msys2 environment/tools option, use seprate post-install script to finalize install
John Donoghue
parents: 4644
diff changeset
48 wshSystemEnv("MSYSTEM") = MSysType
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
49 ' set terminal type
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
50 wshSystemEnv("TERM") = "cygwin"
4472
0fdeee4cfe11 gnuplot: enable Qt terminal and set default to wxt
Mike Miller <mtmiller@octave.org>
parents: 4276
diff changeset
51 wshSystemEnv("GNUTERM") = "wxt"
4183
cc549d1865cb pstoedit: use GS environment var if set in windows
John D
parents: 4028
diff changeset
52
cc549d1865cb pstoedit: use GS environment var if set in windows
John D
parents: 4028
diff changeset
53 wshSystemEnv("GS") = "gs.exe"
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
54
4276
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
55 If wshShell.ExpandEnvironmentStrings("%HOME%") = "%HOME%" Then
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
56 Home = wshSystemEnv("USERPROFILE")
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
57 Set fo = fso.GetFolder(Home)
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
58 wshSystemEnv("HOME") = fo.ShortPath
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
59 Set fo = Nothing
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
60 End If
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
61
4222
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
62 ' set Qt plugin directory and path
6837
6adeb47401d6 Add qt6 usage to mxe-octave
John Donoghue <john.donoghue@ieee.org>
parents: 6371
diff changeset
63 If objFSO.FolderExists(OctavePath & "\qt6\bin") Then
6adeb47401d6 Add qt6 usage to mxe-octave
John Donoghue <john.donoghue@ieee.org>
parents: 6371
diff changeset
64 wshSystemEnv("PATH") = OctavePath & "\qt6\bin;" & wshSystemEnv("PATH")
6adeb47401d6 Add qt6 usage to mxe-octave
John Donoghue <john.donoghue@ieee.org>
parents: 6371
diff changeset
65 wshSystemEnv("QT_PLUGIN_PATH") = OctavePath & "\qt6\plugins"
6adeb47401d6 Add qt6 usage to mxe-octave
John Donoghue <john.donoghue@ieee.org>
parents: 6371
diff changeset
66 ElseIf objFSO.FolderExists(OctavePath & "\qt5\bin") Then
4222
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
67 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
68 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
69 Else
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
70 wshSystemEnv("QT_PLUGIN_PATH") = OctavePath & "\plugins"
44b1a9b2193e qt5: add initial qt5 to mxe-octave, based on mxe.cc
John D
parents: 4183
diff changeset
71 End If
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
72
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
73 ' pkgconfig .pc files path
6174
cf7adc238c0c * installer-files/cmdshell.bat, installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 5493
diff changeset
74 wshSystemEnv("PKG_CONFIG_PATH") = OctavePath & "\lib\pkgconfig"
cf7adc238c0c * installer-files/cmdshell.bat, installer-files/octave-firsttime.vbs,
John Donoghue <john.donoghue@ieee.org>
parents: 5493
diff changeset
75
6184
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
76 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: 6174
diff changeset
77 ' 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: 6174
diff changeset
78 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: 6174
diff changeset
79 If Not wshExec.Stdout.atEndOfStream then
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
80 ' Check that first line contains "NumberOfCores".
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
81 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: 6174
diff changeset
82 ' 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: 6174
diff changeset
83 wshSystemEnv("OPENBLAS_NUM_THREADS") = wshExec.StdOut.ReadLine()
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
84 End If
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
85 End If
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
86 End If
d02b5d26ac28 Set OPENBLAS_NUM_THREADS also in launcher scripts.
Markus Mützel <markus.muetzel@gmx.de>
parents: 6174
diff changeset
87
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
88 ' set directory to users
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
89 startpath = wshShell.ExpandEnvironmentStrings("%UserProfile%")
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
90 wshShell.CurrentDirectory = startpath
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
91
4644
c3950e2b4066 Fix vbs scripts to launch with '--gui' option (bug #53369).
Rik <rik@octave.org>
parents: 4643
diff changeset
92 GUIArg = " " & 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) & GUIArg, 0
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
94
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
95 ' free our objects
4276
b73fe78f73c3 If home not set, set it to userprofile
John D
parents: 4258
diff changeset
96 Set fso = Nothing
4028
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
97 Set wshShell = Nothing
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
98 Set wshSystemEnv = Nothing
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
99 Set wshArgs = Nothing
8803dfa40236 nsis installer: set directory to userprofile on startof octave from installer (Bug #45899)
John Donoghue
parents:
diff changeset
100