cec: make sure we're not trying to unlock the mutex too many times
[deb_libcec.git] / project / libCEC.nsi
CommitLineData
09054f70
LOK
1;libCEC installer
2;Copyright (C) 2011 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 "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"
25!insertmacro MUI_PAGE_DIRECTORY
26
27!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
28!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\libCEC"
29!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
30!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
31
32!insertmacro MUI_PAGE_INSTFILES
33!insertmacro MUI_PAGE_FINISH
34
35!insertmacro MUI_UNPAGE_WELCOME
36!insertmacro MUI_UNPAGE_CONFIRM
37!insertmacro MUI_UNPAGE_INSTFILES
38!insertmacro MUI_UNPAGE_FINISH
39
40!insertmacro MUI_LANGUAGE "English"
41
42InstType "Full"
43
44Section "libCEC" SecLibCEC
45 SetShellVarContext current
46 SectionIn RO
47 SectionIn 1 #section is in installtype Full
4d760b54
LOK
48
49 ; Copy to the installation directory
09054f70
LOK
50 SetOutPath "$INSTDIR"
51 File "..\AUTHORS"
4d760b54 52 File /x dpinst*.exe "..\build\*.exe"
09054f70
LOK
53 File "..\ChangeLog"
54 File "..\COPYING"
09054f70 55 File "..\README"
4d760b54
LOK
56 File "..\build\*.dll"
57 SetOutPath "$INSTDIR\x64"
58 File /nonfatal "..\build\x64\*"
09054f70 59
f6562fae
B
60 ; Copy to XBMC\system
61 ReadRegStr $1 HKCU "Software\XBMC" ""
62 ${If} $1 != ""
63 SetOutPath "$1\system"
4d760b54 64 File "..\build\libcec.dll"
f6562fae
B
65 ${EndIf}
66
4d760b54 67 ; Copy the driver installer and .inf file
09054f70 68 SetOutPath "$INSTDIR\driver"
4d760b54
LOK
69 File "..\build\dpinst-amd64.exe"
70 File "..\build\dpinst-x86.exe"
09054f70 71 File "..\OEM001.inf"
4d760b54
LOK
72
73 ; Copy the headers
09054f70 74 SetOutPath "$INSTDIR\include"
465ab2f1 75 File /r /x *.so "..\include\cec*.*"
09054f70 76
4d760b54
LOK
77 ; Copy libcec.dll and libcec.x64.dll to the system directory
78 SetOutPath "$SYSDIR"
79 File "..\build\libcec.dll"
80 ${If} ${RunningX64}
81 File /nonfatal "..\build\x64\libcec.x64.dll"
82 ${EndIf}
83
09054f70
LOK
84 ;Store installation folder
85 WriteRegStr HKCU "Software\libCEC" "" $INSTDIR
86
87 ;Create uninstaller
88 WriteUninstaller "$INSTDIR\Uninstall.exe"
89
90 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
91 SetOutPath "$INSTDIR"
92
93 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
94 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \
95 "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \
96 "" "Start the CEC Test client."
f00ff009 97 ${If} ${RunningX64}
4d760b54 98 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" "$INSTDIR\x64\cec-client.x64.exe" \
f00ff009
LOK
99 "" "$INSTDIR\cec-client.x64.exe" 0 SW_SHOWNORMAL \
100 "" "Start the CEC Test client (x64)."
101 ${EndIf}
09054f70
LOK
102 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \
103 "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
104 "" "Uninstall libCEC."
105
106 WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/"
107 !insertmacro MUI_STARTMENU_WRITE_END
108
109
110 ;add entry to add/remove programs
111 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
112 "DisplayName" "libCEC"
113 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
114 "UninstallString" "$INSTDIR\uninstall.exe"
115 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
116 "NoModify" 1
117 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
118 "NoRepair" 1
119 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
120 "InstallLocation" "$INSTDIR"
121 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
122 "DisplayIcon" "$INSTDIR\cec-client.exe,0"
123 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
124 "Publisher" "Pulse-Eight Ltd."
125 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
126 "HelpLink" "http://www.pulse-eight.com/"
127 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
128 "URLInfoAbout" "http://www.pulse-eight.com"
129
130 ;install driver
131 ${If} ${RunningX64}
132 ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /lm /sa /sw /PATH "$INSTDIR\driver"'
133 ${Else}
134 ExecWait '"$INSTDIR\driver\dpinst-x86.exe" /lm /sa /sw /PATH "$INSTDIR\driver"'
135 ${EndIf}
136SectionEnd
137
138;--------------------------------
139;Uninstaller Section
140
141Section "Uninstall"
142
143 SetShellVarContext current
144
145 ${If} ${RunningX64}
146 ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\OEM001.inf"'
147 ${Else}
148 ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\OEM001.inf"'
149 ${EndIf}
150 Delete "$INSTDIR\AUTHORS"
f00ff009 151 Delete "$INSTDIR\cec*.exe"
09054f70
LOK
152 Delete "$INSTDIR\ChangeLog"
153 Delete "$INSTDIR\COPYING"
7879fa15 154 Delete "$INSTDIR\*.dll"
f00ff009 155 Delete "$INSTDIR\*.lib"
4d760b54
LOK
156 Delete "$INSTDIR\x64\*.dll"
157 Delete "$INSTDIR\x64\*.lib"
09054f70
LOK
158 Delete "$INSTDIR\README"
159 Delete "$INSTDIR\driver\OEM001.inf"
160 Delete "$INSTDIR\driver\dpinst-amd64.exe"
161 Delete "$INSTDIR\driver\dpinst-x86.exe"
162
163 RMDir /r "$INSTDIR\include"
164 Delete "$INSTDIR\Uninstall.exe"
165 RMDir /r "$INSTDIR"
166
167 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
168 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
f00ff009
LOK
169 ${If} ${RunningX64}
170 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk"
171 ${EndIf}
09054f70
LOK
172 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk"
173 Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url"
174 RMDir "$SMPROGRAMS\$StartMenuFolder"
175
176 DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC"
177
178 DeleteRegKey /ifempty HKCU "Software\libCEC"
179
180SectionEnd