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

Contents of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


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

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