Mercurial > mxe-octave
comparison tools/makeinst-script.sh.in @ 4124:5ae69991eaa1
installer: detect win64/win32 java depending on octave 32/64 (Bug #47606)
* makeinst-script.sh: removed
* tools/makeinst-script.sh.in: copy makeinst-script.sh, with additions for SetRegView if built for WINDOWS_64
* binary-dist-rules.mk: update to use tools/makeinst-script.sh
* configure.ac: add generated configure file tools/makeinst-script.sh
author | John Donoghue |
---|---|
date | Tue, 05 Apr 2016 17:18:50 -0400 |
parents | makeinst-script.sh@1c3be8c68d3f |
children | 35c9886e1f60 |
comparison
equal
deleted
inserted
replaced
4123:28a83a566666 | 4124:5ae69991eaa1 |
---|---|
1 #! /bin/bash | |
2 set -e | |
3 | |
4 if [ $# != 2 ]; then | |
5 echo "usage: makeinst-script.sh dist-dir output-script-name" 1>&2 | |
6 exit 1 | |
7 fi | |
8 | |
9 OUTFILE="$2" | |
10 TOPDIR=@abs_top_srcdir@ | |
11 ENABLE64="@ENABLE_WINDOWS_64@" | |
12 | |
13 OCTAVE_SOURCE=`basename $1` | |
14 | |
15 cd `dirname $1` | |
16 MXEDIR=`cd ..; pwd` | |
17 | |
18 if [ -e $OCTAVE_SOURCE/bin/libopenblas.dll ]; then | |
19 DEFAULT_BLAS="OpenBLAS" | |
20 else | |
21 DEFAULT_BLAS="Reference BLAS" | |
22 fi | |
23 | |
24 | |
25 # find octave shortcut icon | |
26 ICON=`find $OCTAVE_SOURCE -name octave-logo.ico -printf "%P\n" | head -1 | sed 's,/,\\\\,g'` | |
27 | |
28 # extract version number | |
29 OCTAVE_VERSION=`head -1 $MXEDIR/octave/octave-version` | |
30 VERSION=`echo $OCTAVE_VERSION | sed -n 's,\([0-9\.]*\).*,\1,p'` | |
31 | |
32 # estimated size of installed files | |
33 SIZE=`du -slk $OCTAVE_SOURCE | awk '{print \$1}'` | |
34 | |
35 # create installer script | |
36 echo "; octave setup script $OCTAVE_SOURCE" > $OUTFILE | |
37 | |
38 # installer settings | |
39 cat >> $OUTFILE << EOF | |
40 !define APP_NAME "GNU Octave" | |
41 !define COMP_NAME "GNU Project" | |
42 !define WEB_SITE "http://www.octave.org" | |
43 !define VERSION "$VERSION.0" | |
44 !define OCTAVE_VERSION "$OCTAVE_VERSION" | |
45 !define COPYRIGHT "Copyright © 2013 John W. Eaton and others." | |
46 !define DESCRIPTION "GNU Octave is a high-level programming language, primarily intended for numerical computations." | |
47 !define INSTALLER_FILES "$TOPDIR/installer-files" | |
48 !define INSTALLER_NAME "octave-$OCTAVE_VERSION-installer.exe" | |
49 !define MAIN_APP_EXE "octave-firsttime.vbs" | |
50 !define INSTALL_TYPE "SetShellVarContext current" | |
51 !define PRODUCT_ROOT_KEY "HKLM" | |
52 !define PRODUCT_KEY "Software\\Octave-$VERSION" | |
53 | |
54 ###################################################################### | |
55 | |
56 VIProductVersion "\${VERSION}" | |
57 VIAddVersionKey "ProductName" "\${APP_NAME}" | |
58 VIAddVersionKey "CompanyName" "\${COMP_NAME}" | |
59 VIAddVersionKey "LegalCopyright" "\${COPYRIGHT}" | |
60 VIAddVersionKey "FileDescription" "\${DESCRIPTION}" | |
61 VIAddVersionKey "FileVersion" "\${VERSION}" | |
62 | |
63 ###################################################################### | |
64 | |
65 SetCompressor /SOLID Lzma | |
66 Name "\${APP_NAME}" | |
67 Caption "\${APP_NAME}" | |
68 OutFile "\${INSTALLER_NAME}" | |
69 BrandingText "\${APP_NAME}" | |
70 XPStyle on | |
71 InstallDir "C:\\Octave\\Octave-\${OCTAVE_VERSION}" | |
72 Icon "\${INSTALLER_FILES}/octave-logo.ico" | |
73 | |
74 ###################################################################### | |
75 ; StrFunc usage | |
76 !include "StrFunc.nsh" | |
77 \${StrRep} | |
78 ###################################################################### | |
79 ; MUI settings | |
80 !include "MUI.nsh" | |
81 | |
82 ; custom dialogs | |
83 !include nsDialogs.nsh | |
84 !macro __DropList_GetCurSel CONTROL VAR | |
85 SendMessage \${CONTROL} \${CB_GETCURSEL} 0 0 \${VAR} | |
86 !macroend | |
87 | |
88 !define DropList_GetCurSel \`!insertmacro __DropList_GetCurSel\` | |
89 | |
90 ; additional logic | |
91 !include LogicLib.nsh | |
92 | |
93 | |
94 !define MUI_ABORTWARNING | |
95 !define MUI_UNABORTWARNING | |
96 !define MUI_HEADERIMAGE | |
97 | |
98 ; Theme | |
99 !define MUI_ICON "\${INSTALLER_FILES}/octave-logo.ico" | |
100 !define MUI_UNICON "./${OCTAVE_SOURCE}/share/nsis/Contrib/Graphics/Icons/orange-uninstall.ico" | |
101 !define MUI_HEADERIMAGE_BITMAP "\${INSTALLER_FILES}/octave-hdr.bmp" | |
102 !define MUI_WELCOMEFINISHPAGE_BITMAP "\${INSTALLER_FILES}/octave.bmp" | |
103 | |
104 !insertmacro MUI_PAGE_WELCOME | |
105 | |
106 !define MUI_LICENSEPAGE_TEXT_BOTTOM "The source code for Octave is freely redistributable under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation." | |
107 !define MUI_LICENSEPAGE_BUTTON "Next >" | |
108 !insertmacro MUI_PAGE_LICENSE "\${INSTALLER_FILES}/gpl-3.0.txt" | |
109 | |
110 Page custom octaveOptionsPage octaveOptionsLeave | |
111 | |
112 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckPrevInstallAndDest | |
113 !insertmacro MUI_PAGE_DIRECTORY | |
114 | |
115 !insertmacro MUI_PAGE_INSTFILES | |
116 | |
117 !define MUI_FINISHPAGE_RUN "\$WINDIR\\explorer.exe" | |
118 !define MUI_FINISHPAGE_RUN_PARAMETERS "\$INSTDIR\\\${MAIN_APP_EXE}" | |
119 !define MUI_FINISHPAGE_SHOWREADME "\$INSTDIR\\README.html" | |
120 !insertmacro MUI_PAGE_FINISH | |
121 | |
122 !insertmacro MUI_UNPAGE_CONFIRM | |
123 | |
124 !insertmacro MUI_UNPAGE_INSTFILES | |
125 | |
126 !insertmacro MUI_UNPAGE_FINISH | |
127 | |
128 !insertmacro MUI_LANGUAGE "English" | |
129 | |
130 ###################################################################### | |
131 | |
132 RequestExecutionLevel admin | |
133 | |
134 ###################################################################### | |
135 | |
136 ; custom options page functions | |
137 | |
138 Var InstallAllUsers | |
139 Var InstallAllUsersCtrl | |
140 Var InstallShortcuts | |
141 Var InstallShortcutsCtrl | |
142 Var RegisterOctaveFileType | |
143 Var RegisterOctaveFileTypeCtrl | |
144 Var InstallBlasLibCtrl | |
145 Var InstallBlasLib | |
146 | |
147 Function octaveOptionsPage | |
148 Push \$0 | |
149 nsDialogs::Create 1018 | |
150 Pop \$0 | |
151 | |
152 \${If} \$0 == error | |
153 Abort | |
154 \${EndIf} | |
155 | |
156 \${NSD_CreateCheckBox} 0 0 100% 12u "Install for all users" | |
157 Pop \$InstallAllUsersCtrl | |
158 \${NSD_SetState} \$InstallAllUsersCtrl \${BST_CHECKED} | |
159 | |
160 \${NSD_CreateCheckBox} 0 20 100% 12u "Create desktop shortcuts" | |
161 Pop \$InstallShortcutsCtrl | |
162 \${NSD_SetState} \$InstallShortcutsCtrl \${BST_CHECKED} | |
163 | |
164 \${NSD_CreateCheckBox} 0 40 100% 12u "Register .m file type with Octave" | |
165 Pop \$RegisterOctaveFileTypeCtrl | |
166 \${NSD_SetState} \$RegisterOctaveFileTypeCtrl \${BST_CHECKED} | |
167 | |
168 \${NSD_CreateLabel} 0 70 110u 12u "BLAS library implementation:" | |
169 Pop \$0 | |
170 | |
171 \${NSD_CreateDropList} 120u 70 100u 80u "" | |
172 Pop \$InstallBlasLibCtrl | |
173 EOF | |
174 # add option to install libopenblas if we have the dll present | |
175 if [ -e $OCTAVE_SOURCE/bin/libopenblas.dll ]; then | |
176 cat >> $OUTFILE << EOF | |
177 \${NSD_CB_AddString} \$InstallBlasLibCtrl "OpenBLAS" | |
178 EOF | |
179 fi | |
180 cat >> $OUTFILE << EOF | |
181 \${NSD_CB_AddString} \$InstallBlasLibCtrl "Reference BLAS" | |
182 EOF | |
183 | |
184 cat >> $OUTFILE << EOF | |
185 \${NSD_CB_SelectString} \$InstallBlasLibCtrl "$DEFAULT_BLAS" | |
186 | |
187 !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing" | |
188 nsDialogs::Show | |
189 Pop \$0 | |
190 FunctionEnd | |
191 | |
192 Function octaveOptionsLeave | |
193 \${NSD_GetState} \$InstallAllUsersCtrl \$InstallAllUsers | |
194 \${NSD_GetState} \$InstallShortcutsCtrl \$InstallShortcuts | |
195 \${NSD_GetState} \$RegisterOctaveFileTypeCtrl \$RegisterOctaveFileType | |
196 \${DropList_GetCurSel} \$InstallBlasLibCtrl \$InstallBlasLib | |
197 FunctionEnd | |
198 | |
199 ###################################################################### | |
200 | |
201 Function .onInit | |
202 Call CheckWinVer | |
203 Call CheckCurrVersion | |
204 Call CheckJRE | |
205 InitPluginsDir | |
206 FunctionEnd | |
207 | |
208 ; file section | |
209 Section "MainFiles" | |
210 | |
211 ; set context based on whether installing for user or all | |
212 \${If} \$InstallAllUsers == \${BST_CHECKED} | |
213 SetShellVarContext all | |
214 \${Else} | |
215 SetShellVarContext current | |
216 \${Endif} | |
217 | |
218 ; include the README | |
219 SetOutPath "\$INSTDIR" | |
220 File "$OCTAVE_SOURCE/README.html" | |
221 | |
222 ; include the octave.bat file | |
223 SetOutPath "\$INSTDIR" | |
224 File "$OCTAVE_SOURCE/octave.bat" | |
225 File "$OCTAVE_SOURCE/octave.vbs" | |
226 File "$OCTAVE_SOURCE/octave-firsttime.vbs" | |
227 | |
228 ; distro files | |
229 EOF | |
230 if [ -f $OCTAVE_SOURCE/cmdshell.bat ]; then | |
231 echo "File '$OCTAVE_SOURCE/cmdshell.bat'" >> $OUTFILE | |
232 fi | |
233 | |
234 # insert the files | |
235 IFS=$'\n' | |
236 for f in $(find $OCTAVE_SOURCE -type d -printf "%P\n"); do | |
237 winf=`echo $f | sed 's,/,\\\\,g'` | |
238 echo " CreateDirectory \"\$INSTDIR\\$winf\"" >> $OUTFILE | |
239 echo " SetOutPath \"\$INSTDIR\\$winf\"" >> $OUTFILE | |
240 find "$OCTAVE_SOURCE/$f" -maxdepth 1 -type f -printf " File \"%p\"\n" >> $OUTFILE | |
241 done | |
242 | |
243 cat >> $OUTFILE << EOF | |
244 | |
245 ; add qt.conf | |
246 Push \$0 | |
247 \${StrRep} '\$0' '\$INSTDIR' '\\' '/' | |
248 WriteINIStr "\$INSTDIR\\bin\\qt.conf" "Paths" "Prefix" "\$0" | |
249 WriteINIStr "\$INSTDIR\\bin\\qt.conf" "Paths" "Translations" "translations" | |
250 Pop \$0 | |
251 SectionEnd | |
252 | |
253 Section make_uninstaller | |
254 ; Write the uninstall keys for Windows | |
255 SetOutPath "\$INSTDIR" | |
256 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayName" "Octave $VERSION" | |
257 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayVersion" "$VERSION" | |
258 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayIcon" "\$INSTDIR\\$ICON" | |
259 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "UninstallString" "\$INSTDIR\\uninstall.exe" | |
260 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoModify" 1 | |
261 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "NoRepair" 1 | |
262 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "Publisher" "\${APP_NAME}" | |
263 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "EstimatedSize" $SIZE | |
264 \${If} \$InstallAllUsers == \${BST_CHECKED} | |
265 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "AllUsers" 1 | |
266 \${EndIf} | |
267 WriteUninstaller "uninstall.exe" | |
268 SectionEnd | |
269 | |
270 ; start menu (currently hardcoded) | |
271 Section "Shortcuts" | |
272 | |
273 CreateDirectory "\$SMPROGRAMS\\Octave-$VERSION" | |
274 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0 | |
275 SetOutPath "%USERPROFILE%" | |
276 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (CLI).lnk" "\$INSTDIR\\octave.vbs" "--no-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED | |
277 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (GUI).lnk" "\$INSTDIR\\octave.vbs" "--force-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED | |
278 SetOutPath "\$INSTDIR" | |
279 EOF | |
280 # shortcut for cmd win | |
281 if [ -f $OCTAVE_SOURCE/cmdshell.bat ]; then | |
282 echo "CreateShortCut '\$SMPROGRAMS\\Octave-$VERSION\\Bash Shell.lnk' '\$INSTDIR\\cmdshell.bat' '' '' 0" >> $OUTFILE | |
283 fi | |
284 # if we have documentation files, create shortcuts | |
285 if [ -d $OCTAVE_SOURCE/share/doc/octave ]; then | |
286 cat >> $OUTFILE << EOF | |
287 CreateDirectory "\$SMPROGRAMS\\Octave-$VERSION\\Documentation" | |
288 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave C++ Classes (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.pdf" "" "" 0 | |
289 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave C++ Classes (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\liboctave.html\\index.html" "" "" 0 | |
290 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (PDF).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.pdf" "" "" 0 | |
291 CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\Octave (HTML).lnk" "\$INSTDIR\\share\\doc\\octave\\octave.html\\index.html" "" "" 0 | |
292 EOF | |
293 fi | |
294 | |
295 cat >> $OUTFILE << EOF | |
296 | |
297 \${If} \$InstallShortcuts == \${BST_CHECKED} | |
298 SetOutPath "%USERPROFILE%" | |
299 CreateShortCut "\$desktop\\Octave-$VERSION (CLI).lnk" "\$INSTDIR\\octave.vbs" "--no-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED | |
300 CreateShortCut "\$desktop\\Octave-$VERSION (GUI).lnk" "\$INSTDIR\\octave.vbs" "--force-gui" "\$INSTDIR\\$ICON" 0 SW_SHOWMINIMIZED | |
301 \${Endif} | |
302 | |
303 ; BLAS set up | |
304 \${If} \$InstallBlasLib == 1 | |
305 ; Reference BLAS | |
306 CopyFiles /SILENT "\$INSTDIR\\bin\\librefblas.dll" "\$INSTDIR\\bin\\libblas.dll" | |
307 \${Else} | |
308 ; OpenBLAS | |
309 CopyFiles /SILENT "\$INSTDIR\\bin\\libopenblas.dll" "\$INSTDIR\\bin\\libblas.dll" | |
310 \${EndIf} | |
311 | |
312 SectionEnd | |
313 | |
314 Section "FileTypeRego" | |
315 ; Octave document | |
316 WriteRegStr HKCR "Octave.Document.$VERSION" "" "GNU Octave Script" | |
317 WriteRegStr HKCR "Octave.Document.$VERSION\\DefaultIcon" "" "\$INSTDIR\\$ICON" | |
318 ; document actions | |
319 WriteRegStr HKCR "Octave.Document.$VERSION\\shell\\open\\command" "" "wscript \$\\"\$INSTDIR\\octave.vbs\$\\" --force-gui --persist --eval \$\\"edit '%1'\$\\"" | |
320 | |
321 \${If} \$RegisterOctaveFileType == \${BST_CHECKED} | |
322 ReadRegStr \$0 HKCR ".m" "" | |
323 StrCmp "\$0" "" no_back_type | |
324 WriteRegStr HKCR ".m" "backup_val" "\$0" | |
325 no_back_type: | |
326 WriteRegStr HKCR ".m" "" "Octave.Document.$VERSION" | |
327 WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "RegisteredFileType" 1 | |
328 \${EndIf} | |
329 SectionEnd | |
330 | |
331 Section "InstallPackages" | |
332 ; fix the installed packages (if any) | |
333 SetOutPath "\$INSTDIR" | |
334 ExecWait '"\$INSTDIR\\bin\\octave-cli.exe" --no-gui -W -H -f -q --eval "pkg rebuild"' \$0 | |
335 SectionEnd | |
336 | |
337 Section "Uninstall" | |
338 | |
339 ReadRegDWORD \$0 HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "AllUsers" | |
340 IfErrors not_all_users | |
341 | |
342 SetShellVarContext all | |
343 | |
344 not_all_users: | |
345 ReadRegDWORD \$0 HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "RegisteredFileType" | |
346 IfErrors not_registered_file | |
347 | |
348 ReadRegStr \$0 HKCR ".m" "backup_val" | |
349 IfErrors not_backup_file | |
350 | |
351 # retore backup | |
352 WriteRegStr HKCR ".m" "" "\$0" | |
353 | |
354 DeleteRegValue HKCR ".m" "backup_val" | |
355 | |
356 ; dont delete .m if just restored backup | |
357 Goto not_registered_file | |
358 not_backup_file: | |
359 DeleteRegKey HKCR ".m" | |
360 | |
361 not_registered_file: | |
362 ; delete file type | |
363 DeleteRegKey HKCR "Octave.Document.$VERSION" | |
364 | |
365 DeleteRegKey HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" | |
366 DeleteRegKey HKLM "Software\\Octave-$VERSION" | |
367 | |
368 ; Remove shortcuts | |
369 Delete "\$SMPROGRAMS\\Octave-$VERSION\\Documentation\\*.*" | |
370 RMDir "\$SMPROGRAMS\\Octave-$VERSION\\Documentation" | |
371 | |
372 Delete "\$SMPROGRAMS\\Octave-$VERSION\\*.*" | |
373 RMDir "\$SMPROGRAMS\\Octave-$VERSION" | |
374 | |
375 Delete "\$desktop\\Octave-$VERSION (CLI).lnk" | |
376 Delete "\$desktop\\Octave-$VERSION (GUI).lnk" | |
377 | |
378 ; delete generated qt.conf file | |
379 Delete "\$INSTDIR\\bin\\qt.conf" | |
380 EOF | |
381 | |
382 # insert dir list (backwards order) for uninstall files | |
383 for f in $(find $OCTAVE_SOURCE -depth -type d -printf "%P\n"); do | |
384 winf=`echo $f | sed 's,/,\\\\,g'` | |
385 echo " Delete \"\$INSTDIR\\$winf\\*.*\"" >> $OUTFILE | |
386 echo " RmDir \"\$INSTDIR\\$winf\"" >> $OUTFILE | |
387 done | |
388 | |
389 # last bit of the uninstaller | |
390 cat >> $OUTFILE << EOF | |
391 Delete "\$INSTDIR\\*.*" | |
392 RmDir "\$INSTDIR" | |
393 | |
394 ; didnt remove directory ? most likely from not all files removed | |
395 IfErrors 0 uninstall_done | |
396 MessageBox MB_YESNO "One or more folders were not uninstalled because they contain extra files. Try to delete them?" IDNO uninstall_done | |
397 RMDir /r "\$INSTDIR" | |
398 | |
399 IfErrors 0 uninstall_done | |
400 MessageBox MB_YESNO "One of more files were still not uninstalled. Do you want to delete them on the next reboot?" IDNO uninstall_done | |
401 RMDir /r /REBOOTOK "\$INSTDIR" | |
402 uninstall_done: | |
403 | |
404 SectionEnd | |
405 | |
406 ; Function to detect Windows version and abort if Octave is unsupported in the current platform | |
407 Function CheckWinVer | |
408 Push \$0 | |
409 Push \$1 | |
410 | |
411 ReadRegStr \$0 HKLM "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" CurrentVersion | |
412 IfErrors is_error is_winnt | |
413 is_winnt: | |
414 StrCpy \$1 \$0 1 | |
415 StrCmp \$1 4 is_error ; Aborting installation for Windows versions older than Windows 2000 | |
416 StrCmp \$0 "5.0" is_error ; Removing Windows 2000 as supported Windows version | |
417 StrCmp \$0 "5.1" is_winnt_XP | |
418 StrCmp \$0 "5.2" is_winnt_2003 | |
419 StrCmp \$0 "6.0" is_winnt_vista | |
420 StrCmp \$0 "6.1" is_winnt_7 | |
421 StrCmp \$0 "6.2" is_winnt_8 | |
422 StrCmp \$0 "6.3" is_winnt_10 | |
423 StrCmp \$1 6 is_winnt_10 ; Checking for future versions of Windows 10+ | |
424 Goto is_error | |
425 | |
426 is_winnt_10: | |
427 | |
428 MessageBox MB_YESNO|MB_ICONEXCLAMATION "Setup has detected Windows 10 installed on your system. Octave is currently not fully tested on Windows 10. Testers are welcome to provide feedback. Do you want to proceed with the installation anyway?" IDYES done IDNO 0 | |
429 Abort | |
430 is_winnt_XP: | |
431 is_winnt_2003: | |
432 is_winnt_vista: | |
433 is_winnt_7: | |
434 is_winnt_8: | |
435 Goto done | |
436 is_error: | |
437 StrCpy \$1 \$0 | |
438 ReadRegStr \$0 HKLM "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" ProductName | |
439 IfErrors 0 +4 | |
440 ReadRegStr \$0 HKLM "SOFTWARE\\Microsoft\\Windows\\CurrentVersion" Version | |
441 IfErrors 0 +2 | |
442 StrCpy \$0 "Unknown" | |
443 MessageBox MB_ICONSTOP|MB_OK "This version of Octave cannot be installed on this system. Octave is supported only on Windows NT systems. Current system: \$0 (version: \$1)" | |
444 Abort | |
445 done: | |
446 Pop \$1 | |
447 Pop \$0 | |
448 FunctionEnd | |
449 | |
450 ; Function to check whether already installed this version | |
451 Function CheckCurrVersion | |
452 Push \$0 | |
453 ClearErrors | |
454 ReadRegStr \$0 HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION" "DisplayName" | |
455 IfErrors curr_check_ok | |
456 MessageBox MB_OK|MB_ICONSTOP "Another Octave installation (with the same version) has been detected. Please uninstall it first." | |
457 Abort | |
458 curr_check_ok: | |
459 pop \$0 | |
460 FunctionEnd | |
461 | |
462 ; Check whether prev install is here and no spaces in dest name | |
463 Function CheckPrevInstallAndDest | |
464 IfFileExists "\$INSTDIR\\bin\\octave.exe" inst_exists inst_none | |
465 inst_exists: | |
466 MessageBox MB_YESNO|MB_ICONEXCLAMATION "Another Octave installation has been detected at that destination. It is recommended to uninstall it if you intend to use the same installation directory. Do you want to proceed with the installation anyway?" IDYES inst_none IDNO 0 | |
467 Abort | |
468 GoTo inst_end | |
469 inst_none: | |
470 | |
471 | |
472 ; check for spaces in dest filename | |
473 Push \$R0 | |
474 Push \$R1 | |
475 | |
476 StrCpy \$R1 0 # r1 = counter | |
477 space_loop: | |
478 StrCpy \$R0 \$INSTDIR 1 \$R1 # R0 = character in string to check | |
479 StrCmp \$R0 "" space_end # end of string | |
480 StrCmp \$R0 " " space_found | |
481 IntOp \$R1 \$R1 + 1 | |
482 GoTo space_loop | |
483 space_found: | |
484 MessageBox MB_OK|MB_ICONEXCLAMATION "Octave should not be installed to a destination folder containing spaces. Please select another destination." | |
485 Abort | |
486 space_end: | |
487 Pop \$R1 | |
488 Pop \$R0 | |
489 | |
490 inst_end: | |
491 | |
492 FunctionEnd | |
493 | |
494 ; Function to check Java Runtime Environment | |
495 Function CheckJRE | |
496 ; looks in: | |
497 ; 1 - JAVA_HOME environment variable | |
498 ; 2 - the registry | |
499 EOF | |
500 # use 64 bit reg to look for java | |
501 if [ "$ENABLE64" == "yes" ]; then | |
502 echo "SetRegView 64" >> $OUTFILE | |
503 fi | |
504 cat >> $OUTFILE << EOF | |
505 | |
506 Push \$R0 | |
507 Push \$R1 | |
508 | |
509 ; use javaw.exe to avoid dosbox. | |
510 ; use java.exe to keep stdout/stderr | |
511 !define JAVAEXE "javaw.exe" | |
512 | |
513 ClearErrors | |
514 ReadEnvStr \$R0 "JAVA_HOME" | |
515 StrCpy \$R0 "\$R0\\bin\\\${JAVAEXE}" | |
516 IfErrors 0 continue ;; 1) found it in JAVA_HOME | |
517 | |
518 ClearErrors | |
519 ReadRegStr \$R1 HKLM "SOFTWARE\\JavaSoft\\Java Runtime Environment" "CurrentVersion" | |
520 ReadRegStr \$R0 HKLM "SOFTWARE\\JavaSoft\\Java Runtime Environment\\\$R1" "JavaHome" | |
521 StrCpy \$R0 "\$R0\\bin\\\${JAVAEXE}" | |
522 | |
523 IfErrors 0 continue ;; 2) found it in the registry | |
524 IfErrors JRE_Error | |
525 | |
526 JRE_Error: | |
527 MessageBox MB_ICONEXCLAMATION|MB_YESNO "Octave includes a Java integration component, but it seems Java is not available on this system. This component requires the Java Runtime Environment from Oracle (http://www.java.com) installed on your system. Octave can work without Java available, but the Java integration component will not be functional. Installing those components without Java available might prevent Octave from working correctly. Proceed with installation anyway?" IDYES continue | |
528 Abort | |
529 continue: | |
530 Pop \$R1 | |
531 Pop \$R0 | |
532 EOF | |
533 # put reg back to 32 (our version of nsis is a 32 bit app) | |
534 if [ "$ENABLE64" == "yes" ]; then | |
535 echo "SetRegView 32" >> $OUTFILE | |
536 fi | |
537 cat >> $OUTFILE << EOF | |
538 | |
539 FunctionEnd | |
540 EOF |