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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


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

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