forked from Amebis/eduVPN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
229 lines (180 loc) · 7.96 KB
/
Makefile
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
#
# eduVPN - VPN for education and research
#
# Copyright: 2017-2023 The Commons Conservancy
# SPDX-License-Identifier: GPL-3.0+
#
VERSION=3.255.8
PRODUCT_GUID_TEMPLATE={E583620B-92B8-4B0D-95F5-298C556C22AB}
!IFNDEF BUILD_EDUVPN
BUILD_EDUVPN=1
!ENDIF
!IFNDEF BUILD_LETSCONNECT
BUILD_LETSCONNECT=1
!ENDIF
!IFNDEF BUILD_GOVVPN
BUILD_GOVVPN=0
!ENDIF
# Default testing configuration and platform
TEST_CFG=Debug
!IF "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
TEST_PLAT=x64
!ELSE
TEST_PLAT=x86
!ENDIF
SETUP_CFG=Release
# Go and CGo building
PATH=$(MAKEDIR)\bin\llvm-mingw-20220906-msvcrt-x86_64\bin;$(PATH)
# Utility default flags
REG_FLAGS=/f
NUGET_FLAGS=-Verbosity quiet
MSBUILD_FLAGS=/m /v:minimal /nologo
CSCRIPT_FLAGS=//Nologo
WIX_EXTENSIONS=-ext WixNetFxExtension -ext WixUtilExtension -ext WixBalExtension
WIX_WIXCOP_FLAGS=-nologo "-set1$(MAKEDIR)\wixcop.xml"
WIX_CANDLE_FLAGS=-nologo \
-dVersion="$(VERSION)" \
$(WIX_EXTENSIONS) \
-sw1118
WIX_LIGHT_FLAGS=-nologo -dcl:high -spdb -sice:ICE03 -sice:ICE60 -sice:ICE61 -sice:ICE82 $(WIX_EXTENSIONS)
WIX_INSIGNIA_FLAGS=-nologo
!IF [minisign.exe -v > NUL] == 0
MINISIGN_AVAILABLE=1
!IF EXISTS("$(USERPROFILE)\.minisign\minisign.key")
MINISIGN_KEY_AVAILABLE=1
!ENDIF
!ENDIF
CGO_CFLAGS=-O3 -Wall -Wno-unused-function -Wno-switch -std=gnu11 -DWINVER=0x0601
CGO_LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--export-all-symbols
######################################################################
# Default target
######################################################################
Build ::
######################################################################
# Build
######################################################################
Build \
SetupBuild :: \
"bin\$(TEST_CFG)\$(TEST_PLAT)"
bin\nuget.exe restore $(NUGET_FLAGS)
BuildDeps :: \
BuildOpenVPN \
BuildWireGuard \
BuildeduVPNCommon \
BuildeduVPNWindows \
SignDeps
BuildWireGuard ::
cd "wireguard-windows\embeddable-dll-service"
build.bat
cd "$(MAKEDIR)"
"bin\llvm-mingw-20220906-msvcrt-x86_64\bin\gcc.exe" :
cd "bin"
curl.exe --location --output "llvm-mingw-msvcrt.zip" "https://github.com/mstorsjo/llvm-mingw/releases/download/20220906/llvm-mingw-20220906-msvcrt-x86_64.zip"
for /f %%a in ('CertUtil -hashfile "llvm-mingw-msvcrt.zip" SHA256 ^| findstr /r "^[0-9a-f]*$$"') do if not "%%a"=="1b63120c346ff78a4e3dba77101a535434a62122d3b44021438a77bdf1b4679a" exit /b 1
tar -xf "llvm-mingw-msvcrt.zip"
del /f /q "llvm-mingw-msvcrt.zip"
cd "$(MAKEDIR)"
"eduvpn-common\internal\discovery\server_list.json" ::
curl.exe --location --output $@ "https://disco.eduvpn.org/v2/server_list.json"
!IFDEF MINISIGN_AVAILABLE
curl.exe --location --output "$(@:"=).minisig" "https://disco.eduvpn.org/v2/server_list.json.minisig"
minisign.exe -Vm $@ -P RWRtBSX1alxyGX+Xn3LuZnWUT0w//B6EmTJvgaAxBMYzlQeI+jdrO6KF || minisign.exe -Vm $@ -P "RWQKqtqvd0R7rUDp0rWzbtYPA3towPWcLDCl7eY9pBMMI/ohCmrS0WiM"
!ENDIF
"eduvpn-common\internal\discovery\organization_list.json" ::
curl.exe --location --output $@ "https://disco.eduvpn.org/v2/organization_list.json"
!IFDEF MINISIGN_AVAILABLE
curl.exe --location --output "$(@:"=).minisig" "https://disco.eduvpn.org/v2/organization_list.json.minisig"
minisign.exe -Vm $@ -P RWRtBSX1alxyGX+Xn3LuZnWUT0w//B6EmTJvgaAxBMYzlQeI+jdrO6KF || minisign.exe -Vm $@ -P "RWQKqtqvd0R7rUDp0rWzbtYPA3towPWcLDCl7eY9pBMMI/ohCmrS0WiM"
!ENDIF
CleanDeps :: \
CleanOpenVPN \
CleanWireGuard \
CleaneduVPNCommon
CleanWireGuard ::
-if exist "wireguard-windows\.deps" rd /q /s "wireguard-windows\.deps"
-if exist "wireguard-windows\amd64" rd /q /s "wireguard-windows\amd64"
-if exist "wireguard-windows\arm64" rd /q /s "wireguard-windows\arm64"
-if exist "wireguard-windows\x86" rd /q /s "wireguard-windows\x86"
-if exist "wireguard-windows\resources_*.syso" del /f /q "wireguard-windows\resources_*.syso"
-if exist "wireguard-windows\embeddable-dll-service\amd64" rd /q /s "wireguard-windows\embeddable-dll-service\amd64"
-if exist "wireguard-windows\embeddable-dll-service\arm64" rd /q /s "wireguard-windows\embeddable-dll-service\arm64"
-if exist "wireguard-windows\embeddable-dll-service\x86" rd /q /s "wireguard-windows\embeddable-dll-service\x86"
CleaneduVPNCommon ::
-if exist "bin\llvm-mingw-20220906-msvcrt-x86_64" rd /q /s "bin\llvm-mingw-20220906-msvcrt-x86_64"
-if exist "eduvpn-common\internal\discovery\server_list.json" del /f /q "eduvpn-common\internal\discovery\server_list.json"
-if exist "eduvpn-common\internal\discovery\server_list.json.minisig" del /f /q "eduvpn-common\internal\discovery\server_list.json.minisig"
-if exist "eduvpn-common\internal\discovery\organization_list.json" del /f /q "eduvpn-common\internal\discovery\organization_list.json"
-if exist "eduvpn-common\internal\discovery\organization_list.json.minisig" del /f /q "eduvpn-common\internal\discovery\organization_list.json.minisig"
Clean ::
-if exist "bin\Setup\PDB_*.zip" del /f /q "bin\Setup\PDB_*.zip"
.SUFFIXES : .exe .dll .msi
.exe.vtanalysis :
curl.exe --request POST --url "https://www.virustotal.com/api/v3/files" --header "Accept: application/json" --header "Content-Type: multipart/form-data" --header "x-apikey: $(VIRUSTOTALAPIKEY)" --form "file=@$**" --output "$(@:"=).tmp"
move /y "$(@:"=).tmp" $@ > NUL
.dll.vtanalysis :
curl.exe --request POST --url "https://www.virustotal.com/api/v3/files" --header "Accept: application/json" --header "Content-Type: multipart/form-data" --header "x-apikey: $(VIRUSTOTALAPIKEY)" --form "file=@$**" --output "$(@:"=).tmp"
move /y "$(@:"=).tmp" $@ > NUL
.msi.vtanalysis :
curl.exe --request POST --url "https://www.virustotal.com/api/v3/files" --header "Accept: application/json" --header "Content-Type: multipart/form-data" --header "x-apikey: $(VIRUSTOTALAPIKEY)" --form "file=@$**" --output "$(@:"=).tmp"
move /y "$(@:"=).tmp" $@ > NUL
######################################################################
# Setup
######################################################################
Setup :: \
SetupBuild \
SetupSign \
SetupMSI \
SetupSignMSI \
SetupBoot \
SetupSignBoot \
SetupExe \
SetupSignExe \
SetupPDB
######################################################################
# Configuration specific rules
######################################################################
CFG=Debug
!INCLUDE "MakefileCfg.mak"
CFG=Release
!INCLUDE "MakefileCfg.mak"
######################################################################
# Signing
######################################################################
SignDeps \
SignOpenVPN \
SignWireGuard \
SigneduVPNCommon \
SigneduVPNWindows \
Sign \
SetupSign \
SetupSignMSI \
SetupSignBoot \
SetupSignExe :
!IFDEF MANIFESTCERTIFICATETHUMBPRINT
signtool.exe sign /sha1 "$(MANIFESTCERTIFICATETHUMBPRINT)" /fd sha256 /tr "$(MANIFESTTIMESTAMPRFC3161URL)" /td sha256 $**
!ENDIF
BuildOpenVPN :: SignOpenVPN
BuildWireGuard :: SignWireGuard
BuildeduVPNCommon :: SigneduVPNCommon
BuildeduVPNWindows :: SigneduVPNWindows
Build :: Sign
######################################################################
# Transifex
######################################################################
TRANSIFEX_ORG=amebis
TRANSIFEX_PROJ=eduvpn
RESOURCE_DIR=$(MAKEDIR)\eduJSON\eduJSON\Resources
TRANSIFEX_RES=edujson
!INCLUDE "MakefileTransifex.mak"
RESOURCE_DIR=$(MAKEDIR)\eduOpenVPN\eduOpenVPN\Resources
TRANSIFEX_RES=eduopenvpn
!INCLUDE "MakefileTransifex.mak"
RESOURCE_DIR=$(MAKEDIR)\eduVPN\Resources
TRANSIFEX_RES=eduvpn
!INCLUDE "MakefileTransifex.mak"
RESOURCE_DIR=$(MAKEDIR)\eduVPN.Views\Resources
TRANSIFEX_RES=eduvpnviews
!INCLUDE "MakefileTransifex.mak"
RESOURCE_DIR=$(MAKEDIR)\eduWireGuard\eduWireGuard\Resources
TRANSIFEX_RES=eduwireguard
!INCLUDE "MakefileTransifex.mak"