aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-03-08 04:23:39 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-08 19:05:39 +0100
commitf0f13f7467c029a77fc4384dcf1e1dcf33cf20e1 (patch)
tree2e938f46822494f63dc00f0bfe1b95df9aa26e59 /Makefile
parentifaceconfig: don't try to set v6 MTUs under 1280 (diff)
downloadwireguard-windows-f0f13f7467c029a77fc4384dcf1e1dcf33cf20e1.tar.xz
wireguard-windows-f0f13f7467c029a77fc4384dcf1e1dcf33cf20e1.zip
build: patch golang against dll injection
Diffstat (limited to '')
-rw-r--r--Makefile13
1 files changed, 11 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 720c0099..8a93a700 100644
--- a/Makefile
+++ b/Makefile
@@ -4,17 +4,26 @@ WINDRES := x86_64-w64-mingw32-windres
export CGO_ENABLED := 1
export GOOS := windows
export GOARCH := amd64
+REAL_GOROOT := $(shell go env GOROOT)
+export GOROOT := $(PWD)/deps/go
+export PATH := $(GOROOT)/bin:$(PATH)
DEPLOYMENT_HOST ?= winvm
DEPLOYMENT_PATH ?= Desktop
all: wireguard.exe
+deps/.prepared:
+ mkdir -p deps
+ rsync -a --delete --exclude=pkg/obj/go-build "$(REAL_GOROOT)/" "$(GOROOT)/"
+ patch -f -N -r- -d deps/go -p1 < golang-runtime-dll-injection.patch
+ touch "$@"
+
resources.syso: resources.rc manifest.xml ui/icon/icon.ico
$(WINDRES) -i $< -o $@ -O coff
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
-wireguard.exe: resources.syso $(call rwildcard,,*.go *.c *.h)
+wireguard.exe: resources.syso $(call rwildcard,,*.go *.c *.h) deps/.prepared
go build -ldflags="-H windowsgui -s -w" -v -o $@
deploy: wireguard.exe
@@ -22,6 +31,6 @@ deploy: wireguard.exe
scp wireguard.exe $(DEPLOYMENT_HOST):$(DEPLOYMENT_PATH)
clean:
- rm -rf resources.syso wireguard.exe
+ rm -rf resources.syso wireguard.exe deps
.PHONY: deploy clean all