1 |
jpye |
1465 |
; NSIS script to create an ASCEND binary installer for Windows |
2 |
|
|
; by John Pye, 2006-2007. |
3 |
johnpye |
357 |
; |
4 |
|
|
;-------------------------------- |
5 |
|
|
|
6 |
|
|
; The name of the installer |
7 |
|
|
|
8 |
jpye |
1467 |
!ifndef VERSION |
9 |
|
|
!define VERSION 0.svn |
10 |
|
|
!endif |
11 |
|
|
|
12 |
|
|
Name "ASCEND ${VERSION}" |
13 |
|
|
|
14 |
jpye |
1572 |
;SetCompressor /FINAL zlib |
15 |
|
|
SetCompressor /SOLID lzma |
16 |
jpye |
1568 |
|
17 |
johnpye |
845 |
!include LogicLib.nsh |
18 |
jpye |
1568 |
!include nsDialogs.nsh |
19 |
johnpye |
845 |
|
20 |
jpye |
1467 |
!ifndef PYVERSION |
21 |
|
|
!define PYVERSION "2.5" |
22 |
|
|
!endif |
23 |
|
|
|
24 |
jpye |
1567 |
!ifndef PYPATCH |
25 |
|
|
!define PYPATCH ".1" |
26 |
|
|
!endif |
27 |
|
|
|
28 |
johnpye |
357 |
; The file to write |
29 |
johnpye |
578 |
!ifdef OUTFILE |
30 |
jpye |
1467 |
OutFile ${OUTFILE} |
31 |
johnpye |
578 |
!else |
32 |
jpye |
1467 |
OutFile "ascend-${VERSION}-py${PYVERSION}.exe" |
33 |
johnpye |
578 |
!endif |
34 |
johnpye |
357 |
|
35 |
johnpye |
578 |
|
36 |
johnpye |
357 |
; 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 |
jpye |
1568 |
Page license |
48 |
jpye |
1570 |
LicenseData "..\LICENSE.txt" |
49 |
jpye |
1568 |
|
50 |
johnpye |
357 |
Page components |
51 |
|
|
Page directory |
52 |
jpye |
1569 |
Page custom dependenciesCreate dependenciesLeave |
53 |
johnpye |
357 |
Page instfiles |
54 |
jpye |
1571 |
Page custom ascendIniCreate ascendIniLeave |
55 |
johnpye |
357 |
|
56 |
|
|
UninstPage uninstConfirm |
57 |
|
|
UninstPage instfiles |
58 |
|
|
|
59 |
|
|
;-------------------------------- |
60 |
|
|
|
61 |
jpye |
1381 |
Var /GLOBAL DEFAULTPATH |
62 |
johnpye |
845 |
Var /GLOBAL PYOK |
63 |
|
|
Var /GLOBAL PYPATH |
64 |
|
|
Var /GLOBAL GTKOK |
65 |
|
|
Var /GLOBAL GTKPATH |
66 |
johnpye |
859 |
Var /GLOBAL GLADEOK |
67 |
jpye |
1467 |
Var /GLOBAL PYGTKOK |
68 |
|
|
Var /GLOBAL PYGOBJECTOK |
69 |
|
|
Var /GLOBAL PYCAIROOK |
70 |
johnpye |
859 |
Var /GLOBAL GLADEPATH |
71 |
johnpye |
845 |
Var /GLOBAL PYINSTALLED |
72 |
|
|
Var /GLOBAL TCLOK |
73 |
|
|
Var /GLOBAL TCLPATH |
74 |
|
|
Var /GLOBAL TCLINSTALLED |
75 |
jpye |
1572 |
|
76 |
|
|
Var /GLOBAL PDFINSTALLED |
77 |
|
|
|
78 |
jpye |
1381 |
Var /GLOBAL PATH |
79 |
johnpye |
845 |
|
80 |
jpye |
1569 |
Var /GLOBAL PYDOWNLOAD |
81 |
|
|
Var /GLOBAL PYGTKDOWNLOAD |
82 |
|
|
Var /GLOBAL PYGOBJECTDOWNLOAD |
83 |
|
|
Var /GLOBAL PYCAIRODOWNLOAD |
84 |
|
|
Var /GLOBAL GTKDOWNLOAD |
85 |
jpye |
1573 |
Var /GLOBAL TCLDOWNLOAD |
86 |
jpye |
1569 |
|
87 |
jpye |
1571 |
Var /GLOBAL ASCENDINIFOUND |
88 |
|
|
|
89 |
johnpye |
845 |
Function .onInit |
90 |
|
|
StrCpy $PYINSTALLED "" |
91 |
|
|
StrCpy $TCLINSTALLED "" |
92 |
jpye |
1571 |
StrCpy $ASCENDINIFOUND "" |
93 |
jpye |
1572 |
StrCpy $PDFINSTALLED "" |
94 |
jpye |
1381 |
|
95 |
|
|
ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32" |
96 |
johnpye |
845 |
|
97 |
|
|
Call DetectPython |
98 |
|
|
Pop $PYOK |
99 |
|
|
Pop $PYPATH |
100 |
|
|
|
101 |
|
|
Call DetectGTK |
102 |
|
|
Pop $GTKOK |
103 |
|
|
Pop $GTKPATH |
104 |
johnpye |
859 |
|
105 |
|
|
Call DetectGlade |
106 |
|
|
Pop $GLADEOK |
107 |
|
|
Pop $GLADEPATH |
108 |
johnpye |
845 |
|
109 |
|
|
Call DetectTcl |
110 |
|
|
Pop $TCLOK |
111 |
jpye |
1467 |
Pop $TCLPATH |
112 |
johnpye |
845 |
|
113 |
jpye |
1467 |
Call DetectPyGTK |
114 |
|
|
Pop $PYGTKOK |
115 |
|
|
|
116 |
|
|
Call DetectPyGObject |
117 |
|
|
Pop $PYGOBJECTOK |
118 |
|
|
|
119 |
|
|
Call DetectPyCairo |
120 |
|
|
Pop $PYCAIROOK |
121 |
|
|
|
122 |
jpye |
1381 |
StrCpy $PATH "$DEFAULTPATH;$PYPATH;$GTKPATH" |
123 |
|
|
|
124 |
johnpye |
845 |
FunctionEnd |
125 |
|
|
|
126 |
jpye |
1570 |
;------------------------------------------------------------ |
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 |
jpye |
1571 |
!define PYTHON_CMD "msiexec /i $DAI_TMPFILE /passive" |
133 |
jpye |
1570 |
|
134 |
|
|
!define GTK_FN "gtk-2.10.11-win32-1.exe" |
135 |
|
|
!define GTK_URL "http://downloads.sourceforge.net/gladewin32/${GTK_FN}" |
136 |
jpye |
1571 |
!define GTK_CMD "$DAI_TMPFILE" |
137 |
jpye |
1570 |
|
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 |
jpye |
1571 |
!define PYGOBJECT_CMD "$DAI_TMPFILE" |
141 |
jpye |
1570 |
|
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 |
jpye |
1571 |
!define PYCAIRO_CMD "$DAI_TMPFILE" |
145 |
jpye |
1570 |
|
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 |
jpye |
1571 |
!define PYGTK_CMD "$DAI_TMPFILE" |
149 |
jpye |
1570 |
|
150 |
jpye |
1573 |
!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 |
jpye |
1570 |
!include "download.nsi" |
156 |
|
|
|
157 |
|
|
Section "-python" |
158 |
|
|
DetailPrint "--- DOWNLOAD PYTHON ---" |
159 |
|
|
${If} $PYDOWNLOAD == '1' |
160 |
jpye |
1571 |
!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 |
jpye |
1570 |
${EndIf} |
168 |
|
|
SectionEnd |
169 |
|
|
Section "-gtk" |
170 |
|
|
DetailPrint "--- DOWNLOAD GTK+ ---" |
171 |
|
|
${If} $GTKDOWNLOAD == '1' |
172 |
jpye |
1571 |
!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 |
jpye |
1570 |
${EndIf} |
180 |
|
|
SectionEnd |
181 |
|
|
Section "-pygobject" |
182 |
|
|
DetailPrint "--- DOWNLOAD PYGOBJECT ---" |
183 |
|
|
${If} $PYGOBJECTDOWNLOAD == '1' |
184 |
jpye |
1571 |
${AndIf} $PYOK == 'OK' |
185 |
|
|
!insertmacro downloadAndInstall "PyGObject" ${PYGOBJECT_URL} ${PYGOBJECT_FN} ${PYGOBJECT_CMD} |
186 |
|
|
Call DetectPyGObject |
187 |
|
|
Pop $PYGOBJECTOK |
188 |
jpye |
1570 |
${EndIf} |
189 |
|
|
SectionEnd |
190 |
|
|
Section "-pycairo" |
191 |
|
|
DetailPrint "--- DOWNLOAD PYCAIRO ---" |
192 |
|
|
${If} $PYCAIRODOWNLOAD == '1' |
193 |
jpye |
1571 |
${AndIf} $PYOK == 'OK' |
194 |
|
|
!insertmacro downloadAndInstall "PyCairo" ${PYCAIRO_URL} ${PYCAIRO_FN} ${PYCAIRO_CMD} |
195 |
jpye |
1570 |
Call DetectPyCairo |
196 |
|
|
Pop $PYCAIROOK |
197 |
|
|
${EndIf} |
198 |
|
|
SectionEnd |
199 |
|
|
Section "-pygtk" |
200 |
|
|
DetailPrint "--- DOWNLOAD PYGTK ---" |
201 |
|
|
${If} $PYGTKDOWNLOAD == '1' |
202 |
jpye |
1571 |
${AndIf} $PYOK == 'OK' |
203 |
|
|
!insertmacro downloadAndInstall "PyGTK" ${PYGTK_URL} ${PYGTK_FN} ${PYGTK_CMD} |
204 |
jpye |
1570 |
Call DetectPyGTK |
205 |
|
|
Pop $PYGTKOK |
206 |
|
|
|
207 |
|
|
${EndIf} |
208 |
jpye |
1573 |
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 |
jpye |
1570 |
|
219 |
|
|
;------------------------------------------------------------------------ |
220 |
|
|
; INSTALL CORE STUFF including model library |
221 |
|
|
|
222 |
johnpye |
357 |
; The stuff to install |
223 |
|
|
Section "ASCEND (required)" |
224 |
johnpye |
922 |
SectionIn RO |
225 |
johnpye |
357 |
|
226 |
johnpye |
922 |
DetailPrint "--- COMMON FILES ---" |
227 |
|
|
|
228 |
|
|
; Set output path to the installation directory. |
229 |
|
|
SetOutPath $INSTDIR |
230 |
jpye |
1570 |
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 |
jpye |
1569 |
|
237 |
|
|
; Model Library |
238 |
johnpye |
922 |
SetOutPath $INSTDIR\models |
239 |
jpye |
1570 |
File /r /x .svn "..\models\*.a4*" |
240 |
|
|
File /r /x .svn "..\models\*.tcl" |
241 |
jpye |
1597 |
File /r /x .svn "..\models\*_ascend.dll" ; extension modules |
242 |
jpye |
1570 |
File /r /x .svn "..\models\*.py"; python modules |
243 |
jpye |
1515 |
|
244 |
|
|
SetOutPath $INSTDIR\solvers |
245 |
jpye |
1597 |
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 |
jpye |
1593 |
|
252 |
johnpye |
922 |
SetOutPath $INSTDIR |
253 |
jpye |
1465 |
;File "Makefile.bt" |
254 |
jpye |
1570 |
File "..\tools\textpad\ascend.syn" |
255 |
jpye |
1569 |
|
256 |
|
|
${If} ${FileExists} "$APPDATA\.ascend.ini" |
257 |
jpye |
1571 |
StrCpy $ASCENDINIFOUND "1" |
258 |
jpye |
1569 |
${Else} |
259 |
johnpye |
1076 |
; Set 'librarypath' in .ascend.ini |
260 |
|
|
WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models" |
261 |
jpye |
1569 |
${EndIf} |
262 |
johnpye |
922 |
|
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 |
jpye |
1518 |
WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_SOLVERS" "$INSTDIR\solvers" |
280 |
jpye |
1463 |
WriteRegStr HKLM SOFTWARE\ASCEND "GTKLIBS" "$GTKPATH" |
281 |
jpye |
1616 |
|
282 |
|
|
; Write default values of ASCENDLIBRARY and ASCENDSOLVERS (user can override with env vars) |
283 |
|
|
WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDLIBRARY" "$INSTDIR\models" |
284 |
|
|
WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDSOLVERS" "$INSTDIR\solvers" |
285 |
johnpye |
922 |
|
286 |
jpye |
1614 |
; Create 'ascend.bat' batch file for launching the PyGTK GUI. |
287 |
|
|
ClearErrors |
288 |
|
|
FileOpen $0 $INSTDIR\ascend.bat w |
289 |
|
|
${If} ${Errors} |
290 |
|
|
MessageBox MB_OK "The 'ascend.bat' file was not installed properly; problems writing to that file." |
291 |
|
|
${Else} |
292 |
|
|
FileWrite $0 "@echo off" |
293 |
|
|
FileWriteByte $0 "13" |
294 |
|
|
FileWriteByte $0 "10" |
295 |
|
|
FileWrite $0 "set PATH=$PATH" |
296 |
|
|
FileWriteByte $0 "13" |
297 |
|
|
FileWriteByte $0 "10" |
298 |
|
|
FileWrite $0 "cd " |
299 |
|
|
FileWrite $0 $INSTDIR |
300 |
|
|
FileWriteByte $0 "13" |
301 |
|
|
FileWriteByte $0 "10" |
302 |
|
|
FileWrite $0 "$PYPATH\python " |
303 |
|
|
FileWriteByte $0 "34" |
304 |
|
|
FileWrite $0 "$INSTDIR\ascend" |
305 |
|
|
FileWriteByte $0 "34" |
306 |
|
|
FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8" |
307 |
|
|
FileWriteByte $0 "13" |
308 |
|
|
FileWriteByte $0 "10" |
309 |
|
|
FileClose $0 |
310 |
|
|
${EndIf} |
311 |
|
|
|
312 |
johnpye |
922 |
; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'. |
313 |
|
|
ClearErrors |
314 |
|
|
FileOpen $0 $INSTDIR\ascend-config.bat w |
315 |
jpye |
1614 |
${If} ${Errors} |
316 |
|
|
MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file." |
317 |
|
|
${Else} |
318 |
|
|
FileWrite $0 "@echo off" |
319 |
|
|
FileWriteByte $0 "13" |
320 |
|
|
FileWriteByte $0 "10" |
321 |
|
|
FileWrite $0 "set PATH=$PATH" |
322 |
|
|
FileWriteByte $0 "13" |
323 |
|
|
FileWriteByte $0 "10" |
324 |
|
|
FileWrite $0 "cd " |
325 |
|
|
FileWrite $0 $INSTDIR |
326 |
|
|
FileWriteByte $0 "13" |
327 |
|
|
FileWriteByte $0 "10" |
328 |
|
|
FileWrite $0 "$PYPATH\python " |
329 |
|
|
FileWriteByte $0 "34" |
330 |
|
|
FileWrite $0 "$INSTDIR\ascend-config" |
331 |
|
|
FileWriteByte $0 "34" |
332 |
|
|
FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8" |
333 |
|
|
FileWriteByte $0 "13" |
334 |
|
|
FileWriteByte $0 "10" |
335 |
|
|
FileClose $0 |
336 |
|
|
${EndIf} |
337 |
|
|
|
338 |
johnpye |
922 |
Return |
339 |
johnpye |
357 |
SectionEnd |
340 |
|
|
|
341 |
johnpye |
845 |
;-------------------------------- |
342 |
|
|
|
343 |
|
|
Section "PyGTK GUI" |
344 |
jpye |
1467 |
; Check the dependencies of the PyGTK GUI before proceding... |
345 |
|
|
${If} $PYOK == 'NOK' |
346 |
|
|
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)" |
347 |
|
|
${ElseIf} $GTKOK == 'NOK' |
348 |
|
|
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)" |
349 |
|
|
${ElseIf} $GLADEOK == 'NOK' |
350 |
jpye |
1567 |
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." |
351 |
jpye |
1467 |
${ElseIf} $PYGTKOK == "NOK" |
352 |
|
|
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)" |
353 |
|
|
${ElseIf} $PYCAIROOK == "NOK" |
354 |
|
|
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)" |
355 |
|
|
${ElseIf} $PYGOBJECTOK == "NOK" |
356 |
|
|
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)" |
357 |
|
|
${Else} |
358 |
|
|
;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH" |
359 |
johnpye |
845 |
|
360 |
jpye |
1467 |
DetailPrint "--- PYTHON INTERFACE ---" |
361 |
johnpye |
845 |
|
362 |
jpye |
1467 |
; Set output path to the installation directory. |
363 |
|
|
SetOutPath $INSTDIR |
364 |
johnpye |
845 |
|
365 |
jpye |
1467 |
; Python interface |
366 |
jpye |
1570 |
File /nonfatal "..\pygtk\_ascpy.pyd" |
367 |
|
|
File "..\pygtk\*.py" |
368 |
|
|
File "..\pygtk\ascend" |
369 |
|
|
File "..\pygtk\glade\ascend-doc.ico" |
370 |
johnpye |
845 |
|
371 |
jpye |
1467 |
SetOutPath $INSTDIR\glade |
372 |
jpye |
1570 |
File "..\pygtk\glade\*.glade" |
373 |
|
|
File "..\pygtk\glade\*.png" |
374 |
|
|
File "..\pygtk\glade\*.svg" |
375 |
jpye |
1461 |
|
376 |
jpye |
1467 |
StrCpy $PYINSTALLED "1" |
377 |
|
|
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1 |
378 |
jpye |
1461 |
|
379 |
jpye |
1467 |
;---- file association ---- |
380 |
jpye |
1461 |
|
381 |
jpye |
1467 |
; back up old value of .a4c file association |
382 |
|
|
ReadRegStr $1 HKCR ".a4c" "" |
383 |
|
|
StrCmp $1 "" a4cnobkp |
384 |
|
|
StrCmp $1 "ASCEND.model" a4cnobkp |
385 |
jpye |
1461 |
|
386 |
jpye |
1467 |
; Remember the old file association if necessary |
387 |
|
|
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1 |
388 |
|
|
|
389 |
jpye |
1461 |
a4cnobkp: |
390 |
jpye |
1467 |
WriteRegStr HKCR ".a4c" "" "ASCEND.model" |
391 |
jpye |
1461 |
|
392 |
jpye |
1467 |
; back up old value of .a4c file association |
393 |
|
|
ReadRegStr $1 HKCR ".a4l" "" |
394 |
|
|
StrCmp $1 "" a4lnobkp |
395 |
|
|
StrCmp $1 "ASCEND.model" a4lnobkp |
396 |
jpye |
1461 |
|
397 |
jpye |
1467 |
; Remember the old file association if necessary |
398 |
|
|
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1 |
399 |
jpye |
1461 |
|
400 |
|
|
a4lnobkp: |
401 |
jpye |
1467 |
WriteRegStr HKCR ".a4l" "" "ASCEND.model" |
402 |
jpye |
1461 |
|
403 |
jpye |
1467 |
; So, what does an A4L or A4C file actually do? |
404 |
jpye |
1461 |
|
405 |
jpye |
1467 |
ReadRegStr $0 HKCR "ASCEND.model" "" |
406 |
|
|
StrCmp $0 "" 0 a4cskip |
407 |
jpye |
1461 |
|
408 |
jpye |
1467 |
WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file" |
409 |
|
|
WriteRegStr HKCR "ASCEND.model\shell" "" "open" |
410 |
|
|
WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico" |
411 |
|
|
|
412 |
jpye |
1461 |
a4cskip: |
413 |
jpye |
1467 |
WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw "$INSTDIR\ascend" "%1"' |
414 |
jpye |
1461 |
|
415 |
jpye |
1467 |
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' |
416 |
jpye |
1461 |
|
417 |
johnpye |
859 |
${EndIf} |
418 |
|
|
Return |
419 |
jpye |
1464 |
|
420 |
johnpye |
845 |
SectionEnd |
421 |
|
|
|
422 |
|
|
;--------------------------------- |
423 |
|
|
|
424 |
|
|
Section "Tcl/Tk GUI" |
425 |
|
|
|
426 |
jpye |
1567 |
${If} $TCLOK != 'OK' |
427 |
|
|
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)" |
428 |
|
|
${Else} |
429 |
|
|
DetailPrint "--- TCL/TK INTERFACE ---" |
430 |
|
|
SetOutPath $INSTDIR\tcltk |
431 |
jpye |
1570 |
File /r /x .svn "..\tcltk\TK\*" |
432 |
jpye |
1567 |
SetOutPath $INSTDIR |
433 |
jpye |
1570 |
File "..\tcltk\generic\interface\ascendtcl.dll" |
434 |
|
|
File "..\tcltk\generic\interface\ascend4.exe" |
435 |
johnpye |
845 |
|
436 |
jpye |
1567 |
StrCpy $TCLINSTALLED "1" |
437 |
|
|
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "TclTk" 1 |
438 |
johnpye |
845 |
|
439 |
jpye |
1567 |
${EndIf} |
440 |
|
|
|
441 |
johnpye |
845 |
SectionEnd |
442 |
|
|
|
443 |
|
|
;--------------------------------- |
444 |
|
|
|
445 |
jpye |
1572 |
Section "Documentation" |
446 |
|
|
SetOutPath $INSTDIR |
447 |
|
|
File "..\doc\book.pdf" |
448 |
|
|
StrCpy $PDFINSTALLED "1" |
449 |
|
|
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1 |
450 |
|
|
SectionEnd |
451 |
|
|
|
452 |
johnpye |
357 |
; Optional section (can be disabled by the user) |
453 |
|
|
Section "Start Menu Shortcuts" |
454 |
johnpye |
845 |
|
455 |
jpye |
1572 |
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1 |
456 |
johnpye |
357 |
|
457 |
jpye |
1572 |
CreateDirectory "$SMPROGRAMS\ASCEND" |
458 |
jpye |
1461 |
|
459 |
jpye |
1572 |
; Link to PyGTK GUI |
460 |
|
|
${If} $PYINSTALLED == "1" |
461 |
|
|
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0 |
462 |
|
|
${EndIf} |
463 |
jpye |
1464 |
|
464 |
jpye |
1572 |
; Model library shortcut |
465 |
|
|
CreateShortCut "$SMPROGRAMS\ASCEND\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0 |
466 |
johnpye |
845 |
|
467 |
jpye |
1572 |
; Link to Tcl/Tk GUI |
468 |
|
|
${If} $TCLINSTALLED == "1" |
469 |
|
|
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0 |
470 |
|
|
${EndIf} |
471 |
|
|
|
472 |
|
|
; Documentation |
473 |
|
|
${If} $PDFINSTALLED == "1" |
474 |
|
|
CreateShortCut "$SMPROGRAMS\ASCEND\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0 |
475 |
|
|
${EndIf} |
476 |
jpye |
1467 |
|
477 |
jpye |
1572 |
; Information files |
478 |
|
|
CreateShortCut "$SMPROGRAMS\ASCEND\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0 |
479 |
|
|
CreateShortCut "$SMPROGRAMS\ASCEND\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0 |
480 |
|
|
CreateShortCut "$SMPROGRAMS\ASCEND\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0 |
481 |
|
|
|
482 |
|
|
CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
483 |
johnpye |
357 |
|
484 |
|
|
SectionEnd |
485 |
|
|
|
486 |
johnpye |
845 |
;------------------------------------------------------------------ |
487 |
jpye |
1593 |
; HEADER FILES for DEVELOPERS |
488 |
|
|
|
489 |
|
|
Section /o "Header files (for developers)" |
490 |
|
|
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1 |
491 |
|
|
|
492 |
|
|
SetOutPath $INSTDIR\include |
493 |
|
|
File /r /x .svn "..\base\generic\*.h" |
494 |
|
|
|
495 |
|
|
SetOutPath $INSTDIR |
496 |
|
|
SectionEnd |
497 |
|
|
|
498 |
|
|
;------------------------------------------------------------------ |
499 |
johnpye |
845 |
; UNINSTALLER |
500 |
johnpye |
357 |
|
501 |
johnpye |
845 |
Section "Uninstall" |
502 |
johnpye |
357 |
|
503 |
johnpye |
845 |
;--- python components --- |
504 |
|
|
|
505 |
|
|
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python" |
506 |
|
|
IntCmp $0 0 unnopython unpython |
507 |
johnpye |
357 |
|
508 |
johnpye |
845 |
unpython: |
509 |
|
|
DetailPrint "--- REMOVING PYTHON COMPONENTS ---" |
510 |
jpye |
1467 |
Delete $INSTDIR\_ascpy.pyd |
511 |
jpye |
1463 |
Delete $INSTDIR\ascend |
512 |
johnpye |
845 |
Delete $INSTDIR\*.py |
513 |
jpye |
1433 |
Delete $INSTDIR\*.pyc |
514 |
johnpye |
845 |
Delete $INSTDIR\glade\*.glade |
515 |
|
|
Delete $INSTDIR\glade\*.png |
516 |
jpye |
1432 |
Delete $INSTDIR\glade\*.svg |
517 |
johnpye |
845 |
RmDir $INSTDIR\glade |
518 |
jpye |
1461 |
Delete $INSTDIR\ascend-doc.ico |
519 |
johnpye |
357 |
|
520 |
jpye |
1461 |
;--- file association (for Python GUI) --- |
521 |
|
|
|
522 |
|
|
DetailPrint "--- REMOVING FILE ASSOCIATION ---" |
523 |
|
|
;start of restore script |
524 |
|
|
ReadRegStr $1 HKCR ".a4c" "" |
525 |
|
|
${If} $1 == "ASCEND.model" |
526 |
|
|
ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" |
527 |
|
|
${If} $1 == "" |
528 |
|
|
; nothing to restore: delete it |
529 |
|
|
DeleteRegKey HKCR ".a4c" |
530 |
|
|
${Else} |
531 |
|
|
WriteRegStr HKCR ".a4c" "" $1 |
532 |
|
|
${EndIf} |
533 |
|
|
DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" |
534 |
|
|
${EndIf} |
535 |
|
|
|
536 |
|
|
ReadRegStr $1 HKCR ".a4l" "" |
537 |
|
|
${If} $1 == "ASCEND.model" |
538 |
|
|
ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" |
539 |
|
|
${If} $1 == "" |
540 |
|
|
; nothing to restore: delete it |
541 |
|
|
DeleteRegKey HKCR ".a4l" |
542 |
|
|
${Else} |
543 |
|
|
WriteRegStr HKCR ".a4l" "" $1 |
544 |
|
|
${EndIf} |
545 |
|
|
DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" |
546 |
|
|
${EndIf} |
547 |
|
|
|
548 |
|
|
DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings |
549 |
|
|
|
550 |
|
|
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' |
551 |
|
|
;rest of script |
552 |
|
|
|
553 |
johnpye |
845 |
unnopython: |
554 |
johnpye |
357 |
|
555 |
johnpye |
845 |
;--- tcl/tk components --- |
556 |
johnpye |
357 |
|
557 |
johnpye |
845 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk" |
558 |
|
|
${If} $0 != 0 |
559 |
|
|
DetailPrint "--- REMOVING TCL/TK COMPONENTS ---" |
560 |
|
|
Delete $INSTDIR\ascendtcl.dll |
561 |
jpye |
1433 |
Delete $INSTDIR\ascend4.exe |
562 |
johnpye |
845 |
RMDir /r $INSTDIR\tcltk |
563 |
|
|
${EndIf} |
564 |
johnpye |
357 |
|
565 |
jpye |
1572 |
;--- documentation --- |
566 |
|
|
|
567 |
|
|
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF" |
568 |
|
|
${If} $0 != 0 |
569 |
|
|
DetailPrint "--- REMOVING DOCUMENTATION ---" |
570 |
|
|
Delete $INSTDIR\book.pdf |
571 |
|
|
${EndIf} |
572 |
|
|
|
573 |
jpye |
1593 |
;--- header files --- |
574 |
|
|
|
575 |
|
|
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles" |
576 |
|
|
${If} $0 != 0 |
577 |
|
|
DetailPrint "--- REMOVING HEADER FILES ---" |
578 |
|
|
RMDir /r $INSTDIR\include |
579 |
|
|
${EndIf} |
580 |
|
|
|
581 |
johnpye |
845 |
;--- start menu --- |
582 |
|
|
|
583 |
jpye |
1593 |
ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu" |
584 |
|
|
${If} $0 != 0 |
585 |
|
|
; Remove shortcuts, if any |
586 |
|
|
DetailPrint "--- REMOVING START MENU SHORTCUTS ---" |
587 |
|
|
RmDir /r "$SMPROGRAMS\ASCEND" |
588 |
|
|
${EndIf} |
589 |
johnpye |
845 |
|
590 |
|
|
;--- common components --- |
591 |
|
|
|
592 |
|
|
DetailPrint "--- REMOVING COMMON COMPONENTS ---" |
593 |
|
|
; Remove registry keys |
594 |
|
|
|
595 |
|
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" |
596 |
|
|
DeleteRegKey HKLM "SOFTWARE\ASCEND" |
597 |
|
|
|
598 |
|
|
; Remove files and uninstaller |
599 |
|
|
|
600 |
jpye |
1433 |
Delete $INSTDIR\ascend-config |
601 |
|
|
Delete $INSTDIR\ascend-config.bat |
602 |
jpye |
1614 |
Delete $INSTDIR\ascend.bat |
603 |
johnpye |
845 |
Delete $INSTDIR\ascend.dll |
604 |
jpye |
1467 |
Delete $INSTDIR\LICENSE.txt |
605 |
jpye |
1469 |
Delete $INSTDIR\README-windows.txt |
606 |
jpye |
1467 |
Delete $INSTDIR\CHANGELOG.txt |
607 |
jpye |
1464 |
Delete $INSTDIR\ascend.ico |
608 |
johnpye |
845 |
Delete $INSTDIR\Makefile.bt |
609 |
|
|
Delete $INSTDIR\ascend.syn |
610 |
|
|
RMDir /r $INSTDIR\models |
611 |
jpye |
1597 |
Delete $INSTDIR\solvers\qrslv_ascend.dll |
612 |
|
|
Delete $INSTDIR\solvers\conopt_ascend.dll |
613 |
|
|
Delete $INSTDIR\solvers\lrslv_ascend.dll |
614 |
|
|
Delete $INSTDIR\solvers\cmslv_ascend.dll |
615 |
|
|
Delete $INSTDIR\solvers\lsode_ascend.dll |
616 |
|
|
Delete $INSTDIR\solvers\ida_ascend.dll |
617 |
jpye |
1593 |
RMDir $INSTDIR\solvers |
618 |
johnpye |
845 |
|
619 |
|
|
; Remove directories used |
620 |
|
|
|
621 |
jpye |
1433 |
Delete $INSTDIR\uninstall.exe |
622 |
|
|
RMDir $INSTDIR |
623 |
|
|
|
624 |
johnpye |
357 |
SectionEnd |
625 |
johnpye |
845 |
|
626 |
jpye |
1570 |
!include "dependencies.nsi" |
627 |
|
|
|
628 |
|
|
!include "detect.nsi" |
629 |
jpye |
1571 |
|
630 |
|
|
!include "ascendini.nsi" |