Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1452 | chris | 1 | ; Script generated by the HM NIS Edit Script Wizard. |
| 2 | RequestExecutionLevel user |
||
| 3 | |||
| 4 | !include x64.nsh |
||
| 5 | !include WordFunc.nsh |
||
| 6 | !insertmacro VersionCompare |
||
| 7 | !include LogicLib.nsh |
||
| 8 | |||
| 9 | SetCompressor /SOLID lzma |
||
| 10 | |||
| 11 | ; HM NIS Edit Wizard helper defines |
||
| 12 | !define PRODUCT_NAME "OpenTK" |
||
| 13 | !define PRODUCT_VERSION "1.0" ; To be replaced by Build.exe |
||
| 14 | ;!define PRODUCT_VERSION_REVISION "{{revision}}" ; To be replaced by Build.exe |
||
| 15 | ;!define PRODUCT_VERSION_EXTRA "{{extra}}" ; To be replaced by Build.exe |
||
| 16 | !define PRODUCT_PUBLISHER "The Open Toolkit team" |
||
| 17 | !define PRODUCT_WEB_SITE "http://www.opentk.com" |
||
| 18 | !define PRODUCT_UNINST_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" |
||
| 19 | !define DOTNET20_PUBLIC_ASSEMBLIES_KEY "SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\${PRODUCT_NAME} ${PRODUCT_VERSION}" |
||
| 20 | |||
| 21 | !define MULTIUSER_EXECUTIONLEVEL User |
||
| 22 | !define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER |
||
| 23 | !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "SHELL_CONTEXT" |
||
| 24 | !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "InstallDir" |
||
| 25 | !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "SHELL_CONTEXT" |
||
| 26 | !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "InstallDir" |
||
| 27 | !define MULTIUSER_INSTALLMODE_INSTDIR "${PRODUCT_NAME}\${PRODUCT_VERSION}" |
||
| 28 | ;!include MultiUser.nsh ; Doesn't really do what we need to (goes to AppData instead of Documents, no x64 support) |
||
| 29 | |||
| 30 | ; MUI 1.67 compatible ------ |
||
| 31 | !include "MUI.nsh" |
||
| 32 | |||
| 33 | ; MUI Settings |
||
| 34 | !define MUI_ABORTWARNING |
||
| 35 | !define MUI_ICON "..\..\Source\Examples\Resources\App.ico" |
||
| 36 | !define MUI_UNICON "..\..\Source\Examples\Resources\App.ico" |
||
| 37 | |||
| 38 | ; Language Selection Dialog Settings |
||
| 39 | !define MUI_LANGDLL_REGISTRY_ROOT "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" |
||
| 40 | !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" |
||
| 41 | !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language" |
||
| 42 | |||
| 43 | ; Welcome page |
||
| 44 | ;!insertmacro MUI_PAGE_WELCOME |
||
| 45 | ; License page; |
||
| 46 | !insertmacro MUI_PAGE_LICENSE "..\..\Documentation\License.txt" |
||
| 47 | ; Directory page |
||
| 48 | !insertmacro MUI_PAGE_DIRECTORY |
||
| 49 | ; Components page |
||
| 50 | !insertmacro MUI_PAGE_COMPONENTS |
||
| 51 | ; Instfiles page |
||
| 52 | !insertmacro MUI_PAGE_INSTFILES |
||
| 53 | ; Finish page |
||
| 54 | !insertmacro MUI_PAGE_FINISH |
||
| 55 | |||
| 56 | ; Uninstaller pages |
||
| 57 | !insertmacro MUI_UNPAGE_INSTFILES |
||
| 58 | |||
| 59 | ; Language files |
||
| 60 | !insertmacro MUI_LANGUAGE "English" |
||
| 61 | |||
| 62 | ; Reserve files |
||
| 63 | !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS |
||
| 64 | |||
| 65 | ; MUI END ------ |
||
| 66 | |||
| 67 | Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" |
||
| 68 | OutFile "opentk.exe" |
||
| 69 | InstallDir "${MULTIUSER_INSTALLMODE_INSTDIR}" |
||
| 70 | ShowInstDetails show |
||
| 71 | ShowUnInstDetails show |
||
| 72 | |||
| 73 | Function .onInit |
||
| 74 | StrCpy $INSTDIR "$DOCUMENTS\${MULTIUSER_INSTALLMODE_INSTDIR}" |
||
| 75 | !insertmacro MUI_LANGDLL_DISPLAY |
||
| 76 | FunctionEnd |
||
| 77 | |||
| 78 | ; The "" makes the section hidden. |
||
| 79 | Section "" SecUninstallPrevious |
||
| 80 | |||
| 81 | Call UninstallPrevious |
||
| 82 | |||
| 83 | SectionEnd |
||
| 84 | |||
| 85 | Function UninstallPrevious |
||
| 86 | |||
| 87 | ; Check for uninstaller. |
||
| 88 | ReadRegStr $R0 ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" |
||
| 89 | ReadRegStr $R1 ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "InstallDir" |
||
| 90 | |||
| 91 | ${If} $R0 == "" |
||
| 92 | Goto Done |
||
| 93 | ${EndIf} |
||
| 94 | |||
| 95 | DetailPrint "Removing previous installation." |
||
| 96 | |||
| 97 | ; Run the uninstaller silently. |
||
| 98 | ; The "if" is necessary becaused older installer versions |
||
| 99 | ; did not set "InstallDir". |
||
| 100 | CopyFiles "$R0" "$TEMP\uninst.exe" |
||
| 101 | ${If} $R1 != "" |
||
| 102 | ExecWait '$TEMP\uninst.exe /S _?=$R1' |
||
| 103 | ${Else} |
||
| 104 | Push $R0 |
||
| 105 | Call GetParent |
||
| 106 | Pop $R0 |
||
| 107 | ExecWait '$TEMP\uninst.exe /S _?=$R0' |
||
| 108 | ${EndIf} |
||
| 109 | |||
| 110 | Done: |
||
| 111 | |||
| 112 | FunctionEnd |
||
| 113 | |||
| 114 | ; GetParent |
||
| 115 | ; input, top of stack (e.g. C:\Program Files\Poop) |
||
| 116 | ; output, top of stack (replaces, with e.g. C:\Program Files) |
||
| 117 | ; modifies no other variables. |
||
| 118 | ; |
||
| 119 | ; Usage: |
||
| 120 | ; Push "C:\Program Files\Directory\Whatever" |
||
| 121 | ; Call GetParent |
||
| 122 | ; Pop $R0 |
||
| 123 | ; ; at this point $R0 will equal "C:\Program Files\Directory" |
||
| 124 | Function GetParent |
||
| 125 | |||
| 126 | Exch $R0 |
||
| 127 | Push $R1 |
||
| 128 | Push $R2 |
||
| 129 | Push $R3 |
||
| 130 | |||
| 131 | StrCpy $R1 0 |
||
| 132 | StrLen $R2 $R0 |
||
| 133 | |||
| 134 | loop: |
||
| 135 | IntOp $R1 $R1 + 1 |
||
| 136 | IntCmp $R1 $R2 get 0 get |
||
| 137 | StrCpy $R3 $R0 1 -$R1 |
||
| 138 | StrCmp $R3 "\" get |
||
| 139 | Goto loop |
||
| 140 | |||
| 141 | get: |
||
| 142 | StrCpy $R0 $R0 -$R1 |
||
| 143 | |||
| 144 | Pop $R3 |
||
| 145 | Pop $R2 |
||
| 146 | Pop $R1 |
||
| 147 | Exch $R0 |
||
| 148 | |||
| 149 | FunctionEnd |
||
| 150 | |||
| 151 | Section "Core library" SEC01 |
||
| 152 | SectionIn RO |
||
| 153 | |||
| 154 | ${If} $INSTDIR == $PROGRAMFILES |
||
| 155 | ${OrIf} $INSTDIR == $DOCUMENTS |
||
| 156 | ${OrIf} $INSTDIR == $DESKTOP |
||
| 157 | ${OrIf} $INSTDIR == $WINDIR |
||
| 158 | ${OrIf} $INSTDIR == $SYSDIR |
||
| 159 | ${OrIf} $INSTDIR == $PROFILE |
||
| 160 | MessageBox MB_OK "Cannot install directly under $INSTDIR. Please specify a subfolder." |
||
| 161 | Abort |
||
| 162 | ${EndIf} |
||
| 163 | |||
| 164 | SetOutPath $INSTDIR |
||
| 165 | File /r /x *.vshost.exe /x *.vshost.exe.manifest /x *.log ..\..\Binaries |
||
| 166 | File /r /x .svn /x obj /x Source /x Source\*.* ..\..\Documentation |
||
| 167 | SetOutPath $INSTDIR\Source\Examples |
||
| 168 | File /r /x .svn /x obj /x *.snk /x *.user /x *.pidb /x html /x latex /x OpenTK*.xml ..\..\Source\Examples |
||
| 169 | SectionEnd |
||
| 170 | |||
| 171 | Section "Source code" SEC02 |
||
| 172 | SetOutPath $INSTDIR |
||
| 173 | File /r /x .svn /x obj /x *.snk /x *.user /x *.pidb /x html /x latex /x OpenTK*.xml ..\..\Source |
||
| 174 | File /r /x .svn ..\..\*.csproj |
||
| 175 | File ..\..\*.sln |
||
| 176 | File ..\..\OpenTK.snk |
||
| 177 | File /r /x .svn /x obj /x opentk /x opentk-actual.* /x *.exe /x *.msi /x *.deb /x *.rpm /x *.zip ..\..\Installers |
||
| 178 | SectionEnd |
||
| 179 | |||
| 180 | Section "OpenAL drivers" SEC03 |
||
| 181 | SetOutPath $INSTDIR\Installers\Dependencies |
||
| 182 | NSISdl::download /TIMEOUT=5000 http://www.opentk.net/files/dependencies/win32/oalinst.exe oalinst.exe |
||
| 183 | NSISdl::download /TIMEOUT=5000 http://www.opentk.net/files/dependencies/win32/oalinst-license.txt oalinst-license.txt |
||
| 184 | ExecShell "open" '"$INSTDIR\Installers\Dependencies\oalinst.exe"' /S |
||
| 185 | SectionEnd |
||
| 186 | |||
| 187 | Section "NShader plugin (VS2010)" SEC04 |
||
| 188 | SetOutPath $INSTDIR\Installers\Dependencies |
||
| 189 | NSISdl::download /TIMEOUT=5000 http://www.opentk.net/files/dependencies/win32/NShaderVS2010.vsix NShaderVS2010.vsix |
||
| 190 | NSISdl::download /TIMEOUT=5000 http://www.opentk.net/files/dependencies/win32/nshader-license.txt nshader-license.txt |
||
| 191 | ExecShell "open" '"$INSTDIR\Installers\Dependencies\NShaderVS2010.vsix"' |
||
| 192 | SectionEnd |
||
| 193 | |||
| 194 | Section "NShader plugin (VS2008)" SEC05 |
||
| 195 | SetOutPath $INSTDIR\Installers\Dependencies |
||
| 196 | NSISdl::download /TIMEOUT=5000 http://www.opentk.net/files/dependencies/win32/NShaderVS2008.msi NShaderVS2008.msi |
||
| 197 | NSISdl::download /TIMEOUT=5000 http://www.opentk.net/files/dependencies/win32/nshader-license.txt nshader-license.txt |
||
| 198 | ExecShell "open" '"$INSTDIR\Installers\Dependencies\NShaderVS2008.msi"' |
||
| 199 | SectionEnd |
||
| 200 | |||
| 201 | Section -AdditionalIcons |
||
| 202 | SetOutPath $INSTDIR |
||
| 203 | WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" |
||
| 204 | CreateDirectory "$SMPROGRAMS\OpenTK" |
||
| 205 | |||
| 206 | SetOutPath "$INSTDIR\Binaries\OpenTK\Release" ; Make sure the working directory is correct |
||
| 207 | CreateShortCut "$SMPROGRAMS\OpenTK\OpenTK Example Browser.lnk" "$INSTDIR\Binaries\OpenTK\Release\Examples.exe" |
||
| 208 | SetOutPath $INSTDIR |
||
| 209 | |||
| 210 | CreateShortCut "$SMPROGRAMS\OpenTK\Function Reference (PDF).lnk" "$INSTDIR\Documentation\Reference.pdf" |
||
| 211 | CreateShortCut "$SMPROGRAMS\OpenTK\Project Manual (PDF).lnk" "$INSTDIR\Documentation\Manual.pdf" |
||
| 212 | ;CreateShortCut "$SMPROGRAMS\OpenTK\Release Notes.lnk" "$INSTDIR\Documentation\Release.txt" |
||
| 213 | ;CreateShortCut "$SMPROGRAMS\OpenTK\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" |
||
| 214 | SectionEnd |
||
| 215 | |||
| 216 | Section -Post |
||
| 217 | ${If} ${RunningX64} |
||
| 218 | SetRegView 64 |
||
| 219 | ${EndIf} |
||
| 220 | WriteUninstaller "$INSTDIR\uninst.exe" |
||
| 221 | WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" |
||
| 222 | WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "InstallDir" "$INSTDIR" |
||
| 223 | WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" |
||
| 224 | WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" |
||
| 225 | WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" |
||
| 226 | WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" |
||
| 227 | WriteRegStr ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${DOTNET20_PUBLIC_ASSEMBLIES_KEY}" "" "$INSTDIR\Binaries\OpenTK\Release" |
||
| 228 | SectionEnd |
||
| 229 | |||
| 230 | LangString DESC_Section1 ${LANG_ENGLISH} "Installs the Open Toolkit library, documentation and samples." |
||
| 231 | LangString DESC_Section2 ${LANG_ENGLISH} "Installs the source code for the Open Toolkit library." |
||
| 232 | LangString DESC_Section3 ${LANG_ENGLISH} "Installs OpenAL sound drivers from Creative Inc. Required for OpenAL support." |
||
| 233 | LangString DESC_Section4 ${LANG_ENGLISH} "Adds support for GLSL syntax highlighting to Visual Studio 2010. Requires Professional edition or higher." |
||
| 234 | LangString DESC_Section5 ${LANG_ENGLISH} "Adds support for GLSL syntax highlighting to Visual Studio 2008. Requires Professional edition or higher." |
||
| 235 | |||
| 236 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
||
| 237 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_Section1) |
||
| 238 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_Section2) |
||
| 239 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(DESC_Section3) |
||
| 240 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(DESC_Section4) |
||
| 241 | !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $(DESC_Section5) |
||
| 242 | !insertmacro MUI_FUNCTION_DESCRIPTION_END |
||
| 243 | |||
| 244 | Function un.onUninstSuccess |
||
| 245 | HideWindow |
||
| 246 | FunctionEnd |
||
| 247 | |||
| 248 | Function un.onInit |
||
| 249 | !insertmacro MUI_UNGETLANGUAGE |
||
| 250 | IfSilent +3 |
||
| 251 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you wish to completely uninstall $(^Name) and all of its components?" IDYES +2 |
||
| 252 | Abort |
||
| 253 | FunctionEnd |
||
| 254 | |||
| 255 | Section Uninstall |
||
| 256 | ${If} ${RunningX64} |
||
| 257 | SetRegView 64 |
||
| 258 | ${EndIf} |
||
| 259 | |||
| 260 | Delete "$INSTDIR\${PRODUCT_NAME}.url" |
||
| 261 | Delete "$INSTDIR\uninst.exe" |
||
| 262 | |||
| 263 | RMDir /r "$SMPROGRAMS\OpenTK" |
||
| 264 | |||
| 265 | Delete "$INSTDIR\*.sln" |
||
| 266 | Delete "$INSTDIR\Build.exe" |
||
| 267 | Delete "$INSTDIR\*.log" |
||
| 268 | RMDir /r "$INSTDIR\Installers" |
||
| 269 | RMDir /r "$INSTDIR\Source" |
||
| 270 | RMDir /r "$INSTDIR\Documentation" |
||
| 271 | RMDir /r "$INSTDIR\Binaries" |
||
| 272 | RMDir "$INSTDIR" |
||
| 273 | |||
| 274 | |||
| 275 | DeleteRegKey ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${PRODUCT_UNINST_KEY}" |
||
| 276 | DeleteRegKey ${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY} "${DOTNET20_PUBLIC_ASSEMBLIES_KEY}" |
||
| 277 | SetAutoClose true |
||
| 278 | SectionEnd |