cec: added "driver only" and "driver + libcec" sections to the installer
[deb_libcec.git] / project / libCEC.nsi
CommitLineData
09054f70 1;libCEC installer
d4954fb7 2;Copyright (C) 2012 Pulse-Eight Ltd.
09054f70
LOK
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 "libCEC"
4d760b54 11OutFile "..\build\libCEC-installer.exe"
09054f70
LOK
12
13XPStyle on
14InstallDir "$PROGRAMFILES\libCEC"
15InstallDirRegKey HKCU "Software\libCEC" ""
16RequestExecutionLevel admin
17Var StartMenuFolder
18
dfb08039 19!define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information."
09054f70
LOK
20!define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/"
21!define MUI_ABORTWARNING
22
23!insertmacro MUI_PAGE_WELCOME
24!insertmacro MUI_PAGE_LICENSE "..\COPYING"
d4954fb7 25!insertmacro MUI_PAGE_COMPONENTS
09054f70
LOK
26!insertmacro MUI_PAGE_DIRECTORY
27
28!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
29!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\libCEC"
30!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
31!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
32
33!insertmacro MUI_PAGE_INSTFILES
34!insertmacro MUI_PAGE_FINISH
35
36!insertmacro MUI_UNPAGE_WELCOME
37!insertmacro MUI_UNPAGE_CONFIRM
38!insertmacro MUI_UNPAGE_INSTFILES
39!insertmacro MUI_UNPAGE_FINISH
40
41!insertmacro MUI_LANGUAGE "English"
42
d4954fb7
LOK
43InstType "USB-CEC driver & libCEC"
44InstType "USB-CEC driver only"
45InstType "Full installation"
09054f70 46
d4954fb7 47Section "USB-CEC driver" SecDriver
09054f70
LOK
48 SetShellVarContext current
49 SectionIn RO
d4954fb7 50 SectionIn 1 2 3
4d760b54
LOK
51
52 ; Copy to the installation directory
09054f70
LOK
53 SetOutPath "$INSTDIR"
54 File "..\AUTHORS"
09054f70 55 File "..\COPYING"
f6562fae 56
4d760b54 57 ; Copy the driver installer and .inf file
09054f70 58 SetOutPath "$INSTDIR\driver"
4d760b54
LOK
59 File "..\build\dpinst-amd64.exe"
60 File "..\build\dpinst-x86.exe"
61e91a48
LOK
61 File "..\driver\p8usb-cec.inf"
62 File "..\driver\p8usb-cec.cat"
4d760b54 63
09054f70
LOK
64 ;Store installation folder
65 WriteRegStr HKCU "Software\libCEC" "" $INSTDIR
66
67 ;Create uninstaller
68 WriteUninstaller "$INSTDIR\Uninstall.exe"
69
70 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
71 SetOutPath "$INSTDIR"
72
73 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
09054f70
LOK
74 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \
75 "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
76 "" "Uninstall libCEC."
77
78 WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/"
79 !insertmacro MUI_STARTMENU_WRITE_END
d4954fb7 80
09054f70
LOK
81 ;add entry to add/remove programs
82 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
83 "DisplayName" "libCEC"
84 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
85 "UninstallString" "$INSTDIR\uninstall.exe"
86 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
87 "NoModify" 1
88 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
89 "NoRepair" 1
90 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
91 "InstallLocation" "$INSTDIR"
92 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
93 "DisplayIcon" "$INSTDIR\cec-client.exe,0"
94 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
95 "Publisher" "Pulse-Eight Ltd."
96 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
97 "HelpLink" "http://www.pulse-eight.com/"
98 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
99 "URLInfoAbout" "http://www.pulse-eight.com"
100
101 ;install driver
102 ${If} ${RunningX64}
103 ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /lm /sa /sw /PATH "$INSTDIR\driver"'
104 ${Else}
105 ExecWait '"$INSTDIR\driver\dpinst-x86.exe" /lm /sa /sw /PATH "$INSTDIR\driver"'
106 ${EndIf}
107SectionEnd
108
d4954fb7
LOK
109Section "libCEC" SecLibCec
110 SetShellVarContext current
111 SectionIn 1 3
112
113 ; Copy to the installation directory
114 SetOutPath "$INSTDIR"
115 File "..\ChangeLog"
116 File "..\README"
117 File "..\build\*.dll"
118 SetOutPath "$INSTDIR\x64"
119 File /nonfatal "..\build\x64\*.dll"
120
121 ; Copy to XBMC\system
122 ReadRegStr $1 HKCU "Software\XBMC" ""
123 ${If} $1 != ""
124 SetOutPath "$1\system"
125 File "..\build\libcec.dll"
126 ${EndIf}
127
128 ; Copy the headers
129 SetOutPath "$INSTDIR\include"
130 File /r /x *.so "..\include\cec*.*"
131
132 ; Copy libcec.dll and libcec.x64.dll to the system directory
133 SetOutPath "$SYSDIR"
134 File "..\build\libcec.dll"
135 ${If} ${RunningX64}
136 File /nonfatal "..\build\x64\libcec.x64.dll"
137 ${EndIf}
138SectionEnd
139
140Section "CEC debug client" SecCecClient
141 SetShellVarContext current
142 SectionIn 3
143
144 ; Copy to the installation directory
145 SetOutPath "$INSTDIR"
146 File /x dpinst*.exe "..\build\*.exe"
147 SetOutPath "$INSTDIR\x64"
148 File /nonfatal "..\build\x64\*.exe"
149
150 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
151 SetOutPath "$INSTDIR"
152
153 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
154 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \
155 "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \
156 "" "Start the CEC Test client."
157 ${If} ${RunningX64}
158 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" "$INSTDIR\x64\cec-client.x64.exe" \
159 "" "$INSTDIR\cec-client.x64.exe" 0 SW_SHOWNORMAL \
160 "" "Start the CEC Test client (x64)."
161 ${EndIf}
162 !insertmacro MUI_STARTMENU_WRITE_END
163
164SectionEnd
165
09054f70
LOK
166;--------------------------------
167;Uninstaller Section
168
169Section "Uninstall"
170
171 SetShellVarContext current
172
173 ${If} ${RunningX64}
61e91a48 174 ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"'
09054f70 175 ${Else}
61e91a48 176 ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"'
09054f70
LOK
177 ${EndIf}
178 Delete "$INSTDIR\AUTHORS"
f00ff009 179 Delete "$INSTDIR\cec*.exe"
09054f70
LOK
180 Delete "$INSTDIR\ChangeLog"
181 Delete "$INSTDIR\COPYING"
7879fa15 182 Delete "$INSTDIR\*.dll"
f00ff009 183 Delete "$INSTDIR\*.lib"
4d760b54
LOK
184 Delete "$INSTDIR\x64\*.dll"
185 Delete "$INSTDIR\x64\*.lib"
09054f70 186 Delete "$INSTDIR\README"
61e91a48
LOK
187 Delete "$INSTDIR\driver\p8usb-cec.inf"
188 Delete "$INSTDIR\driver\p8usb-cec.cat"
09054f70
LOK
189 Delete "$INSTDIR\driver\dpinst-amd64.exe"
190 Delete "$INSTDIR\driver\dpinst-x86.exe"
191
192 RMDir /r "$INSTDIR\include"
193 Delete "$INSTDIR\Uninstall.exe"
194 RMDir /r "$INSTDIR"
195
196 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
197 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
f00ff009
LOK
198 ${If} ${RunningX64}
199 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk"
200 ${EndIf}
09054f70
LOK
201 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk"
202 Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url"
203 RMDir "$SMPROGRAMS\$StartMenuFolder"
204
205 DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC"
206
207 DeleteRegKey /ifempty HKCU "Software\libCEC"
208
209SectionEnd