1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
; gwyddion.nsi
;
;--------------------------------
; Include header for Modern UI
!include "MUI.nsh"
; The name of the installer
Name "Gwyddion"
; The file to write
OutFile "gwyddion-%VERSION%-pygwy.exe"
; The default installation directory
InstallDir $PROGRAMFILES\Gwyddion
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\Gwyddion" "Install_Dir"
;--------------------------------
; Pages
!insertmacro MUI_PAGE_LICENSE "COPYING"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
;--------------------------------
; The stuff to install
Section "Gwyddion (required)" gwyddion
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
%GWYDDION_INSTALL%
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\Gwyddion "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gwyddion" "DisplayName" "Gwyddion"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gwyddion" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gwyddion" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gwyddion" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "GTK runtime libraries (required when no GTK runtime enviroment is installed)" gtk
SetOutPath $INSTDIR
%GTK_INSTALL%
SectionEnd
Section "Python wrapper (Pygwy module)" pygwy
SetOutPath $INSTDIR\modules
%PYGWY_INSTALL%
Var /GLOBAL PYTHON_PATH
ClearErrors
DetailPrint "Checking Python..."
ReadRegStr $PYTHON_PATH HKLM "software\Python\PythonCore\2.4\InstallPath" ""
IfErrors 0 NoError
ReadRegStr $PYTHON_PATH HKLM "software\Python\PythonCore\2.5\InstallPath" ""
IfErrors 0 NoError
MessageBox MB_OK "Python not installed, please install Python >= 2.4 for Pygwy module."
NoError:
DetailPrint " Python location: $PYTHON_PATH"
DetailPrint "Checking PyGTK..."
nsExec::Exec '"$PYTHON_PATH\python.exe" -c "import pygtk"'
Pop $0 # return value/error/timeout
IntCmp 0 $0 have_pygtk
DetailPrint " PyGTK not found. "
MessageBox MB_OK "PyGTK not installed, please install PyGTK >= 2.10 ($PYTHON_PATH)."
have_pygtk:
DetailPrint "Checking PyGObject..."
nsExec::Exec '"$PYTHON_PATH\python.exe" -c "import gobject"'
Pop $0 # return value/error/timeout
IntCmp 0 $0 have_pygobject
DetailPrint " PyGObject not found. "
MessageBox MB_OK "PyGObject not installed, please install PyGObject >= 2.12 for Python ($PYTHON_PATH)."
have_pygobject:
DetailPrint "Checking PyCairo..."
nsExec::Exec '"$PYTHON_PATH\python.exe" -c "import cairo"'
Pop $0 # return value/error/timeout
IntCmp 0 $0 have_pycairo
DetailPrint " PyCairo not found. "
MessageBox MB_OK "PyCairo not installed, please install PyCairo >= 1.2 for Python ($PYTHON_PATH)."
have_pycairo:
SectionEnd
Section "Start Menu Shortcuts" startmenu
SetOutPath $INSTDIR
CreateDirectory "$SMPROGRAMS\Gwyddion"
CreateShortCut "$SMPROGRAMS\Gwyddion\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\Gwyddion\Gwyddion.lnk" "$INSTDIR\gwyddion.exe" "" "$INSTDIR\pixmaps\gwyddion.ico"
SectionEnd
;--------------------------------
;--------------------------------
;Descriptions
;Language strings
LangString DESC_pygwy ${LANG_ENGLISH} "Python wrapper module. Required: Python>=2.4, PyGTK>=2.10, PyGObject>=2.12"
LangString DESC_gtk ${LANG_ENGLISH} "GTK runtime libraries are required when no GTK runtime environment is installed."
LangString DESC_startmenu ${LANG_ENGLISH} ""
LangString DESC_gwyddion ${LANG_ENGLISH} ""
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${pygwy} $(DESC_pygwy)
!insertmacro MUI_DESCRIPTION_TEXT ${gtk} $(DESC_gtk)
!insertmacro MUI_DESCRIPTION_TEXT ${gwyddion} $(DESC_gwyddion)
!insertmacro MUI_DESCRIPTION_TEXT ${startmenu} $(DESC_startmenu)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gwyddion"
DeleteRegKey HKLM SOFTWARE\Gwyddion
; Pygwy uninstall
%PYGWY_UNINSTALL%
; GTK uninstall
%GTK_UNINSTALL%
; Gwyddion uninstall
%GWYDDION_UNINSTALL%
; Remove shortcuts, if any
Delete "$SMPROGRAMS\Gwyddion\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\Gwyddion"
RMDir "$INSTDIR"
SectionEnd
|