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