/[ascend]/branches/georgy/nsis/installer.nsi
ViewVC logotype

Contents of /branches/georgy/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3127 - (show annotations) (download)
Sun Jun 26 21:18:58 2016 UTC (4 years, 1 month ago) by georgy
File size: 25356 byte(s)
Create NSIS Modern UI 2.0 based installers.
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 Modern UI
14 !include "MUI2.nsh"
15
16 ;Create Unicode installer to display all languages
17 Unicode true
18
19 !define MUI_ABORTWARNING
20
21 ;Show all languages, despite user's codepage
22 !define MUI_LANGDLL_ALLLANGUAGES
23
24 !insertmacro MUI_DEFAULT MUI_PAGE_UNINSTALLER_PREFIX ""
25 ;Languages
26
27 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
28 !insertmacro MUI_LANGUAGE "French"
29 !insertmacro MUI_LANGUAGE "German"
30 !insertmacro MUI_LANGUAGE "Spanish"
31 !insertmacro MUI_LANGUAGE "SpanishInternational"
32 !insertmacro MUI_LANGUAGE "SimpChinese"
33 !insertmacro MUI_LANGUAGE "TradChinese"
34 !insertmacro MUI_LANGUAGE "Japanese"
35 !insertmacro MUI_LANGUAGE "Korean"
36 !insertmacro MUI_LANGUAGE "Italian"
37 !insertmacro MUI_LANGUAGE "Dutch"
38 !insertmacro MUI_LANGUAGE "Danish"
39 !insertmacro MUI_LANGUAGE "Swedish"
40 !insertmacro MUI_LANGUAGE "Norwegian"
41 !insertmacro MUI_LANGUAGE "NorwegianNynorsk"
42 !insertmacro MUI_LANGUAGE "Finnish"
43 !insertmacro MUI_LANGUAGE "Greek"
44 !insertmacro MUI_LANGUAGE "Russian"
45 !insertmacro MUI_LANGUAGE "Portuguese"
46 !insertmacro MUI_LANGUAGE "PortugueseBR"
47 !insertmacro MUI_LANGUAGE "Polish"
48 !insertmacro MUI_LANGUAGE "Ukrainian"
49 !insertmacro MUI_LANGUAGE "Czech"
50 !insertmacro MUI_LANGUAGE "Slovak"
51 !insertmacro MUI_LANGUAGE "Croatian"
52 !insertmacro MUI_LANGUAGE "Bulgarian"
53 !insertmacro MUI_LANGUAGE "Hungarian"
54 !insertmacro MUI_LANGUAGE "Thai"
55 !insertmacro MUI_LANGUAGE "Romanian"
56 !insertmacro MUI_LANGUAGE "Latvian"
57 !insertmacro MUI_LANGUAGE "Macedonian"
58 !insertmacro MUI_LANGUAGE "Estonian"
59 !insertmacro MUI_LANGUAGE "Turkish"
60 !insertmacro MUI_LANGUAGE "Lithuanian"
61 !insertmacro MUI_LANGUAGE "Slovenian"
62 !insertmacro MUI_LANGUAGE "Serbian"
63 !insertmacro MUI_LANGUAGE "SerbianLatin"
64 !insertmacro MUI_LANGUAGE "Arabic"
65 !insertmacro MUI_LANGUAGE "Farsi"
66 !insertmacro MUI_LANGUAGE "Hebrew"
67 !insertmacro MUI_LANGUAGE "Indonesian"
68 !insertmacro MUI_LANGUAGE "Mongolian"
69 !insertmacro MUI_LANGUAGE "Luxembourgish"
70 !insertmacro MUI_LANGUAGE "Albanian"
71 !insertmacro MUI_LANGUAGE "Breton"
72 !insertmacro MUI_LANGUAGE "Belarusian"
73 !insertmacro MUI_LANGUAGE "Icelandic"
74 !insertmacro MUI_LANGUAGE "Malay"
75 !insertmacro MUI_LANGUAGE "Bosnian"
76 !insertmacro MUI_LANGUAGE "Kurdish"
77 !insertmacro MUI_LANGUAGE "Irish"
78 !insertmacro MUI_LANGUAGE "Uzbek"
79 !insertmacro MUI_LANGUAGE "Galician"
80 !insertmacro MUI_LANGUAGE "Afrikaans"
81 !insertmacro MUI_LANGUAGE "Catalan"
82 !insertmacro MUI_LANGUAGE "Esperanto"
83 !insertmacro MUI_LANGUAGE "Asturian"
84 !insertmacro MUI_LANGUAGE "Basque"
85 !insertmacro MUI_LANGUAGE "Pashto"
86 !insertmacro MUI_LANGUAGE "ScotsGaelic"
87 !insertmacro MUI_LANGUAGE "Georgian"
88 !insertmacro MUI_LANGUAGE "Vietnamese"
89 !insertmacro MUI_LANGUAGE "Welsh"
90 !insertmacro MUI_LANGUAGE "Armenian"
91
92 ;--------------------------------
93 ;Reserve Files
94
95 ;If you are using solid compression, files that are required before
96 ;the actual installation should be stored first in the data block,
97 ;because this will make your installer start faster.
98
99 !insertmacro MUI_RESERVEFILE_LANGDLL
100
101
102 !include LogicLib.nsh
103 !include nsDialogs.nsh
104 !include x64.nsh
105
106 ; The file to write
107 OutFile ${OUTFILE}
108
109 !if "${INSTARCH}" == "x64"
110 !define INST64
111 !endif
112
113 ; The default installation directory
114 !ifdef INST64
115 InstallDir $PROGRAMFILES64\ASCEND
116 !define SMNAME "ASCEND (64-bit)"
117 !else
118 InstallDir $PROGRAMFILES32\ASCEND
119 !define SMNAME "ASCEND"
120 !endif
121
122 ; NOTE we *don't* user InstallDirRegKey because it doesn't work correctly on Win64.
123 ;InstallDirRegKey HKLM "Software\ASCEND" "Install_Dir"
124
125 RequestExecutionLevel admin
126
127 ;--------------------------------
128
129 ; Pages
130
131 Page license
132 LicenseData "..\LICENSE.txt"
133
134 Page components
135 Page directory
136 Page custom dependenciesCreate dependenciesLeave
137 Page instfiles
138 Page custom ascendIniCreate ascendIniLeave
139 Page custom ascendEnvVarCreate ascendEnvVarLeave
140
141 UninstPage uninstConfirm
142 UninstPage instfiles
143
144 ;--------------------------------
145
146 !define GTKSEARCHPATH "c:\GTK"
147
148 Var DEFAULTPATH
149 Var HAVE_PYTHON
150 Var PYPATH
151 Var HAVE_GTK
152 Var GTKPATH
153 Var HAVE_PYGTK
154 Var HAVE_PYGOBJECT
155 Var HAVE_PYCAIRO
156 Var PYINSTALLED
157
158 Var PDFINSTALLED
159
160 Var PATH
161
162 Var NEED_PYTHON
163 Var NEED_GTK
164 Var NEED_PYGTK
165 Var NEED_PYCAIRO
166 Var NEED_PYGOBJECT
167
168 Var ASCENDINIFOUND
169 Var ASCENDENVVARFOUND
170 Var ASCENDLIBRARY
171
172 Var PYTHONTARGETDIR
173
174 ; .onInit has been moved to after section decls so that they can be references
175
176 ;------------------------------------------------------------
177 ; DOWNLOAD AND INSTALL DEPENDENCIES FIRST
178
179 ; Use the official python.org Python packages
180 !define PYTHON_VERSION "${PYVERSION}${PYPATCH}"
181 !define PYTHON_FN "python-${PYTHON_VERSION}${PYARCH}.msi"
182 !define PYTHON_URL "http://python.org/ftp/python/${PYTHON_VERSION}/${PYTHON_FN}"
183 !define PYTHON_CMD "msiexec /i $DAI_TMPFILE /passive ALLUSERS=1 TARGETDIR=$PYTHONTARGETDIR"
184
185 !define THIRDPARTY_DIR "http://downloads.sourceforge.net/project/ascend-sim/thirdparty/"
186 !define GTK_VER "2.22"
187
188 !ifdef INST64
189 !define WINXX "win64"
190 !define AMDXX ".win-amd64"
191 !define NNBIT "64-bit"
192 !define X64I386 "x64"
193 !define GTK_PATCH ".1-20101229"
194 !else
195 !define WINXX "win32"
196 !define AMDXX ".win32"
197 !define X64I386 "i386"
198 !define NNBIT "32-bit"
199 !define GTK_PATCH ".1-20101227"
200 !endif
201
202 ; Host our own GTK bundles, repackaged as installers.
203 ; User should still be able to use the ftp.gnome.org zip files, we just can't easily install them from here.
204 ; Also, but having GTK installer, we can store the installation location in the registry (and have both 64 and 32 bit versions)
205 !define GTK_FN "gtk+-${GTK_VER}${GTK_PATCH}-${X64I386}-a4.exe"
206 !define GTK_URL "${THIRDPARTY_DIR}${GTK_FN}"
207 !define GTK_MFT "gtk+-bundle_${GTK_VER}${GTK_PATCH}_${WINXX}.mft"
208 !define GTK_CMD "$DAI_TMPFILE /S"
209
210 ; We will host the PyGTK, PyGObject and PyCairo dependencies on SF.net ourselves... for the moment.
211 ; Note that PyGTK version should match GTK+ version.
212 !define PYGTK_PATCH ".0"
213 !define PYCAIRO_VER "1.10.0"
214 !define PYGOBJECT_VER "2.28.6"
215 !define PYGTK_FN "pygtk-${GTK_VER}${PYGTK_PATCH}${AMDXX}-py${PYVERSION}.exe"
216 !define PYCAIRO_FN "py2cairo-${PYCAIRO_VER}${AMDXX}-py${PYVERSION}.exe"
217 !define PYGOBJECT_FN "pygobject-${PYGOBJECT_VER}${AMDXX}-py${PYVERSION}.exe"
218 !define PYGTK_URL "${THIRDPARTY_DIR}${PYGTK_FN}"
219 !define PYCAIRO_URL "${THIRDPARTY_DIR}${PYCAIRO_FN}"
220 !define PYGOBJECT_URL "${THIRDPARTY_DIR}${PYGOBJECT_FN}"
221 !define PYGTK_CMD "$DAI_TMPFILE"
222 !define PYCAIRO_CMD "$DAI_TMPFILE"
223 !define PYGOBJECT_CMD "$DAI_TMPFILE"
224
225 !include "download.nsi"
226
227 Section "-python"
228 DetailPrint "--- DOWNLOAD PYTHON ---"
229 ${If} $NEED_PYTHON == '1'
230 !insertmacro downloadAndInstall "Python" "${PYTHON_URL}" "${PYTHON_FN}" "${PYTHON_CMD}"
231 Call DetectPython
232 ${If} $HAVE_PYTHON == 'NOK'
233 MessageBox MB_OK "Python installation appears to have failed. You may need to retry manually."
234 ${EndIf}
235 ${EndIf}
236 SectionEnd
237
238 Section "-gtk"
239 DetailPrint "--- DOWNLOAD GTK ---"
240 ${If} $NEED_GTK == '1'
241 !insertmacro downloadAndInstall "GTK" "${GTK_URL}" "${GTK_FN}" "${GTK_CMD}"
242 Call DetectGTK
243 ${If} $HAVE_GTK == 'NOK'
244 MessageBox MB_OK "GTK installation appears to have failed. You may need to retry manually."
245 ${EndIf}
246 ${EndIf}
247 SectionEnd
248
249 Section "-pygtk"
250 DetailPrint "--- DOWNLOAD PYGTK ---"
251 ${If} $NEED_PYGTK == '1'
252 !insertmacro downloadAndInstall "PyGTK" "${PYGTK_URL}" "${PYGTK_FN}" "${PYGTK_CMD}"
253 Call DetectPyGTK
254 ${If} $HAVE_PYGTK == 'NOK'
255 MessageBox MB_OK "PyGTK installation appears to have failed. You may need to retry manually"
256 ${EndIf}
257 ${EndIf}
258 SectionEnd
259
260 Section "-pycairo"
261 DetailPrint "--- DOWNLOAD PYCAIRO ---"
262 ${If} $NEED_PYCAIRO == '1'
263 !insertmacro downloadAndInstall "PyCAIRO" "${PYCAIRO_URL}" "${PYCAIRO_FN}" "${PYCAIRO_CMD}"
264 Call DetectPyCairo
265 ${If} $HAVE_PYCAIRO == 'NOK'
266 MessageBox MB_OK "PyCairo installation appears to have failed. You may need to retry manually."
267 ${EndIf}
268 ${EndIf}
269 SectionEnd
270
271 Section "-pygobject"
272 DetailPrint "--- DOWNLOAD PYGOBJECT ---"
273 ${If} $NEED_PYGOBJECT == '1'
274 !insertmacro downloadAndInstall "PyGObject" "${PYGOBJECT_URL}" "${PYGOBJECT_FN}" "${PYGOBJECT_CMD}"
275 Call DetectPyGObject
276 ${If} $HAVE_PYGOBJECT == 'NOK'
277 MessageBox MB_OK "PyGObject installation appears to have failed. You may need to retry manually."
278 ${EndIf}
279 ${EndIf}
280 SectionEnd
281
282 ;------------------------------------------------------------------------
283 ; INSTALL CORE STUFF including model library
284
285 ; The stuff to install
286 Section "ASCEND (required)"
287 SectionIn RO
288
289 DetailPrint "--- COMMON FILES ---"
290
291 ; Set output path to the installation directory.
292 SetOutPath $INSTDIR
293 File "..\ascend.dll"
294 File "..\ascend-config"
295 File "..\pygtk\glade\ascend.ico"
296 File "..\LICENSE.txt"
297 File "..\CHANGELOG.txt"
298 File "..\README-windows.txt"
299 ${FILE_IPOPT_1}
300 ${FILE_IPOPT_2}
301 ${FILE_IPOPT_3}
302 ${FILE_IPOPT_4}
303 ${FILE_IPOPT_5}
304
305 ; Model Library
306 SetOutPath $INSTDIR\models
307 File /r /x .svn "..\models\*.a4*"
308 File /r /x .svn "..\models\*.tcl"
309 File /r /x .svn "..\models\*_ascend.dll" ; extension modules
310 File /r /x .svn "..\models\*.py"; python modules
311
312 SetOutPath $INSTDIR\solvers
313 File "..\solvers\qrslv\qrslv_ascend.dll"
314 File "..\solvers\conopt\conopt_ascend.dll"
315 File "..\solvers\lrslv\lrslv_ascend.dll"
316 File "..\solvers\cmslv\cmslv_ascend.dll"
317 File "..\solvers\lsode\lsode_ascend.dll"
318 File "..\solvers\ida\ida_ascend.dll"
319 File "..\solvers\dopri5\dopri5_ascend.dll"
320 File "..\solvers\ipopt\ipopt_ascend.dll"
321
322 SetOutPath $INSTDIR
323 ;File "Makefile.bt"
324 File "..\tools\textpad\ascend.syn"
325
326 ; Check for pre-existing .ascend.ini for current user (warn after installation, if so)
327 ${If} ${FileExists} "$APPDATA\.ascend.ini"
328 StrCpy $ASCENDINIFOUND "1"
329 ${Else}
330 ; Set 'librarypath' in .ascend.ini
331 WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models"
332 ${EndIf}
333
334 ; Check for ASCENDLIBRARY environment variable for current user
335 ExpandEnvStrings $ASCENDLIBRARY "%ASCENDLIBRARY%"
336 ${IfNot} $ASCENDLIBRARY == "%ASCENDLIBRARY%"
337 StrCpy $ASCENDENVVARFOUND "1"
338 ${EndIf}
339
340 ; Write the installation path into the registry
341 WriteRegStr HKLM SOFTWARE\ASCEND "Install_Dir" "$INSTDIR"
342
343 ; Write the uninstall keys for Windows
344 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "DisplayName" "ASCEND Simulation Environment"
345 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "UninstallString" '"$INSTDIR\uninstall.exe"'
346 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoModify" 1
347 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoRepair" 1
348 WriteUninstaller "uninstall.exe"
349
350 ; Write file locations to the registry for access from ascend-config
351 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_LIB" "$INSTDIR"
352 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_BIN" "$INSTDIR"
353 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_INCLUDE" "$INSTDIR\include"
354 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_ASCDATA" "$INSTDIR"
355 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_MODELS" "$INSTDIR\models"
356 WriteRegStr HKLM SOFTWARE\ASCEND "INSTALL_SOLVERS" "$INSTDIR\solvers"
357 WriteRegStr HKLM SOFTWARE\ASCEND "GTKLIBS" "$GTKPATH"
358
359 ; Write default values of ASCENDLIBRARY and ASCENDSOLVERS (user can override with env vars)
360 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDLIBRARY" "$INSTDIR\models"
361 WriteRegStr HKLM SOFTWARE\ASCEND "ASCENDSOLVERS" "$INSTDIR\solvers"
362
363 Return
364 SectionEnd
365
366 ;--------------------------------
367
368 Section "PyGTK GUI" sect_pygtk
369 !ifdef INST64
370 SetRegView 64
371 !endif
372 ; Check the dependencies of the PyGTK GUI before proceding...
373 ${If} $HAVE_PYTHON == 'NOK'
374 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)"
375 ${ElseIf} $HAVE_GTK == 'NOK'
376 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)"
377 ${ElseIf} $HAVE_PYGTK == "NOK"
378 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)"
379 ${ElseIf} $HAVE_PYCAIRO == "NOK"
380 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)"
381 ${ElseIf} $HAVE_PYGOBJECT == "NOK"
382 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)"
383 ${Else}
384 ;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH"
385
386 DetailPrint "--- PYTHON INTERFACE ---"
387
388 ; File icon
389 SetOutPath $INSTDIR
390 File "..\pygtk\glade\ascend-doc.ico"
391 File "..\pygtk\ascend"
392
393 ; Python interface
394 SetOutPath $INSTDIR\python
395 File "..\ascxx\_ascpy.pyd"
396 File "..\ascxx\ascpy.py"
397 File "..\pygtk\*.py"
398
399 ; FPROPS: python bindings
400 File "..\models\johnpye\fprops\python\_fprops.pyd"
401 File "..\models\johnpye\fprops\python\*.py"
402
403 ; GLADE assets
404 SetOutPath $INSTDIR\glade
405 File "..\pygtk\glade\*.glade"
406 File "..\pygtk\glade\*.png"
407 File "..\pygtk\glade\*.svg"
408
409 StrCpy $PYINSTALLED "1"
410 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1
411
412 ; Create 'ascend.bat' batch file for launching the PyGTK GUI.
413 ClearErrors
414 FileOpen $0 $INSTDIR\ascend.bat w
415 ${If} ${Errors}
416 MessageBox MB_OK "The 'ascend.bat' file was not installed properly; problems writing to that file."
417 ${Else}
418 FileWrite $0 "@echo off"
419 FileWriteByte $0 "13"
420 FileWriteByte $0 "10"
421 FileWrite $0 "set PATH=$PATH"
422 FileWriteByte $0 "13"
423 FileWriteByte $0 "10"
424 FileWrite $0 "cd "
425 FileWrite $0 $INSTDIR
426 FileWriteByte $0 "13"
427 FileWriteByte $0 "10"
428 FileWrite $0 "$PYPATH\python "
429 FileWriteByte $0 "34"
430 FileWrite $0 "$INSTDIR\ascend"
431 FileWriteByte $0 "34"
432 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
433 FileWriteByte $0 "13"
434 FileWriteByte $0 "10"
435 FileClose $0
436 ${EndIf}
437
438 ;---- file association ----
439
440 ; back up old value of .a4c file association
441 ReadRegStr $1 HKCR ".a4c" ""
442 StrCmp $1 "" a4cnobkp
443 StrCmp $1 "ASCEND.model" a4cnobkp
444
445 ; Remember the old file association if necessary
446 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1
447
448 a4cnobkp:
449 WriteRegStr HKCR ".a4c" "" "ASCEND.model"
450
451 ; back up old value of .a4c file association
452 ReadRegStr $1 HKCR ".a4l" ""
453 StrCmp $1 "" a4lnobkp
454 StrCmp $1 "ASCEND.model" a4lnobkp
455
456 ; Remember the old file association if necessary
457 WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1
458
459 a4lnobkp:
460 WriteRegStr HKCR ".a4l" "" "ASCEND.model"
461
462 ; So, what does an A4L or A4C file actually do?
463
464 ReadRegStr $0 HKCR "ASCEND.model" ""
465 StrCmp $0 "" 0 a4cskip
466
467 WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file"
468 WriteRegStr HKCR "ASCEND.model\shell" "" "open"
469 WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico"
470
471 a4cskip:
472 WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw.exe "$INSTDIR\ascend" "%1"'
473
474 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
475
476 ${EndIf}
477 Return
478
479 SectionEnd
480
481 ;---------------------------------
482
483 Section "Documentation" sect_doc
484 SetOutPath $INSTDIR
485 File "..\doc\book.pdf"
486 StrCpy $PDFINSTALLED "1"
487 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "PDF" 1
488 SectionEnd
489
490 ; Optional section (can be disabled by the user)
491 Section "Start Menu Shortcuts" sect_menu
492
493 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "StartMenu" 1
494
495 CreateDirectory "$SMPROGRAMS\${SMNAME}"
496
497 ; Link to PyGTK GUI
498 ${If} $PYINSTALLED == "1"
499 CreateShortCut "$SMPROGRAMS\${SMNAME}\ASCEND.lnk" "$PYPATH\pythonw.exe" '"$INSTDIR\ascend"' "$INSTDIR\ascend.ico" 0
500 ${EndIf}
501
502 ; Model library shortcut
503 CreateShortCut "$SMPROGRAMS\${SMNAME}\Model Library.lnk" "$INSTDIR\models" "" "$INSTDIR\models" 0
504
505 ; ; Link to Tcl/Tk GUI
506 ; ${If} $TCLINSTALLED == "1"
507 ; CreateShortCut "$SMPROGRAMS\${SMNAME}\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0
508 ; ${EndIf}
509
510 ; Documentation
511 ${If} $PDFINSTALLED == "1"
512 CreateShortCut "$SMPROGRAMS\${SMNAME}\User's Manual.lnk" "$INSTDIR\book.pdf" "" "$INSTDIR\book.pdf" 0
513 ${EndIf}
514
515 ; Information files
516 CreateShortCut "$SMPROGRAMS\${SMNAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0
517 CreateShortCut "$SMPROGRAMS\${SMNAME}\CHANGELOG.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0
518 CreateShortCut "$SMPROGRAMS\${SMNAME}\README.lnk" "$INSTDIR\README-windows.txt" '' "$INSTDIR\README-windows.txt" 0
519
520 CreateShortCut "$SMPROGRAMS\${SMNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
521
522 SectionEnd
523
524 ;------------------------------------------------------------------
525 ; HEADER FILES for DEVELOPERS
526
527 Section /o "Header files (for developers)" sect_devel
528 WriteRegDWORD HKLM "SOFTWARE\ASCEND" "HeaderFiles" 1
529
530 SetOutPath $INSTDIR\include\ascend
531 File /r /x .svn "..\ascend\*.h"
532
533 ; Create 'ascend-config.bat' batch file for launching the python script 'ascend-config'.
534 ClearErrors
535 FileOpen $0 $INSTDIR\ascend-config.bat w
536 ${If} ${Errors}
537 MessageBox MB_OK "The 'ascend-config.bat' file was not installed properly; problems writing to that file."
538 ${Else}
539 FileWrite $0 "@echo off"
540 FileWriteByte $0 "13"
541 FileWriteByte $0 "10"
542 FileWrite $0 "set PATH=$PATH"
543 FileWriteByte $0 "13"
544 FileWriteByte $0 "10"
545 FileWrite $0 "cd "
546 FileWrite $0 $INSTDIR
547 FileWriteByte $0 "13"
548 FileWriteByte $0 "10"
549 FileWrite $0 "$PYPATH\python "
550 FileWriteByte $0 "34"
551 FileWrite $0 "$INSTDIR\ascend-config"
552 FileWriteByte $0 "34"
553 FileWrite $0 " %1 %2 %3 %4 %5 %6 %7 %8"
554 FileWriteByte $0 "13"
555 FileWriteByte $0 "10"
556 FileClose $0
557 ${EndIf}
558 SetOutPath $INSTDIR
559 SectionEnd
560
561 ;------------------------------------------------------------------
562 ; UNINSTALLER
563
564 Section "Uninstall"
565 !ifdef INST64
566 SetRegView 64
567 !endif
568
569 ;--- python components ---
570
571 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
572 ${If} $0 <> 0
573
574 DetailPrint "--- REMOVING PYTHON COMPONENTS ---"
575 Delete $INSTDIR\python\_ascpy.pyd
576 Delete $INSTDIR\python\_fprops.pyd
577 Delete $INSTDIR\python\*.py
578 Delete $INSTDIR\python\*.pyc
579 Delete $INSTDIR\glade\*.glade
580 Delete $INSTDIR\glade\*.png
581 Delete $INSTDIR\glade\*.svg
582 Delete $INSTDIR\ascend-doc.ico
583 Delete $INSTDIR\ascend
584 Delete $INSTDIR\ascend.bat
585 RmDir $INSTDIR\glade
586 RmDir $INSTDIR\python
587
588 ;--- file association (for Python GUI) ---
589
590 DetailPrint "--- REMOVING FILE ASSOCIATION ---"
591 ;start of restore script
592 ReadRegStr $1 HKCR ".a4c" ""
593 ${If} $1 == "ASCEND.model"
594 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
595 ${If} $1 == ""
596 ; nothing to restore: delete it
597 DeleteRegKey HKCR ".a4c"
598 ${Else}
599 WriteRegStr HKCR ".a4c" "" $1
600 ${EndIf}
601 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4C"
602 ${EndIf}
603
604 ReadRegStr $1 HKCR ".a4l" ""
605 ${If} $1 == "ASCEND.model"
606 ReadRegStr $1 HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
607 ${If} $1 == ""
608 ; nothing to restore: delete it
609 DeleteRegKey HKCR ".a4l"
610 ${Else}
611 WriteRegStr HKCR ".a4l" "" $1
612 ${EndIf}
613 DeleteRegValue HKLM "SOFTWARE\ASCEND" "BackupAssocA4L"
614 ${EndIf}
615
616 DeleteRegKey HKCR "ASCEND.model" ;Delete key with association settings
617
618 System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
619 ;rest of script
620
621 ${EndIf}
622
623 ;--- tcl/tk components ---
624
625 ; ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "TclTk"
626 ; ${If} $0 <> 0
627 ; DetailPrint "--- REMOVING TCL/TK COMPONENTS ---"
628 ; Delete $INSTDIR\ascendtcl.dll
629 ; Delete $INSTDIR\ascend4.exe
630 ; RMDir /r $INSTDIR\tcltk
631 ; ${EndIf}
632
633 ;--- documentation ---
634
635 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
636 ${If} $0 <> 0
637 DetailPrint "--- REMOVING DOCUMENTATION ---"
638 Delete $INSTDIR\book.pdf
639 ${EndIf}
640
641 ;--- header files ---
642
643 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
644 ${If} $0 <> 0
645 DetailPrint "--- REMOVING HEADER FILES ---"
646 RMDir /r $INSTDIR\include
647 ${EndIf}
648
649 ;--- start menu ---
650
651 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
652 ${If} $0 <> 0
653 ; Remove shortcuts, if any
654 DetailPrint "--- REMOVING START MENU SHORTCUTS ---"
655 RmDir /r "$SMPROGRAMS\${SMNAME}"
656 ${EndIf}
657
658 ;--- common components ---
659
660 DetailPrint "--- REMOVING COMMON COMPONENTS ---"
661 ; Remove registry keys
662
663 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND"
664 DeleteRegKey HKLM "SOFTWARE\ASCEND"
665
666 ; Remove files and uninstaller
667
668 Delete $INSTDIR\ascend-config
669 Delete $INSTDIR\ascend-config.bat
670 Delete $INSTDIR\ascend.dll
671 Delete $INSTDIR\LICENSE.txt
672 Delete $INSTDIR\README-windows.txt
673 Delete $INSTDIR\CHANGELOG.txt
674 Delete $INSTDIR\ascend.ico
675 Delete $INSTDIR\Makefile.bt
676 Delete $INSTDIR\ascend.syn
677 Delete $INSTDIR\ipopt38.dll
678 RMDir /r $INSTDIR\models
679 Delete $INSTDIR\solvers\qrslv_ascend.dll
680 Delete $INSTDIR\solvers\conopt_ascend.dll
681 Delete $INSTDIR\solvers\lrslv_ascend.dll
682 Delete $INSTDIR\solvers\cmslv_ascend.dll
683 Delete $INSTDIR\solvers\lsode_ascend.dll
684 Delete $INSTDIR\solvers\ida_ascend.dll
685 Delete $INSTDIR\solvers\dopri5_ascend.dll
686 Delete $INSTDIR\solvers\ipopt_ascend.dll
687 RMDir $INSTDIR\solvers
688
689 ${DEL_IPOPT_1}
690 ${DEL_IPOPT_2}
691 ${DEL_IPOPT_3}
692 ${DEL_IPOPT_4}
693 ${DEL_IPOPT_5}
694
695 ; Remove directories used
696
697 Delete $INSTDIR\uninstall.exe
698 RMDir $INSTDIR
699
700 SectionEnd
701
702 !include "dependencies.nsi"
703
704 !include "detect.nsi"
705
706 !include "ascendini.nsi"
707
708 !include "envvarwarning.nsi"
709
710 Function .onInit
711 !insertmacro MUI_LANGDLL_DISPLAY
712
713 !ifdef INST64
714 ${IfNot} ${RunningX64}
715 MessageBox MB_OK "This ASCEND installer is for 64-bit Windows versions only.$\n$\nVisit http://ascend4.org for 32-bit versions."
716 Abort
717 ${EndIf}
718 SetRegView 64
719 !endif
720
721 ;Get the previously-chosen $INSTDIR
722 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
723 ${If} $0 != ""
724 StrCpy $INSTDIR $0
725 ${EndIf}
726
727 ;set the default python target dir
728 StrCpy $PYTHONTARGETDIR "c:\Python${PYVERSION}"
729 !ifndef INST64
730 ${If} ${RunningX64}
731 ; this is a 32-bit installer on 64-bit Windows: install Python to a special location
732 StrCpy $PYTHONTARGETDIR "c:\Python${PYVERSION}_32"
733 ${EndIf}
734 ; FIXME we should check whether that directory already exists before going ahead...
735 !endif
736
737 StrCpy $PYINSTALLED ""
738 StrCpy $ASCENDINIFOUND ""
739 StrCpy $PDFINSTALLED ""
740 StrCpy $ASCENDENVVARFOUND ""
741
742 ExpandEnvStrings $DEFAULTPATH "%WINDIR%;%WINDIR%\system32"
743
744 Call DetectPython
745 Call DetectGTK
746 Call DetectPyGTK
747 Call DetectPyGObject
748 Call DetectPyCairo
749
750 ;MessageBox MB_OK "GTK path is $GTKPATH"
751 StrCpy $PATH "$GTKPATH;$DEFAULTPATH;$PYPATH"
752
753 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
754 ${If} $0 != ""
755 ;MessageBox MB_OK "Previous installation detected..."
756
757 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "Python"
758 ${If} $0 = 0
759 ;MessageBox MB_OK "Python was previously deselected"
760 SectionGetFlags "${sect_pygtk}" $1
761 IntOp $1 $1 ^ ${SF_SELECTED}
762 SectionSetFlags "${sect_pygtk}" $1
763 ${Else}
764 SectionGetFlags "${sect_pygtk}" $1
765 IntOp $1 $1 ^ ${SF_RO}
766 SectionSetFlags "${sect_pygtk}" $1
767 ${EndIf}
768
769 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "PDF"
770 ${If} $0 = 0
771 ;MessageBox MB_OK "Documentation was previously deselected"
772 SectionGetFlags "${sect_doc}" $1
773 IntOp $1 $1 ^ ${SF_SELECTED}
774 SectionSetFlags "${sect_doc}" $1
775 ${Else}
776 SectionGetFlags "${sect_doc}" $1
777 IntOp $1 $1 ^ ${SF_RO}
778 SectionSetFlags "${sect_doc}" $1
779 ${EndIf}
780
781 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "StartMenu"
782 ${If} $0 = 0
783 ;MessageBox MB_OK "Start Menu was previously deselected"
784 SectionGetFlags "${sect_menu}" $1
785 IntOp $1 $1 ^ ${SF_SELECTED}
786 SectionSetFlags "${sect_menu}" $1
787 ${Else}
788 SectionGetFlags "${sect_menu}" $1
789 IntOp $1 $1 ^ ${SF_RO}
790 SectionSetFlags "${sect_menu}" $1
791 ${EndIf}
792
793 ReadRegDWORD $0 HKLM "SOFTWARE\ASCEND" "HeaderFiles"
794 ${If} $0 <> 0
795 ;MessageBox MB_OK "Header files were previously selected"
796 SectionGetFlags "${sect_devel}" $1
797 IntOp $1 $1 | ${SF_SELECTED}
798 IntOp $1 $1 | ${SF_RO}
799 SectionSetFlags "${sect_devel}" $1
800 ${EndIf}
801 ${EndIf}
802
803 FunctionEnd
804
805
806 Function un.onInit
807 !insertmacro MUI_UNGETLANGUAGE
808
809 !ifdef INST64
810 SetRegView 64
811 !endif
812
813 ;Get the previously-chosen $INSTDIR
814 ReadRegStr $0 HKLM "SOFTWARE\ASCEND" "Install_Dir"
815 ${If} $0 != ""
816 StrCpy $INSTDIR $0
817 ${EndIf}
818 FunctionEnd

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22