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