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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3080 - (show annotations) (download)
Thu Aug 20 14:00:49 2015 UTC (6 years, 10 months ago) by adrian
File size: 23784 byte(s)
Updated thirdparty url
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 HAVE_GTKSOURCEVIEW
64 Var HAVE_GAPHAS
65 Var HAVE_SIMPLEGENERIC
66 Var HAVE_DECORATOR
67 Var PYINSTALLED
68
69 Var PDFINSTALLED
70
71 Var PATH
72 Var GTK_GUI
73
74 Var NEED_PYTHON
75 Var NEED_GTK
76 Var NEED_GTKSOURCEVIEW
77 Var NEED_GAPHAS
78 Var NEED_SIMPLEGENERIC
79 Var NEED_DECORATOR
80
81 Var ASCENDINIFOUND
82 Var ASCENDENVVARFOUND
83 Var ASCENDLIBRARY
84
85 Var PYTHONTARGETDIR
86
87 ; .onInit has been moved to after section decls so that they can be references
88
89 ;------------------------------------------------------------
90 ; DOWNLOAD AND INSTALL DEPENDENCIES FIRST
91
92 ; Use the official python.org Python packages
93 !define PYTHON_VERSION "${PYVERSION}${PYPATCH}"
94 !define PYTHON_FN "python-${PYTHON_VERSION}${PYARCH}.msi"
95 !define PYTHON_URL "http://python.org/ftp/python/${PYTHON_VERSION}/${PYTHON_FN}"
96 !define PYTHON_CMD "msiexec /i $DAI_TMPFILE /passive ALLUSERS=1 TARGETDIR=$PYTHONTARGETDIR"
97
98 !define THIRDPARTY_DIR "http://downloads.sourceforge.net/project/ascend-sim/thirdparty/"
99 !define TMP_DROPBOX_DIR "https://dl.dropboxusercontent.com/u/79623370/ascend/"
100
101 !ifdef INST64
102 !define WINXX "win64"
103 !define AMDXX ".win-amd64"
104 !define NNBIT "64-bit"
105 !define X64I386 "x64"
106 !else
107 !define WINXX "win32"
108 !define AMDXX ".win32"
109 !define X64I386 "i386"
110 !define NNBIT "32-bit"
111 !endif
112
113 !define PYGI_VER "3.14.0"
114 !define PYGI_REV "rev18"
115 !define PYGI_FN "pygi-aio-${PYGI_VER}_${PYGI_REV}-min-setup.exe"
116 !define PYGI_URL "${TMP_DROPBOX_DIR}${PYGI_FN}"
117 !define PYGI_CMD "$DAI_TMPFILE"
118
119 !define SG_VER "0.8.1"
120 !define GAP_VER "0.8.0"
121 !define DEC_VER "3.4.2"
122 !define SG_FN "simplegeneric-${SG_VER}${AMDXX}-py${PYVERSION}.exe"
123 !define DEC_FN "decorator-${DEC_VER}${AMDXX}-py${PYVERSION}.exe"
124 !define GAP_FN "gaphas-${GAP_VER}${AMDXX}-py${PYVERSION}.exe"
125 !define SG_URL "${TMP_DROPBOX_DIR}${SG_FN}"
126 !define DEC_URL "${TMP_DROPBOX_DIR}${DEC_FN}"
127 !define GAP_URL "${TMP_DROPBOX_DIR}${GAP_FN}"
128 !define SG_CMD "$DAI_TMPFILE"
129 !define DEC_CMD "$DAI_TMPFILE"
130 !define GAP_CMD "$DAI_TMPFILE"
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. You may need to retry manually."
141 ${EndIf}
142 ${EndIf}
143 SectionEnd
144
145 Section "-pygi"
146 DetailPrint "--- DOWNLOAD PYGI ---"
147 ${If} $NEED_GTK == '1'
148 ${OrIf} $NEED_GTKSOURCEVIEW == '1'
149 !insertmacro downloadAndInstall "PyGI" "${PYGI_URL}" "${PYGI_FN}" "${PYGI_CMD}"
150 Call DetectGTK
151 Call DetectGTKSourceView
152 ${If} $HAVE_GTK == 'NOK'
153 MessageBox MB_OK "GTK installation appears to have failed. You may need to retry manually."
154 ${EndIf}
155 ${If} $HAVE_GTKSOURCEVIEW == 'NOK'
156 MessageBox MB_OK "GTKSourceView installation appears to have failed. You may need to retry manually."
157 ${EndIf}
158 ${EndIf}
159 SectionEnd
160
161 Section "-simplegeneric"
162 DetailPrint "--- DOWNLOAD SIMPLEGENERIC ---"
163 ${If} $NEED_SIMPLEGENERIC == '1'
164 !insertmacro downloadAndInstall "SimpleGeneric" "${SG_URL}" "${SG_FN}" "${SG_CMD}"
165 Call DetectSimpleGeneric
166 ${If} $HAVE_SIMPLEGENERIC == 'NOK'
167 MessageBox MB_OK "SimpleGeneric installation appears to have failed. You may need to retry manually."
168 ${EndIf}
169 ${EndIf}
170 SectionEnd
171
172 Section "-decorator"
173 DetailPrint "--- DOWNLOAD DECORATOR ---"
174 ${If} $NEED_DECORATOR == '1'
175 !insertmacro downloadAndInstall "Decorator" "${DEC_URL}" "${DEC_FN}" "${DEC_CMD}"
176 Call DetectDecorator
177 ${If} $HAVE_DECORATOR == 'NOK'
178 MessageBox MB_OK "Decorator installation appears to have failed. You may need to retry manually."
179 ${EndIf}
180 ${EndIf}
181 SectionEnd
182
183 Section "-gaphas"
184 DetailPrint "--- DOWNLOAD GAPHAS ---"
185 ${If} $NEED_GAPHAS == '1'
186 !insertmacro downloadAndInstall "Gaphas" "${GAP_URL}" "${GAP_FN}" "${GAP_CMD}"
187 Call DetectGaphas
188 ${If} $HAVE_GAPHAS == 'NOK'
189 MessageBox MB_OK "Gaphas installation appears to have failed. You may need to retry manually."
190 ${EndIf}
191 ${EndIf}
192 SectionEnd
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
269 ; Write default values of ASCENDLIBRARY and ASCENDSOLVERS (user can override with env vars)
270 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDLIBRARY" "$INSTDIR\models"
271 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDSOLVERS" "$INSTDIR\solvers"
272
273 Return
274 SectionEnd
275
276 ;--------------------------------
277 Section "GTK GUI" sect_pygtk
278 !ifdef INST64
279 SetRegView 64
280 !endif
281 StrCpy $GTK_GUI "YES"
282 ; Check the dependencies of the GTK GUI before proceding...
283 ${If} $HAVE_PYTHON == 'NOK'
284 MessageBox MB_OK "GTK GUI can not be installed, because Python was not found on this system.$\nIf you do want to use the GTK GUI, please check the installation instructions$\n$\n(PYPATH=$PYPATH)"
285 ${ElseIf} $HAVE_GTK == 'NOK'
286 MessageBox MB_OK "GTK GUI cannot be installed, because GTK+ 3.x was not found on this system.$\nIf you do want to use the GTK GUI, please install GTK3 from PyGObject for Windows$\n"
287 ${ElseIf} $HAVE_GTKSOURCEVIEW == 'NOK'
288 MessageBox MB_OK "GTK GUI cannot be installed, because GTKSourceView was not found on this system.$\nIf you do want to use the GTK GUI, please install GTKSourceView from PyGObject for Windows$\n"
289 ${Else}
290 ;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH"
291
292 DetailPrint "--- PYTHON INTERFACE ---"
293
294 ; File icon
295 SetOutPath $INSTDIR
296 File "..\pygtk\glade\ascend-doc.ico"
297 File "..\pygtk\ascend"
298
299 ; Python interface
300 SetOutPath $INSTDIR\python
301 File "..\ascxx\_ascpy.pyd"
302 File "..\ascxx\*.py"
303 File "..\pygtk\*.py"
304
305 ; FPROPS: python bindings
306 File "..\models\johnpye\fprops\python\_fprops.pyd"
307 File "..\models\johnpye\fprops\python\*.py"
308
309 ; GLADE assets
310 SetOutPath $INSTDIR\glade
311 File "..\pygtk\glade\*.glade"
312 File "..\pygtk\glade\*.png"
313 File "..\pygtk\glade\*.svg"
314
315 StrCpy $PYINSTALLED "1"
316 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1
317
318 ; Create 'ascend.bat' batch file for launching the PyGTK GUI.
319 ClearErrors
320 FileOpen $0 $INSTDIR\ascend.bat w
321 ${If} ${Errors}
322 MessageBox MB_OK "The 'ascend.bat' file was not installed properly; problems writing to that file."
323 ${Else}
324 FileWrite $0 "@echo off"
325 FileWriteByte $0 "13"
326 FileWriteByte $0 "10"
327 FileWrite $0 "set PATH=$PATH"
328 FileWriteByte $0 "13"
329 FileWriteByte $0 "10"
330 FileWrite $0 "cd "
331 FileWrite $0 $INSTDIR
332 FileWriteByte $0 "13"
333 FileWriteByte $0 "10"
334 FileWrite $0 "$PYPATH\python "
335 FileWriteByte $0 "34"
336 FileWrite $0 "$INSTDIR\ascend"
337 FileWriteByte $0 "34"
338 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
339 FileWriteByte $0 "13"
340 FileWriteByte $0 "10"
341 FileClose $0
342 ${EndIf}
343
344 ;---- file association ----
345
346 ; back up old value of .a4c file association
347 ReadRegStr $1 HKCR ".a4c" ""
348 StrCmp $1 "" a4cnobkp
349 StrCmp $1 "ASCEND.model" a4cnobkp
350
351 ; Remember the old file association if necessary
352 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1
353
354 a4cnobkp:
355 WriteRegStr HKCR ".a4c" "" "ASCEND.model"
356
357 ; back up old value of .a4c file association
358 ReadRegStr $1 HKCR ".a4l" ""
359 StrCmp $1 "" a4lnobkp
360 StrCmp $1 "ASCEND.model" a4lnobkp
361
362 ; Remember the old file association if necessary
363 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1
364
365 a4lnobkp:
366 WriteRegStr HKCR ".a4l" "" "ASCEND.model"
367
368 ; So, what does an A4L or A4C file actually do?
369
370 ReadRegStr $0 HKCR "ASCEND.model" ""
371 StrCmp $0 "" 0 a4cskip
372
373 WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file"
374 WriteRegStr HKCR "ASCEND.model\shell" "" "open"
375 WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico"
376
377 a4cskip:
378 WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw.exe "$INSTDIR\ascend" "%1"'
379
380 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
381
382 ${EndIf}
383 Return
384
385 SectionEnd
386
387 Section "Canvas GUI" sect_canvas
388 !ifdef INST64
389 SetRegView 64
390 !endif
391 ; Check the dependencies of the Canvas GUI before proceding...
392 ${If} $GTK_GUI == 'NO'
393 MessageBox MB_OK "Canvas cannot be installed, because GTK GUI was not installed on this system.$\nIf you do want to use the Canvas, please firstly install GTK GUI$\n"
394 ${ElseIf} $HAVE_PYTHON == 'NOK'
395 MessageBox MB_OK "Canvas cannot be installed, because Python was not found on this system.$\nIf you do want to use the Canvas, please check the installation instructions$\n$\n(PYPATH=$PYPATH)"
396 ${ElseIf} $HAVE_GTK == 'NOK'
397 MessageBox MB_OK "Canvas cannot be installed, because GTK+ 3.x was not found on this system.$\nIf you do want to use the Canvas, please install GTK3 from PyGObject for Windows$\n"
398 ${ElseIf} $HAVE_GTKSOURCEVIEW == 'NOK'
399 MessageBox MB_OK "Canvas cannot be installed, because GTKSourceView was not found on this system.$\nIf you do want to use the Canvas, please install GTKSourceView from PyGObject for Windows$\n"
400 ${ElseIf} $HAVE_SIMPLEGENERIC == 'NOK'
401 MessageBox MB_OK "Canvas cannot be installed, because SimpleGeneric was not found on this system.$\nIf you do want to use the Canvas, please install SimpleGeneric python package$\n"
402 ${ElseIf} $HAVE_DECORATOR == 'NOK'
403 MessageBox MB_OK "Canvas cannot be installed, because Decorator was not found on this system.$\nIf you do want to use the Canvas, please install Decorator python package$\n"
404 ${ElseIf} $HAVE_GAPHAS == 'NOK'
405 MessageBox MB_OK "Canvas cannot be installed, because Gaphas was not found on this system.$\nIf you do want to use the Canvas, please install Gaphas python package$\n"
406 ${Else}
407 ;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH"
408
409 DetailPrint "--- Canvas ---"
410 ; Python interface
411 SetOutPath $INSTDIR\python
412 File "..\pygtk\canvas\*.py"
413
414 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Canvas" 1
415 ${EndIf}
416 Return
417
418 SectionEnd
419
420 ;---------------------------------
421
422 Section "Documentation" sect_doc
423 SetOutPath $INSTDIR
424 File "..\doc\book.pdf"
425 StrCpy $PDFINSTALLED "1"
426 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1
427 SectionEnd
428
429 ; Optional section (can be disabled by the user)
430 Section "Start Menu Shortcuts" sect_menu
431
432 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1
433
434 CreateDirectory "$SMPROGRAMS\${SMNAME}"
435
436 ; Link to PyGTK GUI
437 ${If} $PYINSTALLED == "1"
438 CreateShortCut "$SMPROGRAMS\${SMNAME}\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0
439 ${EndIf}
440
441 ; Model library shortcut
442 CreateShortCut "$SMPROGRAMS\${SMNAME}\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0
443
444 ; ; Link to Tcl/Tk GUI
445 ; ${If} $TCLINSTALLED == "1"
446 ; CreateShortCut "$SMPROGRAMS\${SMNAME}\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0
447 ; ${EndIf}
448
449 ; Documentation
450 ${If} $PDFINSTALLED == "1"
451 CreateShortCut "$SMPROGRAMS\${SMNAME}\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0
452 ${EndIf}
453
454 ; Information files
455 CreateShortCut "$SMPROGRAMS\${SMNAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0
456 CreateShortCut "$SMPROGRAMS\${SMNAME}\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0
457 CreateShortCut "$SMPROGRAMS\${SMNAME}\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0
458
459 CreateShortCut "$SMPROGRAMS\${SMNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
460
461 SectionEnd
462
463 ;------------------------------------------------------------------
464 ; HEADER FILES for DEVELOPERS
465
466 Section /o "Header files (for developers)" sect_devel
467 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1
468
469 SetOutPath $INSTDIR\include\ascend
470 File /r /x .svn "..\ascend\*.h"
471
472 ; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'.
473 ClearErrors
474 FileOpen $0 $INSTDIR\ascend-config.bat w
475 ${If} ${Errors}
476 MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file."
477 ${Else}
478 FileWrite $0 "@echo off"
479 FileWriteByte $0 "13"
480 FileWriteByte $0 "10"
481 FileWrite $0 "set PATH=$PATH"
482 FileWriteByte $0 "13"
483 FileWriteByte $0 "10"
484 FileWrite $0 "cd "
485 FileWrite $0 $INSTDIR
486 FileWriteByte $0 "13"
487 FileWriteByte $0 "10"
488 FileWrite $0 "$PYPATH\python "
489 FileWriteByte $0 "34"
490 FileWrite $0 "$INSTDIR\ascend-config"
491 FileWriteByte $0 "34"
492 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
493 FileWriteByte $0 "13"
494 FileWriteByte $0 "10"
495 FileClose $0
496 ${EndIf}
497 SetOutPath $INSTDIR
498 SectionEnd
499
500 ;------------------------------------------------------------------
501 ; UNINSTALLER
502
503 Section "Uninstall"
504 !ifdef INST64
505 SetRegView 64
506 !endif
507
508 ;--- python components ---
509
510 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
511 ${If} $0 <> 0
512
513 DetailPrint "--- REMOVING PYTHON COMPONENTS ---"
514 Delete $INSTDIR\python\_ascpy.pyd
515 Delete $INSTDIR\python\_fprops.pyd
516 Delete $INSTDIR\python\*.py
517 Delete $INSTDIR\python\*.pyc
518 Delete $INSTDIR\glade\*.glade
519 Delete $INSTDIR\glade\*.png
520 Delete $INSTDIR\glade\*.svg
521 Delete $INSTDIR\ascend-doc.ico
522 Delete $INSTDIR\ascend
523 Delete $INSTDIR\ascend.bat
524 RmDir $INSTDIR\glade
525 RmDir $INSTDIR\python
526
527 ;--- file association (for Python GUI) ---
528
529 DetailPrint "--- REMOVING FILE ASSOCIATION ---"
530 ;start of restore script
531 ReadRegStr $1 HKCR ".a4c" ""
532 ${If} $1 == "ASCEND.model"
533 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
534 ${If} $1 == ""
535 ; nothing to restore: delete it
536 DeleteRegKey HKCR ".a4c"
537 ${Else}
538 WriteRegStr HKCR ".a4c" "" $1
539 ${EndIf}
540 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
541 ${EndIf}
542
543 ReadRegStr $1 HKCR ".a4l" ""
544 ${If} $1 == "ASCEND.model"
545 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
546 ${If} $1 == ""
547 ; nothing to restore: delete it
548 DeleteRegKey HKCR ".a4l"
549 ${Else}
550 WriteRegStr HKCR ".a4l" "" $1
551 ${EndIf}
552 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
553 ${EndIf}
554
555 DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings
556
557 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
558 ;rest of script
559
560 ${EndIf}
561
562 ;--- tcl/tk components ---
563
564 ; ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
565 ; ${If} $0 <> 0
566 ; DetailPrint "--- REMOVING TCL/TK COMPONENTS ---"
567 ; Delete $INSTDIR\ascendtcl.dll
568 ; Delete $INSTDIR\ascend4.exe
569 ; RMDir /r $INSTDIR\tcltk
570 ; ${EndIf}
571
572 ;--- documentation ---
573
574 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
575 ${If} $0 <> 0
576 DetailPrint "--- REMOVING DOCUMENTATION ---"
577 Delete $INSTDIR\book.pdf
578 ${EndIf}
579
580 ;--- header files ---
581
582 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
583 ${If} $0 <> 0
584 DetailPrint "--- REMOVING HEADER FILES ---"
585 RMDir /r $INSTDIR\include
586 ${EndIf}
587
588 ;--- start menu ---
589
590 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
591 ${If} $0 <> 0
592 ; Remove shortcuts, if any
593 DetailPrint "--- REMOVING START MENU SHORTCUTS ---"
594 RmDir /r "$SMPROGRAMS\${SMNAME}"
595 ${EndIf}
596
597 ;--- common components ---
598
599 DetailPrint "--- REMOVING COMMON COMPONENTS ---"
600 ; Remove registry keys
601
602 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND"
603 DeleteRegKey HKLM "SOFTWARE\ASCEND"
604
605 ; Remove files and uninstaller
606
607 Delete $INSTDIR\ascend-config
608 Delete $INSTDIR\ascend-config.bat
609 Delete $INSTDIR\ascend.dll
610 Delete $INSTDIR\LICENSE.txt
611 Delete $INSTDIR\README-windows.txt
612 Delete $INSTDIR\CHANGELOG.txt
613 Delete $INSTDIR\ascend.ico
614 Delete $INSTDIR\Makefile.bt
615 Delete $INSTDIR\ascend.syn
616 Delete $INSTDIR\ipopt38.dll
617 RMDir /r $INSTDIR\models
618 Delete $INSTDIR\solvers\qrslv_ascend.dll
619 Delete $INSTDIR\solvers\conopt_ascend.dll
620 Delete $INSTDIR\solvers\lrslv_ascend.dll
621 Delete $INSTDIR\solvers\cmslv_ascend.dll
622 Delete $INSTDIR\solvers\lsode_ascend.dll
623 Delete $INSTDIR\solvers\ida_ascend.dll
624 Delete $INSTDIR\solvers\dopri5_ascend.dll
625 Delete $INSTDIR\solvers\ipopt_ascend.dll
626 RMDir $INSTDIR\solvers
627
628 ${DEL_IPOPT_1}
629 ${DEL_IPOPT_2}
630 ${DEL_IPOPT_3}
631 ${DEL_IPOPT_4}
632 ${DEL_IPOPT_5}
633
634 ; Remove directories used
635
636 Delete $INSTDIR\uninstall.exe
637 RMDir $INSTDIR
638
639 SectionEnd
640
641 !include "dependencies.nsi"
642
643 !include "detect.nsi"
644
645 !include "ascendini.nsi"
646
647 !include "envvarwarning.nsi"
648
649 Function .onInit
650 !ifdef INST64
651 ${IfNot} ${RunningX64}
652 MessageBox MB_OK "This ASCEND installer is for 64-bit Windows versions only.$\n$\nVisit http://ascend4.org for 32-bit versions."
653 Abort
654 ${EndIf}
655 SetRegView 64
656 !endif
657
658 ;Get the previously-chosen $INSTDIR
659 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
660 ${If} $0 != ""
661 StrCpy $INSTDIR $0
662 ${EndIf}
663
664 ;set the default python target dir
665 StrCpy $PYTHONTARGETDIR "c:\Python${PYVERSION}"
666 !ifndef INST64
667 ${If} ${RunningX64}
668 ; this is a 32-bit installer on 64-bit Windows: install Python to a special location
669 StrCpy $PYTHONTARGETDIR "c:\Python${PYVERSION}_32"
670 ${EndIf}
671 ; FIXME we should check whether that directory already exists before going ahead...
672 !endif
673 StrCpy $GTK_GUI "NO"
674 StrCpy $PYINSTALLED ""
675 StrCpy $ASCENDINIFOUND ""
676 StrCpy $PDFINSTALLED ""
677 StrCpy $ASCENDENVVARFOUND ""
678
679 ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32"
680
681 Call DetectPython
682 Call DetectGTK
683 Call DetectGTKSourceView
684 Call DetectDecorator
685 Call DetectSimpleGeneric
686 Call DetectGaphas
687
688 ;MessageBox MB_OK "GTK path is $GTKPATH"
689 StrCpy $PATH "$DEFAULTPATH;$PYPATH"
690
691 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
692 ${If} $0 != ""
693 ;MessageBox MB_OK "Previous installation detected..."
694
695 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
696 ${If} $0 = 0
697 ;MessageBox MB_OK "Python was previously deselected"
698 SectionGetFlags "${sect_pygtk}" $1
699 IntOp $1 $1 ^ ${SF_SELECTED}
700 SectionSetFlags "${sect_pygtk}" $1
701 ${Else}
702 SectionGetFlags "${sect_pygtk}" $1
703 IntOp $1 $1 ^ ${SF_RO}
704 SectionSetFlags "${sect_pygtk}" $1
705 ${EndIf}
706
707 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Canvas"
708 ${If} $0 = 0
709 ;MessageBox MB_OK "Python was previously deselected"
710 SectionGetFlags "${sect_canvas}" $1
711 IntOp $1 $1 ^ ${SF_SELECTED}
712 SectionSetFlags "${sect_canvas}" $1
713 ${Else}
714 SectionGetFlags "${sect_canvas}" $1
715 IntOp $1 $1 ^ ${SF_RO}
716 SectionSetFlags "${sect_canvas}" $1
717 ${EndIf}
718
719 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
720 ${If} $0 = 0
721 ;MessageBox MB_OK "Documentation was previously deselected"
722 SectionGetFlags "${sect_doc}" $1
723 IntOp $1 $1 ^ ${SF_SELECTED}
724 SectionSetFlags "${sect_doc}" $1
725 ${Else}
726 SectionGetFlags "${sect_doc}" $1
727 IntOp $1 $1 ^ ${SF_RO}
728 SectionSetFlags "${sect_doc}" $1
729 ${EndIf}
730
731 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
732 ${If} $0 = 0
733 ;MessageBox MB_OK "Start Menu was previously deselected"
734 SectionGetFlags "${sect_menu}" $1
735 IntOp $1 $1 ^ ${SF_SELECTED}
736 SectionSetFlags "${sect_menu}" $1
737 ${Else}
738 SectionGetFlags "${sect_menu}" $1
739 IntOp $1 $1 ^ ${SF_RO}
740 SectionSetFlags "${sect_menu}" $1
741 ${EndIf}
742
743 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
744 ${If} $0 <> 0
745 ;MessageBox MB_OK "Header files were previously selected"
746 SectionGetFlags "${sect_devel}" $1
747 IntOp $1 $1 | ${SF_SELECTED}
748 IntOp $1 $1 | ${SF_RO}
749 SectionSetFlags "${sect_devel}" $1
750 ${EndIf}
751 ${EndIf}
752
753 FunctionEnd
754
755
756 Function un.onInit
757 !ifdef INST64
758 SetRegView 64
759 !endif
760
761 ;Get the previously-chosen $INSTDIR
762 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
763 ${If} $0 != ""
764 StrCpy $INSTDIR $0
765 ${EndIf}
766 FunctionEnd

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