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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2447 - (show annotations) (download)
Mon Apr 4 06:04:20 2011 UTC (13 years, 3 months ago) by jpye
File size: 21308 byte(s)
Don't install Tcl/Tk GUI by default.
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
383 SectionEnd
384
385 ;---------------------------------
386
387 Section "Documentation" sect_doc
388 SetOutPath $INSTDIR
389 File "..\doc\book.pdf"
390 StrCpy $PDFINSTALLED "1"
391 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1
392 SectionEnd
393
394 ; Optional section (can be disabled by the user)
395 Section "Start Menu Shortcuts" sect_menu
396
397 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1
398
399 CreateDirectory "$SMPROGRAMS\ASCEND"
400
401 ; Link to PyGTK GUI
402 ${If} $PYINSTALLED == "1"
403 CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0
404 ${EndIf}
405
406 ; Model library shortcut
407 CreateShortCut "$SMPROGRAMS\ASCEND\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0
408
409 ; Link to Tcl/Tk GUI
410 ${If} $TCLINSTALLED == "1"
411 CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0
412 ${EndIf}
413
414 ; Documentation
415 ${If} $PDFINSTALLED == "1"
416 CreateShortCut "$SMPROGRAMS\ASCEND\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0
417 ${EndIf}
418
419 ; Information files
420 CreateShortCut "$SMPROGRAMS\ASCEND\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0
421 CreateShortCut "$SMPROGRAMS\ASCEND\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0
422 CreateShortCut "$SMPROGRAMS\ASCEND\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0
423
424 CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
425
426 SectionEnd
427
428 ;------------------------------------------------------------------
429 ; HEADER FILES for DEVELOPERS
430
431 Section /o "Header files (for developers)" sect_devel
432 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1
433
434 SetOutPath $INSTDIR\include\ascend
435 File /r /x .svn "..\ascend\*.h"
436
437 ; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'.
438 ClearErrors
439 FileOpen $0 $INSTDIR\ascend-config.bat w
440 ${If} ${Errors}
441 MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file."
442 ${Else}
443 FileWrite $0 "@echo off"
444 FileWriteByte $0 "13"
445 FileWriteByte $0 "10"
446 FileWrite $0 "set PATH=$PATH"
447 FileWriteByte $0 "13"
448 FileWriteByte $0 "10"
449 FileWrite $0 "cd "
450 FileWrite $0 $INSTDIR
451 FileWriteByte $0 "13"
452 FileWriteByte $0 "10"
453 FileWrite $0 "$PYPATH\python "
454 FileWriteByte $0 "34"
455 FileWrite $0 "$INSTDIR\ascend-config"
456 FileWriteByte $0 "34"
457 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
458 FileWriteByte $0 "13"
459 FileWriteByte $0 "10"
460 FileClose $0
461 ${EndIf}
462 SetOutPath $INSTDIR
463 SectionEnd
464
465 ;------------------------------------------------------------------
466 ; UNINSTALLER
467
468 Section "Uninstall"
469
470 ;--- python components ---
471
472 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
473 ${If} $0 <> 0
474
475 DetailPrint "--- REMOVING PYTHON COMPONENTS ---"
476 Delete $INSTDIR\python\_ascpy.pyd
477 Delete $INSTDIR\python\_fprops.pyd
478 Delete $INSTDIR\python\*.py
479 Delete $INSTDIR\python\*.pyc
480 Delete $INSTDIR\glade\*.glade
481 Delete $INSTDIR\glade\*.png
482 Delete $INSTDIR\glade\*.svg
483 Delete $INSTDIR\ascend-doc.ico
484 Delete $INSTDIR\ascend
485 Delete $INSTDIR\ascend.bat
486 RmDir $INSTDIR\glade
487 RmDir $INSTDIR\python
488
489 ;--- file association (for Python GUI) ---
490
491 DetailPrint "--- REMOVING FILE ASSOCIATION ---"
492 ;start of restore script
493 ReadRegStr $1 HKCR ".a4c" ""
494 ${If} $1 == "ASCEND.model"
495 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
496 ${If} $1 == ""
497 ; nothing to restore: delete it
498 DeleteRegKey HKCR ".a4c"
499 ${Else}
500 WriteRegStr HKCR ".a4c" "" $1
501 ${EndIf}
502 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
503 ${EndIf}
504
505 ReadRegStr $1 HKCR ".a4l" ""
506 ${If} $1 == "ASCEND.model"
507 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
508 ${If} $1 == ""
509 ; nothing to restore: delete it
510 DeleteRegKey HKCR ".a4l"
511 ${Else}
512 WriteRegStr HKCR ".a4l" "" $1
513 ${EndIf}
514 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
515 ${EndIf}
516
517 DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings
518
519 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
520 ;rest of script
521
522 ${EndIf}
523
524 ;--- tcl/tk components ---
525
526 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
527 ${If} $0 <> 0
528 DetailPrint "--- REMOVING TCL/TK COMPONENTS ---"
529 Delete $INSTDIR\ascendtcl.dll
530 Delete $INSTDIR\ascend4.exe
531 RMDir /r $INSTDIR\tcltk
532 ${EndIf}
533
534 ;--- documentation ---
535
536 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
537 ${If} $0 <> 0
538 DetailPrint "--- REMOVING DOCUMENTATION ---"
539 Delete $INSTDIR\book.pdf
540 ${EndIf}
541
542 ;--- header files ---
543
544 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
545 ${If} $0 <> 0
546 DetailPrint "--- REMOVING HEADER FILES ---"
547 RMDir /r $INSTDIR\include
548 ${EndIf}
549
550 ;--- start menu ---
551
552 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
553 ${If} $0 <> 0
554 ; Remove shortcuts, if any
555 DetailPrint "--- REMOVING START MENU SHORTCUTS ---"
556 RmDir /r "$SMPROGRAMS\ASCEND"
557 ${EndIf}
558
559 ;--- common components ---
560
561 DetailPrint "--- REMOVING COMMON COMPONENTS ---"
562 ; Remove registry keys
563
564 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND"
565 DeleteRegKey HKLM "SOFTWARE\ASCEND"
566
567 ; Remove files and uninstaller
568
569 Delete $INSTDIR\ascend-config
570 Delete $INSTDIR\ascend-config.bat
571 Delete $INSTDIR\ascend.dll
572 Delete $INSTDIR\LICENSE.txt
573 Delete $INSTDIR\README-windows.txt
574 Delete $INSTDIR\CHANGELOG.txt
575 Delete $INSTDIR\ascend.ico
576 Delete $INSTDIR\Makefile.bt
577 Delete $INSTDIR\ascend.syn
578 Delete $INSTDIR\ipopt39.dll
579 RMDir /r $INSTDIR\models
580 Delete $INSTDIR\solvers\qrslv_ascend.dll
581 Delete $INSTDIR\solvers\conopt_ascend.dll
582 Delete $INSTDIR\solvers\lrslv_ascend.dll
583 Delete $INSTDIR\solvers\cmslv_ascend.dll
584 Delete $INSTDIR\solvers\lsode_ascend.dll
585 Delete $INSTDIR\solvers\ida_ascend.dll
586 Delete $INSTDIR\solvers\dopri5_ascend.dll
587 Delete $INSTDIR\solvers\ipopt_ascend.dll
588 RMDir $INSTDIR\solvers
589
590 ; Remove directories used
591
592 Delete $INSTDIR\uninstall.exe
593 RMDir $INSTDIR
594
595 SectionEnd
596
597 !include "dependencies.nsi"
598
599 !include "detect.nsi"
600
601 !include "ascendini.nsi"
602
603 !include "envvarwarning.nsi"
604
605 Function .onInit
606 StrCpy $PYINSTALLED ""
607 StrCpy $TCLINSTALLED ""
608 StrCpy $ASCENDINIFOUND ""
609 StrCpy $PDFINSTALLED ""
610 StrCpy $ASCENDENVVARFOUND ""
611
612 ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32"
613
614 Call DetectPython
615 Pop $PYOK
616 Pop $PYPATH
617
618 Call DetectGTK
619 Pop $GTKOK
620 Pop $GTKPATH
621
622 Call DetectGlade
623 Pop $GLADEOK
624 Pop $GLADEPATH
625
626 Call DetectTcl
627 Pop $TCLOK
628 Pop $TCLPATH
629
630 Call DetectPyGTK
631 Pop $PYGTKOK
632
633 Call DetectPyGObject
634 Pop $PYGOBJECTOK
635
636 Call DetectPyCairo
637 Pop $PYCAIROOK
638
639 StrCpy $PATH "$DEFAULTPATH;$PYPATH;$GTKPATH"
640
641 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
642 ${If} $0 != ""
643 ;MessageBox MB_OK "Previous installation detected..."
644 ; If user previous deselected Tcl/Tk, then deselect it by
645 ; default now, i.e don't force the user to install it.
646 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
647 ${If} $0 = 0
648 ;MessageBox MB_OK "Tcl/Tk was previously deselected"
649 SectionGetFlags "${sect_tcltk}" $1
650 IntOp $1 $1 ^ ${SF_SELECTED}
651 SectionSetFlags "${sect_tcltk}" $1
652 ${Else}
653 ; If previously installed, force it to stay installed;
654 ; the only way to uninstall a component is via complete
655 ; uninstall.
656 SectionGetFlags "${sect_tcltk}" $1
657 IntOp $1 $1 ^ ${SF_RO}
658 SectionSetFlags "${sect_tcltk}" $1
659 ${EndIf}
660
661 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
662 ${If} $0 = 0
663 ;MessageBox MB_OK "Python was previously deselected"
664 SectionGetFlags "${sect_pygtk}" $1
665 IntOp $1 $1 ^ ${SF_SELECTED}
666 SectionSetFlags "${sect_pygtk}" $1
667 ${Else}
668 SectionGetFlags "${sect_pygtk}" $1
669 IntOp $1 $1 ^ ${SF_RO}
670 SectionSetFlags "${sect_pygtk}" $1
671 ${EndIf}
672
673 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
674 ${If} $0 = 0
675 ;MessageBox MB_OK "Documentation was previously deselected"
676 SectionGetFlags "${sect_doc}" $1
677 IntOp $1 $1 ^ ${SF_SELECTED}
678 SectionSetFlags "${sect_doc}" $1
679 ${Else}
680 SectionGetFlags "${sect_doc}" $1
681 IntOp $1 $1 ^ ${SF_RO}
682 SectionSetFlags "${sect_doc}" $1
683 ${EndIf}
684
685 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
686 ${If} $0 = 0
687 ;MessageBox MB_OK "Start Menu was previously deselected"
688 SectionGetFlags "${sect_menu}" $1
689 IntOp $1 $1 ^ ${SF_SELECTED}
690 SectionSetFlags "${sect_menu}" $1
691 ${Else}
692 SectionGetFlags "${sect_menu}" $1
693 IntOp $1 $1 ^ ${SF_RO}
694 SectionSetFlags "${sect_menu}" $1
695 ${EndIf}
696
697 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
698 ${If} $0 <> 0
699 ;MessageBox MB_OK "Header files were previously selected"
700 SectionGetFlags "${sect_devel}" $1
701 IntOp $1 $1 | ${SF_SELECTED}
702 IntOp $1 $1 | ${SF_RO}
703 SectionSetFlags "${sect_devel}" $1
704 ${EndIf}
705 ${EndIf}
706
707 FunctionEnd

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