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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


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

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