/[ascend]/trunk/nsis/installer.nsi
ViewVC logotype

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2571 - (show annotations) (download)
Wed Feb 15 17:45:47 2012 UTC (5 years, 9 months ago) by jpye
File size: 21435 byte(s)
require outfile
1 ; NSIS script to create an ASCEND binary installer for Windows
2 ; by John Pye, 2006-2012.
3 ;
4 ;--------------------------------
5
6 ; The name of the installer
7
8 !ifndef VERSION
9 !define VERSION 0.svn
10 !endif
11
12 Name "ASCEND ${VERSION}"
13
14 ;SetCompressor /SOLID zlib
15 ;SetCompressor /FINAL zlib
16 SetCompressor /SOLID lzma
17
18 !include LogicLib.nsh
19 !include nsDialogs.nsh
20 !include x64.nsh
21
22 !ifndef PYVERSION
23 !define PYVERSION "2.7"
24 !endif
25
26 !ifndef PYPATCH
27 !define PYPATCH ".1"
28 !endif
29
30 !ifndef INST64
31 !define INST64 1
32 !endif
33
34 ; The file to write
35 OutFile ${OUTFILE}
36
37 ; The default installation directory
38 !if ${INST64}
39 InstallDir $PROGRAMFILES64\ASCEND
40 !else
41 InstallDir $PROGRAMFILES32\ASCEND
42 !endif
43
44 ; Registry key to check for directory (so if you install again, it will
45 ; overwrite the old one automatically)
46 InstallDirRegKey HKLM "Software\ASCEND" "Install_Dir"
47
48 RequestExecutionLevel admin
49
50 ;--------------------------------
51
52 ; Pages
53
54 Page license
55 LicenseData "..\LICENSE.txt"
56
57 Page components
58 Page directory
59 Page custom dependenciesCreate dependenciesLeave
60 Page instfiles
61 Page custom ascendIniCreate ascendIniLeave
62 Page custom ascendEnvVarCreate ascendEnvVarLeave
63
64 UninstPage uninstConfirm
65 UninstPage instfiles
66
67 ;--------------------------------
68
69 !define GTKSEARCHPATH "c:\GTK"
70
71 Var /GLOBAL DEFAULTPATH
72 Var /GLOBAL PYOK
73 Var /GLOBAL PYPATH
74 Var /GLOBAL GTKOK
75 Var /GLOBAL GTKPATH
76 Var /GLOBAL PYGTKOK
77 Var /GLOBAL PYGOBJECTOK
78 Var /GLOBAL PYCAIROOK
79 Var /GLOBAL PYINSTALLED
80 ;Var /GLOBAL TCLOK
81 ;Var /GLOBAL TCLPATH
82 ;Var /GLOBAL TCLINSTALLED
83
84 Var /GLOBAL PDFINSTALLED
85
86 Var /GLOBAL PATH
87
88 Var /GLOBAL PYDOWNLOAD
89 Var /GLOBAL GTKDOWNLOAD
90 ;Var /GLOBAL TCLDOWNLOAD
91
92 Var /GLOBAL ASCENDINIFOUND
93 Var /GLOBAL ASCENDENVVARFOUND
94 Var /GLOBAL ASCENDLIBRARY
95
96 ; .onInit has been moved to after section decls so that they can be references
97
98 ;------------------------------------------------------------
99 ; DOWNLOAD AND INSTALL DEPENDENCIES FIRST
100
101 !define PYTHON_VERSION "${PYVERSION}${PYPATCH}${PYARCH}"
102 !define PYTHON_FN "python-${PYTHON_VERSION}.msi"
103 !define PYTHON_URL "http://python.org/ftp/python/${PYTHON_VERSION}/${PYTHON_FN}"
104 !define PYTHON_CMD "msiexec /i $DAI_TMPFILE /passive ALLUSERS=1 TARGETDIR=c:\Python${PYVERSION}"
105 !define PYTHON_MD5 "a69ce1b2d870be29befd1cefb4615d82"
106
107 !define GTK_VER "2.22"
108 !define GTK_PATCH ".6"
109 !define GTK_FN "pygtk-all-in-one-${GTK_VER}${GTK_PATCH}.win32-py${PYVERSION}.msi"
110 !define GTK_URL "http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.22/${GTK_FN}"
111 !define GTK_CMD "msiexec /i $DAI_TMPFILE TARGETDIR=c:\Python${PYVERSION} INSTALLLEVEL=1 ALLUSERS=1 /passive"
112 !define GTK_MD5 "75cfe879a13ae99d5b19fee4f1597bb5"
113 ; FIXME shouldn't need to specify TARGETDIR here...
114
115 ; passive install of pygtk 2.22.6 doesn't seem to work.
116
117 ;!define TCL_VERSION "8.5.9.2"
118 ;!define TCL_PATCH ".294317"
119 ;!define TCL_FN "ActiveTcl${TCL_VERSION}${TCL_PATCH}-win32-ix86-threaded.exe"
120 ;!define TCL_URL "http://downloads.activestate.com/ActiveTcl/releases/${TCL_VERSION}/${TCL_FN}"
121 ;!define TCL_CMD "$DAI_TMPFILE"
122 ;!define TCL_MD5 "15d6b17d38e66a83956dc16b7d80fc59"
123
124 !include "download.nsi"
125
126 Section "-python"
127 DetailPrint "--- DOWNLOAD PYTHON ---"
128 ${If} $PYDOWNLOAD == '1'
129 !insertmacro downloadAndInstall "Python" "${PYTHON_URL}" "${PYTHON_FN}" "${PYTHON_CMD}" "${PYTHON_MD5}"
130 Call DetectPython
131 Pop $PYOK
132 Pop $PYPATH
133 ${If} $PYOK == 'NOK'
134 MessageBox MB_OK "Python installation appears to have failed"
135 ${EndIf}
136 ${EndIf}
137 SectionEnd
138 ; FIXME need to go back to using separate GTK, PyGTK, PyGObject, PyCairo installers :-(
139 Section "-gtk"
140 DetailPrint "--- DOWNLOAD PYGTK ---"
141 ${If} $GTKDOWNLOAD == '1'
142 !insertmacro downloadAndInstall "PyGTK All-in-one" "${GTK_URL}" "${GTK_FN}" "${GTK_CMD}" "${GTK_MD5}"
143 Call DetectGTK
144 Pop $GTKOK
145 Pop $GTKPATH
146
147 ; Call DetectTcl
148 ; Pop $TCLOK
149 ; Pop $TCLPATH
150
151 Call DetectPyGTK
152 Pop $PYGTKOK
153
154 Call DetectPyGObject
155 Pop $PYGOBJECTOK
156
157 Call DetectPyCairo
158 Pop $PYCAIROOK
159 ${EndIf}
160 SectionEnd
161 ;Section "-tcl"
162 ; DetailPrint "--- DOWNLOAD TCL/TK ---"
163 ; ${If} $TCLDOWNLOAD == '1'
164 ; !insertmacro downloadAndInstall "Tcl/Tk" "${TCL_URL}" "${TCL_FN}" "${TCL_CMD}" "${TCL_MD5}"
165 ; Call DetectTcl
166 ; Pop $TCLOK
167 ; Pop $TCLPATH
168 ; ${EndIf}
169 ;SectionEnd
170
171 ;------------------------------------------------------------------------
172 ; INSTALL CORE STUFF including model library
173
174 ; The stuff to install
175 Section "ASCEND (required)"
176 SectionIn RO
177
178 DetailPrint "--- COMMON FILES ---"
179
180 ; Set output path to the installation directory.
181 SetOutPath $INSTDIR
182 File "..\ascend.dll"
183 File "..\ascend-config"
184 File "..\pygtk\glade\ascend.ico"
185 File "..\LICENSE.txt"
186 File "..\CHANGELOG.txt"
187 File "..\README-windows.txt"
188 ${IPOPTDLL_LINE}
189 ${IPOPTDLL_LINE2}
190
191 ; Model Library
192 SetOutPath $INSTDIR\models
193 File /r /x .svn "..\models\*.a4*"
194 File /r /x .svn "..\models\*.tcl"
195 File /r /x .svn "..\models\*_ascend.dll" ; extension modules
196 File /r /x .svn "..\models\*.py"; python modules
197
198 SetOutPath $INSTDIR\solvers
199 File "..\solvers\qrslv\qrslv_ascend.dll"
200 File "..\solvers\conopt\conopt_ascend.dll"
201 File "..\solvers\lrslv\lrslv_ascend.dll"
202 File "..\solvers\cmslv\cmslv_ascend.dll"
203 File "..\solvers\lsode\lsode_ascend.dll"
204 File "..\solvers\ida\ida_ascend.dll"
205 File "..\solvers\dopri5\dopri5_ascend.dll"
206 File "..\solvers\ipopt\ipopt_ascend.dll"
207
208 SetOutPath $INSTDIR
209 ;File "Makefile.bt"
210 File "..\tools\textpad\ascend.syn"
211
212 ; Check for pre-existing .ascend.ini for current user (warn after installation, if so)
213 ${If} ${FileExists} "$APPDATA\.ascend.ini"
214 StrCpy $ASCENDINIFOUND "1"
215 ${Else}
216 ; Set 'librarypath' in .ascend.ini
217 WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models"
218 ${EndIf}
219
220 ; Check for ASCENDLIBRARY environment variable for current user
221 ExpandEnvStrings $ASCENDLIBRARY "%ASCENDLIBRARY%"
222 ${IfNot} $ASCENDLIBRARY == "%ASCENDLIBRARY%"
223 StrCpy $ASCENDENVVARFOUND "1"
224 ${EndIf}
225
226 ; Write the installation path into the registry
227 WriteRegStr HKLM SOFTWARE\ASCEND "Install_Dir" "$INSTDIR"
228
229 ; Write the uninstall keys for Windows
230 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "DisplayName" "ASCEND Simulation Environment"
231 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "UninstallString" '"$INSTDIR\uninstall.exe"'
232 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoModify" 1
233 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoRepair" 1
234 WriteUninstaller "uninstall.exe"
235
236 ; Write file locations to the registry for access from ascend-config
237 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_LIB" "$INSTDIR"
238 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_BIN" "$INSTDIR"
239 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_INCLUDE" "$INSTDIR\include"
240 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_ASCDATA" "$INSTDIR"
241 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_MODELS" "$INSTDIR\models"
242 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_SOLVERS" "$INSTDIR\solvers"
243 WriteRegStr HKLM SOFTWARE\ASCEND "GTKLIBS" "$GTKPATH"
244
245 ; Write default values of ASCENDLIBRARY and ASCENDSOLVERS (user can override with env vars)
246 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDLIBRARY" "$INSTDIR\models"
247 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDSOLVERS" "$INSTDIR\solvers"
248
249 Return
250 SectionEnd
251
252 ;--------------------------------
253
254 Section "PyGTK GUI" sect_pygtk
255 !if ${INST64}
256 SetRegView 64
257 !endif
258 ; Check the dependencies of the PyGTK GUI before proceding...
259 ${If} $PYOK == 'NOK'
260 MessageBox MB_OK "PyGTK GUI can not be installed, because Python was not found on this system.$\nIf you do want to use the PyGTK GUI, please check the installation instructions$\n$\n(PYPATH=$PYPATH)"
261 ${ElseIf} $GTKOK == 'NOK'
262 MessageBox MB_OK "PyGTK GUI cannot be installed, because GTK+ 2.x was not found on this system.$\nIf you do want to use the PyGTK GUI, please check the installation instructions$\n$\n(GTKPATH=$GTKPATH)"
263 ${ElseIf} $PYGTKOK == "NOK"
264 MessageBox MB_OK "PyGTK GUI cannot be installed, because PyGTK was not found on this system.$\nPlease check the installation instructions.$\n$\n(PYPATH=$PYPATH)"
265 ${ElseIf} $PYCAIROOK == "NOK"
266 MessageBox MB_OK "PyGTK GUI cannot be installed, because PyCairo was not found on this system.$\nPlease check the installation instructions.$\n$\n(PYPATH=$PYPATH)"
267 ${ElseIf} $PYGOBJECTOK == "NOK"
268 MessageBox MB_OK "PyGTK GUI cannot be installed, because PyGObject was not found on this system.$\nPlease check the installation instructions.$\n$\n(PYPATH=$PYPATH)"
269 ${Else}
270 ;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH"
271
272 DetailPrint "--- PYTHON INTERFACE ---"
273
274 ; File icon
275 SetOutPath $INSTDIR
276 File "..\pygtk\glade\ascend-doc.ico"
277 File "..\pygtk\ascend"
278
279 ; Python interface
280 SetOutPath $INSTDIR\python
281 File "..\ascxx\_ascpy.pyd"
282 File "..\ascxx\ascpy.py"
283 File "..\pygtk\*.py"
284
285 ; FPROPS: python bindings
286 File "..\models\johnpye\fprops\python\_fprops.pyd"
287 File "..\models\johnpye\fprops\python\*.py"
288
289 ; GLADE assets
290 SetOutPath $INSTDIR\glade
291 File "..\pygtk\glade\*.glade"
292 File "..\pygtk\glade\*.png"
293 File "..\pygtk\glade\*.svg"
294
295 StrCpy $PYINSTALLED "1"
296 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1
297
298 ; Create 'ascend.bat' batch file for launching the PyGTK GUI.
299 ClearErrors
300 FileOpen $0 $INSTDIR\ascend.bat w
301 ${If} ${Errors}
302 MessageBox MB_OK "The 'ascend.bat' file was not installed properly; problems writing to that file."
303 ${Else}
304 FileWrite $0 "@echo off"
305 FileWriteByte $0 "13"
306 FileWriteByte $0 "10"
307 FileWrite $0 "set PATH=$PATH"
308 FileWriteByte $0 "13"
309 FileWriteByte $0 "10"
310 FileWrite $0 "cd "
311 FileWrite $0 $INSTDIR
312 FileWriteByte $0 "13"
313 FileWriteByte $0 "10"
314 FileWrite $0 "$PYPATH\python "
315 FileWriteByte $0 "34"
316 FileWrite $0 "$INSTDIR\ascend"
317 FileWriteByte $0 "34"
318 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
319 FileWriteByte $0 "13"
320 FileWriteByte $0 "10"
321 FileClose $0
322 ${EndIf}
323
324 ;---- file association ----
325
326 ; back up old value of .a4c file association
327 ReadRegStr $1 HKCR ".a4c" ""
328 StrCmp $1 "" a4cnobkp
329 StrCmp $1 "ASCEND.model" a4cnobkp
330
331 ; Remember the old file association if necessary
332 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1
333
334 a4cnobkp:
335 WriteRegStr HKCR ".a4c" "" "ASCEND.model"
336
337 ; back up old value of .a4c file association
338 ReadRegStr $1 HKCR ".a4l" ""
339 StrCmp $1 "" a4lnobkp
340 StrCmp $1 "ASCEND.model" a4lnobkp
341
342 ; Remember the old file association if necessary
343 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1
344
345 a4lnobkp:
346 WriteRegStr HKCR ".a4l" "" "ASCEND.model"
347
348 ; So, what does an A4L or A4C file actually do?
349
350 ReadRegStr $0 HKCR "ASCEND.model" ""
351 StrCmp $0 "" 0 a4cskip
352
353 WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file"
354 WriteRegStr HKCR "ASCEND.model\shell" "" "open"
355 WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico"
356
357 a4cskip:
358 WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw.exe "$INSTDIR\ascend" "%1"'
359
360 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
361
362 ${EndIf}
363 Return
364
365 SectionEnd
366
367 ;---------------------------------
368
369 ;Section /o "Tcl/Tk GUI" sect_tcltk
370 ;
371 ; ${If} $TCLOK != 'OK'
372 ; MessageBox MB_OK "Tck/Tk GUI can not be installed, because ActiveTcl was not found on this system. If do you want to use the Tcl/Tk GUI, please check the installation instructions ($TCLPATH)"
373 ; ${Else}
374 ; DetailPrint "--- TCL/TK INTERFACE ---"
375 ; SetOutPath $INSTDIR\tcltk
376 ; ; FIXME we should be a bit more selective here?
377 ; File /r /x .svn "..\tcltk\tk\*"
378 ; SetOutPath $INSTDIR
379 ; File "..\tcltk\interface\ascendtcl.dll"
380 ; File "..\tcltk\interface\ascend4.exe"
381 ;
382 ; StrCpy $TCLINSTALLED "1"
383 ; WriteRegDWORD HKLM "SOFTWARE\ASCEND" "TclTk" 1
384 ;
385 ; ${EndIf}
386 ;SectionEnd
387
388 ;---------------------------------
389
390 Section "Documentation" sect_doc
391 SetOutPath $INSTDIR
392 File "..\doc\book.pdf"
393 StrCpy $PDFINSTALLED "1"
394 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1
395 SectionEnd
396
397 ; Optional section (can be disabled by the user)
398 Section "Start Menu Shortcuts" sect_menu
399
400 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1
401
402 CreateDirectory "$SMPROGRAMS\ASCEND"
403
404 ; Link to PyGTK GUI
405 ${If} $PYINSTALLED == "1"
406 CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0
407 ${EndIf}
408
409 ; Model library shortcut
410 CreateShortCut "$SMPROGRAMS\ASCEND\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0
411
412 ; ; Link to Tcl/Tk GUI
413 ; ${If} $TCLINSTALLED == "1"
414 ; CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0
415 ; ${EndIf}
416
417 ; Documentation
418 ${If} $PDFINSTALLED == "1"
419 CreateShortCut "$SMPROGRAMS\ASCEND\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0
420 ${EndIf}
421
422 ; Information files
423 CreateShortCut "$SMPROGRAMS\ASCEND\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0
424 CreateShortCut "$SMPROGRAMS\ASCEND\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0
425 CreateShortCut "$SMPROGRAMS\ASCEND\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0
426
427 CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
428
429 SectionEnd
430
431 ;------------------------------------------------------------------
432 ; HEADER FILES for DEVELOPERS
433
434 Section /o "Header files (for developers)" sect_devel
435 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1
436
437 SetOutPath $INSTDIR\include\ascend
438 File /r /x .svn "..\ascend\*.h"
439
440 ; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'.
441 ClearErrors
442 FileOpen $0 $INSTDIR\ascend-config.bat w
443 ${If} ${Errors}
444 MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file."
445 ${Else}
446 FileWrite $0 "@echo off"
447 FileWriteByte $0 "13"
448 FileWriteByte $0 "10"
449 FileWrite $0 "set PATH=$PATH"
450 FileWriteByte $0 "13"
451 FileWriteByte $0 "10"
452 FileWrite $0 "cd "
453 FileWrite $0 $INSTDIR
454 FileWriteByte $0 "13"
455 FileWriteByte $0 "10"
456 FileWrite $0 "$PYPATH\python "
457 FileWriteByte $0 "34"
458 FileWrite $0 "$INSTDIR\ascend-config"
459 FileWriteByte $0 "34"
460 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
461 FileWriteByte $0 "13"
462 FileWriteByte $0 "10"
463 FileClose $0
464 ${EndIf}
465 SetOutPath $INSTDIR
466 SectionEnd
467
468 ;------------------------------------------------------------------
469 ; UNINSTALLER
470
471 Section "Uninstall"
472 !if ${INST64}
473 SetRegView 64
474 !endif
475
476 ;--- python components ---
477
478 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
479 ${If} $0 <> 0
480
481 DetailPrint "--- REMOVING PYTHON COMPONENTS ---"
482 Delete $INSTDIR\python\_ascpy.pyd
483 Delete $INSTDIR\python\_fprops.pyd
484 Delete $INSTDIR\python\*.py
485 Delete $INSTDIR\python\*.pyc
486 Delete $INSTDIR\glade\*.glade
487 Delete $INSTDIR\glade\*.png
488 Delete $INSTDIR\glade\*.svg
489 Delete $INSTDIR\ascend-doc.ico
490 Delete $INSTDIR\ascend
491 Delete $INSTDIR\ascend.bat
492 RmDir $INSTDIR\glade
493 RmDir $INSTDIR\python
494
495 ;--- file association (for Python GUI) ---
496
497 DetailPrint "--- REMOVING FILE ASSOCIATION ---"
498 ;start of restore script
499 ReadRegStr $1 HKCR ".a4c" ""
500 ${If} $1 == "ASCEND.model"
501 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
502 ${If} $1 == ""
503 ; nothing to restore: delete it
504 DeleteRegKey HKCR ".a4c"
505 ${Else}
506 WriteRegStr HKCR ".a4c" "" $1
507 ${EndIf}
508 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
509 ${EndIf}
510
511 ReadRegStr $1 HKCR ".a4l" ""
512 ${If} $1 == "ASCEND.model"
513 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
514 ${If} $1 == ""
515 ; nothing to restore: delete it
516 DeleteRegKey HKCR ".a4l"
517 ${Else}
518 WriteRegStr HKCR ".a4l" "" $1
519 ${EndIf}
520 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
521 ${EndIf}
522
523 DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings
524
525 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
526 ;rest of script
527
528 ${EndIf}
529
530 ;--- tcl/tk components ---
531
532 ; ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
533 ; ${If} $0 <> 0
534 ; DetailPrint "--- REMOVING TCL/TK COMPONENTS ---"
535 ; Delete $INSTDIR\ascendtcl.dll
536 ; Delete $INSTDIR\ascend4.exe
537 ; RMDir /r $INSTDIR\tcltk
538 ; ${EndIf}
539
540 ;--- documentation ---
541
542 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
543 ${If} $0 <> 0
544 DetailPrint "--- REMOVING DOCUMENTATION ---"
545 Delete $INSTDIR\book.pdf
546 ${EndIf}
547
548 ;--- header files ---
549
550 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
551 ${If} $0 <> 0
552 DetailPrint "--- REMOVING HEADER FILES ---"
553 RMDir /r $INSTDIR\include
554 ${EndIf}
555
556 ;--- start menu ---
557
558 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
559 ${If} $0 <> 0
560 ; Remove shortcuts, if any
561 DetailPrint "--- REMOVING START MENU SHORTCUTS ---"
562 RmDir /r "$SMPROGRAMS\ASCEND"
563 ${EndIf}
564
565 ;--- common components ---
566
567 DetailPrint "--- REMOVING COMMON COMPONENTS ---"
568 ; Remove registry keys
569
570 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND"
571 DeleteRegKey HKLM "SOFTWARE\ASCEND"
572
573 ; Remove files and uninstaller
574
575 Delete $INSTDIR\ascend-config
576 Delete $INSTDIR\ascend-config.bat
577 Delete $INSTDIR\ascend.dll
578 Delete $INSTDIR\LICENSE.txt
579 Delete $INSTDIR\README-windows.txt
580 Delete $INSTDIR\CHANGELOG.txt
581 Delete $INSTDIR\ascend.ico
582 Delete $INSTDIR\Makefile.bt
583 Delete $INSTDIR\ascend.syn
584 Delete $INSTDIR\ipopt38.dll
585 RMDir /r $INSTDIR\models
586 Delete $INSTDIR\solvers\qrslv_ascend.dll
587 Delete $INSTDIR\solvers\conopt_ascend.dll
588 Delete $INSTDIR\solvers\lrslv_ascend.dll
589 Delete $INSTDIR\solvers\cmslv_ascend.dll
590 Delete $INSTDIR\solvers\lsode_ascend.dll
591 Delete $INSTDIR\solvers\ida_ascend.dll
592 Delete $INSTDIR\solvers\dopri5_ascend.dll
593 Delete $INSTDIR\solvers\ipopt_ascend.dll
594 RMDir $INSTDIR\solvers
595
596 ; Remove directories used
597
598 Delete $INSTDIR\uninstall.exe
599 RMDir $INSTDIR
600
601 SectionEnd
602
603 !include "dependencies.nsi"
604
605 !include "detect.nsi"
606
607 !include "ascendini.nsi"
608
609 !include "envvarwarning.nsi"
610
611 Function .onInit
612 !if ${INST64}
613 ${If} ${RunningX64}
614 ${Else}
615 MessageBox MB_OK "This ASCEND installer is for 64-bit Windows versions only.\n\nVisit http://ascend4.org for 32-bit versions."
616 ${EndIf}
617 SetRegView 64
618 !endif
619
620 StrCpy $PYINSTALLED ""
621 ; StrCpy $TCLINSTALLED ""
622 StrCpy $ASCENDINIFOUND ""
623 StrCpy $PDFINSTALLED ""
624 StrCpy $ASCENDENVVARFOUND ""
625
626 ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32"
627
628 Call DetectPython
629 Pop $PYOK
630 Pop $PYPATH
631
632 Call DetectGTK
633 Pop $GTKOK
634 Pop $GTKPATH
635
636 ; Call DetectTcl
637 ; Pop $TCLOK
638 ; Pop $TCLPATH
639
640 Call DetectPyGTK
641 Pop $PYGTKOK
642
643 Call DetectPyGObject
644 Pop $PYGOBJECTOK
645
646 Call DetectPyCairo
647 Pop $PYCAIROOK
648
649 MessageBox MB_OK "GTK path is $GTKPATH"
650 StrCpy $PATH "$GTKPATH;$DEFAULTPATH;$PYPATH"
651
652 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
653 ${If} $0 != ""
654 ;MessageBox MB_OK "Previous installation detected..."
655 ; If user previous deselected Tcl/Tk, then deselect it by
656 ; default now, i.e don't force the user to install it.
657
658 ; ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
659 ; ${If} $0 = 0
660 ; ;MessageBox MB_OK "Tcl/Tk was previously deselected"
661 ; SectionGetFlags "${sect_tcltk}" $1
662 ; IntOp $1 $1 ^ ${SF_SELECTED}
663 ; SectionSetFlags "${sect_tcltk}" $1
664 ; ${Else}
665 ; ; If previously installed, force it to stay installed;
666 ; ; the only way to uninstall a component is via complete
667 ; ; uninstall.
668 ; SectionGetFlags "${sect_tcltk}" $1
669 ; IntOp $1 $1 ^ ${SF_RO}
670 ; SectionSetFlags "${sect_tcltk}" $1
671 ; ${EndIf}
672
673 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
674 ${If} $0 = 0
675 ;MessageBox MB_OK "Python was previously deselected"
676 SectionGetFlags "${sect_pygtk}" $1
677 IntOp $1 $1 ^ ${SF_SELECTED}
678 SectionSetFlags "${sect_pygtk}" $1
679 ${Else}
680 SectionGetFlags "${sect_pygtk}" $1
681 IntOp $1 $1 ^ ${SF_RO}
682 SectionSetFlags "${sect_pygtk}" $1
683 ${EndIf}
684
685 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
686 ${If} $0 = 0
687 ;MessageBox MB_OK "Documentation was previously deselected"
688 SectionGetFlags "${sect_doc}" $1
689 IntOp $1 $1 ^ ${SF_SELECTED}
690 SectionSetFlags "${sect_doc}" $1
691 ${Else}
692 SectionGetFlags "${sect_doc}" $1
693 IntOp $1 $1 ^ ${SF_RO}
694 SectionSetFlags "${sect_doc}" $1
695 ${EndIf}
696
697 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
698 ${If} $0 = 0
699 ;MessageBox MB_OK "Start Menu was previously deselected"
700 SectionGetFlags "${sect_menu}" $1
701 IntOp $1 $1 ^ ${SF_SELECTED}
702 SectionSetFlags "${sect_menu}" $1
703 ${Else}
704 SectionGetFlags "${sect_menu}" $1
705 IntOp $1 $1 ^ ${SF_RO}
706 SectionSetFlags "${sect_menu}" $1
707 ${EndIf}
708
709 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
710 ${If} $0 <> 0
711 ;MessageBox MB_OK "Header files were previously selected"
712 SectionGetFlags "${sect_devel}" $1
713 IntOp $1 $1 | ${SF_SELECTED}
714 IntOp $1 $1 | ${SF_RO}
715 SectionSetFlags "${sect_devel}" $1
716 ${EndIf}
717 ${EndIf}
718
719 FunctionEnd

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22