-
Notifications
You must be signed in to change notification settings - Fork 5
/
installer.bat
147 lines (118 loc) · 2.95 KB
/
installer.bat
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
@echo off
echo ********************************
echo **** QPEP INSTALLER BUILDER ****
echo ********************************
echo.
set /A BUILD64=0
set /A BUILD32=0
if "%1" EQU "--build32" (
set /A BUILD32=1
)
if "%1" EQU "--build64" (
set /A BUILD64=1
)
if "%2" EQU "--build32" (
set /A BUILD32=1
)
if "%2" EQU "--build64" (
set /A BUILD64=1
)
if "%2" EQU "--rebuild" (
goto installer
)
if %BUILD64% EQU 0 (
if %BUILD32% EQU 0 (
echo Usage: installer.bat [--build32] [--build64]
echo.
goto fail
)
)
if %BUILD32% EQU 0 (
if %BUILD64% EQU 0 (
echo Usage: installer.bat [--build32] [--build64]
echo.
goto fail
)
)
ECHO [Requirements check: GO]
go version
if %ERRORLEVEL% GEQ 1 goto fail
ECHO [Requirements check: MSBuild]
msbuild --version
if %ERRORLEVEL% GEQ 1 goto fail
ECHO [Requirements check: Wix Toolkit]
heat -help
if %ERRORLEVEL% GEQ 1 goto fail
ECHO [Cleanup]
DEL /S /Q build 2> NUL
RMDIR build\x64 2> NUL
RMDIR build\x86 2> NUL
RMDIR build\installer 2> NUL
RMDIR build 2> NUL
echo OK
ECHO [Preparation]
MKDIR build\ 2> NUL
if %ERRORLEVEL% GEQ 1 goto fail
MKDIR build\x64\ 2> NUL
if %ERRORLEVEL% GEQ 1 goto fail
MKDIR build\x86\ 2> NUL
if %ERRORLEVEL% GEQ 1 goto fail
go clean
if %ERRORLEVEL% GEQ 1 goto fail
COPY /Y windivert\LICENSE build\LICENSE.windivert
if %ERRORLEVEL% GEQ 1 goto fail
COPY /Y LICENSE build\LICENSE
if %ERRORLEVEL% GEQ 1 goto fail
echo OK
set GOOS=windows
if %BUILD64% NEQ 0 (
set GOARCH=amd64
go clean -cache
ECHO [Copy dependencies x64]
COPY /Y windivert\x64\* build\x64\
if %ERRORLEVEL% GEQ 1 goto fail
echo OK
ECHO [Build x64 server/client]
go build -o build\x64\qpep.exe
if %ERRORLEVEL% GEQ 1 goto fail
echo OK
ECHO [Build x64 tray icon]
pushd qpep-tray
if %ERRORLEVEL% GEQ 1 goto fail
go build -ldflags -H=windowsgui -o ..\build\x64\qpep-tray.exe
if %ERRORLEVEL% GEQ 1 goto fail
popd
echo OK
)
if %BUILD32% NEQ 0 (
set GOARCH=386
go clean -cache
ECHO [Copy dependencies x86]
COPY /Y windivert\x86\* build\x86\
if %ERRORLEVEL% GEQ 1 goto fail
echo OK
ECHO [Build x86 server/client]
go build -x -o build\x86\qpep.exe
if %ERRORLEVEL% GEQ 1 goto fail
echo OK
ECHO [Build x86 tray icon]
pushd qpep-tray
if %ERRORLEVEL% GEQ 1 goto fail
go build -ldflags -H=windowsgui -o ..\build\x86\qpep-tray.exe
if %ERRORLEVEL% GEQ 1 goto fail
popd
echo OK
)
:installer
echo [Build of installer]
msbuild installer\installer.sln
if %ERRORLEVEL% GEQ 1 goto fail
echo ********************************
echo **** RESULT: SUCCESS ****
echo ********************************
exit /B 0
:fail
echo ********************************
echo **** RESULT: FAILURE ****
echo ********************************
exit /B 1