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.bat' batch file for launching the PyGTK GUI. |
283 |
ClearErrors |
284 |
FileOpen $0 $INSTDIR\ascend.bat w |
285 |
${If} ${Errors} |
286 |
MessageBox MB_OK "The 'ascend.bat' file was not installed properly; problems writing to that file." |
287 |
${Else} |
288 |
FileWrite $0 "@echo off" |
289 |
FileWriteByte $0 "13" |
290 |
FileWriteByte $0 "10" |
291 |
FileWrite $0 "set PATH=$PATH" |
292 |
FileWriteByte $0 "13" |
293 |
FileWriteByte $0 "10" |
294 |
FileWrite $0 "cd " |
295 |
FileWrite $0 $INSTDIR |
296 |
FileWriteByte $0 "13" |
297 |
FileWriteByte $0 "10" |
298 |
FileWrite $0 "$PYPATH\python " |
299 |
FileWriteByte $0 "34" |
300 |
FileWrite $0 "$INSTDIR\ascend" |
301 |
FileWriteByte $0 "34" |
302 |
FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8" |
303 |
FileWriteByte $0 "13" |
304 |
FileWriteByte $0 "10" |
305 |
FileClose $0 |
306 |
${EndIf} |
307 |
|
308 |
; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'. |
309 |
ClearErrors |
310 |
FileOpen $0 $INSTDIR\ascend-config.bat w |
311 |
${If} ${Errors} |
312 |
MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file." |
313 |
${Else} |
314 |
FileWrite $0 "@echo off" |
315 |
FileWriteByte $0 "13" |
316 |
FileWriteByte $0 "10" |
317 |
FileWrite $0 "set PATH=$PATH" |
318 |
FileWriteByte $0 "13" |
319 |
FileWriteByte $0 "10" |
320 |
FileWrite $0 "cd " |
321 |
FileWrite $0 $INSTDIR |
322 |
FileWriteByte $0 "13" |
323 |
FileWriteByte $0 "10" |
324 |
FileWrite $0 "$PYPATH\python " |
325 |
FileWriteByte $0 "34" |
326 |
FileWrite $0 "$INSTDIR\ascend-config" |
327 |
FileWriteByte $0 "34" |
328 |
FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8" |
329 |
FileWriteByte $0 "13" |
330 |
FileWriteByte $0 "10" |
331 |
FileClose $0 |
332 |
${EndIf} |
333 |
|
334 |
Return |
335 |
SectionEnd |
336 |
|
337 |
;-------------------------------- |
338 |
|
339 |
Section "PyGTK GUI" |
340 |
; Check the dependencies of the PyGTK GUI before proceding... |
341 |
${If} $PYOK == 'NOK' |
342 |
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)" |
343 |
${ElseIf} $GTKOK == 'NOK' |
344 |
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)" |
345 |
${ElseIf} $GLADEOK == 'NOK' |
346 |
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." |
347 |
${ElseIf} $PYGTKOK == "NOK" |
348 |
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)" |
349 |
${ElseIf} $PYCAIROOK == "NOK" |
350 |
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)" |
351 |
${ElseIf} $PYGOBJECTOK == "NOK" |
352 |
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)" |
353 |
${Else} |
354 |
;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH" |
355 |
|
356 |
DetailPrint "--- PYTHON INTERFACE ---" |
357 |
|
358 |
; Set output path to the installation directory. |
359 |
SetOutPath $INSTDIR |
360 |
|
361 |
; Python interface |
362 |
File /nonfatal "..\pygtk\_ascpy.pyd" |
363 |
File "..\pygtk\*.py" |
364 |
File "..\pygtk\ascend" |
365 |
File "..\pygtk\glade\ascend-doc.ico" |
366 |
|
367 |
SetOutPath $INSTDIR\glade |
368 |
File "..\pygtk\glade\*.glade" |
369 |
File "..\pygtk\glade\*.png" |
370 |
File "..\pygtk\glade\*.svg" |
371 |
|
372 |
StrCpy $PYINSTALLED "1" |
373 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1 |
374 |
|
375 |
;---- file association ---- |
376 |
|
377 |
; back up old value of .a4c file association |
378 |
ReadRegStr $1 HKCR ".a4c" "" |
379 |
StrCmp $1 "" a4cnobkp |
380 |
StrCmp $1 "ASCEND.model" a4cnobkp |
381 |
|
382 |
; Remember the old file association if necessary |
383 |
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1 |
384 |
|
385 |
a4cnobkp: |
386 |
WriteRegStr HKCR ".a4c" "" "ASCEND.model" |
387 |
|
388 |
; back up old value of .a4c file association |
389 |
ReadRegStr $1 HKCR ".a4l" "" |
390 |
StrCmp $1 "" a4lnobkp |
391 |
StrCmp $1 "ASCEND.model" a4lnobkp |
392 |
|
393 |
; Remember the old file association if necessary |
394 |
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1 |
395 |
|
396 |
a4lnobkp: |
397 |
WriteRegStr HKCR ".a4l" "" "ASCEND.model" |
398 |
|
399 |
; So, what does an A4L or A4C file actually do? |
400 |
|
401 |
ReadRegStr $0 HKCR "ASCEND.model" "" |
402 |
StrCmp $0 "" 0 a4cskip |
403 |
|
404 |
WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file" |
405 |
WriteRegStr HKCR "ASCEND.model\shell" "" "open" |
406 |
WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico" |
407 |
|
408 |
a4cskip: |
409 |
WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw "$INSTDIR\ascend" "%1"' |
410 |
|
411 |
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' |
412 |
|
413 |
${EndIf} |
414 |
Return |
415 |
|
416 |
SectionEnd |
417 |
|
418 |
;--------------------------------- |
419 |
|
420 |
Section "Tcl/Tk GUI" |
421 |
|
422 |
${If} $TCLOK != 'OK' |
423 |
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)" |
424 |
${Else} |
425 |
DetailPrint "--- TCL/TK INTERFACE ---" |
426 |
SetOutPath $INSTDIR\tcltk |
427 |
File /r /x .svn "..\tcltk\TK\*" |
428 |
SetOutPath $INSTDIR |
429 |
File "..\tcltk\generic\interface\ascendtcl.dll" |
430 |
File "..\tcltk\generic\interface\ascend4.exe" |
431 |
|
432 |
StrCpy $TCLINSTALLED "1" |
433 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "TclTk" 1 |
434 |
|
435 |
${EndIf} |
436 |
|
437 |
SectionEnd |
438 |
|
439 |
;--------------------------------- |
440 |
|
441 |
Section "Documentation" |
442 |
SetOutPath $INSTDIR |
443 |
File "..\doc\book.pdf" |
444 |
StrCpy $PDFINSTALLED "1" |
445 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1 |
446 |
SectionEnd |
447 |
|
448 |
; Optional section (can be disabled by the user) |
449 |
Section "Start Menu Shortcuts" |
450 |
|
451 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1 |
452 |
|
453 |
CreateDirectory "$SMPROGRAMS\ASCEND" |
454 |
|
455 |
; Link to PyGTK GUI |
456 |
${If} $PYINSTALLED == "1" |
457 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0 |
458 |
${EndIf} |
459 |
|
460 |
; Model library shortcut |
461 |
CreateShortCut "$SMPROGRAMS\ASCEND\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0 |
462 |
|
463 |
; Link to Tcl/Tk GUI |
464 |
${If} $TCLINSTALLED == "1" |
465 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0 |
466 |
${EndIf} |
467 |
|
468 |
; Documentation |
469 |
${If} $PDFINSTALLED == "1" |
470 |
CreateShortCut "$SMPROGRAMS\ASCEND\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0 |
471 |
${EndIf} |
472 |
|
473 |
; Information files |
474 |
CreateShortCut "$SMPROGRAMS\ASCEND\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0 |
475 |
CreateShortCut "$SMPROGRAMS\ASCEND\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0 |
476 |
CreateShortCut "$SMPROGRAMS\ASCEND\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0 |
477 |
|
478 |
CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
479 |
|
480 |
SectionEnd |
481 |
|
482 |
;------------------------------------------------------------------ |
483 |
; HEADER FILES for DEVELOPERS |
484 |
|
485 |
Section /o "Header files (for developers)" |
486 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1 |
487 |
|
488 |
SetOutPath $INSTDIR\include |
489 |
File /r /x .svn "..\base\generic\*.h" |
490 |
|
491 |
SetOutPath $INSTDIR |
492 |
SectionEnd |
493 |
|
494 |
;------------------------------------------------------------------ |
495 |
; UNINSTALLER |
496 |
|
497 |
Section "Uninstall" |
498 |
|
499 |
;--- python components --- |
500 |
|
501 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python" |
502 |
IntCmp $0 0 unnopython unpython |
503 |
|
504 |
unpython: |
505 |
DetailPrint "--- REMOVING PYTHON COMPONENTS ---" |
506 |
Delete $INSTDIR\_ascpy.pyd |
507 |
Delete $INSTDIR\ascend |
508 |
Delete $INSTDIR\*.py |
509 |
Delete $INSTDIR\*.pyc |
510 |
Delete $INSTDIR\glade\*.glade |
511 |
Delete $INSTDIR\glade\*.png |
512 |
Delete $INSTDIR\glade\*.svg |
513 |
RmDir $INSTDIR\glade |
514 |
Delete $INSTDIR\ascend-doc.ico |
515 |
|
516 |
;--- file association (for Python GUI) --- |
517 |
|
518 |
DetailPrint "--- REMOVING FILE ASSOCIATION ---" |
519 |
;start of restore script |
520 |
ReadRegStr $1 HKCR ".a4c" "" |
521 |
${If} $1 == "ASCEND.model" |
522 |
ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" |
523 |
${If} $1 == "" |
524 |
; nothing to restore: delete it |
525 |
DeleteRegKey HKCR ".a4c" |
526 |
${Else} |
527 |
WriteRegStr HKCR ".a4c" "" $1 |
528 |
${EndIf} |
529 |
DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" |
530 |
${EndIf} |
531 |
|
532 |
ReadRegStr $1 HKCR ".a4l" "" |
533 |
${If} $1 == "ASCEND.model" |
534 |
ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" |
535 |
${If} $1 == "" |
536 |
; nothing to restore: delete it |
537 |
DeleteRegKey HKCR ".a4l" |
538 |
${Else} |
539 |
WriteRegStr HKCR ".a4l" "" $1 |
540 |
${EndIf} |
541 |
DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" |
542 |
${EndIf} |
543 |
|
544 |
DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings |
545 |
|
546 |
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' |
547 |
;rest of script |
548 |
|
549 |
unnopython: |
550 |
|
551 |
;--- tcl/tk components --- |
552 |
|
553 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk" |
554 |
${If} $0 != 0 |
555 |
DetailPrint "--- REMOVING TCL/TK COMPONENTS ---" |
556 |
Delete $INSTDIR\ascendtcl.dll |
557 |
Delete $INSTDIR\ascend4.exe |
558 |
RMDir /r $INSTDIR\tcltk |
559 |
${EndIf} |
560 |
|
561 |
;--- documentation --- |
562 |
|
563 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF" |
564 |
${If} $0 != 0 |
565 |
DetailPrint "--- REMOVING DOCUMENTATION ---" |
566 |
Delete $INSTDIR\book.pdf |
567 |
${EndIf} |
568 |
|
569 |
;--- header files --- |
570 |
|
571 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles" |
572 |
${If} $0 != 0 |
573 |
DetailPrint "--- REMOVING HEADER FILES ---" |
574 |
RMDir /r $INSTDIR\include |
575 |
${EndIf} |
576 |
|
577 |
;--- start menu --- |
578 |
|
579 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu" |
580 |
${If} $0 != 0 |
581 |
; Remove shortcuts, if any |
582 |
DetailPrint "--- REMOVING START MENU SHORTCUTS ---" |
583 |
RmDir /r "$SMPROGRAMS\ASCEND" |
584 |
${EndIf} |
585 |
|
586 |
;--- common components --- |
587 |
|
588 |
DetailPrint "--- REMOVING COMMON COMPONENTS ---" |
589 |
; Remove registry keys |
590 |
|
591 |
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" |
592 |
DeleteRegKey HKLM "SOFTWARE\ASCEND" |
593 |
|
594 |
; Remove files and uninstaller |
595 |
|
596 |
Delete $INSTDIR\ascend-config |
597 |
Delete $INSTDIR\ascend-config.bat |
598 |
Delete $INSTDIR\ascend.bat |
599 |
Delete $INSTDIR\ascend.dll |
600 |
Delete $INSTDIR\LICENSE.txt |
601 |
Delete $INSTDIR\README-windows.txt |
602 |
Delete $INSTDIR\CHANGELOG.txt |
603 |
Delete $INSTDIR\ascend.ico |
604 |
Delete $INSTDIR\Makefile.bt |
605 |
Delete $INSTDIR\ascend.syn |
606 |
RMDir /r $INSTDIR\models |
607 |
Delete $INSTDIR\solvers\qrslv_ascend.dll |
608 |
Delete $INSTDIR\solvers\conopt_ascend.dll |
609 |
Delete $INSTDIR\solvers\lrslv_ascend.dll |
610 |
Delete $INSTDIR\solvers\cmslv_ascend.dll |
611 |
Delete $INSTDIR\solvers\lsode_ascend.dll |
612 |
Delete $INSTDIR\solvers\ida_ascend.dll |
613 |
RMDir $INSTDIR\solvers |
614 |
|
615 |
; Remove directories used |
616 |
|
617 |
Delete $INSTDIR\uninstall.exe |
618 |
RMDir $INSTDIR |
619 |
|
620 |
SectionEnd |
621 |
|
622 |
!include "dependencies.nsi" |
623 |
|
624 |
!include "detect.nsi" |
625 |
|
626 |
!include "ascendini.nsi" |