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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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