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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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