panasonic: send out an active source message when the tv started up because it someti...
[deb_libcec.git] / project / libCEC.nsi
... / ...
CommitLineData
1;libCEC installer
2;Copyright (C) 2012 Pulse-Eight Ltd.
3;http://www.pulse-eight.com/
4
5!include "MUI2.nsh"
6!include "nsDialogs.nsh"
7!include "LogicLib.nsh"
8!include "x64.nsh"
9
10Name "Pulse-Eight USB-CEC Adapter"
11OutFile "..\build\libCEC-installer.exe"
12
13XPStyle on
14InstallDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter"
15InstallDirRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter software" ""
16RequestExecutionLevel admin
17Var StartMenuFolder
18Var VSRedistSetupError
19Var VSRedistInstalled
20
21!define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information."
22!define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/"
23!define MUI_ABORTWARNING
24
25!insertmacro MUI_PAGE_WELCOME
26!insertmacro MUI_PAGE_LICENSE "..\COPYING"
27!insertmacro MUI_PAGE_COMPONENTS
28!insertmacro MUI_PAGE_DIRECTORY
29
30!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
31!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Pulse-Eight\USB-CEC Adapter sofware"
32!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
33!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
34
35!insertmacro MUI_PAGE_INSTFILES
36!insertmacro MUI_PAGE_FINISH
37
38!insertmacro MUI_UNPAGE_WELCOME
39!insertmacro MUI_UNPAGE_CONFIRM
40!insertmacro MUI_UNPAGE_INSTFILES
41!insertmacro MUI_UNPAGE_FINISH
42
43!insertmacro MUI_LANGUAGE "English"
44
45InstType "USB-CEC driver & libCEC"
46InstType "USB-CEC driver only"
47InstType "Full installation"
48
49Section "USB-CEC driver" SecDriver
50 SetShellVarContext current
51 SectionIn RO
52 SectionIn 1 2 3
53
54 ; Uninstall the old unsigned software if it's found
55 ReadRegStr $1 HKCU "Software\libCEC" ""
56 ${If} $1 != ""
57 MessageBox MB_OK \
58 "A previous libCEC and USB-CEC driver was found. This update requires the old version to be uninstalled. Press OK to uninstall the old version."
59 ExecWait '"$1\Uninstall.exe" /S _?=$1'
60 Delete "$1\Uninstall.exe"
61 RMDir "$1"
62 ${EndIf}
63
64 ; Delete libcec.dll and libcec.x64.dll from the system directory
65 ; Let a seperate installer do this, when we need it
66 Delete "$SYSDIR\libcec.dll"
67 ${If} ${RunningX64}
68 Delete "$SYSDIR\libcec.x64.dll"
69 ${EndIf}
70
71 ; Copy to the installation directory
72 SetOutPath "$INSTDIR"
73 File "..\AUTHORS"
74 File "..\COPYING"
75
76 ; Copy the driver installer
77 SetOutPath "$INSTDIR\driver"
78 File "..\build\p8-usbcec-driver-installer.exe"
79
80 ;Store installation folder
81 WriteRegStr HKLM "Software\Pulse-Eight\USB-CEC Adapter software" "" $INSTDIR
82
83 ;Create uninstaller
84 WriteUninstaller "$INSTDIR\Uninstall.exe"
85
86 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
87 SetOutPath "$INSTDIR"
88
89 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
90 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk" "$INSTDIR\Uninstall.exe" \
91 "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
92 "" "Uninstall Pulse-Eight USB-CEC Adapter software."
93
94 WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/"
95 !insertmacro MUI_STARTMENU_WRITE_END
96
97 ;add entry to add/remove programs
98 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
99 "DisplayName" "Pulse-Eight USB-CEC Adapter software"
100 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
101 "UninstallString" "$INSTDIR\uninstall.exe"
102 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
103 "NoModify" 1
104 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
105 "NoRepair" 1
106 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
107 "InstallLocation" "$INSTDIR"
108 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
109 "DisplayIcon" "$INSTDIR\cec-client.exe,0"
110 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
111 "Publisher" "Pulse-Eight Limited"
112 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
113 "HelpLink" "http://www.pulse-eight.com/"
114 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
115 "URLInfoAbout" "http://www.pulse-eight.com"
116
117 ;install driver
118 ExecWait '"$INSTDIR\driver\p8-usbcec-driver-installer.exe" /S'
119 Delete "$INSTDIR\driver\p8-usbcec-driver-installer.exe"
120SectionEnd
121
122Section "libCEC" SecLibCec
123 SetShellVarContext current
124 SectionIn 1 3
125
126 ; Copy to the installation directory
127 SetOutPath "$INSTDIR"
128 File "..\ChangeLog"
129 File "..\README"
130 File "..\build\*.dll"
131 SetOutPath "$INSTDIR\x64"
132 File /nonfatal "..\build\x64\*.dll"
133
134 ; Copy to XBMC\system
135 ReadRegStr $1 HKCU "Software\XBMC" ""
136 ${If} $1 != ""
137 SetOutPath "$1\system"
138 File "..\build\libcec.dll"
139 ${EndIf}
140
141 ; Copy the headers
142 SetOutPath "$INSTDIR\include"
143 File /r /x *.so "..\include\cec*.*"
144SectionEnd
145
146Section "CEC debug client" SecCecClient
147 SetShellVarContext current
148 SectionIn 3
149
150 ; Copy to the installation directory
151 SetOutPath "$INSTDIR"
152 File /x p8-usbcec-driver-installer.exe /x cec-config-gui.exe "..\build\*.exe"
153 SetOutPath "$INSTDIR\x64"
154 File /nonfatal /x cec-config-gui.exe "..\build\x64\*.exe"
155
156 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
157 SetOutPath "$INSTDIR"
158
159 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
160 ${If} ${RunningX64}
161 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" "$INSTDIR\x64\cec-client.x64.exe" \
162 "" "$INSTDIR\cec-client.x64.exe" 0 SW_SHOWNORMAL \
163 "" "Start the CEC Test client (x64)."
164 ${Else}
165 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \
166 "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \
167 "" "Start the CEC Test client."
168 ${EndIf}
169 !insertmacro MUI_STARTMENU_WRITE_END
170
171SectionEnd
172
173Section "CEC configuration tool" SecCecConfig
174 SetShellVarContext current
175 SectionIn 1 3
176
177 ; Copy to the installation directory
178 SetOutPath "$INSTDIR"
179 File "..\build\cec-config-gui.exe"
180 SetOutPath "$INSTDIR\x64"
181 File /nonfatal "..\build\x64\cec-config-gui.exe"
182
183 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
184 SetOutPath "$INSTDIR"
185
186 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
187 ${If} ${RunningX64}
188 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Adapter Configuration (x64).lnk" "$INSTDIR\x64\cec-config-gui.exe" \
189 "" "$INSTDIR\x64\cec-config-gui.exe" 0 SW_SHOWNORMAL \
190 "" "Start the CEC Adapter Configuration tool (x64)."
191 ${Else}
192 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Adapter Configuration.lnk" "$INSTDIR\cec-config-gui.exe" \
193 "" "$INSTDIR\cec-config-gui.exe" 0 SW_SHOWNORMAL \
194 "" "Start the CEC Adapter Configuration tool."
195 ${EndIf}
196 !insertmacro MUI_STARTMENU_WRITE_END
197
198SectionEnd
199
200!define REDISTRIBUTABLE_SECTIONNAME "Microsoft Visual C++ 2010 Redistributable Package"
201Section "" SecVCRedist
202 SetShellVarContext current
203 SectionIn 1 3
204
205
206 ${If} $VSRedistInstalled != "Yes"
207 ; Download redistributable
208 SetOutPath "$TEMP\vc20XX"
209 ${If} ${RunningX64}
210 NSISdl::download http://packages.pulse-eight.net/windows/vcredist_x64.exe vcredist_x64.exe
211 ExecWait '"$TEMP\vc20XX\vcredist_x64.exe" /q' $VSRedistSetupError
212 ${Else}
213 NSISdl::download http://packages.pulse-eight.net/windows/vcredist_x86.exe vcredist_x86.exe
214 ExecWait '"$TEMP\vc20XX\vcredist_x86.exe" /q' $VSRedistSetupError
215 ${Endif}
216 RMDIR /r "$TEMP\vc20XX"
217 ${Endif}
218
219SectionEnd
220
221Function .onInit
222
223 ; SP0 x86
224 ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{196BB40D-1578-3D01-B289-BEFC77A11A1E}" "Version"
225 ${If} $1 != ""
226 StrCpy $VSRedistInstalled "Yes"
227 ${Endif}
228
229 ; SP0 x64
230 ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}" "Version"
231 ${If} $1 != ""
232 StrCpy $VSRedistInstalled "Yes"
233 ${Endif}
234
235 ; SP0 ia64
236 ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C1A35166-4301-38E9-BA67-02823AD72A1B}" "Version"
237 ${If} $1 != ""
238 StrCpy $VSRedistInstalled "Yes"
239 ${Endif}
240
241 ; SP1 x86
242 ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}" "Version"
243 ${If} $1 != ""
244 StrCpy $VSRedistInstalled "Yes"
245 ${Endif}
246
247 ; SP1 x64
248 ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1D8E6291-B0D5-35EC-8441-6616F567A0F7}" "Version"
249 ${If} $1 != ""
250 StrCpy $VSRedistInstalled "Yes"
251 ${Endif}
252
253 ; SP1 ia64
254 ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{88C73C1C-2DE5-3B01-AFB8-B46EF4AB41CD}" "Version"
255 ${If} $1 != ""
256 StrCpy $VSRedistInstalled "Yes"
257 ${Endif}
258
259 ${If} $VSRedistInstalled == "Yes"
260 !insertMacro UnSelectSection ${SecVCRedist}
261 SectionSetText ${SecVCRedist} ""
262 ${Else}
263 !insertMacro SelectSection ${SecVCRedist}
264 SectionSetText ${SecVCRedist} "${REDISTRIBUTABLE_SECTIONNAME}"
265 ${Endif}
266
267FunctionEnd
268
269;--------------------------------
270;Uninstaller Section
271
272Section "Uninstall"
273
274 SetShellVarContext current
275
276 Delete "$INSTDIR\AUTHORS"
277 Delete "$INSTDIR\*.exe"
278 Delete "$INSTDIR\ChangeLog"
279 Delete "$INSTDIR\COPYING"
280 Delete "$INSTDIR\*.dll"
281 Delete "$INSTDIR\*.lib"
282 Delete "$INSTDIR\x64\*.dll"
283 Delete "$INSTDIR\x64\*.lib"
284 Delete "$INSTDIR\x64\*.exe"
285 Delete "$INSTDIR\README"
286 Delete "$SYSDIR\libcec.dll"
287 ${If} ${RunningX64}
288 Delete "$SYSDIR\libcec.x64.dll"
289 ${EndIf}
290
291 ; Uninstall the driver
292 ReadRegStr $1 HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" ""
293 ${If} $1 != ""
294 ExecWait '"$1\Uninstall.exe" /S _?=$1'
295 ${EndIf}
296
297 RMDir /r "$INSTDIR\include"
298 Delete "$INSTDIR\Uninstall.exe"
299 RMDir /r "$INSTDIR"
300 RMDir "$PROGRAMFILES\Pulse-Eight"
301
302 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
303 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Adapter Configuration.lnk"
304 ${If} ${RunningX64}
305 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Adapter Configuration (x64).lnk"
306 ${EndIf}
307 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
308 ${If} ${RunningX64}
309 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk"
310 ${EndIf}
311 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk"
312 Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url"
313 RMDir "$SMPROGRAMS\$StartMenuFolder"
314
315 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware"
316 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver"
317 DeleteRegKey /ifempty HKLM "Software\Pulse-Eight\USB-CEC Adapter software"
318 DeleteRegKey /ifempty HKLM "Software\Pulse-Eight"
319SectionEnd