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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


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

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