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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2216 - (show annotations) (download)
Tue Jul 20 02:13:30 2010 UTC (9 years, 2 months ago) by jpye
File size: 21576 byte(s)
Weird bug on Windows seems to be causing failure with pythonw but not python.exe.
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.8.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 "..\pygtk\_ascpy.pyd"
289 File "..\pygtk\*.py"
290
291 ; GLADE assets
292 SetOutPath $INSTDIR\glade
293 File "..\pygtk\glade\*.glade"
294 File "..\pygtk\glade\*.png"
295 File "..\pygtk\glade\*.svg"
296
297 StrCpy $PYINSTALLED "1"
298 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1
299
300 ; Create 'ascend.bat' batch file for launching the PyGTK GUI.
301 ClearErrors
302 FileOpen $0 $INSTDIR\ascend.bat w
303 ${If} ${Errors}
304 MessageBox MB_OK "The 'ascend.bat' file was not installed properly; problems writing to that file."
305 ${Else}
306 FileWrite $0 "@echo off"
307 FileWriteByte $0 "13"
308 FileWriteByte $0 "10"
309 FileWrite $0 "set PATH=$PATH"
310 FileWriteByte $0 "13"
311 FileWriteByte $0 "10"
312 FileWrite $0 "cd "
313 FileWrite $0 $INSTDIR
314 FileWriteByte $0 "13"
315 FileWriteByte $0 "10"
316 FileWrite $0 "$PYPATH\python "
317 FileWriteByte $0 "34"
318 FileWrite $0 "$INSTDIR\ascend"
319 FileWriteByte $0 "34"
320 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
321 FileWriteByte $0 "13"
322 FileWriteByte $0 "10"
323 FileClose $0
324 ${EndIf}
325
326 ;---- file association ----
327
328 ; back up old value of .a4c file association
329 ReadRegStr $1 HKCR ".a4c" ""
330 StrCmp $1 "" a4cnobkp
331 StrCmp $1 "ASCEND.model" a4cnobkp
332
333 ; Remember the old file association if necessary
334 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1
335
336 a4cnobkp:
337 WriteRegStr HKCR ".a4c" "" "ASCEND.model"
338
339 ; back up old value of .a4c file association
340 ReadRegStr $1 HKCR ".a4l" ""
341 StrCmp $1 "" a4lnobkp
342 StrCmp $1 "ASCEND.model" a4lnobkp
343
344 ; Remember the old file association if necessary
345 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1
346
347 a4lnobkp:
348 WriteRegStr HKCR ".a4l" "" "ASCEND.model"
349
350 ; So, what does an A4L or A4C file actually do?
351
352 ReadRegStr $0 HKCR "ASCEND.model" ""
353 StrCmp $0 "" 0 a4cskip
354
355 WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file"
356 WriteRegStr HKCR "ASCEND.model\shell" "" "open"
357 WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico"
358
359 a4cskip:
360 WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\python.exe "$INSTDIR\ascend" "%1"'
361
362 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
363
364 ${EndIf}
365 Return
366
367 SectionEnd
368
369 ;---------------------------------
370
371 Section "Tcl/Tk GUI" sect_tcltk
372
373 ${If} $TCLOK != 'OK'
374 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)"
375 ${Else}
376 DetailPrint "--- TCL/TK INTERFACE ---"
377 SetOutPath $INSTDIR\tcltk
378 ; FIXME we should be a bit more selective here?
379 File /r /x .svn "..\tcltk\tk\*"
380 SetOutPath $INSTDIR
381 File "..\tcltk\interface\ascendtcl.dll"
382 File "..\tcltk\interface\ascend4.exe"
383
384 StrCpy $TCLINSTALLED "1"
385 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "TclTk" 1
386
387 ${EndIf}
388
389 SectionEnd
390
391 ;---------------------------------
392
393 Section "Documentation" sect_doc
394 SetOutPath $INSTDIR
395 File "..\doc\book.pdf"
396 StrCpy $PDFINSTALLED "1"
397 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1
398 SectionEnd
399
400 ; Optional section (can be disabled by the user)
401 Section "Start Menu Shortcuts" sect_menu
402
403 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1
404
405 CreateDirectory "$SMPROGRAMS\ASCEND"
406
407 ; Link to PyGTK GUI
408 ${If} $PYINSTALLED == "1"
409 CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$PYPATH\python.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0
410 ${EndIf}
411
412 ; Model library shortcut
413 CreateShortCut "$SMPROGRAMS\ASCEND\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0
414
415 ; Link to Tcl/Tk GUI
416 ${If} $TCLINSTALLED == "1"
417 CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0
418 ${EndIf}
419
420 ; Documentation
421 ${If} $PDFINSTALLED == "1"
422 CreateShortCut "$SMPROGRAMS\ASCEND\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0
423 ${EndIf}
424
425 ; Information files
426 CreateShortCut "$SMPROGRAMS\ASCEND\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0
427 CreateShortCut "$SMPROGRAMS\ASCEND\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0
428 CreateShortCut "$SMPROGRAMS\ASCEND\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0
429
430 CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
431
432 SectionEnd
433
434 ;------------------------------------------------------------------
435 ; HEADER FILES for DEVELOPERS
436
437 Section /o "Header files (for developers)" sect_devel
438 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1
439
440 SetOutPath $INSTDIR\include\ascend
441 File /r /x .svn "..\ascend\*.h"
442
443 ; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'.
444 ClearErrors
445 FileOpen $0 $INSTDIR\ascend-config.bat w
446 ${If} ${Errors}
447 MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file."
448 ${Else}
449 FileWrite $0 "@echo off"
450 FileWriteByte $0 "13"
451 FileWriteByte $0 "10"
452 FileWrite $0 "set PATH=$PATH"
453 FileWriteByte $0 "13"
454 FileWriteByte $0 "10"
455 FileWrite $0 "cd "
456 FileWrite $0 $INSTDIR
457 FileWriteByte $0 "13"
458 FileWriteByte $0 "10"
459 FileWrite $0 "$PYPATH\python "
460 FileWriteByte $0 "34"
461 FileWrite $0 "$INSTDIR\ascend-config"
462 FileWriteByte $0 "34"
463 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
464 FileWriteByte $0 "13"
465 FileWriteByte $0 "10"
466 FileClose $0
467 ${EndIf}
468 SetOutPath $INSTDIR
469 SectionEnd
470
471 ;------------------------------------------------------------------
472 ; UNINSTALLER
473
474 Section "Uninstall"
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\*.py
484 Delete $INSTDIR\python\*.pyc
485 Delete $INSTDIR\glade\*.glade
486 Delete $INSTDIR\glade\*.png
487 Delete $INSTDIR\glade\*.svg
488 Delete $INSTDIR\ascend-doc.ico
489 Delete $INSTDIR\ascend
490 Delete $INSTDIR\ascend.bat
491 RmDir $INSTDIR\glade
492 RmDir $INSTDIR\python
493
494 ;--- file association (for Python GUI) ---
495
496 DetailPrint "--- REMOVING FILE ASSOCIATION ---"
497 ;start of restore script
498 ReadRegStr $1 HKCR ".a4c" ""
499 ${If} $1 == "ASCEND.model"
500 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
501 ${If} $1 == ""
502 ; nothing to restore: delete it
503 DeleteRegKey HKCR ".a4c"
504 ${Else}
505 WriteRegStr HKCR ".a4c" "" $1
506 ${EndIf}
507 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
508 ${EndIf}
509
510 ReadRegStr $1 HKCR ".a4l" ""
511 ${If} $1 == "ASCEND.model"
512 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
513 ${If} $1 == ""
514 ; nothing to restore: delete it
515 DeleteRegKey HKCR ".a4l"
516 ${Else}
517 WriteRegStr HKCR ".a4l" "" $1
518 ${EndIf}
519 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
520 ${EndIf}
521
522 DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings
523
524 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
525 ;rest of script
526
527 ${EndIf}
528
529 ;--- tcl/tk components ---
530
531 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
532 ${If} $0 <> 0
533 DetailPrint "--- REMOVING TCL/TK COMPONENTS ---"
534 Delete $INSTDIR\ascendtcl.dll
535 Delete $INSTDIR\ascend4.exe
536 RMDir /r $INSTDIR\tcltk
537 ${EndIf}
538
539 ;--- documentation ---
540
541 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
542 ${If} $0 <> 0
543 DetailPrint "--- REMOVING DOCUMENTATION ---"
544 Delete $INSTDIR\book.pdf
545 ${EndIf}
546
547 ;--- header files ---
548
549 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
550 ${If} $0 <> 0
551 DetailPrint "--- REMOVING HEADER FILES ---"
552 RMDir /r $INSTDIR\include
553 Delete $INSTDIR\ascend-config
554 Delete $INSTDIR\ascend-config.bat
555 ${EndIf}
556
557 ;--- start menu ---
558
559 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
560 ${If} $0 <> 0
561 ; Remove shortcuts, if any
562 DetailPrint "--- REMOVING START MENU SHORTCUTS ---"
563 RmDir /r "$SMPROGRAMS\ASCEND"
564 ${EndIf}
565
566 ;--- common components ---
567
568 DetailPrint "--- REMOVING COMMON COMPONENTS ---"
569 ; Remove registry keys
570
571 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND"
572 DeleteRegKey HKLM "SOFTWARE\ASCEND"
573
574 ; Remove files and uninstaller
575
576 Delete $INSTDIR\ascend.dll
577 Delete $INSTDIR\LICENSE.txt
578 Delete $INSTDIR\README-windows.txt
579 Delete $INSTDIR\CHANGELOG.txt
580 Delete $INSTDIR\ascend.ico
581 Delete $INSTDIR\Makefile.bt
582 Delete $INSTDIR\ascend.syn
583 Delete $INSTDIR\ipopt38.dll
584 RMDir /r $INSTDIR\models
585 Delete $INSTDIR\solvers\qrslv_ascend.dll
586 Delete $INSTDIR\solvers\conopt_ascend.dll
587 Delete $INSTDIR\solvers\lrslv_ascend.dll
588 Delete $INSTDIR\solvers\cmslv_ascend.dll
589 Delete $INSTDIR\solvers\lsode_ascend.dll
590 Delete $INSTDIR\solvers\ida_ascend.dll
591 Delete $INSTDIR\solvers\dopri5_ascend.dll
592 Delete $INSTDIR\solvers\ipopt_ascend.dll
593 RMDir $INSTDIR\solvers
594
595 ; Remove directories used
596
597 Delete $INSTDIR\uninstall.exe
598 RMDir $INSTDIR
599
600 SectionEnd
601
602 !include "dependencies.nsi"
603
604 !include "detect.nsi"
605
606 !include "ascendini.nsi"
607
608 Function .onInit
609 StrCpy $PYINSTALLED ""
610 StrCpy $TCLINSTALLED ""
611 StrCpy $ASCENDINIFOUND ""
612 StrCpy $PDFINSTALLED ""
613
614 ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32"
615
616 Call DetectPython
617 Pop $PYOK
618 Pop $PYPATH
619
620 Call DetectGTK
621 Pop $GTKOK
622 Pop $GTKPATH
623
624 Call DetectGlade
625 Pop $GLADEOK
626 Pop $GLADEPATH
627
628 Call DetectTcl
629 Pop $TCLOK
630 Pop $TCLPATH
631
632 Call DetectPyGTK
633 Pop $PYGTKOK
634
635 Call DetectPyGObject
636 Pop $PYGOBJECTOK
637
638 Call DetectPyCairo
639 Pop $PYCAIROOK
640
641 StrCpy $PATH "$DEFAULTPATH;$PYPATH;$GTKPATH"
642
643 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
644 ${If} $0 != ""
645 ;MessageBox MB_OK "Previous installation detected..."
646 ; If user previous deselected Tcl/Tk, then deselect it by
647 ; default now, i.e don't force the user to install it.
648 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
649 ${If} $0 = 0
650 ;MessageBox MB_OK "Tcl/Tk was previously deselected"
651 SectionGetFlags "${sect_tcltk}" $1
652 IntOp $1 $1 ^ ${SF_SELECTED}
653 SectionSetFlags "${sect_tcltk}" $1
654 ${Else}
655 ; If previously installed, force it to stay installed;
656 ; the only way to uninstall a component is via complete
657 ; uninstall.
658 SectionGetFlags "${sect_tcltk}" $1
659 IntOp $1 $1 ^ ${SF_RO}
660 SectionSetFlags "${sect_tcltk}" $1
661 ${EndIf}
662
663 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
664 ${If} $0 = 0
665 ;MessageBox MB_OK "Python was previously deselected"
666 SectionGetFlags "${sect_pygtk}" $1
667 IntOp $1 $1 ^ ${SF_SELECTED}
668 SectionSetFlags "${sect_pygtk}" $1
669 ${Else}
670 SectionGetFlags "${sect_pygtk}" $1
671 IntOp $1 $1 ^ ${SF_RO}
672 SectionSetFlags "${sect_pygtk}" $1
673 ${EndIf}
674
675 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
676 ${If} $0 = 0
677 ;MessageBox MB_OK "Documentation was previously deselected"
678 SectionGetFlags "${sect_doc}" $1
679 IntOp $1 $1 ^ ${SF_SELECTED}
680 SectionSetFlags "${sect_doc}" $1
681 ${Else}
682 SectionGetFlags "${sect_doc}" $1
683 IntOp $1 $1 ^ ${SF_RO}
684 SectionSetFlags "${sect_doc}" $1
685 ${EndIf}
686
687 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
688 ${If} $0 = 0
689 ;MessageBox MB_OK "Start Menu was previously deselected"
690 SectionGetFlags "${sect_menu}" $1
691 IntOp $1 $1 ^ ${SF_SELECTED}
692 SectionSetFlags "${sect_menu}" $1
693 ${Else}
694 SectionGetFlags "${sect_menu}" $1
695 IntOp $1 $1 ^ ${SF_RO}
696 SectionSetFlags "${sect_menu}" $1
697 ${EndIf}
698
699 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
700 ${If} $0 <> 0
701 ;MessageBox MB_OK "Header files were previously selected"
702 SectionGetFlags "${sect_devel}" $1
703 IntOp $1 $1 | ${SF_SELECTED}
704 IntOp $1 $1 | ${SF_RO}
705 SectionSetFlags "${sect_devel}" $1
706 ${EndIf}
707 ${EndIf}
708
709 FunctionEnd

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