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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


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

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