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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2094 - (show annotations) (download)
Sat Nov 28 02:26:22 2009 UTC (14 years, 7 months ago) by jpye
File size: 21448 byte(s)
Changes made for 0.9.7 (?) release against latest GTK, PyGTK.
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.4.15"
119 !define TCL_PATCH ".0.280619"
120 !define TCL_FN "ActiveTcl${TCL_VERSION}${TCL_PATCH}-win32-ix86-threaded.exe"
121 !define TCL_URL "http://downloads.activestate.com/ActiveTcl/Windows/${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
205 ; Model Library
206 SetOutPath $INSTDIR\models
207 File /r /x .svn "..\models\*.a4*"
208 File /r /x .svn "..\models\*.tcl"
209 File /r /x .svn "..\models\*_ascend.dll" ; extension modules
210 File /r /x .svn "..\models\*.py"; python modules
211
212 SetOutPath $INSTDIR\solvers
213 File "..\solvers\qrslv\qrslv_ascend.dll"
214 File "..\solvers\conopt\conopt_ascend.dll"
215 File "..\solvers\lrslv\lrslv_ascend.dll"
216 File "..\solvers\cmslv\cmslv_ascend.dll"
217 File "..\solvers\lsode\lsode_ascend.dll"
218 File "..\solvers\ida\ida_ascend.dll"
219 File "..\solvers\dopri5\dopri5_ascend.dll"
220
221 SetOutPath $INSTDIR
222 ;File "Makefile.bt"
223 File "..\tools\textpad\ascend.syn"
224
225 ${If} ${FileExists} "$APPDATA\.ascend.ini"
226 StrCpy $ASCENDINIFOUND "1"
227 ${Else}
228 ; Set 'librarypath' in .ascend.ini
229 WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models"
230 ${EndIf}
231
232 ; Write the installation path into the registry
233 WriteRegStr HKLM SOFTWARE\ASCEND "Install_Dir" "$INSTDIR"
234
235 ; Write the uninstall keys for Windows
236 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "DisplayName" "ASCEND Simulation Environment"
237 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "UninstallString" '"$INSTDIR\uninstall.exe"'
238 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoModify" 1
239 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoRepair" 1
240 WriteUninstaller "uninstall.exe"
241
242 ; Write file locations to the registry for access from ascend-config
243 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_LIB" "$INSTDIR"
244 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_BIN" "$INSTDIR"
245 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_INCLUDE" "$INSTDIR\include"
246 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_ASCDATA" "$INSTDIR"
247 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_MODELS" "$INSTDIR\models"
248 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_SOLVERS" "$INSTDIR\solvers"
249 WriteRegStr HKLM SOFTWARE\ASCEND "GTKLIBS" "$GTKPATH"
250
251 ; Write default values of ASCENDLIBRARY and ASCENDSOLVERS (user can override with env vars)
252 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDLIBRARY" "$INSTDIR\models"
253 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDSOLVERS" "$INSTDIR\solvers"
254
255 Return
256 SectionEnd
257
258 ;--------------------------------
259
260 Section "PyGTK GUI" sect_pygtk
261 ; Check the dependencies of the PyGTK GUI before proceding...
262 ${If} $PYOK == 'NOK'
263 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)"
264 ${ElseIf} $GTKOK == 'NOK'
265 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)"
266 ${ElseIf} $GLADEOK == 'NOK'
267 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."
268 ${ElseIf} $PYGTKOK == "NOK"
269 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)"
270 ${ElseIf} $PYCAIROOK == "NOK"
271 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)"
272 ${ElseIf} $PYGOBJECTOK == "NOK"
273 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)"
274 ${Else}
275 ;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH"
276
277 DetailPrint "--- PYTHON INTERFACE ---"
278
279 ; File icon
280 SetOutPath $INSTDIR
281 File "..\pygtk\glade\ascend-doc.ico"
282 File "..\pygtk\ascend"
283
284 ; Python interface
285 SetOutPath $INSTDIR\python
286 File "..\pygtk\_ascpy.pyd"
287 File "..\pygtk\*.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\python\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 "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
387 SectionEnd
388
389 ;---------------------------------
390
391 Section "Documentation" sect_doc
392 SetOutPath $INSTDIR
393 File "..\doc\book.pdf"
394 StrCpy $PDFINSTALLED "1"
395 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1
396 SectionEnd
397
398 ; Optional section (can be disabled by the user)
399 Section "Start Menu Shortcuts" sect_menu
400
401 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1
402
403 CreateDirectory "$SMPROGRAMS\ASCEND"
404
405 ; Link to PyGTK GUI
406 ${If} $PYINSTALLED == "1"
407 CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0
408 ${EndIf}
409
410 ; Model library shortcut
411 CreateShortCut "$SMPROGRAMS\ASCEND\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0
412
413 ; Link to Tcl/Tk GUI
414 ${If} $TCLINSTALLED == "1"
415 CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0
416 ${EndIf}
417
418 ; Documentation
419 ${If} $PDFINSTALLED == "1"
420 CreateShortCut "$SMPROGRAMS\ASCEND\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0
421 ${EndIf}
422
423 ; Information files
424 CreateShortCut "$SMPROGRAMS\ASCEND\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0
425 CreateShortCut "$SMPROGRAMS\ASCEND\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0
426 CreateShortCut "$SMPROGRAMS\ASCEND\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0
427
428 CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
429
430 SectionEnd
431
432 ;------------------------------------------------------------------
433 ; HEADER FILES for DEVELOPERS
434
435 Section /o "Header files (for developers)" sect_devel
436 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1
437
438 SetOutPath $INSTDIR\include\ascend
439 File /r /x .svn "..\ascend\*.h"
440
441 ; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'.
442 ClearErrors
443 FileOpen $0 $INSTDIR\ascend-config.bat w
444 ${If} ${Errors}
445 MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file."
446 ${Else}
447 FileWrite $0 "@echo off"
448 FileWriteByte $0 "13"
449 FileWriteByte $0 "10"
450 FileWrite $0 "set PATH=$PATH"
451 FileWriteByte $0 "13"
452 FileWriteByte $0 "10"
453 FileWrite $0 "cd "
454 FileWrite $0 $INSTDIR
455 FileWriteByte $0 "13"
456 FileWriteByte $0 "10"
457 FileWrite $0 "$PYPATH\python "
458 FileWriteByte $0 "34"
459 FileWrite $0 "$INSTDIR\ascend-config"
460 FileWriteByte $0 "34"
461 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
462 FileWriteByte $0 "13"
463 FileWriteByte $0 "10"
464 FileClose $0
465 ${EndIf}
466 SetOutPath $INSTDIR
467 SectionEnd
468
469 ;------------------------------------------------------------------
470 ; UNINSTALLER
471
472 Section "Uninstall"
473
474 ;--- python components ---
475
476 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
477 ${If} $0 <> 0
478
479 DetailPrint "--- REMOVING PYTHON COMPONENTS ---"
480 Delete $INSTDIR\python\_ascpy.pyd
481 Delete $INSTDIR\python\*.py
482 Delete $INSTDIR\python\*.pyc
483 Delete $INSTDIR\glade\*.glade
484 Delete $INSTDIR\glade\*.png
485 Delete $INSTDIR\glade\*.svg
486 Delete $INSTDIR\ascend-doc.ico
487 Delete $INSTDIR\ascend
488 Delete $INSTDIR\ascend.bat
489 RmDir $INSTDIR\glade
490 RmDir $INSTDIR\python
491
492 ;--- file association (for Python GUI) ---
493
494 DetailPrint "--- REMOVING FILE ASSOCIATION ---"
495 ;start of restore script
496 ReadRegStr $1 HKCR ".a4c" ""
497 ${If} $1 == "ASCEND.model"
498 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
499 ${If} $1 == ""
500 ; nothing to restore: delete it
501 DeleteRegKey HKCR ".a4c"
502 ${Else}
503 WriteRegStr HKCR ".a4c" "" $1
504 ${EndIf}
505 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
506 ${EndIf}
507
508 ReadRegStr $1 HKCR ".a4l" ""
509 ${If} $1 == "ASCEND.model"
510 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
511 ${If} $1 == ""
512 ; nothing to restore: delete it
513 DeleteRegKey HKCR ".a4l"
514 ${Else}
515 WriteRegStr HKCR ".a4l" "" $1
516 ${EndIf}
517 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
518 ${EndIf}
519
520 DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings
521
522 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
523 ;rest of script
524
525 ${EndIf}
526
527 ;--- tcl/tk components ---
528
529 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
530 ${If} $0 <> 0
531 DetailPrint "--- REMOVING TCL/TK COMPONENTS ---"
532 Delete $INSTDIR\ascendtcl.dll
533 Delete $INSTDIR\ascend4.exe
534 RMDir /r $INSTDIR\tcltk
535 ${EndIf}
536
537 ;--- documentation ---
538
539 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
540 ${If} $0 <> 0
541 DetailPrint "--- REMOVING DOCUMENTATION ---"
542 Delete $INSTDIR\book.pdf
543 ${EndIf}
544
545 ;--- header files ---
546
547 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
548 ${If} $0 <> 0
549 DetailPrint "--- REMOVING HEADER FILES ---"
550 RMDir /r $INSTDIR\include
551 Delete $INSTDIR\ascend-config
552 Delete $INSTDIR\ascend-config.bat
553 ${EndIf}
554
555 ;--- start menu ---
556
557 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
558 ${If} $0 <> 0
559 ; Remove shortcuts, if any
560 DetailPrint "--- REMOVING START MENU SHORTCUTS ---"
561 RmDir /r "$SMPROGRAMS\ASCEND"
562 ${EndIf}
563
564 ;--- common components ---
565
566 DetailPrint "--- REMOVING COMMON COMPONENTS ---"
567 ; Remove registry keys
568
569 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND"
570 DeleteRegKey HKLM "SOFTWARE\ASCEND"
571
572 ; Remove files and uninstaller
573
574 Delete $INSTDIR\ascend.dll
575 Delete $INSTDIR\LICENSE.txt
576 Delete $INSTDIR\README-windows.txt
577 Delete $INSTDIR\CHANGELOG.txt
578 Delete $INSTDIR\ascend.ico
579 Delete $INSTDIR\Makefile.bt
580 Delete $INSTDIR\ascend.syn
581 RMDir /r $INSTDIR\models
582 Delete $INSTDIR\solvers\qrslv_ascend.dll
583 Delete $INSTDIR\solvers\conopt_ascend.dll
584 Delete $INSTDIR\solvers\lrslv_ascend.dll
585 Delete $INSTDIR\solvers\cmslv_ascend.dll
586 Delete $INSTDIR\solvers\lsode_ascend.dll
587 Delete $INSTDIR\solvers\ida_ascend.dll
588 Delete $INSTDIR\solvers\dopri5_ascend.dll
589 RMDir $INSTDIR\solvers
590
591 ; Remove directories used
592
593 Delete $INSTDIR\uninstall.exe
594 RMDir $INSTDIR
595
596 SectionEnd
597
598 !include "dependencies.nsi"
599
600 !include "detect.nsi"
601
602 !include "ascendini.nsi"
603
604 Function .onInit
605 StrCpy $PYINSTALLED ""
606 StrCpy $TCLINSTALLED ""
607 StrCpy $ASCENDINIFOUND ""
608 StrCpy $PDFINSTALLED ""
609
610 ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32"
611
612 Call DetectPython
613 Pop $PYOK
614 Pop $PYPATH
615
616 Call DetectGTK
617 Pop $GTKOK
618 Pop $GTKPATH
619
620 Call DetectGlade
621 Pop $GLADEOK
622 Pop $GLADEPATH
623
624 Call DetectTcl
625 Pop $TCLOK
626 Pop $TCLPATH
627
628 Call DetectPyGTK
629 Pop $PYGTKOK
630
631 Call DetectPyGObject
632 Pop $PYGOBJECTOK
633
634 Call DetectPyCairo
635 Pop $PYCAIROOK
636
637 StrCpy $PATH "$DEFAULTPATH;$PYPATH;$GTKPATH"
638
639 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
640 ${If} $0 != ""
641 ;MessageBox MB_OK "Previous installation detected..."
642 ; If user previous deselected Tcl/Tk, then deselect it by
643 ; default now, i.e don't force the user to install it.
644 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
645 ${If} $0 = 0
646 ;MessageBox MB_OK "Tcl/Tk was previously deselected"
647 SectionGetFlags "${sect_tcltk}" $1
648 IntOp $1 $1 ^ ${SF_SELECTED}
649 SectionSetFlags "${sect_tcltk}" $1
650 ${Else}
651 ; If previously installed, force it to stay installed;
652 ; the only way to uninstall a component is via complete
653 ; uninstall.
654 SectionGetFlags "${sect_tcltk}" $1
655 IntOp $1 $1 ^ ${SF_RO}
656 SectionSetFlags "${sect_tcltk}" $1
657 ${EndIf}
658
659 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
660 ${If} $0 = 0
661 ;MessageBox MB_OK "Python was previously deselected"
662 SectionGetFlags "${sect_pygtk}" $1
663 IntOp $1 $1 ^ ${SF_SELECTED}
664 SectionSetFlags "${sect_pygtk}" $1
665 ${Else}
666 SectionGetFlags "${sect_pygtk}" $1
667 IntOp $1 $1 ^ ${SF_RO}
668 SectionSetFlags "${sect_pygtk}" $1
669 ${EndIf}
670
671 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
672 ${If} $0 = 0
673 ;MessageBox MB_OK "Documentation was previously deselected"
674 SectionGetFlags "${sect_doc}" $1
675 IntOp $1 $1 ^ ${SF_SELECTED}
676 SectionSetFlags "${sect_doc}" $1
677 ${Else}
678 SectionGetFlags "${sect_doc}" $1
679 IntOp $1 $1 ^ ${SF_RO}
680 SectionSetFlags "${sect_doc}" $1
681 ${EndIf}
682
683 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
684 ${If} $0 = 0
685 ;MessageBox MB_OK "Start Menu was previously deselected"
686 SectionGetFlags "${sect_menu}" $1
687 IntOp $1 $1 ^ ${SF_SELECTED}
688 SectionSetFlags "${sect_menu}" $1
689 ${Else}
690 SectionGetFlags "${sect_menu}" $1
691 IntOp $1 $1 ^ ${SF_RO}
692 SectionSetFlags "${sect_menu}" $1
693 ${EndIf}
694
695 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
696 ${If} $0 <> 0
697 ;MessageBox MB_OK "Header files were previously selected"
698 SectionGetFlags "${sect_devel}" $1
699 IntOp $1 $1 | ${SF_SELECTED}
700 IntOp $1 $1 | ${SF_RO}
701 SectionSetFlags "${sect_devel}" $1
702 ${EndIf}
703 ${EndIf}
704
705 FunctionEnd

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