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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2883 - (show annotations) (download)
Tue Mar 31 13:11:43 2015 UTC (7 years, 6 months ago) by jpye
File size: 22002 byte(s)
Create branch for ongoing work on EVENT functionality with IDA. Copied from ksenija2 branch. Thanks Ksenija!

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

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