File: create-installer.cmd

package info (click to toggle)
libcec 4.0.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,360 kB
  • sloc: cpp: 18,613; ansic: 1,961; python: 1,357; sh: 42; makefile: 13
file content (158 lines) | stat: -rw-r--r-- 5,679 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
@echo off

set EXITCODE=1
SET MYDIR=%~dp0

rem Check for support folder
IF NOT EXIST "%MYDIR%..\support\windows\p8-usbcec-driver-installer.exe" (
  echo "support submodule was not checked out"
  goto RETURNEXIT
)

rem Check for NSIS
IF EXIST "%ProgramFiles%\NSIS\makensis.exe" (
  set NSIS="%ProgramFiles%\NSIS\makensis.exe"
) ELSE IF EXIST "%ProgramFiles(x86)%\NSIS\makensis.exe" (
  set NSIS="%ProgramFiles(x86)%\NSIS\makensis.exe"
) ELSE GOTO NONSIS

rem Check for VC14
IF "%VS140COMNTOOLS%"=="" (
  set COMPILER14="%ProgramFiles%\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com"
) ELSE IF EXIST "%VS140COMNTOOLS%\..\IDE\VCExpress.exe" (
  set COMPILER14="%VS140COMNTOOLS%\..\IDE\VCExpress.exe"
) ELSE IF EXIST "%VS140COMNTOOLS%\..\IDE\devenv.com" (
  set COMPILER14="%VS140COMNTOOLS%\..\IDE\devenv.com"
) ELSE GOTO NOSDK14

rmdir /s /q %MYDIR%..\build 2> nul
call %MYDIR%build.cmd
IF NOT ERRORLEVEL 0 (
  GOTO ERRORCREATINGINSTALLER
)

copy "%MYDIR%..\support\windows\p8-usbcec-driver-installer.exe" "%MYDIR%..\build\."
cd "%MYDIR%..\project"

rem Skip to libCEC/x86 when we're running on win32
if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto libcecx86

rem Compile libCEC and cec-client x64
echo. Cleaning libCEC (x64)
%COMPILER14% libcec.sln /Clean "Release|x64"
echo. Compiling libCEC (x64)
%COMPILER14% libcec.sln /Build "Release|x64" /Project LibCecSharp
%COMPILER14% libcec.sln /Build "Release|x64"
echo. Compiling .Net applications
cd "%MYDIR%..\src\dotnet\project"
%COMPILER14% cec-dotnet.sln /Build "Release|x64"
copy ..\build\x64\CecSharpTester.exe %MYDIR%..\build\amd64\CecSharpTester.exe
copy ..\build\x64\cec-tray.exe %MYDIR%..\build\amd64\cec-tray.exe

:libcecx86
rem Compile libCEC and cec-client Win32
cd "%MYDIR%..\project"
echo. Cleaning libCEC (x86)
%COMPILER14% libcec.sln /Clean "Release|x86"
echo. Compiling libCEC (x86)
%COMPILER14% libcec.sln /Build "Release|x86" /Project LibCecSharp
%COMPILER14% libcec.sln /Build "Release|x86"
echo. Compiling .Net applications
cd "%MYDIR%..\src\dotnet\project"
%COMPILER14% cec-dotnet.sln /Build "Release|x86"
copy ..\build\x86\CecSharpTester.exe %MYDIR%..\build\x86\CecSharpTester.exe
copy ..\build\x86\cec-tray.exe %MYDIR%..\build\x86\cec-tray.exe
cd "%MYDIR%..\project"

rem Clean things up before creating the installer
del /q /f %MYDIR%..\build\x86\LibCecSharp.pdb 2> nul
del /q /f %MYDIR%..\build\amd64\LibCecSharp.pdb 2> nul

GOTO CREATEEGPLUGIN

:SIGNBINARIES
rem Check for sign-binary.cmd, only present on the Pulse-Eight production build system
rem Calls signtool.exe and signs the DLLs with Pulse-Eight's code signing key
IF NOT EXIST "..\support\private\sign-binary.cmd" GOTO CREATEINSTALLER
echo. Signing all binaries
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\x86\cec.dll
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\x86\LibCecSharp.dll
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\x86\cec-client.exe
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\x86\cecc-client.exe
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\x86\cec-tray.exe
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\x86\CecSharpTester.exe
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\amd64\cec.dll
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\amd64\LibCecSharp.dll
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\amd64\cec-client.exe
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\amd64\cecc-client.exe
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\amd64\cec-tray.exe
CALL ..\support\private\sign-binary.cmd %MYDIR%..\build\amd64\CecSharpTester.exe


:CREATEINSTALLER
echo. Creating the installer
cd %MYDIR%..\build\x86
copy cec.dll libcec.dll
cd ..\amd64
copy cec.dll cec.x64.dll
cd %MYDIR%..\project
%NSIS% /V1 /X"SetCompressor /FINAL lzma" "libCEC.nsi"

FOR /F "delims=" %%F IN ('dir /b /s "%MYDIR%..\build\libCEC-*.exe" 2^>nul') DO SET INSTALLER=%%F
IF [%INSTALLER%] == [] (
  GOTO EGPLUGINCLEANUP
  GOTO ERRORCREATINGINSTALLER
)

rem Sign the installer if sign-binary.cmd exists
IF EXIST "..\support\private\sign-binary.cmd" (
  echo. Signing the installer binaries
  CALL ..\support\private\sign-binary.cmd %INSTALLER%
)

echo. The installer can be found here: %INSTALLER%
set EXITCODE=0
del /q /f %EGSOURCES%..\pulse_eight.egplugin 2> nul
GOTO EXIT

:CREATEEGPLUGIN
echo. Creating EventGhost plugin file
SET EGSOURCES=%MYDIR%..\src\eventghost\egplugin_sources\
copy %MYDIR%..\build\x86\python\cec\__init__.py %EGSOURCES%PulseEight\cec
copy %MYDIR%..\build\x86\python\cec\_cec.pyd %EGSOURCES%PulseEight
copy %MYDIR%..\build\x86\cec.dll %EGSOURCES%PulseEight
del /q /f %EGSOURCES%..\pulse_eight.egplugin 2> nul
PowerShell -ExecutionPolicy ByPass -Command "Add-Type -Assembly System.IO.Compression.FileSystem;[System.IO.Compression.ZipFile]::CreateFromDirectory('%EGSOURCES%', '%EGSOURCES%..\pulse_eight.egplugin', [System.IO.Compression.CompressionLevel]::Optimal, $false)"
del /q /f %EGSOURCES%PulseEight\cec\__init__.py 2> nul
del /q /f %EGSOURCES%PulseEight\_cec.pyd 2> nul
del /q /f %EGSOURCES%PulseEight\cec.dll 2> nul
IF NOT EXIST "%EGSOURCES%..\pulse_eight.egplugin" (
  GOTO NOEGPLUGIN
)
GOTO SIGNBINARIES

:NOEGPLUGIN
echo. Failed to create the EventGhost plugin file.
GOTO EXIT

:NOSDK14
echo. Visual Studio 2015 was not found on your system.
GOTO EXIT

:NOSIS
echo. NSIS could not be found on your system.
GOTO EXIT

:NODDK
echo. Windows DDK could not be found on your system
GOTO EXIT

:ERRORCREATINGINSTALLER
echo. The installer could not be created. The most likely cause is that something went wrong while compiling.

:EXIT
cd %MYDIR%..

:RETURNEXIT
exit /b %EXITCODE%
pause