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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


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

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