cec: added "driver only" and "driver + libcec" sections to the installer
[deb_libcec.git] / project / libCEC.nsi
index eaf10932e36d54215ddbf196183116a5d6561b98..bf14ee0631d46840f784a7cb185cc5c03f3ce2f1 100644 (file)
@@ -1,5 +1,5 @@
 ;libCEC installer
-;Copyright (C) 2011 Pulse-Eight Ltd.
+;Copyright (C) 2012 Pulse-Eight Ltd.
 ;http://www.pulse-eight.com/
 
 !include "MUI2.nsh"
@@ -8,7 +8,7 @@
 !include "x64.nsh"
 
 Name "libCEC"
-OutFile "libCEC-installer.exe"
+OutFile "..\build\libCEC-installer.exe"
 
 XPStyle on
 InstallDir "$PROGRAMFILES\libCEC"
@@ -16,12 +16,13 @@ InstallDirRegKey HKCU "Software\libCEC" ""
 RequestExecutionLevel admin
 Var StartMenuFolder
 
-!define MUI_FINISHPAGE_LINK "Please visit http://www.pulse-eight.com/ for more information."
+!define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information."
 !define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/"
 !define MUI_ABORTWARNING  
 
 !insertmacro MUI_PAGE_WELCOME
 !insertmacro MUI_PAGE_LICENSE "..\COPYING"
+!insertmacro MUI_PAGE_COMPONENTS
 !insertmacro MUI_PAGE_DIRECTORY
 
 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" 
@@ -39,28 +40,26 @@ Var StartMenuFolder
 
 !insertmacro MUI_LANGUAGE "English"
 
-InstType "Full"
+InstType "USB-CEC driver & libCEC"
+InstType "USB-CEC driver only"
+InstType "Full installation"
 
-Section "libCEC" SecLibCEC
+Section "USB-CEC driver" SecDriver
   SetShellVarContext current
   SectionIn RO
-  SectionIn 1 #section is in installtype Full
+  SectionIn 1 2 3
+
+  ; Copy to the installation directory
   SetOutPath "$INSTDIR"
   File "..\AUTHORS"
-  File "..\cec-client.exe"
-  File "..\ChangeLog"
   File "..\COPYING"
-  File "..\libcec.dll"
-  File "..\libcec.lib"
-  File "..\pthreadVC2.dll"
-  File "..\README"
 
+  ; Copy the driver installer and .inf file
   SetOutPath "$INSTDIR\driver"
-  File "..\dpinst-amd64.exe"
-  File "..\dpinst-x86.exe"
-  File "..\OEM001.inf"
-  SetOutPath "$INSTDIR\include"
-  File /r /x *.so "..\include\cec*.*"
+  File "..\build\dpinst-amd64.exe"
+  File "..\build\dpinst-x86.exe"
+  File "..\driver\p8usb-cec.inf"
+  File "..\driver\p8usb-cec.cat"
 
   ;Store installation folder
   WriteRegStr HKCU "Software\libCEC" "" $INSTDIR
@@ -72,17 +71,13 @@ Section "libCEC" SecLibCEC
   SetOutPath "$INSTDIR"
 
   CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
-  CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \
-    "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \
-    "" "Start the CEC Test client."
   CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \
     "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
     "" "Uninstall libCEC."
 
   WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/"
   !insertmacro MUI_STARTMENU_WRITE_END  
-  
-  
+    
   ;add entry to add/remove programs
   WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \
                  "DisplayName" "libCEC"
@@ -111,6 +106,63 @@ Section "libCEC" SecLibCEC
   ${EndIf}
 SectionEnd
 
+Section "libCEC" SecLibCec
+  SetShellVarContext current
+  SectionIn 1 3
+
+  ; Copy to the installation directory
+  SetOutPath "$INSTDIR"
+  File "..\ChangeLog"
+  File "..\README"
+  File "..\build\*.dll"
+  SetOutPath "$INSTDIR\x64"
+  File /nonfatal "..\build\x64\*.dll"
+
+  ; Copy to XBMC\system
+  ReadRegStr $1 HKCU "Software\XBMC" ""
+  ${If} $1 != ""
+    SetOutPath "$1\system"
+       File "..\build\libcec.dll"
+  ${EndIf}
+
+  ; Copy the headers
+  SetOutPath "$INSTDIR\include"
+  File /r /x *.so "..\include\cec*.*"
+
+  ; Copy libcec.dll and libcec.x64.dll to the system directory
+  SetOutPath "$SYSDIR"
+  File "..\build\libcec.dll"
+  ${If} ${RunningX64}
+    File /nonfatal "..\build\x64\libcec.x64.dll"
+  ${EndIf}
+SectionEnd
+
+Section "CEC debug client" SecCecClient
+  SetShellVarContext current
+  SectionIn 3
+
+  ; Copy to the installation directory
+  SetOutPath "$INSTDIR"
+  File /x dpinst*.exe "..\build\*.exe"
+  SetOutPath "$INSTDIR\x64"
+  File /nonfatal "..\build\x64\*.exe"
+
+  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+  SetOutPath "$INSTDIR"
+
+  CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
+  CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \
+    "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \
+    "" "Start the CEC Test client."
+  ${If} ${RunningX64}
+    CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" "$INSTDIR\x64\cec-client.x64.exe" \
+      "" "$INSTDIR\cec-client.x64.exe" 0 SW_SHOWNORMAL \
+      "" "Start the CEC Test client (x64)."
+  ${EndIf}
+  !insertmacro MUI_STARTMENU_WRITE_END  
+    
+SectionEnd
+
 ;--------------------------------
 ;Uninstaller Section
 
@@ -119,20 +171,21 @@ Section "Uninstall"
   SetShellVarContext current
 
   ${If} ${RunningX64}
-       ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\OEM001.inf"'
+       ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"'
   ${Else}
-       ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\OEM001.inf"'
+       ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"'
   ${EndIf}
   Delete "$INSTDIR\AUTHORS"
-  Delete "$INSTDIR\cec-client.exe"
+  Delete "$INSTDIR\cec*.exe"
   Delete "$INSTDIR\ChangeLog"
   Delete "$INSTDIR\COPYING"
-  Delete "$INSTDIR\libcec.dll"
-  Delete "$INSTDIR\libcec.lib"
-  Delete "$INSTDIR\libcec.pdb"
-  Delete "$INSTDIR\pthreadVC2.dll"
+  Delete "$INSTDIR\*.dll"
+  Delete "$INSTDIR\*.lib"
+  Delete "$INSTDIR\x64\*.dll"
+  Delete "$INSTDIR\x64\*.lib"
   Delete "$INSTDIR\README"
-  Delete "$INSTDIR\driver\OEM001.inf"
+  Delete "$INSTDIR\driver\p8usb-cec.inf"
+  Delete "$INSTDIR\driver\p8usb-cec.cat"
   Delete "$INSTDIR\driver\dpinst-amd64.exe"
   Delete "$INSTDIR\driver\dpinst-x86.exe"
 
@@ -142,6 +195,9 @@ Section "Uninstall"
   
   !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
   Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
+  ${If} ${RunningX64}
+    Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk"
+  ${EndIf}
   Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk"
   Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url"
   RMDir "$SMPROGRAMS\$StartMenuFolder"