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_WELCOMEFINISHPAGE_BITMAP "xbmc-left.bmp"
51 !define MUI_COMPONENTSPAGE_SMALLDESC
52 !define MUI_FINISHPAGE_LINK "Please visit http://xbmc.org for more information."
53 !define MUI_FINISHPAGE_LINK_LOCATION "http://xbmc.org"
54 !define MUI_FINISHPAGE_RUN "$INSTDIR\${APP_NAME}.exe"
55 !define MUI_FINISHPAGE_RUN_NOTCHECKED
56 !define MUI_ABORTWARNING
57 ;--------------------------------
60 !insertmacro MUI_PAGE_WELCOME
61 !insertmacro MUI_PAGE_LICENSE "..\..\LICENSE.GPL"
62 !insertmacro MUI_PAGE_COMPONENTS
63 !insertmacro MUI_PAGE_DIRECTORY
65 ;Start Menu Folder Page Configuration
66 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
67 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${APP_NAME}"
68 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
69 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
71 !insertmacro MUI_PAGE_INSTFILES
72 !insertmacro MUI_PAGE_FINISH
74 !insertmacro MUI_UNPAGE_WELCOME
75 !insertmacro MUI_UNPAGE_CONFIRM
76 UninstPage custom un.UnPageProfile un.UnPageProfileLeave
77 !insertmacro MUI_UNPAGE_INSTFILES
78 !insertmacro MUI_UNPAGE_FINISH
80 ;--------------------------------
83 !insertmacro MUI_LANGUAGE "English"
85 ;--------------------------------
89 InstType "Normal" ; 2.
90 InstType "Minimal" ; 3.
92 ;--------------------------------
95 Section "XBMC" SecXBMC
96 SetShellVarContext current
98 SectionIn 1 2 3 #section is in install type Normal/Full/Minimal
99 ;ADD YOUR OWN FILES HERE...
100 SetOutPath "$INSTDIR"
101 File "${xbmc_root}\Xbmc\XBMC.exe"
102 File "${xbmc_root}\Xbmc\copying.txt"
103 File "${xbmc_root}\Xbmc\LICENSE.GPL"
104 File "${xbmc_root}\Xbmc\*.dll"
105 SetOutPath "$INSTDIR\language"
106 File /r /x *.so "${xbmc_root}\Xbmc\language\*.*"
107 SetOutPath "$INSTDIR\media"
108 File /r /x *.so "${xbmc_root}\Xbmc\media\*.*"
109 SetOutPath "$INSTDIR\sounds"
110 File /r /x *.so "${xbmc_root}\Xbmc\sounds\*.*"
112 RMDir /r $INSTDIR\addons
113 SetOutPath "$INSTDIR\addons"
114 File /r /x skin.touched ${xbmc_root}\Xbmc\addons\*.*
116 ; delete system/python if its there
117 SetOutPath "$INSTDIR\system"
118 IfFileExists $INSTDIR\system\python 0 +2
119 RMDir /r $INSTDIR\system\python
121 File /r /x *.so /x *_d.* /x tcl85g.dll /x tclpip85g.dll /x tk85g.dll "${xbmc_root}\Xbmc\system\*.*"
123 ; delete msvc?90.dll's in INSTDIR, we use the vcredist installer later
124 Delete "$INSTDIR\msvcr90.dll"
125 Delete "$INSTDIR\msvcp90.dll"
127 ;Turn off overwrite to prevent files in xbmc\userdata\ from being overwritten
130 SetOutPath "$INSTDIR\userdata"
131 File /r /x *.so "${xbmc_root}\Xbmc\userdata\*.*"
133 ;Turn on overwrite for rest of install
136 ;Store installation folder
137 WriteRegStr HKCU "Software\${APP_NAME}" "" $INSTDIR
140 WriteUninstaller "$INSTDIR\Uninstall.exe"
142 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
144 SetOutPath "$INSTDIR"
146 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
147 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe" \
148 "" "$INSTDIR\${APP_NAME}.exe" 0 SW_SHOWNORMAL \
149 "" "Start ${APP_NAME}."
150 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\Uninstall.exe" \
151 "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
152 "" "Uninstall ${APP_NAME}."
154 WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit ${APP_NAME} Online.url" "InternetShortcut" "URL" "http://xbmc.org"
155 !insertmacro MUI_STARTMENU_WRITE_END
157 ;add entry to add/remove programs
158 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
159 "DisplayName" "${APP_NAME}"
160 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
161 "UninstallString" "$INSTDIR\uninstall.exe"
162 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
164 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
166 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
167 "InstallLocation" "$INSTDIR"
168 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
169 "DisplayIcon" "$INSTDIR\${APP_NAME}.exe,0"
170 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
171 "Publisher" "Team XBMC"
172 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
173 "HelpLink" "http://xbmc.org/support"
174 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
175 "URLInfoAbout" "http://xbmc.org"
179 SectionGroup "Skins" SecSkins
180 Section "Confluence" SecSkinConfluence
181 SectionIn 1 2 3 #section is in install type Full/Normal/Minimal
183 SetOutPath "$INSTDIR\addons\skin.confluence\"
184 File /r "${xbmc_root}\Xbmc\addons\skin.confluence\*.*"
186 ;skins.nsi is generated by genNsisIncludes.bat
187 !include /nonfatal "skins.nsi"
190 SectionGroup "PVR Addons" SecPvrAddons
191 ;xbmc-pvr-addons.nsi is generated by genNsisIncludes.bat
192 !include /nonfatal "xbmc-pvr-addons.nsi"
195 ;--------------------------------
199 LangString DESC_SecXBMC ${LANG_ENGLISH} "${APP_NAME}"
201 ;Assign language strings to sections
202 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
203 !insertmacro MUI_DESCRIPTION_TEXT ${SecXBMC} $(DESC_SecXBMC)
204 !insertmacro MUI_FUNCTION_DESCRIPTION_END
206 ;--------------------------------
209 Var UnPageProfileDialog
210 Var UnPageProfileCheckbox
211 Var UnPageProfileCheckbox_State
212 Var UnPageProfileEditBox
214 Function un.UnPageProfile
215 !insertmacro MUI_HEADER_TEXT "Uninstall ${APP_NAME}" "Remove ${APP_NAME}'s profile folder from your computer."
216 nsDialogs::Create /NOUNLOAD 1018
217 Pop $UnPageProfileDialog
219 ${If} $UnPageProfileDialog == error
223 ${NSD_CreateLabel} 0 0 100% 12u "Do you want to delete the profile folder?"
226 ${NSD_CreateText} 0 13u 100% 12u "$APPDATA\${APP_NAME}\"
227 Pop $UnPageProfileEditBox
228 SendMessage $UnPageProfileEditBox ${EM_SETREADONLY} 1 0
230 ${NSD_CreateLabel} 0 46u 100% 24u "Leave unchecked to keep the profile folder for later use or check to delete the profile folder."
233 ${NSD_CreateCheckbox} 0 71u 100% 8u "Yes, also delete the profile folder."
234 Pop $UnPageProfileCheckbox
240 Function un.UnPageProfileLeave
241 ${NSD_GetState} $UnPageProfileCheckbox $UnPageProfileCheckbox_State
246 SetShellVarContext current
248 ;ADD YOUR OWN FILES HERE...
249 Delete "$INSTDIR\${APP_NAME}.exe"
250 Delete "$INSTDIR\copying.txt"
251 Delete "$INSTDIR\known_issues.txt"
252 Delete "$INSTDIR\LICENSE.GPL"
253 Delete "$INSTDIR\glew32.dll"
254 Delete "$INSTDIR\SDL.dll"
255 Delete "$INSTDIR\zlib1.dll"
256 Delete "$INSTDIR\xbmc.log"
257 Delete "$INSTDIR\xbmc.old.log"
258 Delete "$INSTDIR\python26.dll"
259 Delete "$INSTDIR\libcdio-*.dll"
260 Delete "$INSTDIR\libiconv-2.dll"
261 RMDir /r "$INSTDIR\language"
262 RMDir /r "$INSTDIR\media"
263 RMDir /r "$INSTDIR\plugins"
264 RMDir /r "$INSTDIR\scripts"
265 RMDir /r "$INSTDIR\skin"
266 RMDir /r "$INSTDIR\sounds"
267 RMDir /r "$INSTDIR\system"
268 RMDir /r "$INSTDIR\visualisations"
269 RMDir /r "$INSTDIR\addons"
270 RMDir /r "$INSTDIR\web"
271 RMDir /r "$INSTDIR\cache"
273 Delete "$INSTDIR\Uninstall.exe"
275 ;Uninstall User Data if option is checked, otherwise skip
276 ${If} $UnPageProfileCheckbox_State == ${BST_CHECKED}
277 RMDir /r "$INSTDIR\userdata"
279 RMDir /r "$APPDATA\${APP_NAME}\"
281 ;Even if userdata is kept in %appdata%\xbmc\userdata, the $INSTDIR\userdata should be cleaned up on uninstall if not used
282 ;If guisettings.xml exists in the XBMC\userdata directory, do not delete XBMC\userdata directory
283 ;If that file does not exists, then delete that folder and $INSTDIR
284 IfFileExists $INSTDIR\userdata\guisettings.xml +3
285 RMDir /r "$INSTDIR\userdata"
290 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
291 Delete "$SMPROGRAMS\$StartMenuFolder\${APP_NAME}.lnk"
292 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall ${APP_NAME}.lnk"
293 Delete "$SMPROGRAMS\$StartMenuFolder\Visit ${APP_NAME} Online.url"
294 RMDir "$SMPROGRAMS\$StartMenuFolder"
295 DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
297 DeleteRegKey /ifempty HKCU "Software\${APP_NAME}"
301 ;--------------------------------
302 ;vs redist installer Section
304 Section "Microsoft Visual C++ 2008/2010 Redistributable Package (x86)" SEC_VCREDIST
306 SectionIn 1 2 #section is in install type Full/Normal and when not installed
308 DetailPrint "Running VS Redist Setup..."
311 SetOutPath "$TEMP\vc2008"
312 File "${xbmc_root}\..\dependencies\vcredist\2008\vcredist_x86.exe"
313 ExecWait '"$TEMP\vc2008\vcredist_x86.exe" /q' $VSRedistSetupError
314 RMDir /r "$TEMP\vc2008"
317 SetOutPath "$TEMP\vc2010"
318 File "${xbmc_root}\..\dependencies\vcredist\2010\vcredist_x86.exe"
319 DetailPrint "Running VS Redist Setup..."
320 ExecWait '"$TEMP\vc2010\vcredist_x86.exe" /q' $VSRedistSetupError
321 RMDir /r "$TEMP\vc2010"
323 DetailPrint "Finished VS Redist Setup"
324 SetOutPath "$INSTDIR"
327 ;--------------------------------
328 ;DirectX webinstaller Section
330 !if "${xbmc_target}" == "dx"
331 !define DXVERSIONDLL "$SYSDIR\D3DX9_43.dll"
333 Section "DirectX Install" SEC_DIRECTX
335 SectionIn 1 2 #section is in install type Full/Normal and when not installed
337 DetailPrint "Running DirectX Setup..."
339 SetOutPath "$TEMP\dxsetup"
340 File "${xbmc_root}\..\dependencies\dxsetup\dsetup32.dll"
341 File "${xbmc_root}\..\dependencies\dxsetup\DSETUP.dll"
342 File "${xbmc_root}\..\dependencies\dxsetup\dxdllreg_x86.cab"
343 File "${xbmc_root}\..\dependencies\dxsetup\DXSETUP.exe"
344 File "${xbmc_root}\..\dependencies\dxsetup\dxupdate.cab"
345 File "${xbmc_root}\..\dependencies\dxsetup\Jun2010_D3DCompiler_43_x86.cab"
346 File "${xbmc_root}\..\dependencies\dxsetup\Jun2010_d3dx9_43_x86.cab"
347 ExecWait '"$TEMP\dxsetup\dxsetup.exe" /silent' $DirectXSetupError
348 RMDir /r "$TEMP\dxsetup"
349 SetOutPath "$INSTDIR"
351 DetailPrint "Finished DirectX Setup"
355 Section "-Check DirectX installation" SEC_DIRECTXCHECK
357 IfFileExists ${DXVERSIONDLL} +2 0
358 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."
363 ${IfNot} ${AtLeastWinVista}
364 MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Windows Vista or above required.$\nThis program can not be run on Windows XP"
367 # set section 'SEC_DIRECTX' as selected and read-only if required dx version not found
368 IfFileExists ${DXVERSIONDLL} +3 0
369 IntOp $0 ${SF_SELECTED} | ${SF_RO}
370 SectionSetFlags ${SEC_DIRECTX} $0