aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/build.bat
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-11-07 19:12:53 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-13 14:42:54 +0100
commit37248860704230119ce3d5cd98f3824b6b9bd6d8 (patch)
tree5a5cf08efc8eaee043f4e4fc64678893085b82f3 /build.bat
parentsyntax: port to go (diff)
downloadwireguard-windows-37248860704230119ce3d5cd98f3824b6b9bd6d8.tar.xz
wireguard-windows-37248860704230119ce3d5cd98f3824b6b9bd6d8.zip
build: remove cgo
This doesn't yet build but we'll get there. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'build.bat')
-rw-r--r--build.bat10
1 files changed, 3 insertions, 7 deletions
diff --git a/build.bat b/build.bat
index 1a79b79b..d43b0507 100644
--- a/build.bat
+++ b/build.bat
@@ -38,6 +38,7 @@ if exist .deps\prepared goto :render
set WIREGUARD_VERSION=%WIREGUARD_VERSION:"=%
for /f "tokens=1-4" %%a in ("%WIREGUARD_VERSION:.= % 0 0 0") do set WIREGUARD_VERSION_ARRAY=%%a,%%b,%%c,%%d
set GOOS=windows
+ set GOARM=7
set GOPATH=%BUILDDIR%.deps\gopath
set GOROOT=%BUILDDIR%.deps\go
set PATH=%BUILDDIR%.deps\llvm-mingw\bin;%PATH%
@@ -45,12 +46,8 @@ if exist .deps\prepared goto :render
echo [+] Regenerating files
go generate ./... || exit /b 1
)
- set CGO_ENABLED=1
- set CGO_CFLAGS=-O3 -Wall -Wno-unused-function -Wno-switch -std=gnu11 -DWINVER=0x0601
call :build_plat x86 i686 386 || goto :error
call :build_plat amd64 x86_64 amd64 || goto :error
- set CGO_ENABLED=0
- set GOARM=7
call :build_plat arm armv7 arm || goto :error
:sign
@@ -76,17 +73,16 @@ if exist .deps\prepared goto :render
goto :eof
:build_plat
- set CC=%~2-w64-mingw32-gcc
set GOARCH=%~3
mkdir %1 >NUL 2>&1
echo [+] Assembling resources %1
%~2-w64-mingw32-windres -I ".deps\wintun\bin\%~1" -DWIREGUARD_VERSION_ARRAY=%WIREGUARD_VERSION_ARRAY% -DWIREGUARD_VERSION_STR=%WIREGUARD_VERSION% -i resources.rc -o "resources_%~3.syso" -O coff || exit /b %errorlevel%
echo [+] Building program %1
- go build -ldflags="-H windowsgui -s -w" -tags walk_use_cgo -trimpath -v -o "%~1\wireguard.exe" || exit /b 1
+ go build -ldflags="-H windowsgui -s -w" -trimpath -v -o "%~1\wireguard.exe" || exit /b 1
if not exist "%~1\wg.exe" (
echo [+] Building command line tools %1
del .deps\src\*.exe .deps\src\*.o .deps\src\wincompat\*.o 2> NUL
- make --no-print-directory -C .deps\src PLATFORM=windows CC=%CC% V=1 LDFLAGS=-s RUNSTATEDIR= SYSTEMDUNITDIR= -j%NUMBER_OF_PROCESSORS% || exit /b 1
+ make --no-print-directory -C .deps\src PLATFORM=windows CC=%~2-w64-mingw32-gcc V=1 LDFLAGS=-s RUNSTATEDIR= SYSTEMDUNITDIR= -j%NUMBER_OF_PROCESSORS% || exit /b 1
move /Y .deps\src\wg.exe "%~1\wg.exe" > NUL || exit /b 1
)
goto :eof