diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | build.bat | 17 | ||||
-rw-r--r-- | installer/build.bat | 1 | ||||
-rw-r--r-- | installer/wireguard.wxs | 12 |
4 files changed, 28 insertions, 4 deletions
@@ -73,3 +73,5 @@ $ stat wg.exe ``` It interacts with WireGuard instances run by the main WireGuard for Windows program. + +When building on Windows, the aforementioned `build.bat` script takes care of building this. @@ -12,13 +12,16 @@ if exist .deps\prepared goto :render cd .deps || goto :error call :download go.zip https://dl.google.com/go/go1.12.3.windows-amd64.zip 1806e089e85b84f192d782a7f70f90a32e0eccfd181405857e612f806ec04059 || goto :error rem Mirror of https://musl.cc/i686-w64-mingw32-native.zip - call :download mingw-x86.zip https://download.wireguard.com/windows-toolchain/distfiles/i686-w64-mingw32-native-20190425.zip 5810b4a9af34c12690ec355ad2a237d2a4c16f5e8cb68988dc0f2e48457534d0 || goto :error + call :download mingw-x86.zip https://download.wireguard.com/windows-toolchain/distfiles/i686-w64-mingw32-native-20190602.zip 003b7d07c837bfd365cf282772fb478bfd83195ee7f755d789420a6a651553a9 || goto :error rem Mirror of https://musl.cc/x86_64-w64-mingw32-native.zip - call :download mingw-amd64.zip https://download.wireguard.com/windows-toolchain/distfiles/x86_64-w64-mingw32-native-20190307.zip 5390762183e181804b28eb13815b6210f85a1280057b815f749b06768215f817 || goto :error + call :download mingw-amd64.zip https://download.wireguard.com/windows-toolchain/distfiles/x86_64-w64-mingw32-native-20190602.zip 5e6629630f106dcad132f8b4eefdb6d2f98b1db251a1cf48a9f654da68793dad || goto :error rem Mirror of https://imagemagick.org/download/binaries/ImageMagick-7.0.8-42-portable-Q16-x64.zip call :download imagemagick.zip https://download.wireguard.com/windows-toolchain/distfiles/ImageMagick-7.0.8-42-portable-Q16-x64.zip 584e069f56456ce7dde40220948ff9568ac810688c892c5dfb7f6db902aa05aa "convert.exe colors.xml delegates.xml" || goto :error rem Mirror of https://sourceforge.net/projects/gnuwin32/files/patch/2.5.9-7/patch-2.5.9-7-bin.zip with fixed manifest call :download patch.zip https://download.wireguard.com/windows-toolchain/distfiles/patch-2.5.9-7-bin-fixed-manifest.zip 25977006ca9713f2662a5d0a2ed3a5a138225b8be3757035bd7da9dcf985d0a1 "--strip-components 1 bin" || goto :error + rem Mirror of https://sourceforge.net/projects/ezwinports/files/make-4.2.1-without-guile-w32-bin.zip + call :download make.zip https://download.wireguard.com/windows-toolchain/distfiles/make-4.2.1-without-guile-w32-bin.zip 30641be9602712be76212b99df7209f4f8f518ba764cf564262bc9d6e4047cc7 "--strip-components 1 bin" || goto :error + call :download wireguard-tools.zip https://git.zx2c4.com/WireGuard/snapshot/WireGuard-0.0.20190601.zip 881868b07d585246426f7f514706e82af168d0e3f4767dd96508ae0608a4ad8b "--exclude wg-quick --strip-components 1" || goto :error echo [+] Patching go for %%a in ("..\golang-*.patch") do .\patch.exe -f -N -r- -d go -p1 --binary < "%%a" || goto :error copy /y NUL prepared > NUL || goto :error @@ -29,7 +32,7 @@ if exist .deps\prepared goto :render for %%a in ("ui\icon\*.svg") do "%STARTDIR%\.deps\convert.exe" -background none "%%~fa" -define icon:auto-resize="256,128,96,64,48,32,16" "%%~dpna.ico" || goto :error :build - set PATH=%STARTDIR%\.deps\go\bin\;%PATH% + set PATH=%STARTDIR%\.deps\go\bin\;%STARTDIR%\.deps\;%PATH% set GOOS=windows set GOPATH=%STARTDIR%\.deps\gopath set GOROOT=%STARTDIR%\.deps\go @@ -44,7 +47,7 @@ if exist .deps\prepared goto :render if "%SigningCertificate%"=="" goto :success if "%TimestampServer%"=="" goto :success echo [+] Signing - signtool.exe sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d WireGuard x86\wireguard.exe amd64\wireguard.exe || goto :error + signtool.exe sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d WireGuard x86\wireguard.exe x86\wg.exe amd64\wireguard.exe amd64\wg.exe || goto :error :success echo [+] Success. Launch wireguard.exe. @@ -79,5 +82,11 @@ if exist .deps\prepared goto :render windres.exe -i resources.rc -o resources.syso -O coff || exit /b %errorlevel% echo [+] Building program %1 go build -ldflags="-H windowsgui -s -w" -tags walk_use_cgo -v -o "%~1\wireguard.exe" || exit /b 1 + if not exist "%~1\wg.exe" ( + echo [+] Building command line tools %1 + del .deps\src\tools\*.exe .deps\src\tools\*.o .deps\src\tools\wincompat\*.o 2> NUL + make --no-print-directory -C .deps\src\tools PLATFORM=windows CC=%CC% V=1 LDFLAGS=-s RUNSTATEDIR= SYSTEMDUNITDIR= -j%NUMBER_OF_PROCESSORS% || exit /b 1 + move /Y .deps\src\tools\wg.exe "%~1\wg.exe" > NUL || exit /b 1 + ) set PATH=%OLDPATH2% goto :eof diff --git a/installer/build.bat b/installer/build.bat index f8df607c..ef6b2a6d 100644 --- a/installer/build.bat +++ b/installer/build.bat @@ -12,6 +12,7 @@ set WIX_LIGHT_FLAGS=-nologo -spdb set WIX_LIGHT_FLAGS=%WIX_LIGHT_FLAGS% -sw1056 set WIX_LIGHT_FLAGS=%WIX_LIGHT_FLAGS% -sice:ICE30 set WIX_LIGHT_FLAGS=%WIX_LIGHT_FLAGS% -sice:ICE61 +set WIX_LIGHT_FLAGS=%WIX_LIGHT_FLAGS% -sice:ICE09 if exist .deps\prepared goto :build :installdeps diff --git a/installer/wireguard.wxs b/installer/wireguard.wxs index 93c97d0c..5680567b 100644 --- a/installer/wireguard.wxs +++ b/installer/wireguard.wxs @@ -75,6 +75,10 @@ <Directory Id="INSTALLFOLDER" Name="WireGuard"/> </Directory> <Directory Id="ProgramMenuFolder"/> + <Directory Id="SystemFolder"/> + <?if $(var.Platform) != "x86"?> + <Directory Id="System64Folder"/> + <?endif?> </Directory> <!-- @@ -87,6 +91,14 @@ </File> <ServiceControl Id="DummyService.3AA0C492_29F4_4342_B608_DB95B2DECB13" Name="DummyService.3AA0C492_29F4_4342_B608_DB95B2DECB13"/><!-- A dummy to make WiX create ServiceControl table for us. --> </Component> + <Component Directory="SystemFolder" Win64="no" Id="Wg32Executable" Guid="5ca31841-97d8-4614-a318-f1e268135ba7"> + <File Source="..\x86\wg.exe" Id="Wg32Executable"/> + </Component> + <?if $(var.Platform) != "x86"?> + <Component Directory="System64Folder" Win64="yes" Id="Wg64Executable" Guid="d9b494ec-0959-442c-89ad-6aa175acfd03"> + <File Source="..\$(var.Platform)\wg.exe" Id="Wg64Executable"/> + </Component> + <?endif?> </ComponentGroup> <!-- |