/[ascend]/trunk/nsis/installer.nsi
ViewVC logotype

Annotation of /trunk/nsis/installer.nsi

Parent Directory Parent Directory | Revision Log Revision Log


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

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