/[ascend]/branches/adrian/nsis/installer.nsi
ViewVC logotype

Contents of /branches/adrian/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2884 - (show annotations) (download)
Wed Apr 1 10:57:31 2015 UTC (7 years, 6 months ago) by adrian
File size: 22091 byte(s)
creating branch 'adrian' as a copy of the 'pallav' branch, current head revision
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 Name "ASCEND ${VERSION}"
9
10 ;SetCompressor /FINAL zlib
11 SetCompressor /SOLID lzma
12
13 !include LogicLib.nsh
14 !include nsDialogs.nsh
15 !include x64.nsh
16
17 ; The file to write
18 OutFile ${OUTFILE}
19
20 !if "${INSTARCH}" == "x64"
21 !define INST64
22 !endif
23
24 ; The default installation directory
25 !ifdef INST64
26 InstallDir $PROGRAMFILES64\ASCEND
27 !define SMNAME "ASCEND (64-bit)"
28 !else
29 InstallDir $PROGRAMFILES32\ASCEND
30 !define SMNAME "ASCEND"
31 !endif
32
33 ; NOTE we *don't* user InstallDirRegKey because it doesn't work correctly on Win64.
34 ;InstallDirRegKey HKLM "Software\ASCEND" "Install_Dir"
35
36 RequestExecutionLevel admin
37
38 ;--------------------------------
39
40 ; Pages
41
42 Page license
43 LicenseData "..\LICENSE.txt"
44
45 Page components
46 Page directory
47 Page custom dependenciesCreate dependenciesLeave
48 Page instfiles
49 Page custom ascendIniCreate ascendIniLeave
50 Page custom ascendEnvVarCreate ascendEnvVarLeave
51
52 UninstPage uninstConfirm
53 UninstPage instfiles
54
55 ;--------------------------------
56
57 !define GTKSEARCHPATH "c:\GTK"
58
59 Var DEFAULTPATH
60 Var HAVE_PYTHON
61 Var PYPATH
62 Var HAVE_GTK
63 Var GTKPATH
64 Var HAVE_PYGTK
65 Var HAVE_PYGOBJECT
66 Var HAVE_PYCAIRO
67 Var PYINSTALLED
68
69 Var PDFINSTALLED
70
71 Var PATH
72
73 Var NEED_PYTHON
74 Var NEED_GTK
75 Var NEED_PYGTK
76 Var NEED_PYCAIRO
77 Var NEED_PYGOBJECT
78
79 Var ASCENDINIFOUND
80 Var ASCENDENVVARFOUND
81 Var ASCENDLIBRARY
82
83 Var PYTHONTARGETDIR
84
85 ; .onInit has been moved to after section decls so that they can be references
86
87 ;------------------------------------------------------------
88 ; DOWNLOAD AND INSTALL DEPENDENCIES FIRST
89
90 ; Use the official python.org Python packages
91 !define PYTHON_VERSION "${PYVERSION}${PYPATCH}"
92 !define PYTHON_FN "python-${PYTHON_VERSION}${PYARCH}.msi"
93 !define PYTHON_URL "http://python.org/ftp/python/${PYTHON_VERSION}/${PYTHON_FN}"
94 !define PYTHON_CMD "msiexec /i $DAI_TMPFILE /passive ALLUSERS=1 TARGETDIR=$PYTHONTARGETDIR"
95
96 !define THIRDPARTY_DIR "http://downloads.sourceforge.net/project/ascend-sim/thirdparty/"
97 !define GTK_VER "2.22"
98
99 !ifdef INST64
100 !define WINXX "win64"
101 !define AMDXX ".win-amd64"
102 !define NNBIT "64-bit"
103 !define X64I386 "x64"
104 !define GTK_PATCH ".1-20101229"
105 !else
106 !define WINXX "win32"
107 !define AMDXX ".win32"
108 !define X64I386 "i386"
109 !define NNBIT "32-bit"
110 !define GTK_PATCH ".1-20101227"
111 !endif
112
113 ; Host our own GTK bundles, repackaged as installers.
114 ; User should still be able to use the ftp.gnome.org zip files, we just can't easily install them from here.
115 ; Also, but having GTK installer, we can store the installation location in the registry (and have both 64 and 32 bit versions)
116 !define GTK_FN "gtk+-${GTK_VER}${GTK_PATCH}-${X64I386}-a4.exe"
117 !define GTK_URL "${THIRDPARTY_DIR}${GTK_FN}"
118 !define GTK_MFT "gtk+-bundle_${GTK_VER}${GTK_PATCH}_${WINXX}.mft"
119 !define GTK_CMD "$DAI_TMPFILE /S"
120
121 ; We will host the PyGTK, PyGObject and PyCairo dependencies on SF.net ourselves... for the moment.
122 ; Note that PyGTK version should match GTK+ version.
123 !define PYGTK_PATCH ".0"
124 !define PYCAIRO_VER "1.10.0"
125 !define PYGOBJECT_VER "2.28.6"
126 !define PYGTK_FN "pygtk-${GTK_VER}${PYGTK_PATCH}${AMDXX}-py${PYVERSION}.exe"
127 !define PYCAIRO_FN "py2cairo-${PYCAIRO_VER}${AMDXX}-py${PYVERSION}.exe"
128 !define PYGOBJECT_FN "pygobject-${PYGOBJECT_VER}${AMDXX}-py${PYVERSION}.exe"
129 !define PYGTK_URL "${THIRDPARTY_DIR}${PYGTK_FN}"
130 !define PYCAIRO_URL "${THIRDPARTY_DIR}${PYCAIRO_FN}"
131 !define PYGOBJECT_URL "${THIRDPARTY_DIR}${PYGOBJECT_FN}"
132 !define PYGTK_CMD "$DAI_TMPFILE"
133 !define PYCAIRO_CMD "$DAI_TMPFILE"
134 !define PYGOBJECT_CMD "$DAI_TMPFILE"
135
136 !include "download.nsi"
137
138 Section "-python"
139 DetailPrint "--- DOWNLOAD PYTHON ---"
140 ${If} $NEED_PYTHON == '1'
141 !insertmacro downloadAndInstall "Python" "${PYTHON_URL}" "${PYTHON_FN}" "${PYTHON_CMD}"
142 Call DetectPython
143 ${If} $HAVE_PYTHON == 'NOK'
144 MessageBox MB_OK "Python installation appears to have failed. You may need to retry manually."
145 ${EndIf}
146 ${EndIf}
147 SectionEnd
148
149 Section "-gtk"
150 DetailPrint "--- DOWNLOAD GTK ---"
151 ${If} $NEED_GTK == '1'
152 !insertmacro downloadAndInstall "GTK" "${GTK_URL}" "${GTK_FN}" "${GTK_CMD}"
153 Call DetectGTK
154 ${If} $HAVE_GTK == 'NOK'
155 MessageBox MB_OK "GTK installation appears to have failed. You may need to retry manually."
156 ${EndIf}
157 ${EndIf}
158 SectionEnd
159
160 Section "-pygtk"
161 DetailPrint "--- DOWNLOAD PYGTK ---"
162 ${If} $NEED_PYGTK == '1'
163 !insertmacro downloadAndInstall "PyGTK" "${PYGTK_URL}" "${PYGTK_FN}" "${PYGTK_CMD}"
164 Call DetectPyGTK
165 ${If} $HAVE_PYGTK == 'NOK'
166 MessageBox MB_OK "PyGTK installation appears to have failed. You may need to retry manually"
167 ${EndIf}
168 ${EndIf}
169 SectionEnd
170
171 Section "-pycairo"
172 DetailPrint "--- DOWNLOAD PYCAIRO ---"
173 ${If} $NEED_PYCAIRO == '1'
174 !insertmacro downloadAndInstall "PyCAIRO" "${PYCAIRO_URL}" "${PYCAIRO_FN}" "${PYCAIRO_CMD}"
175 Call DetectPyCairo
176 ${If} $HAVE_PYCAIRO == 'NOK'
177 MessageBox MB_OK "PyCairo installation appears to have failed. You may need to retry manually."
178 ${EndIf}
179 ${EndIf}
180 SectionEnd
181
182 Section "-pygobject"
183 DetailPrint "--- DOWNLOAD PYGOBJECT ---"
184 ${If} $NEED_PYGOBJECT == '1'
185 !insertmacro downloadAndInstall "PyGObject" "${PYGOBJECT_URL}" "${PYGOBJECT_FN}" "${PYGOBJECT_CMD}"
186 Call DetectPyGObject
187 ${If} $HAVE_PYGOBJECT == 'NOK'
188 MessageBox MB_OK "PyGObject installation appears to have failed. You may need to retry manually."
189 ${EndIf}
190 ${EndIf}
191 SectionEnd
192
193 ;------------------------------------------------------------------------
194 ; INSTALL CORE STUFF including model library
195
196 ; The stuff to install
197 Section "ASCEND (required)"
198 SectionIn RO
199
200 DetailPrint "--- COMMON FILES ---"
201
202 ; Set output path to the installation directory.
203 SetOutPath $INSTDIR
204 File "..\ascend.dll"
205 File "..\ascend-config"
206 File "..\pygtk\glade\ascend.ico"
207 File "..\LICENSE.txt"
208 File "..\CHANGELOG.txt"
209 File "..\README-windows.txt"
210 ${FILE_IPOPT_1}
211 ${FILE_IPOPT_2}
212 ${FILE_IPOPT_3}
213 ${FILE_IPOPT_4}
214 ${FILE_IPOPT_5}
215
216 ; Model Library
217 SetOutPath $INSTDIR\models
218 File /r /x .svn "..\models\*.a4*"
219 File /r /x .svn "..\models\*.tcl"
220 File /r /x .svn "..\models\*_ascend.dll" ; extension modules
221 File /r /x .svn "..\models\*.py"; python modules
222
223 SetOutPath $INSTDIR\solvers
224 File "..\solvers\qrslv\qrslv_ascend.dll"
225 File "..\solvers\conopt\conopt_ascend.dll"
226 File "..\solvers\lrslv\lrslv_ascend.dll"
227 File "..\solvers\cmslv\cmslv_ascend.dll"
228 File "..\solvers\lsode\lsode_ascend.dll"
229 File "..\solvers\ida\ida_ascend.dll"
230 File "..\solvers\dopri5\dopri5_ascend.dll"
231 File "..\solvers\ipopt\ipopt_ascend.dll"
232
233 SetOutPath $INSTDIR
234 ;File "Makefile.bt"
235 File "..\tools\textpad\ascend.syn"
236
237 ; Check for pre-existing .ascend.ini for current user (warn after installation, if so)
238 ${If} ${FileExists} "$APPDATA\.ascend.ini"
239 StrCpy $ASCENDINIFOUND "1"
240 ${Else}
241 ; Set 'librarypath' in .ascend.ini
242 WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models"
243 ${EndIf}
244
245 ; Check for ASCENDLIBRARY environment variable for current user
246 ExpandEnvStrings $ASCENDLIBRARY "%ASCENDLIBRARY%"
247 ${IfNot} $ASCENDLIBRARY == "%ASCENDLIBRARY%"
248 StrCpy $ASCENDENVVARFOUND "1"
249 ${EndIf}
250
251 ; Write the installation path into the registry
252 WriteRegStr HKLM SOFTWARE\ASCEND "Install_Dir" "$INSTDIR"
253
254 ; Write the uninstall keys for Windows
255 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "DisplayName" "ASCEND Simulation Environment"
256 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "UninstallString" '"$INSTDIR\uninstall.exe"'
257 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoModify" 1
258 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoRepair" 1
259 WriteUninstaller "uninstall.exe"
260
261 ; Write file locations to the registry for access from ascend-config
262 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_LIB" "$INSTDIR"
263 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_BIN" "$INSTDIR"
264 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_INCLUDE" "$INSTDIR\include"
265 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_ASCDATA" "$INSTDIR"
266 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_MODELS" "$INSTDIR\models"
267 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_SOLVERS" "$INSTDIR\solvers"
268 WriteRegStr HKLM SOFTWARE\ASCEND "GTKLIBS" "$GTKPATH"
269
270 ; Write default values of ASCENDLIBRARY and ASCENDSOLVERS (user can override with env vars)
271 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDLIBRARY" "$INSTDIR\models"
272 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDSOLVERS" "$INSTDIR\solvers"
273
274 Return
275 SectionEnd
276
277 ;--------------------------------
278
279 Section "PyGTK GUI" sect_pygtk
280 !ifdef INST64
281 SetRegView 64
282 !endif
283 ; Check the dependencies of the PyGTK GUI before proceding...
284 ${If} $HAVE_PYTHON == 'NOK'
285 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)"
286 ${ElseIf} $HAVE_GTK == 'NOK'
287 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)"
288 ${ElseIf} $HAVE_PYGTK == "NOK"
289 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)"
290 ${ElseIf} $HAVE_PYCAIRO == "NOK"
291 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)"
292 ${ElseIf} $HAVE_PYGOBJECT == "NOK"
293 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)"
294 ${Else}
295 ;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH"
296
297 DetailPrint "--- PYTHON INTERFACE ---"
298
299 ; File icon
300 SetOutPath $INSTDIR
301 File "..\pygtk\glade\ascend-doc.ico"
302 File "..\pygtk\ascend"
303
304 ; Python interface
305 SetOutPath $INSTDIR\python
306 File "..\ascxx\_ascpy.pyd"
307 File "..\ascxx\ascpy.py"
308 File "..\pygtk\*.py"
309
310 ; FPROPS: python bindings
311 File "..\models\johnpye\fprops\python\_fprops.pyd"
312 File "..\models\johnpye\fprops\python\*.py"
313
314 ; GLADE assets
315 SetOutPath $INSTDIR\glade
316 File "..\pygtk\glade\*.glade"
317 File "..\pygtk\glade\*.png"
318 File "..\pygtk\glade\*.svg"
319
320 StrCpy $PYINSTALLED "1"
321 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1
322
323 ; Create 'ascend.bat' batch file for launching the PyGTK GUI.
324 ClearErrors
325 FileOpen $0 $INSTDIR\ascend.bat w
326 ${If} ${Errors}
327 MessageBox MB_OK "The 'ascend.bat' file was not installed properly; problems writing to that file."
328 ${Else}
329 FileWrite $0 "@echo off"
330 FileWriteByte $0 "13"
331 FileWriteByte $0 "10"
332 FileWrite $0 "set PATH=$PATH"
333 FileWriteByte $0 "13"
334 FileWriteByte $0 "10"
335 FileWrite $0 "cd "
336 FileWrite $0 $INSTDIR
337 FileWriteByte $0 "13"
338 FileWriteByte $0 "10"
339 FileWrite $0 "$PYPATH\python "
340 FileWriteByte $0 "34"
341 FileWrite $0 "$INSTDIR\ascend"
342 FileWriteByte $0 "34"
343 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
344 FileWriteByte $0 "13"
345 FileWriteByte $0 "10"
346 FileClose $0
347 ${EndIf}
348
349 ;---- file association ----
350
351 ; back up old value of .a4c file association
352 ReadRegStr $1 HKCR ".a4c" ""
353 StrCmp $1 "" a4cnobkp
354 StrCmp $1 "ASCEND.model" a4cnobkp
355
356 ; Remember the old file association if necessary
357 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1
358
359 a4cnobkp:
360 WriteRegStr HKCR ".a4c" "" "ASCEND.model"
361
362 ; back up old value of .a4c file association
363 ReadRegStr $1 HKCR ".a4l" ""
364 StrCmp $1 "" a4lnobkp
365 StrCmp $1 "ASCEND.model" a4lnobkp
366
367 ; Remember the old file association if necessary
368 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1
369
370 a4lnobkp:
371 WriteRegStr HKCR ".a4l" "" "ASCEND.model"
372
373 ; So, what does an A4L or A4C file actually do?
374
375 ReadRegStr $0 HKCR "ASCEND.model" ""
376 StrCmp $0 "" 0 a4cskip
377
378 WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file"
379 WriteRegStr HKCR "ASCEND.model\shell" "" "open"
380 WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico"
381
382 a4cskip:
383 WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw.exe "$INSTDIR\ascend" "%1"'
384
385 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
386
387 ${EndIf}
388 Return
389
390 SectionEnd
391
392 ;---------------------------------
393
394 Section "Documentation" sect_doc
395 SetOutPath $INSTDIR
396 File "..\doc\book.pdf"
397 StrCpy $PDFINSTALLED "1"
398 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1
399 SectionEnd
400
401 ; Optional section (can be disabled by the user)
402 Section "Start Menu Shortcuts" sect_menu
403
404 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1
405
406 CreateDirectory "$SMPROGRAMS\${SMNAME}"
407
408 ; Link to PyGTK GUI
409 ${If} $PYINSTALLED == "1"
410 CreateShortCut "$SMPROGRAMS\${SMNAME}\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0
411 ${EndIf}
412
413 ; Model library shortcut
414 CreateShortCut "$SMPROGRAMS\${SMNAME}\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0
415
416 ; ; Link to Tcl/Tk GUI
417 ; ${If} $TCLINSTALLED == "1"
418 ; CreateShortCut "$SMPROGRAMS\${SMNAME}\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0
419 ; ${EndIf}
420
421 ; Documentation
422 ${If} $PDFINSTALLED == "1"
423 CreateShortCut "$SMPROGRAMS\${SMNAME}\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0
424 ${EndIf}
425
426 ; Information files
427 CreateShortCut "$SMPROGRAMS\${SMNAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0
428 CreateShortCut "$SMPROGRAMS\${SMNAME}\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0
429 CreateShortCut "$SMPROGRAMS\${SMNAME}\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0
430
431 CreateShortCut "$SMPROGRAMS\${SMNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
432
433 SectionEnd
434
435 ;------------------------------------------------------------------
436 ; HEADER FILES for DEVELOPERS
437
438 Section /o "Header files (for developers)" sect_devel
439 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1
440
441 SetOutPath $INSTDIR\include\ascend
442 File /r /x .svn "..\ascend\*.h"
443
444 ; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'.
445 ClearErrors
446 FileOpen $0 $INSTDIR\ascend-config.bat w
447 ${If} ${Errors}
448 MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file."
449 ${Else}
450 FileWrite $0 "@echo off"
451 FileWriteByte $0 "13"
452 FileWriteByte $0 "10"
453 FileWrite $0 "set PATH=$PATH"
454 FileWriteByte $0 "13"
455 FileWriteByte $0 "10"
456 FileWrite $0 "cd "
457 FileWrite $0 $INSTDIR
458 FileWriteByte $0 "13"
459 FileWriteByte $0 "10"
460 FileWrite $0 "$PYPATH\python "
461 FileWriteByte $0 "34"
462 FileWrite $0 "$INSTDIR\ascend-config"
463 FileWriteByte $0 "34"
464 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
465 FileWriteByte $0 "13"
466 FileWriteByte $0 "10"
467 FileClose $0
468 ${EndIf}
469 SetOutPath $INSTDIR
470 SectionEnd
471
472 ;------------------------------------------------------------------
473 ; UNINSTALLER
474
475 Section "Uninstall"
476 !ifdef INST64
477 SetRegView 64
478 !endif
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 ${EndIf}
559
560 ;--- start menu ---
561
562 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
563 ${If} $0 <> 0
564 ; Remove shortcuts, if any
565 DetailPrint "--- REMOVING START MENU SHORTCUTS ---"
566 RmDir /r "$SMPROGRAMS\${SMNAME}"
567 ${EndIf}
568
569 ;--- common components ---
570
571 DetailPrint "--- REMOVING COMMON COMPONENTS ---"
572 ; Remove registry keys
573
574 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND"
575 DeleteRegKey HKLM "SOFTWARE\ASCEND"
576
577 ; Remove files and uninstaller
578
579 Delete $INSTDIR\ascend-config
580 Delete $INSTDIR\ascend-config.bat
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 ${DEL_IPOPT_1}
601 ${DEL_IPOPT_2}
602 ${DEL_IPOPT_3}
603 ${DEL_IPOPT_4}
604 ${DEL_IPOPT_5}
605
606 ; Remove directories used
607
608 Delete $INSTDIR\uninstall.exe
609 RMDir $INSTDIR
610
611 SectionEnd
612
613 !include "dependencies.nsi"
614
615 !include "detect.nsi"
616
617 !include "ascendini.nsi"
618
619 !include "envvarwarning.nsi"
620
621 Function .onInit
622 !ifdef INST64
623 ${IfNot} ${RunningX64}
624 MessageBox MB_OK "This ASCEND installer is for 64-bit Windows versions only.$\n$\nVisit http://ascend4.org for 32-bit versions."
625 Abort
626 ${EndIf}
627 SetRegView 64
628 !endif
629
630 ;Get the previously-chosen $INSTDIR
631 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
632 ${If} $0 != ""
633 StrCpy $INSTDIR $0
634 ${EndIf}
635
636 ;set the default python target dir
637 StrCpy $PYTHONTARGETDIR "c:\Python${PYVERSION}"
638 !ifndef INST64
639 ${If} ${RunningX64}
640 ; this is a 32-bit installer on 64-bit Windows: install Python to a special location
641 StrCpy $PYTHONTARGETDIR "c:\Python${PYVERSION}_32"
642 ${EndIf}
643 ; FIXME we should check whether that directory already exists before going ahead...
644 !endif
645
646 StrCpy $PYINSTALLED ""
647 StrCpy $ASCENDINIFOUND ""
648 StrCpy $PDFINSTALLED ""
649 StrCpy $ASCENDENVVARFOUND ""
650
651 ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32"
652
653 Call DetectPython
654 Call DetectGTK
655 Call DetectPyGTK
656 Call DetectPyGObject
657 Call DetectPyCairo
658
659 ;MessageBox MB_OK "GTK path is $GTKPATH"
660 StrCpy $PATH "$GTKPATH;$DEFAULTPATH;$PYPATH"
661
662 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
663 ${If} $0 != ""
664 ;MessageBox MB_OK "Previous installation detected..."
665
666 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
667 ${If} $0 = 0
668 ;MessageBox MB_OK "Python was previously deselected"
669 SectionGetFlags "${sect_pygtk}" $1
670 IntOp $1 $1 ^ ${SF_SELECTED}
671 SectionSetFlags "${sect_pygtk}" $1
672 ${Else}
673 SectionGetFlags "${sect_pygtk}" $1
674 IntOp $1 $1 ^ ${SF_RO}
675 SectionSetFlags "${sect_pygtk}" $1
676 ${EndIf}
677
678 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
679 ${If} $0 = 0
680 ;MessageBox MB_OK "Documentation was previously deselected"
681 SectionGetFlags "${sect_doc}" $1
682 IntOp $1 $1 ^ ${SF_SELECTED}
683 SectionSetFlags "${sect_doc}" $1
684 ${Else}
685 SectionGetFlags "${sect_doc}" $1
686 IntOp $1 $1 ^ ${SF_RO}
687 SectionSetFlags "${sect_doc}" $1
688 ${EndIf}
689
690 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
691 ${If} $0 = 0
692 ;MessageBox MB_OK "Start Menu was previously deselected"
693 SectionGetFlags "${sect_menu}" $1
694 IntOp $1 $1 ^ ${SF_SELECTED}
695 SectionSetFlags "${sect_menu}" $1
696 ${Else}
697 SectionGetFlags "${sect_menu}" $1
698 IntOp $1 $1 ^ ${SF_RO}
699 SectionSetFlags "${sect_menu}" $1
700 ${EndIf}
701
702 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
703 ${If} $0 <> 0
704 ;MessageBox MB_OK "Header files were previously selected"
705 SectionGetFlags "${sect_devel}" $1
706 IntOp $1 $1 | ${SF_SELECTED}
707 IntOp $1 $1 | ${SF_RO}
708 SectionSetFlags "${sect_devel}" $1
709 ${EndIf}
710 ${EndIf}
711
712 FunctionEnd
713
714
715 Function un.onInit
716 !ifdef INST64
717 SetRegView 64
718 !endif
719
720 ;Get the previously-chosen $INSTDIR
721 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
722 ${If} $0 != ""
723 StrCpy $INSTDIR $0
724 ${EndIf}
725 FunctionEnd

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