| 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 | |
| 10 | Name "libCEC" |
| 11 | OutFile "..\build\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_COMPONENTS |
| 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 | |
| 43 | InstType "USB-CEC driver & libCEC" |
| 44 | InstType "USB-CEC driver only" |
| 45 | InstType "Full installation" |
| 46 | |
| 47 | Section "USB-CEC driver" SecDriver |
| 48 | SetShellVarContext current |
| 49 | SectionIn RO |
| 50 | SectionIn 1 2 3 |
| 51 | |
| 52 | ; Copy to the installation directory |
| 53 | SetOutPath "$INSTDIR" |
| 54 | File "..\AUTHORS" |
| 55 | File "..\COPYING" |
| 56 | |
| 57 | ; Copy the driver installer and .inf file |
| 58 | SetOutPath "$INSTDIR\driver" |
| 59 | File "..\build\dpinst-amd64.exe" |
| 60 | File "..\build\dpinst-x86.exe" |
| 61 | File "..\driver\p8usb-cec.inf" |
| 62 | File "..\driver\p8usb-cec.cat" |
| 63 | |
| 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" |
| 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 |
| 80 | |
| 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} |
| 107 | SectionEnd |
| 108 | |
| 109 | Section "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} |
| 138 | SectionEnd |
| 139 | |
| 140 | Section "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 | |
| 164 | SectionEnd |
| 165 | |
| 166 | ;-------------------------------- |
| 167 | ;Uninstaller Section |
| 168 | |
| 169 | Section "Uninstall" |
| 170 | |
| 171 | SetShellVarContext current |
| 172 | |
| 173 | ${If} ${RunningX64} |
| 174 | ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"' |
| 175 | ${Else} |
| 176 | ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"' |
| 177 | ${EndIf} |
| 178 | Delete "$INSTDIR\AUTHORS" |
| 179 | Delete "$INSTDIR\cec*.exe" |
| 180 | Delete "$INSTDIR\ChangeLog" |
| 181 | Delete "$INSTDIR\COPYING" |
| 182 | Delete "$INSTDIR\*.dll" |
| 183 | Delete "$INSTDIR\*.lib" |
| 184 | Delete "$INSTDIR\x64\*.dll" |
| 185 | Delete "$INSTDIR\x64\*.lib" |
| 186 | Delete "$INSTDIR\README" |
| 187 | Delete "$INSTDIR\driver\p8usb-cec.inf" |
| 188 | Delete "$INSTDIR\driver\p8usb-cec.cat" |
| 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" |
| 198 | ${If} ${RunningX64} |
| 199 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" |
| 200 | ${EndIf} |
| 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 | |
| 209 | SectionEnd |