-
Notifications
You must be signed in to change notification settings - Fork 17
/
MakefileCfgPlat.mak
298 lines (243 loc) · 10.2 KB
/
MakefileCfgPlat.mak
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#
# eduVPN - VPN for education and research
#
# Copyright: 2017-2024 The Commons Conservancy
# SPDX-License-Identifier: GPL-3.0+
#
!IF "$(PLAT)" == "x64"
PLAT_MSVC=x64
PLAT_VCPKG=x64
PLAT_CLIENT=x64
PLAT_PROCESSOR_ARCHITECTURE=amd64
GOARCH=amd64
CC=x86_64-w64-mingw32-gcc.exe
WINDRES=x86_64-w64-mingw32-windres.exe
!ELSEIF "$(PLAT)" == "ARM64"
PLAT_MSVC=ARM64
PLAT_VCPKG=arm64
PLAT_CLIENT=ARM64
PLAT_PROCESSOR_ARCHITECTURE=arm64
GOARCH=arm64
CC=aarch64-w64-mingw32-gcc.exe
WINDRES=aarch64-w64-mingw32-windres.exe
!ELSE
PLAT_MSVC=Win32
PLAT_VCPKG=x86
PLAT_CLIENT=x86
PLAT_PROCESSOR_ARCHITECTURE=x86
GOARCH=386
CC=i686-w64-mingw32-gcc.exe
WINDRES=i686-w64-mingw32-windres.exe
!ENDIF
# WiX parameters
WIX_CANDLE_FLAGS_CFG_PLAT=$(WIX_CANDLE_FLAGS_CFG) \
-arch $(PLAT) \
-dPlatform="$(PLAT)" \
-dTargetDir="bin\$(CFG)\$(PLAT)\\" \
-dTargetDirClient="bin\$(CFG)\$(PLAT_CLIENT)\\" \
-dVersionInformational="$(VERSION)$(CFG_TARGET) $(PLAT)"
!IF "$(PLAT)" == "x64" || "$(PLAT)" == "ARM64"
WIX_CANDLE_FLAGS_CFG_PLAT=$(WIX_CANDLE_FLAGS_CFG_PLAT) \
-dProgramFilesFolder="ProgramFiles64Folder"
!ELSE
WIX_CANDLE_FLAGS_CFG_PLAT=$(WIX_CANDLE_FLAGS_CFG_PLAT) \
-dProgramFilesFolder="ProgramFilesFolder"
!ENDIF
######################################################################
# Building
######################################################################
"bin\$(CFG)\$(PLAT)" : "bin\$(CFG)"
if not exist $@ md $@
"bin\$(CFG)\$(PLAT)\config" : "bin\$(CFG)\$(PLAT)"
if not exist $@ md $@
!IF "$(CFG)" == "$(SETUP_CFG)"
SetupBuild :: \
Build-$(CFG)-$(PLAT)
!ENDIF
BuildOpenVPN \
BuildOpenVPN-$(CFG)-$(PLAT) ::
msbuild.exe "openvpn\openvpn.sln" /p:Configuration="$(CFG)" /p:Platform="$(PLAT_MSVC)" $(MSBUILD_FLAGS)
BuildOpenVPN \
BuildOpenVPN-$(CFG)-$(PLAT) :: \
"bin\$(CFG)\$(PLAT)" \
"bin\$(CFG)\$(PLAT)\wintun.dll" \
"bin\$(CFG)\$(PLAT)\openvpn.exe" \
"bin\$(CFG)\$(PLAT)\openvpnserv.exe"
"bin\$(CFG)\$(PLAT)\wintun.dll" : "openvpn\src\openvpn\vcpkg_installed\$(PLAT_VCPKG)-windows-ovpn\$(PLAT_VCPKG)-windows-ovpn\$(CFG_VCPKG)bin\wintun.dll"
copy /y $** $@ > NUL
"bin\$(CFG)\$(PLAT)\openvpn.exe" : "openvpn\$(PLAT_MSVC)-Output\$(CFG)\openvpn.exe"
copy /y $** $@ > NUL
"bin\$(CFG)\$(PLAT)\openvpnserv.exe" : "openvpn\$(PLAT_MSVC)-Output\$(CFG)\openvpnserv.exe"
copy /y $** $@ > NUL
SignDeps \
SignOpenVPN : \
"bin\$(CFG)\$(PLAT)\openvpn.exe" \
"bin\$(CFG)\$(PLAT)\openvpnserv.exe"
BuildOpenVPN-$(CFG)-$(PLAT) ::
!IF DEFINED(MANIFESTCERTIFICATETHUMBPRINT)
signtool.exe sign /sha1 "$(MANIFESTCERTIFICATETHUMBPRINT)" /fd sha256 /tr "$(MANIFESTTIMESTAMPRFC3161URL)" /td sha256 \
"bin\$(CFG)\$(PLAT)\openvpn.exe" \
"bin\$(CFG)\$(PLAT)\openvpnserv.exe"
!ELSEIF EXISTS("$(APPDATA)\Microsoft.Trusted.Signing.Client.json")
signtool.exe sign /dlib "$(USERPROFILE)\.nuget\packages\microsoft.trusted.signing.client\1.0.53\bin\x64\Azure.CodeSigning.Dlib.dll" /dmdf "$(APPDATA)\Microsoft.Trusted.Signing.Client.json" /fd sha256 /tr "http://timestamp.acs.microsoft.com" /td sha256 \
"bin\$(CFG)\$(PLAT)\openvpn.exe" \
"bin\$(CFG)\$(PLAT)\openvpnserv.exe"
!ENDIF
CleanOpenVPN \
CleanOpenVPN-$(CFG)-$(PLAT) ::
-msbuild.exe "openvpn\openvpn.sln" /t:Clean /p:Configuration="$(CFG)" /p:Platform="$(PLAT_MSVC)" $(MSBUILD_FLAGS)
-if exist "bin\$(CFG)\$(PLAT)\wintun.dll" del /f /q "bin\$(CFG)\$(PLAT)\wintun.dll"
-if exist "bin\$(CFG)\$(PLAT)\openvpn.exe" del /f /q "bin\$(CFG)\$(PLAT)\openvpn.exe"
-if exist "bin\$(CFG)\$(PLAT)\openvpnserv.exe" del /f /q "bin\$(CFG)\$(PLAT)\openvpnserv.exe"
BuildWireGuard :: \
"bin\$(CFG)\$(PLAT)" \
"bin\$(CFG)\$(PLAT)\wireguard.dll" \
"bin\$(CFG)\$(PLAT)\tunnel.dll"
"bin\$(CFG)\$(PLAT)\wireguard.dll" : "wireguard-windows\.deps\wireguard-nt\bin\$(PLAT_PROCESSOR_ARCHITECTURE)\wireguard.dll"
copy /y $** $@ > NUL
"bin\$(CFG)\$(PLAT)\tunnel.dll" : "wireguard-windows\embeddable-dll-service\$(PLAT_PROCESSOR_ARCHITECTURE)\tunnel.dll"
copy /y $** $@ > NUL
SignDeps \
SignWireGuard : \
"bin\$(CFG)\$(PLAT)\wireguard.dll" \
"bin\$(CFG)\$(PLAT)\tunnel.dll"
CleanWireGuard ::
-if exist "bin\$(CFG)\$(PLAT)\wireguard.dll" del /f /q "bin\$(CFG)\$(PLAT)\wireguard.dll"
-if exist "bin\$(CFG)\$(PLAT)\tunnel.dll" del /f /q "bin\$(CFG)\$(PLAT)\tunnel.dll"
BuildeduVPNCommon \
BuildeduVPNCommon-$(CFG)-$(PLAT) :: \
"bin\llvm-mingw-20220906-msvcrt-x86_64\bin\gcc.exe" \
"eduvpn-common\internal\discovery\server_list.json" \
"eduvpn-common\internal\discovery\organization_list.json" \
"eduvpn-common\exports\resources_$(GOARCH).syso" \
"bin\$(CFG)\$(PLAT)"
cd "eduvpn-common\exports"
set GOARCH=$(GOARCH)
set GOARM=7
set CGO_ENABLED=1
set CGO_CFLAGS=$(CGO_CFLAGS)
set CGO_LDFLAGS=$(CGO_LDFLAGS)
set CC=$(CC)
go.exe build $(CFG_GOFLAGS) -o "..\..\bin\$(CFG)\$(PLAT)\eduvpn_common.dll" -buildmode=c-shared .
cd "$(MAKEDIR)"
SignDeps \
SigneduVPNCommon : "bin\$(CFG)\$(PLAT)\eduvpn_common.dll"
BuildeduVPNCommon-$(CFG)-$(PLAT) ::
!IF DEFINED(MANIFESTCERTIFICATETHUMBPRINT)
signtool.exe sign /sha1 "$(MANIFESTCERTIFICATETHUMBPRINT)" /fd sha256 /tr "$(MANIFESTTIMESTAMPRFC3161URL)" /td sha256 "bin\$(CFG)\$(PLAT)\eduvpn_common.dll"
!ELSEIF EXISTS("$(APPDATA)\Microsoft.Trusted.Signing.Client.json")
signtool.exe sign /dlib "$(USERPROFILE)\.nuget\packages\microsoft.trusted.signing.client\1.0.53\bin\x64\Azure.CodeSigning.Dlib.dll" /dmdf "$(APPDATA)\Microsoft.Trusted.Signing.Client.json" /fd sha256 /tr "http://timestamp.acs.microsoft.com" /td sha256 "bin\$(CFG)\$(PLAT)\eduvpn_common.dll"
!ENDIF
CleaneduVPNCommon ::
-if exist "bin\$(CFG)\$(PLAT)\eduvpn_common.dll" del /f /q "bin\$(CFG)\$(PLAT)\eduvpn_common.dll"
-if exist "bin\$(CFG)\$(PLAT)\eduvpn_common.h" del /f /q "bin\$(CFG)\$(PLAT)\eduvpn_common.h"
!IF "$(CFG)" == "$(SETUP_CFG)"
"eduvpn-common\exports\resources_$(GOARCH).syso" : "eduvpn-common\exports\resources.rc" "Makefile"
$(WINDRES) -DVERSION_ARRAY=$(VERSION:.=,) -DVERSION=$(VERSION) -i "eduvpn-common\exports\resources.rc" -o $@ -O coff -c 65001
CleaneduVPNCommon ::
-if exist "eduvpn-common\exports\resources_$(GOARCH).syso" del /f /q "eduvpn-common\exports\resources_$(GOARCH).syso"
!ENDIF
BuildeduVPNWindows \
BuildeduVPNWindows-$(CFG)-$(PLAT) :: \
"bin\llvm-mingw-20220906-msvcrt-x86_64\bin\gcc.exe" \
"eduvpn-windows\resources_$(GOARCH).syso" \
"bin\$(CFG)\$(PLAT)"
cd "eduvpn-windows"
set GOARCH=$(GOARCH)
set GOARM=7
set CGO_ENABLED=1
set CGO_CFLAGS=$(CGO_CFLAGS)
set CGO_LDFLAGS=$(CGO_LDFLAGS)
set CC=$(CC)
go.exe build $(CFG_GOFLAGS) -o "..\bin\$(CFG)\$(PLAT)\eduvpn_windows.dll" -buildmode=c-shared .
cd "$(MAKEDIR)"
SignDeps \
SigneduVPNWindows : "bin\$(CFG)\$(PLAT)\eduvpn_windows.dll"
BuildeduVPNWindows-$(CFG)-$(PLAT) ::
!IF DEFINED(MANIFESTCERTIFICATETHUMBPRINT)
signtool.exe sign /sha1 "$(MANIFESTCERTIFICATETHUMBPRINT)" /fd sha256 /tr "$(MANIFESTTIMESTAMPRFC3161URL)" /td sha256 "bin\$(CFG)\$(PLAT)\eduvpn_windows.dll"
!ELSEIF EXISTS("$(APPDATA)\Microsoft.Trusted.Signing.Client.json")
signtool.exe sign /dlib "$(USERPROFILE)\.nuget\packages\microsoft.trusted.signing.client\1.0.53\bin\x64\Azure.CodeSigning.Dlib.dll" /dmdf "$(APPDATA)\Microsoft.Trusted.Signing.Client.json" /fd sha256 /tr "http://timestamp.acs.microsoft.com" /td sha256 "bin\$(CFG)\$(PLAT)\eduvpn_windows.dll"
!ENDIF
CleaneduVPNWindows ::
-if exist "bin\$(CFG)\$(PLAT)\eduvpn_windows.dll" del /f /q "bin\$(CFG)\$(PLAT)\eduvpn_windows.dll"
-if exist "bin\$(CFG)\$(PLAT)\eduvpn_windows.h" del /f /q "bin\$(CFG)\$(PLAT)\eduvpn_windows.h"
!IF "$(CFG)" == "$(SETUP_CFG)"
"eduvpn-windows\resources_$(GOARCH).syso" : "eduvpn-windows\resources.rc" "Makefile"
$(WINDRES) -DVERSION_ARRAY=$(VERSION:.=,) -DVERSION=$(VERSION) -i "eduvpn-windows\resources.rc" -o $@ -O coff -c 65001
CleaneduVPNWindows ::
-if exist "eduvpn-windows\resources_$(GOARCH).syso" del /f /q "eduvpn-windows\resources_$(GOARCH).syso"
!ENDIF
Build-$(CFG)-$(PLAT) ::
bin\nuget.exe restore $(NUGET_FLAGS)
Build \
Build-$(CFG)-$(PLAT) :: \
"bin\$(CFG)\$(PLAT)"
msbuild.exe "eduVPN.sln" /p:Configuration="$(CFG)" /p:Platform="$(PLAT)" $(MSBUILD_FLAGS)
!IF "$(CFG)" == "$(SETUP_CFG)"
SetupSign \
!ENDIF
Sign : \
"bin\$(CFG)\$(PLAT)\eduEx.dll" \
"bin\$(CFG)\$(PLAT)\eduOAuth.dll" \
"bin\$(CFG)\$(PLAT)\eduOpenVPN.dll" \
"bin\$(CFG)\$(PLAT)\eduVPN.dll" \
"bin\$(CFG)\$(PLAT)\eduVPN.Client.exe" \
"bin\$(CFG)\$(PLAT)\eduVPN.Views.dll" \
"bin\$(CFG)\$(PLAT)\eduWireGuard.dll" \
"bin\$(CFG)\$(PLAT)\govVPN.Client.exe" \
"bin\$(CFG)\$(PLAT)\LetsConnect.Client.exe" \
"bin\$(CFG)\$(PLAT)\eduMSICA.dll" \
"bin\$(CFG)\$(PLAT)\eduVPN.Resources.dll" \
"bin\$(CFG)\$(PLAT)\eduWGSvcHost.exe"
Clean ::
-msbuild.exe "eduVPN.sln" /t:Clean /p:Configuration="$(CFG)" /p:Platform="$(PLAT)" $(MSBUILD_FLAGS)
!IF "$(CFG)" == "$(SETUP_CFG)"
"bin\Setup\PDB_$(VERSION)$(CFG_TARGET).zip" : \
bin\$(CFG)\$(PLAT)\*.pdb \
!IF "$(CFG)" != "Debug" && "$(PLAT)" != "ARM64"
"openvpn\$(PLAT_MSVC)-Output\$(CFG)\compat.pdb" \
!ENDIF
"openvpn\$(PLAT_MSVC)-Output\$(CFG)\openvpn.pdb" \
"openvpn\$(PLAT_MSVC)-Output\$(CFG)\openvpnserv.pdb"
!ENDIF
######################################################################
# Client-specific rules
######################################################################
!IF $(BUILD_EDUVPN)
!INCLUDE "eduVPN.mak"
!INCLUDE "MakefileCfgPlatClient.mak"
!ENDIF
!IF $(BUILD_LETSCONNECT)
!INCLUDE "LetsConnect.mak"
!INCLUDE "MakefileCfgPlatClient.mak"
!ENDIF
!IF $(BUILD_GOVVPN)
!INCLUDE "govVPN.mak"
!INCLUDE "MakefileCfgPlatClient.mak"
!ENDIF
######################################################################
# Locale-specific rules
######################################################################
LANG=ar
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=en
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=de
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=es
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=es-ES
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=fr
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=nl
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=pt-PT
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=sl
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=tr
!INCLUDE "MakefileCfgPlatLang.mak"
LANG=uk
!INCLUDE "MakefileCfgPlatLang.mak"