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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


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

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