-
Notifications
You must be signed in to change notification settings - Fork 379
Expand file tree
/
Copy pathBuildDependencies.bat
More file actions
120 lines (91 loc) · 4.51 KB
/
BuildDependencies.bat
File metadata and controls
120 lines (91 loc) · 4.51 KB
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
@echo off
if not defined PLATFORM (
set PLATFORM=x64
)
set currentDir=%~dp0
set publishDir=%currentDir%src\bin\win-%PLATFORM%\publish\
set publishDirBTI=%currentDir%src\bin\win-%PLATFORM%\BTI\publish\
set binDir=%currentDir%src\bin\
set resourcesDir=%binDir%Resources\
set mainDir=%binDir%
if "%~1"=="publish" (
set resourcesDir=%publishDir%Resources\
set mainDir=%publishDir%
) else if "%~1"=="publish-BTI" (
set resourcesDir=%publishDirBTI%Resources\
set mainDir=%publishDirBTI%
) else (
:: These dll files only need to be copied for development
:: In CI dll files are collected and packed with the installer
if "%PLATFORM%"=="x64" (
xcopy %currentDir%Setup\Native\x64\wireguard.dll %binDir% /y
xcopy %currentDir%Setup\Native\x64\tunnel.dll %binDir% /y
xcopy %currentDir%Setup\Native\x64\wireguard-tunnel-tcp.dll %binDir% /y
xcopy %currentDir%Setup\Native\x64\wintun.dll %binDir% /y
xcopy %currentDir%Setup\Native\x64\libcrypto-3-x64.dll %resourcesDir% /y
xcopy %currentDir%Setup\Native\x64\libpkcs11-helper-1.dll %resourcesDir% /y
xcopy %currentDir%Setup\Native\x64\libssl-3-x64.dll %resourcesDir% /y
xcopy %currentDir%Setup\Native\x64\openvpn.exe %resourcesDir% /y
xcopy %currentDir%Setup\Native\x64\vcruntime140.dll %resourcesDir% /y
)
if "%PLATFORM%"=="arm64" (
xcopy %currentDir%Setup\Native\arm64\wireguard.dll %binDir% /y
xcopy %currentDir%Setup\Native\arm64\tunnel.dll %binDir% /y
xcopy %currentDir%Setup\Native\arm64\wireguard-tunnel-tcp.dll %binDir% /y
xcopy %currentDir%Setup\Native\arm64\wintun.dll %binDir% /y
xcopy %currentDir%Setup\Native\arm64\libcrypto-3-arm64.dll %resourcesDir% /y
xcopy %currentDir%Setup\Native\arm64\libpkcs11-helper-1.dll %resourcesDir% /y
xcopy %currentDir%Setup\Native\arm64\libssl-3-arm64.dll %resourcesDir% /y
xcopy %currentDir%Setup\Native\arm64\openvpn.exe %resourcesDir% /y
)
)
set buildParams=/p:PlatformToolset=v143 /p:Configuration=Release /p:OutDir=%resourcesDir% /clp:ErrorsOnly
set x86buildParams=%buildParams% /p:Platform=Win32
set x64buildParams=%buildParams% /p:Platform=%PLATFORM%
if "%~2" NEQ "srponly" (
echo compiling ProtonVPN.IPFilter.dll %time%
msbuild src\ProtonVPN.IpFilter\ProtonVPN.IpFilter.vcxproj %x64buildParams% || exit /b %ERRORLEVEL%
echo compiling ProtonVPN.NetworkUtil.dll %time%
msbuild src\ProtonVPN.NetworkUtil\ProtonVPN.NetworkUtil.vcxproj %x64buildParams% || exit /b %ERRORLEVEL%
echo compiling ProtonVPN.InstallActions.x86.dll %time%
msbuild src\ProtonVPN.InstallActions\ProtonVPN.InstallActions.vcxproj %x86buildParams% || exit /b %ERRORLEVEL%
echo compiling ProtonVPN.InstallActions.dll %time%
msbuild src\ProtonVPN.InstallActions\ProtonVPN.InstallActions.vcxproj %x64buildParams% || exit /b %ERRORLEVEL%
echo compiling LocalAgent.dll %time%
if "%PLATFORM%"=="x64" (
pushd %currentDir%src\ProtonVPN.LocalAgent\localAgentWin
set GO111MODULE=on
set CGO_CFLAGS=-O3 -Wall -Wno-unused-function -Wno-switch -std=gnu11 -DWINVER=0x0601
go build -buildmode c-shared -ldflags="-w -s" -trimpath -v -o %resourcesDir%LocalAgent.dll
if %ERRORLEVEL% equ 0 (
echo file saved %resourcesDir%LocalAgent.dll
)
)
if "%PLATFORM%"=="arm64" (
docker run --rm ^
-e GOARCH="arm64" ^
-e GOOS="windows" ^
-e GO111MODULE="on" ^
-v %currentDir%\src\ProtonVPN.LocalAgent:/go/work ^
-w /go/work/localAgentWin x1unix/go-mingw:1.23 ^
go build -buildmode c-shared -ldflags="-w -s" -trimpath -v -o LocalAgent.dll .
xcopy %currentDir%src\ProtonVPN.LocalAgent\localAgentWin\LocalAgent.dll %resourcesDir% /y
)
)
set ipv6chaosFileName=proton_vpn_ipv6chaos.dll
echo Fetching %ipv6chaosFileName% %time%
curl -o "%mainDir%%ipv6chaosFileName%" "%IPV6_CHAOS_DLL_PATH%/v0.0.0/%PLATFORM%/%ipv6chaosFileName%"
if %ERRORLEVEL% equ 0 (
echo file saved %mainDir%%ipv6chaosFileName%
)
set srpFileName=proton_srp_cffi.dll
echo Building %srpFileName% %time%
pushd %currentDir%src\proton-rs-srp-cffi
cargo build --release || exit /b %ERRORLEVEL%
xcopy .\target\release\%srpFileName% %mainDir% /y
set binaryStatusFileName=proton_vpn_binary_status.dll
echo Building %binaryStatusFileName% %time%
pushd %currentDir%src\proton-vpn-binary-status
cargo build --release --features cffi || exit /b %ERRORLEVEL%
xcopy .\target\release\%binaryStatusFileName% %mainDir% /y
echo Dependencies done %time%