Merge branch 'master' into release
[deb_libcec.git] / project / libCEC.nsi
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
10 Name "libCEC"
11 OutFile "libCEC-installer.exe"
12
13 XPStyle on
14 InstallDir "$PROGRAMFILES\libCEC"
15 InstallDirRegKey HKCU "Software\libCEC" ""
16 RequestExecutionLevel admin
17 Var StartMenuFolder
18
19 !define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information."
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
42 InstType "Full"
43
44 Section "libCEC" SecLibCEC
45 SetShellVarContext current
46 SectionIn RO
47 SectionIn 1 #section is in installtype Full
48 SetOutPath "$INSTDIR"
49 File "..\AUTHORS"
50 File "..\cec-client.exe"
51 File "..\ChangeLog"
52 File "..\COPYING"
53 File "..\libcec.dll"
54 File "..\libcec.lib"
55 File "Release\LibCecSharp.dll"
56 File "..\pthreadVC2.dll"
57 File "..\README"
58
59 ; Copy to XBMC\system
60 ReadRegStr $1 HKCU "Software\XBMC" ""
61 ${If} $1 != ""
62 SetOutPath "$1\system"
63 File "..\libcec.dll"
64 ${EndIf}
65
66 SetOutPath "$INSTDIR\driver"
67 File "..\dpinst-amd64.exe"
68 File "..\dpinst-x86.exe"
69 File "..\OEM001.inf"
70 SetOutPath "$INSTDIR\include"
71 File /r /x *.so "..\include\cec*.*"
72
73 ;Store installation folder
74 WriteRegStr HKCU "Software\libCEC" "" $INSTDIR
75
76 ;Create uninstaller
77 WriteUninstaller "$INSTDIR\Uninstall.exe"
78
79 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
80 SetOutPath "$INSTDIR"
81
82 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
83 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \
84 "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \
85 "" "Start the CEC Test client."
86 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \
87 "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
88 "" "Uninstall libCEC."
89
90 WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/"
91 !insertmacro MUI_STARTMENU_WRITE_END
92
93
94 ;add entry to add/remove programs
95 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
96 "DisplayName" "libCEC"
97 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
98 "UninstallString" "$INSTDIR\uninstall.exe"
99 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
100 "NoModify" 1
101 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
102 "NoRepair" 1
103 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
104 "InstallLocation" "$INSTDIR"
105 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
106 "DisplayIcon" "$INSTDIR\cec-client.exe,0"
107 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
108 "Publisher" "Pulse-Eight Ltd."
109 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
110 "HelpLink" "http://www.pulse-eight.com/"
111 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
112 "URLInfoAbout" "http://www.pulse-eight.com"
113
114 ;install driver
115 ${If} ${RunningX64}
116 ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /lm /sa /sw /PATH "$INSTDIR\driver"'
117 ${Else}
118 ExecWait '"$INSTDIR\driver\dpinst-x86.exe" /lm /sa /sw /PATH "$INSTDIR\driver"'
119 ${EndIf}
120 SectionEnd
121
122 ;--------------------------------
123 ;Uninstaller Section
124
125 Section "Uninstall"
126
127 SetShellVarContext current
128
129 ${If} ${RunningX64}
130 ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\OEM001.inf"'
131 ${Else}
132 ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\OEM001.inf"'
133 ${EndIf}
134 Delete "$INSTDIR\AUTHORS"
135 Delete "$INSTDIR\cec-client.exe"
136 Delete "$INSTDIR\ChangeLog"
137 Delete "$INSTDIR\COPYING"
138 Delete "$INSTDIR\libcec.dll"
139 Delete "$INSTDIR\libcec.lib"
140 Delete "$INSTDIR\libcec.pdb"
141 Delete "$INSTDIR\LibCecSharp.dll"
142 Delete "$INSTDIR\pthreadVC2.dll"
143 Delete "$INSTDIR\README"
144 Delete "$INSTDIR\driver\OEM001.inf"
145 Delete "$INSTDIR\driver\dpinst-amd64.exe"
146 Delete "$INSTDIR\driver\dpinst-x86.exe"
147
148 RMDir /r "$INSTDIR\include"
149 Delete "$INSTDIR\Uninstall.exe"
150 RMDir /r "$INSTDIR"
151
152 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
153 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
154 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk"
155 Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url"
156 RMDir "$SMPROGRAMS\$StartMenuFolder"
157
158 DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC"
159
160 DeleteRegKey /ifempty HKCU "Software\libCEC"
161
162 SectionEnd