1 ;XBMC for Windows install script
2 ;Copyright (C) 2005-2013 Team XBMC
7 ;--------------------------------
11 !include "nsDialogs.nsh"
12 !include "LogicLib.nsh"
15 ;--------------------------------
16 ;define global used name
17 !define APP_NAME "XBMC"
19 ;--------------------------------
24 OutFile "${APP_NAME}Setup-${xbmc_revision}-${xbmc_branch}.exe"
28 ;Default installation folder
29 InstallDir "$PROGRAMFILES\${APP_NAME}"
31 ;Get installation folder from registry if available
32 InstallDirRegKey HKCU "Software\${APP_NAME}" ""
34 ;Request application privileges for Windows Vista
35 RequestExecutionLevel admin
37 ;--------------------------------
43 Var VSRedistSetupError
45 ;--------------------------------
48 !define MUI_HEADERIMAGE
49 !define MUI_ICON "..\..\xbmc\win32\xbmc.ico"
50 ;!define MUI_HEADERIMAGE_BITMAP "xbmc-banner.bmp"
51 ;!define MUI_HEADERIMAGE_RIGHT
52 !define MUI_WELCOMEFINISHPAGE_BITMAP "xbmc-left.bmp"
53 !define MUI_COMPONENTSPAGE_SMALLDESC
54 ;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\webapps\ROOT\RELEASE-NOTES.txt"
55 !define MUI_FINISHPAGE_LINK "Please visit http://xbmc.org for more information."
56 !define MUI_FINISHPAGE_LINK_LOCATION "http://xbmc.org"
57 !define MUI_FINISHPAGE_RUN "$INSTDIR\${APP_NAME}.exe"
58 !define MUI_FINISHPAGE_RUN_NOTCHECKED
59 !define MUI_ABORTWARNING
60 ;--------------------------------
63 !insertmacro MUI_PAGE_WELCOME
64 !insertmacro MUI_PAGE_LICENSE "..\..\LICENSE.GPL"
65 !insertmacro MUI_PAGE_COMPONENTS
66 !insertmacro MUI_PAGE_DIRECTORY
68 ;Start Menu Folder Page Configuration
69 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
70 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${APP_NAME}"
71 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
72 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
74 !insertmacro MUI_PAGE_INSTFILES
75 !insertmacro MUI_PAGE_FINISH
77 !insertmacro MUI_UNPAGE_WELCOME
78 !insertmacro MUI_UNPAGE_CONFIRM
79 UninstPage custom un.UnPageProfile un.UnPageProfileLeave
80 !insertmacro MUI_UNPAGE_INSTFILES
81 !insertmacro MUI_UNPAGE_FINISH
83 ;--------------------------------
86 !insertmacro MUI_LANGUAGE "English"
88 ;--------------------------------
92 InstType "Normal" ; 2.
93 InstType "Minimal" ; 3.
95 ;--------------------------------
98 Section "XBMC" SecXBMC
99 SetShellVarContext current
101 SectionIn 1 2 3 #section is in install type Normal/Full/Minimal
102 ;ADD YOUR OWN FILES HERE...
103 SetOutPath "$INSTDIR"
104 File "${xbmc_root}\Xbmc\XBMC.exe"
105 File "${xbmc_root}\Xbmc\copying.txt"
106 File "${xbmc_root}\Xbmc\LICENSE.GPL"
107 File "${xbmc_root}\Xbmc\*.dll"
108 SetOutPath "$INSTDIR\language"
109 File /r /x *.so "${xbmc_root}\Xbmc\language\*.*"
110 SetOutPath "$INSTDIR\media"
111 File /r /x *.so "${xbmc_root}\Xbmc\media\*.*"
112 SetOutPath "$INSTDIR\sounds"
113 File /r /x *.so "${xbmc_root}\Xbmc\sounds\*.*"
114 SetOutPath "$INSTDIR\system"
116 ; delete system/python if its there
117 IfFileExists $INSTDIR\system\python 0 +2
118 RMDir /r $INSTDIR\system\python
120 File /r /x *.so /x mplayer /x *_d.* /x tcl85g.dll /x tclpip85g.dll /x tk85g.dll "${xbmc_root}\Xbmc\system\*.*"
122 ; delete msvc?90.dll's in INSTDIR, we use the vcredist installer later
123 Delete "$INSTDIR\msvcr90.dll"
124 Delete "$INSTDIR\msvcp90.dll"
126 ;Turn off overwrite to prevent files in xbmc\userdata\ from being overwritten
129 SetOutPath "$INSTDIR\userdata"
130 File /r /x *.so "${xbmc_root}\Xbmc\userdata\*.*"
132 ;Turn on overwrite for rest of install
134 RMDir /r $INSTDIR\addons
135 SetOutPath "$INSTDIR\addons"
136 File /r /x skin.touched ${xbmc_root}\Xbmc\addons\*.*
137 ;SetOutPath "$INSTDIR\web"
138 ;File /r "${xbmc_root}\Xbmc\web\*.*"
140 ;Store installation folder
141 WriteRegStr HKCU "Software\${APP_NAME}" "" $INSTDIR
144 WriteUninstaller "$INSTDIR\Uninstall.exe"
146 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
148 SetOutPath "$INSTDIR"
150 ; delete old windowed link
151 Delete "$SMPROGRAMS\$StartMenuFolder\XBMC (Windowed).lnk"
153 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
154 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe" \
155 "" "$INSTDIR\${APP_NAME}.exe" 0 SW_SHOWNORMAL \
156 "" "Start ${APP_NAME}."
157 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\Uninstall.exe" \
158 "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
159 "" "Uninstall ${APP_NAME}."
161 WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit ${APP_NAME} Online.url" "InternetShortcut" "URL" "http://xbmc.org"
162 !insertmacro MUI_STARTMENU_WRITE_END
164 ;add entry to add/remove programs
165 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
166 "DisplayName" "${APP_NAME}"
167 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
168 "UninstallString" "$INSTDIR\uninstall.exe"
169 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
171 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
173 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
174 "InstallLocation" "$INSTDIR"
175 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
176 "DisplayIcon" "$INSTDIR\${APP_NAME}.exe,0"
177 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
178 "Publisher" "Team XBMC"
179 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
180 "HelpLink" "http://xbmc.org/support"
181 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
182 "URLInfoAbout" "http://xbmc.org"
186 SectionGroup "Skins" SecSkins
187 Section "Confluence" SecSkinConfluence
188 SectionIn 1 2 3 #section is in install type Full/Normal/Minimal
190 SetOutPath "$INSTDIR\addons\skin.confluence\"
191 File /r "${xbmc_root}\Xbmc\addons\skin.confluence\*.*"
193 ;skins.nsi is generated by genNsisIncludes.bat
194 !include /nonfatal "skins.nsi"
197 ;SectionGroup "Scripts" SecScripts
198 ;scripts.nsi is generated by genNsisIncludes.bat
199 !include /nonfatal "scripts.nsi"
202 ;SectionGroup "Plugins" SecPlugins
203 ;plugins.nsi is generated by genNsisIncludes.bat
204 !include /nonfatal "plugins.nsi"
207 SectionGroup "PVR Addons" SecPvrAddons
208 ;xbmc-pvr-addons.nsi is generated by genNsisIncludes.bat
209 !include /nonfatal "xbmc-pvr-addons.nsi"
212 ;--------------------------------
216 LangString DESC_SecXBMC ${LANG_ENGLISH} "${APP_NAME}"
218 ;Assign language strings to sections
219 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
220 !insertmacro MUI_DESCRIPTION_TEXT ${SecXBMC} $(DESC_SecXBMC)
221 !insertmacro MUI_FUNCTION_DESCRIPTION_END
223 ;--------------------------------
226 Var UnPageProfileDialog
227 Var UnPageProfileCheckbox
228 Var UnPageProfileCheckbox_State
229 Var UnPageProfileEditBox
231 Function un.UnPageProfile
232 !insertmacro MUI_HEADER_TEXT "Uninstall ${APP_NAME}" "Remove ${APP_NAME}'s profile folder from your computer."
233 nsDialogs::Create /NOUNLOAD 1018
234 Pop $UnPageProfileDialog
236 ${If} $UnPageProfileDialog == error
240 ${NSD_CreateLabel} 0 0 100% 12u "Do you want to delete the profile folder?"
243 ${NSD_CreateText} 0 13u 100% 12u "$APPDATA\${APP_NAME}\"
244 Pop $UnPageProfileEditBox
245 SendMessage $UnPageProfileEditBox ${EM_SETREADONLY} 1 0
247 ${NSD_CreateLabel} 0 46u 100% 24u "Leave unchecked to keep the profile folder for later use or check to delete the profile folder."
250 ${NSD_CreateCheckbox} 0 71u 100% 8u "Yes, also delete the profile folder."
251 Pop $UnPageProfileCheckbox
257 Function un.UnPageProfileLeave
258 ${NSD_GetState} $UnPageProfileCheckbox $UnPageProfileCheckbox_State
263 SetShellVarContext current
265 ;ADD YOUR OWN FILES HERE...
266 Delete "$INSTDIR\${APP_NAME}.exe"
267 Delete "$INSTDIR\copying.txt"
268 Delete "$INSTDIR\known_issues.txt"
269 Delete "$INSTDIR\LICENSE.GPL"
270 Delete "$INSTDIR\glew32.dll"
271 Delete "$INSTDIR\SDL.dll"
272 Delete "$INSTDIR\zlib1.dll"
273 Delete "$INSTDIR\xbmc.log"
274 Delete "$INSTDIR\xbmc.old.log"
275 Delete "$INSTDIR\python26.dll"
276 Delete "$INSTDIR\libcdio-*.dll"
277 Delete "$INSTDIR\libiconv-2.dll"
278 RMDir /r "$INSTDIR\language"
279 RMDir /r "$INSTDIR\media"
280 RMDir /r "$INSTDIR\plugins"
281 RMDir /r "$INSTDIR\scripts"
282 RMDir /r "$INSTDIR\skin"
283 RMDir /r "$INSTDIR\sounds"
284 RMDir /r "$INSTDIR\system"
285 RMDir /r "$INSTDIR\visualisations"
286 RMDir /r "$INSTDIR\addons"
287 RMDir /r "$INSTDIR\web"
288 RMDir /r "$INSTDIR\cache"
290 Delete "$INSTDIR\Uninstall.exe"
292 ;Uninstall User Data if option is checked, otherwise skip
293 ${If} $UnPageProfileCheckbox_State == ${BST_CHECKED}
294 RMDir /r "$INSTDIR\userdata"
296 RMDir /r "$APPDATA\${APP_NAME}\"
298 ;Even if userdata is kept in %appdata%\xbmc\userdata, the $INSTDIR\userdata should be cleaned up on uninstall if not used
299 ;If guisettings.xml exists in the XBMC\userdata directory, do not delete XBMC\userdata directory
300 ;If that file does not exists, then delete that folder and $INSTDIR
301 IfFileExists $INSTDIR\userdata\guisettings.xml +3
302 RMDir /r "$INSTDIR\userdata"
307 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
308 Delete "$SMPROGRAMS\$StartMenuFolder\${APP_NAME}.lnk"
309 Delete "$SMPROGRAMS\$StartMenuFolder\XBMC (Portable).lnk"
310 Delete "$SMPROGRAMS\$StartMenuFolder\XBMC (Windowed).lnk"
311 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall ${APP_NAME}.lnk"
312 Delete "$SMPROGRAMS\$StartMenuFolder\Visit ${APP_NAME} Online.url"
313 RMDir "$SMPROGRAMS\$StartMenuFolder"
314 DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
316 DeleteRegKey /ifempty HKCU "Software\${APP_NAME}"
320 ;--------------------------------
321 ;vs redist installer Section
323 Section "Microsoft Visual C++ 2008/2010 Redistributable Package (x86)" SEC_VCREDIST
325 SectionIn 1 2 #section is in install type Full/Normal and when not installed
327 DetailPrint "Running VS Redist Setup..."
330 SetOutPath "$TEMP\vc2008"
331 File "${xbmc_root}\..\dependencies\vcredist\2008\vcredist_x86.exe"
332 ExecWait '"$TEMP\vc2008\vcredist_x86.exe" /q' $VSRedistSetupError
333 RMDir /r "$TEMP\vc2008"
336 SetOutPath "$TEMP\vc2010"
337 File "${xbmc_root}\..\dependencies\vcredist\2010\vcredist_x86.exe"
338 DetailPrint "Running VS Redist Setup..."
339 ExecWait '"$TEMP\vc2010\vcredist_x86.exe" /q' $VSRedistSetupError
340 RMDir /r "$TEMP\vc2010"
342 DetailPrint "Finished VS Redist Setup"
343 SetOutPath "$INSTDIR"
346 ;--------------------------------
347 ;DirectX webinstaller Section
349 !if "${xbmc_target}" == "dx"
350 !define DXVERSIONDLL "$SYSDIR\D3DX9_43.dll"
352 Section "DirectX Install" SEC_DIRECTX
354 SectionIn 1 2 #section is in install type Full/Normal and when not installed
356 DetailPrint "Running DirectX Setup..."
358 SetOutPath "$TEMP\dxsetup"
359 File "${xbmc_root}\..\dependencies\dxsetup\dsetup32.dll"
360 File "${xbmc_root}\..\dependencies\dxsetup\DSETUP.dll"
361 File "${xbmc_root}\..\dependencies\dxsetup\dxdllreg_x86.cab"
362 File "${xbmc_root}\..\dependencies\dxsetup\DXSETUP.exe"
363 File "${xbmc_root}\..\dependencies\dxsetup\dxupdate.cab"
364 File "${xbmc_root}\..\dependencies\dxsetup\Jun2010_D3DCompiler_43_x86.cab"
365 File "${xbmc_root}\..\dependencies\dxsetup\Jun2010_d3dx9_43_x86.cab"
366 ExecWait '"$TEMP\dxsetup\dxsetup.exe" /silent' $DirectXSetupError
367 RMDir /r "$TEMP\dxsetup"
368 SetOutPath "$INSTDIR"
370 DetailPrint "Finished DirectX Setup"
374 Section "-Check DirectX installation" SEC_DIRECTXCHECK
376 IfFileExists ${DXVERSIONDLL} +2 0
377 MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "DirectX9 wasn't installed properly.$\nPlease download the DirectX End-User Runtime from Microsoft and install it again."
382 ${IfNot} ${AtLeastWinVista}
383 MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Windows Vista or above required.$\nThis program can not be run on Windows XP"
386 # set section 'SEC_DIRECTX' as selected and read-only if required dx version not found
387 IfFileExists ${DXVERSIONDLL} +3 0
388 IntOp $0 ${SF_SELECTED} | ${SF_RO}
389 SectionSetFlags ${SEC_DIRECTX} $0