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 |
Function .onInit |
90 |
StrCpy $PYINSTALLED "" |
91 |
StrCpy $TCLINSTALLED "" |
92 |
StrCpy $ASCENDINIFOUND "" |
93 |
StrCpy $PDFINSTALLED "" |
94 |
|
95 |
ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32" |
96 |
|
97 |
Call DetectPython |
98 |
Pop $PYOK |
99 |
Pop $PYPATH |
100 |
|
101 |
Call DetectGTK |
102 |
Pop $GTKOK |
103 |
Pop $GTKPATH |
104 |
|
105 |
Call DetectGlade |
106 |
Pop $GLADEOK |
107 |
Pop $GLADEPATH |
108 |
|
109 |
Call DetectTcl |
110 |
Pop $TCLOK |
111 |
Pop $TCLPATH |
112 |
|
113 |
Call DetectPyGTK |
114 |
Pop $PYGTKOK |
115 |
|
116 |
Call DetectPyGObject |
117 |
Pop $PYGOBJECTOK |
118 |
|
119 |
Call DetectPyCairo |
120 |
Pop $PYCAIROOK |
121 |
|
122 |
StrCpy $PATH "$DEFAULTPATH;$PYPATH;$GTKPATH" |
123 |
|
124 |
FunctionEnd |
125 |
|
126 |
;------------------------------------------------------------ |
127 |
; DOWNLOAD AND INSTALL DEPENDENCIES FIRST |
128 |
|
129 |
!define PYTHON_VERSION "${PYVERSION}${PYPATCH}" |
130 |
!define PYTHON_FN "python-${PYTHON_VERSION}.msi" |
131 |
!define PYTHON_URL "http://www.python.org/ftp/python/${PYTHON_VERSION}/${PYTHON_FN}" |
132 |
!define PYTHON_CMD "msiexec /i $DAI_TMPFILE /passive" |
133 |
|
134 |
!define GTK_FN "gtk-2.10.11-win32-1.exe" |
135 |
!define GTK_URL "http://downloads.sourceforge.net/gladewin32/${GTK_FN}" |
136 |
!define GTK_CMD "$DAI_TMPFILE" |
137 |
|
138 |
!define PYGOBJECT_FN "pygobject-2.12.3-1.win32-py${PYVERSION}.exe" |
139 |
!define PYGOBJECT_URL "http://ftp.gnome.org/pub/GNOME/binaries/win32/pygobject/2.12/${PYGOBJECT_FN}" |
140 |
!define PYGOBJECT_CMD "$DAI_TMPFILE" |
141 |
|
142 |
!define PYCAIRO_FN "pycairo-1.2.6-1.win32-py${PYVERSION}.exe" |
143 |
!define PYCAIRO_URL "http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.2/${PYCAIRO_FN}" |
144 |
!define PYCAIRO_CMD "$DAI_TMPFILE" |
145 |
|
146 |
!define PYGTK_FN "pygtk-2.10.4-1.win32-py${PYVERSION}.exe" |
147 |
!define PYGTK_URL "http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.10/${PYGTK_FN}" |
148 |
!define PYGTK_CMD "$DAI_TMPFILE" |
149 |
|
150 |
!define TCL_VERSION "8.4.15" |
151 |
!define TCL_PATCH ".0.280619" |
152 |
!define TCL_FN "ActiveTcl${TCL_VERSION}${TCL_PATCH}-win32-ix86-threaded.exe" |
153 |
!define TCL_URL "http://downloads.activestate.com/ActiveTcl/Windows/${TCL_VERSION}/${TCL_FN}" |
154 |
!define TCL_CMD "$DAI_TMPFILE" |
155 |
!include "download.nsi" |
156 |
|
157 |
Section "-python" |
158 |
DetailPrint "--- DOWNLOAD PYTHON ---" |
159 |
${If} $PYDOWNLOAD == '1' |
160 |
!insertmacro downloadAndInstall "Python" "${PYTHON_URL}" "${PYTHON_FN}" "${PYTHON_CMD}" |
161 |
Call DetectPython |
162 |
Pop $PYOK |
163 |
Pop $PYPATH |
164 |
${If} $PYOK == 'NOK' |
165 |
MessageBox MB_OK "Python installation appears to have failed" |
166 |
${EndIf} |
167 |
${EndIf} |
168 |
SectionEnd |
169 |
Section "-gtk" |
170 |
DetailPrint "--- DOWNLOAD GTK+ ---" |
171 |
${If} $GTKDOWNLOAD == '1' |
172 |
!insertmacro downloadAndInstall "GTK+" ${GTK_URL} ${GTK_FN} ${GTK_CMD} |
173 |
Call DetectGTK |
174 |
Pop $GTKOK |
175 |
Pop $GTKPATH |
176 |
Call DetectGlade |
177 |
Pop $GLADEOK |
178 |
Pop $GLADEPATH |
179 |
${EndIf} |
180 |
SectionEnd |
181 |
Section "-pygobject" |
182 |
DetailPrint "--- DOWNLOAD PYGOBJECT ---" |
183 |
${If} $PYGOBJECTDOWNLOAD == '1' |
184 |
${AndIf} $PYOK == 'OK' |
185 |
!insertmacro downloadAndInstall "PyGObject" ${PYGOBJECT_URL} ${PYGOBJECT_FN} ${PYGOBJECT_CMD} |
186 |
Call DetectPyGObject |
187 |
Pop $PYGOBJECTOK |
188 |
${EndIf} |
189 |
SectionEnd |
190 |
Section "-pycairo" |
191 |
DetailPrint "--- DOWNLOAD PYCAIRO ---" |
192 |
${If} $PYCAIRODOWNLOAD == '1' |
193 |
${AndIf} $PYOK == 'OK' |
194 |
!insertmacro downloadAndInstall "PyCairo" ${PYCAIRO_URL} ${PYCAIRO_FN} ${PYCAIRO_CMD} |
195 |
Call DetectPyCairo |
196 |
Pop $PYCAIROOK |
197 |
${EndIf} |
198 |
SectionEnd |
199 |
Section "-pygtk" |
200 |
DetailPrint "--- DOWNLOAD PYGTK ---" |
201 |
${If} $PYGTKDOWNLOAD == '1' |
202 |
${AndIf} $PYOK == 'OK' |
203 |
!insertmacro downloadAndInstall "PyGTK" ${PYGTK_URL} ${PYGTK_FN} ${PYGTK_CMD} |
204 |
Call DetectPyGTK |
205 |
Pop $PYGTKOK |
206 |
|
207 |
${EndIf} |
208 |
SectionEnd |
209 |
Section "-tcl" |
210 |
DetailPrint "--- DOWNLOAD TCL/TK ---" |
211 |
${If} $TCLDOWNLOAD == '1' |
212 |
!insertmacro downloadAndInstall "Tcl/Tk" ${TCL_URL} ${TCL_FN} ${TCL_CMD} |
213 |
Call DetectTcl |
214 |
Pop $TCLOK |
215 |
Pop $TCLPATH |
216 |
${EndIf} |
217 |
SectionEnd |
218 |
|
219 |
;------------------------------------------------------------------------ |
220 |
; INSTALL CORE STUFF including model library |
221 |
|
222 |
; The stuff to install |
223 |
Section "ASCEND (required)" |
224 |
SectionIn RO |
225 |
|
226 |
DetailPrint "--- COMMON FILES ---" |
227 |
|
228 |
; Set output path to the installation directory. |
229 |
SetOutPath $INSTDIR |
230 |
File "..\ascend.dll" |
231 |
File "..\ascend-config" |
232 |
File "..\pygtk\glade\ascend.ico" |
233 |
File "..\LICENSE.txt" |
234 |
File "..\CHANGELOG.txt" |
235 |
File "..\README-windows.txt" |
236 |
|
237 |
; Model Library |
238 |
SetOutPath $INSTDIR\models |
239 |
File /r /x .svn "..\models\*.a4*" |
240 |
File /r /x .svn "..\models\*.tcl" |
241 |
File /r /x .svn "..\models\*_ascend.dll" ; extension modules |
242 |
File /r /x .svn "..\models\*.py"; python modules |
243 |
|
244 |
SetOutPath $INSTDIR\solvers |
245 |
File "..\solvers\qrslv\qrslv_ascend.dll" |
246 |
File "..\solvers\conopt\conopt_ascend.dll" |
247 |
File "..\solvers\lrslv\lrslv_ascend.dll" |
248 |
File "..\solvers\cmslv\cmslv_ascend.dll" |
249 |
File "..\solvers\lsode\lsode_ascend.dll" |
250 |
File "..\solvers\ida\ida_ascend.dll" |
251 |
|
252 |
SetOutPath $INSTDIR |
253 |
;File "Makefile.bt" |
254 |
File "..\tools\textpad\ascend.syn" |
255 |
|
256 |
${If} ${FileExists} "$APPDATA\.ascend.ini" |
257 |
StrCpy $ASCENDINIFOUND "1" |
258 |
${Else} |
259 |
; Set 'librarypath' in .ascend.ini |
260 |
WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models" |
261 |
${EndIf} |
262 |
|
263 |
; Write the installation path into the registry |
264 |
WriteRegStr HKLM SOFTWARE\ASCEND "Install_Dir" "$INSTDIR" |
265 |
|
266 |
; Write the uninstall keys for Windows |
267 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "DisplayName" "ASCEND Simulation Environment" |
268 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "UninstallString" '"$INSTDIR\uninstall.exe"' |
269 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoModify" 1 |
270 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoRepair" 1 |
271 |
WriteUninstaller "uninstall.exe" |
272 |
|
273 |
; Write file locations to the registry for access from ascend-config |
274 |
WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_LIB" "$INSTDIR" |
275 |
WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_BIN" "$INSTDIR" |
276 |
WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_INCLUDE" "$INSTDIR\include" |
277 |
WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_ASCDATA" "$INSTDIR" |
278 |
WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_MODELS" "$INSTDIR\models" |
279 |
WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_SOLVERS" "$INSTDIR\solvers" |
280 |
WriteRegStr HKLM SOFTWARE\ASCEND "GTKLIBS" "$GTKPATH" |
281 |
|
282 |
; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'. |
283 |
ClearErrors |
284 |
FileOpen $0 $INSTDIR\ascend-config.bat w |
285 |
IfErrors ascendconfigerror |
286 |
FileWrite $0 "@echo off" |
287 |
FileWriteByte $0 "13" |
288 |
FileWriteByte $0 "10" |
289 |
FileWrite $0 "set PATH=$PATH" |
290 |
FileWriteByte $0 "13" |
291 |
FileWriteByte $0 "10" |
292 |
FileWrite $0 "cd " |
293 |
FileWrite $0 $INSTDIR |
294 |
FileWriteByte $0 "13" |
295 |
FileWriteByte $0 "10" |
296 |
FileWrite $0 "$PYPATH\python " |
297 |
FileWriteByte $0 "34" |
298 |
FileWrite $0 "$INSTDIR\ascend-config" |
299 |
FileWriteByte $0 "34" |
300 |
FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8" |
301 |
FileWriteByte $0 "13" |
302 |
FileWriteByte $0 "10" |
303 |
|
304 |
FileClose $0 |
305 |
|
306 |
Return |
307 |
ascendconfigerror: |
308 |
MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file." |
309 |
|
310 |
SectionEnd |
311 |
|
312 |
;-------------------------------- |
313 |
|
314 |
Section "PyGTK GUI" |
315 |
; Check the dependencies of the PyGTK GUI before proceding... |
316 |
${If} $PYOK == 'NOK' |
317 |
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)" |
318 |
${ElseIf} $GTKOK == 'NOK' |
319 |
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)" |
320 |
${ElseIf} $GLADEOK == 'NOK' |
321 |
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." |
322 |
${ElseIf} $PYGTKOK == "NOK" |
323 |
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)" |
324 |
${ElseIf} $PYCAIROOK == "NOK" |
325 |
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)" |
326 |
${ElseIf} $PYGOBJECTOK == "NOK" |
327 |
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)" |
328 |
${Else} |
329 |
;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH" |
330 |
|
331 |
DetailPrint "--- PYTHON INTERFACE ---" |
332 |
|
333 |
; Set output path to the installation directory. |
334 |
SetOutPath $INSTDIR |
335 |
|
336 |
; Python interface |
337 |
File /nonfatal "..\pygtk\_ascpy.pyd" |
338 |
File "..\pygtk\*.py" |
339 |
File "..\pygtk\ascend" |
340 |
File "..\pygtk\glade\ascend-doc.ico" |
341 |
|
342 |
SetOutPath $INSTDIR\glade |
343 |
File "..\pygtk\glade\*.glade" |
344 |
File "..\pygtk\glade\*.png" |
345 |
File "..\pygtk\glade\*.svg" |
346 |
|
347 |
StrCpy $PYINSTALLED "1" |
348 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1 |
349 |
|
350 |
;---- file association ---- |
351 |
|
352 |
; back up old value of .a4c file association |
353 |
ReadRegStr $1 HKCR ".a4c" "" |
354 |
StrCmp $1 "" a4cnobkp |
355 |
StrCmp $1 "ASCEND.model" a4cnobkp |
356 |
|
357 |
; Remember the old file association if necessary |
358 |
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1 |
359 |
|
360 |
a4cnobkp: |
361 |
WriteRegStr HKCR ".a4c" "" "ASCEND.model" |
362 |
|
363 |
; back up old value of .a4c file association |
364 |
ReadRegStr $1 HKCR ".a4l" "" |
365 |
StrCmp $1 "" a4lnobkp |
366 |
StrCmp $1 "ASCEND.model" a4lnobkp |
367 |
|
368 |
; Remember the old file association if necessary |
369 |
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1 |
370 |
|
371 |
a4lnobkp: |
372 |
WriteRegStr HKCR ".a4l" "" "ASCEND.model" |
373 |
|
374 |
; So, what does an A4L or A4C file actually do? |
375 |
|
376 |
ReadRegStr $0 HKCR "ASCEND.model" "" |
377 |
StrCmp $0 "" 0 a4cskip |
378 |
|
379 |
WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file" |
380 |
WriteRegStr HKCR "ASCEND.model\shell" "" "open" |
381 |
WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico" |
382 |
|
383 |
a4cskip: |
384 |
WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw "$INSTDIR\ascend" "%1"' |
385 |
|
386 |
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' |
387 |
|
388 |
${EndIf} |
389 |
Return |
390 |
|
391 |
SectionEnd |
392 |
|
393 |
;--------------------------------- |
394 |
|
395 |
Section "Tcl/Tk GUI" |
396 |
|
397 |
${If} $TCLOK != 'OK' |
398 |
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)" |
399 |
${Else} |
400 |
DetailPrint "--- TCL/TK INTERFACE ---" |
401 |
SetOutPath $INSTDIR\tcltk |
402 |
File /r /x .svn "..\tcltk\TK\*" |
403 |
SetOutPath $INSTDIR |
404 |
File "..\tcltk\generic\interface\ascendtcl.dll" |
405 |
File "..\tcltk\generic\interface\ascend4.exe" |
406 |
|
407 |
StrCpy $TCLINSTALLED "1" |
408 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "TclTk" 1 |
409 |
|
410 |
${EndIf} |
411 |
|
412 |
SectionEnd |
413 |
|
414 |
;--------------------------------- |
415 |
|
416 |
Section "Documentation" |
417 |
SetOutPath $INSTDIR |
418 |
File "..\doc\book.pdf" |
419 |
StrCpy $PDFINSTALLED "1" |
420 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1 |
421 |
SectionEnd |
422 |
|
423 |
; Optional section (can be disabled by the user) |
424 |
Section "Start Menu Shortcuts" |
425 |
|
426 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1 |
427 |
|
428 |
CreateDirectory "$SMPROGRAMS\ASCEND" |
429 |
|
430 |
; Link to PyGTK GUI |
431 |
${If} $PYINSTALLED == "1" |
432 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0 |
433 |
${EndIf} |
434 |
|
435 |
; Model library shortcut |
436 |
CreateShortCut "$SMPROGRAMS\ASCEND\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0 |
437 |
|
438 |
; Link to Tcl/Tk GUI |
439 |
${If} $TCLINSTALLED == "1" |
440 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0 |
441 |
${EndIf} |
442 |
|
443 |
; Documentation |
444 |
${If} $PDFINSTALLED == "1" |
445 |
CreateShortCut "$SMPROGRAMS\ASCEND\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0 |
446 |
${EndIf} |
447 |
|
448 |
; Information files |
449 |
CreateShortCut "$SMPROGRAMS\ASCEND\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0 |
450 |
CreateShortCut "$SMPROGRAMS\ASCEND\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0 |
451 |
CreateShortCut "$SMPROGRAMS\ASCEND\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0 |
452 |
|
453 |
CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
454 |
|
455 |
SectionEnd |
456 |
|
457 |
;------------------------------------------------------------------ |
458 |
; HEADER FILES for DEVELOPERS |
459 |
|
460 |
Section /o "Header files (for developers)" |
461 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1 |
462 |
|
463 |
SetOutPath $INSTDIR\include |
464 |
File /r /x .svn "..\base\generic\*.h" |
465 |
|
466 |
SetOutPath $INSTDIR |
467 |
SectionEnd |
468 |
|
469 |
;------------------------------------------------------------------ |
470 |
; UNINSTALLER |
471 |
|
472 |
Section "Uninstall" |
473 |
|
474 |
;--- python components --- |
475 |
|
476 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python" |
477 |
IntCmp $0 0 unnopython unpython |
478 |
|
479 |
unpython: |
480 |
DetailPrint "--- REMOVING PYTHON COMPONENTS ---" |
481 |
Delete $INSTDIR\_ascpy.pyd |
482 |
Delete $INSTDIR\ascend |
483 |
Delete $INSTDIR\*.py |
484 |
Delete $INSTDIR\*.pyc |
485 |
Delete $INSTDIR\glade\*.glade |
486 |
Delete $INSTDIR\glade\*.png |
487 |
Delete $INSTDIR\glade\*.svg |
488 |
RmDir $INSTDIR\glade |
489 |
Delete $INSTDIR\ascend-doc.ico |
490 |
|
491 |
;--- file association (for Python GUI) --- |
492 |
|
493 |
DetailPrint "--- REMOVING FILE ASSOCIATION ---" |
494 |
;start of restore script |
495 |
ReadRegStr $1 HKCR ".a4c" "" |
496 |
${If} $1 == "ASCEND.model" |
497 |
ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" |
498 |
${If} $1 == "" |
499 |
; nothing to restore: delete it |
500 |
DeleteRegKey HKCR ".a4c" |
501 |
${Else} |
502 |
WriteRegStr HKCR ".a4c" "" $1 |
503 |
${EndIf} |
504 |
DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" |
505 |
${EndIf} |
506 |
|
507 |
ReadRegStr $1 HKCR ".a4l" "" |
508 |
${If} $1 == "ASCEND.model" |
509 |
ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" |
510 |
${If} $1 == "" |
511 |
; nothing to restore: delete it |
512 |
DeleteRegKey HKCR ".a4l" |
513 |
${Else} |
514 |
WriteRegStr HKCR ".a4l" "" $1 |
515 |
${EndIf} |
516 |
DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" |
517 |
${EndIf} |
518 |
|
519 |
DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings |
520 |
|
521 |
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' |
522 |
;rest of script |
523 |
|
524 |
unnopython: |
525 |
|
526 |
;--- tcl/tk components --- |
527 |
|
528 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk" |
529 |
${If} $0 != 0 |
530 |
DetailPrint "--- REMOVING TCL/TK COMPONENTS ---" |
531 |
Delete $INSTDIR\ascendtcl.dll |
532 |
Delete $INSTDIR\ascend4.exe |
533 |
RMDir /r $INSTDIR\tcltk |
534 |
${EndIf} |
535 |
|
536 |
;--- documentation --- |
537 |
|
538 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF" |
539 |
${If} $0 != 0 |
540 |
DetailPrint "--- REMOVING DOCUMENTATION ---" |
541 |
Delete $INSTDIR\book.pdf |
542 |
${EndIf} |
543 |
|
544 |
;--- header files --- |
545 |
|
546 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles" |
547 |
${If} $0 != 0 |
548 |
DetailPrint "--- REMOVING HEADER FILES ---" |
549 |
RMDir /r $INSTDIR\include |
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-config |
572 |
Delete $INSTDIR\ascend-config.bat |
573 |
Delete $INSTDIR\ascend.dll |
574 |
Delete $INSTDIR\LICENSE.txt |
575 |
Delete $INSTDIR\README-windows.txt |
576 |
Delete $INSTDIR\CHANGELOG.txt |
577 |
Delete $INSTDIR\ascend.ico |
578 |
Delete $INSTDIR\Makefile.bt |
579 |
Delete $INSTDIR\ascend.syn |
580 |
RMDir /r $INSTDIR\models |
581 |
Delete $INSTDIR\solvers\qrslv_ascend.dll |
582 |
Delete $INSTDIR\solvers\conopt_ascend.dll |
583 |
Delete $INSTDIR\solvers\lrslv_ascend.dll |
584 |
Delete $INSTDIR\solvers\cmslv_ascend.dll |
585 |
Delete $INSTDIR\solvers\lsode_ascend.dll |
586 |
Delete $INSTDIR\solvers\ida_ascend.dll |
587 |
RMDir $INSTDIR\solvers |
588 |
|
589 |
; Remove directories used |
590 |
|
591 |
Delete $INSTDIR\uninstall.exe |
592 |
RMDir $INSTDIR |
593 |
|
594 |
SectionEnd |
595 |
|
596 |
!include "dependencies.nsi" |
597 |
|
598 |
!include "detect.nsi" |
599 |
|
600 |
!include "ascendini.nsi" |