diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-07 16:08:17 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-10 17:35:01 +0100 |
commit | 391d8ff6ca9a5950e670a77c9bcff265b8af7663 (patch) | |
tree | 19b4648197e9e140865fcd39a9ed044fbe2546f7 | |
parent | manager: add TcpIp service dependency for tunnels (diff) | |
download | wireguard-windows-391d8ff6ca9a5950e670a77c9bcff265b8af7663.tar.xz wireguard-windows-391d8ff6ca9a5950e670a77c9bcff265b8af7663.zip |
build: add wintun 0.9 and arm support to makefile
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | Makefile | 37 |
1 files changed, 29 insertions, 8 deletions
@@ -4,30 +4,45 @@ export CGO_CFLAGS := -O3 -Wall -Wno-unused-function -Wno-switch -std=gnu11 -DWIN export CGO_LDFLAGS := -Wl,--dynamicbase -Wl,--nxcompat -Wl,--export-all-symbols export GOOS := windows +VERSION := $(shell sed -n 's/^\s*Number\s*=\s*"\([0-9.]\+\)"$$/\1/p' version/version.go) +comma := , +RCFLAGS := -DWIREGUARD_WINDOWS_VERSION_ARRAY=$(subst .,$(comma),$(VERSION)) -DWIREGUARD_WINDOWS_VERSION_STR=$(VERSION) -O coff + rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) -SOURCE_FILES := $(call rwildcard,,*.go *.c *.h) .deps/prepared go.mod go.sum -RESOURCE_FILES := resources.rc version/version.h manifest.xml $(patsubst %.svg,%.ico,$(wildcard ui/icon/*.svg)) +SOURCE_FILES := $(call rwildcard,,*.go *.c *.h) .deps/goroot/prepared go.mod go.sum +RESOURCE_FILES := resources.rc version/version.go manifest.xml $(patsubst %.svg,%.ico,$(wildcard ui/icon/*.svg)) .deps/wintun/prepared DEPLOYMENT_HOST ?= winvm DEPLOYMENT_PATH ?= Desktop -all: amd64/wireguard.exe x86/wireguard.exe +all: amd64/wireguard.exe x86/wireguard.exe arm/wireguard.exe -.deps/prepared: $(wildcard go-patches/*.patch) - rm -rf .deps && mkdir -p .deps +.deps/goroot/prepared: $(wildcard go-patches/*.patch) + rm -rf .deps/goroot && mkdir -p .deps if ! rsync --exclude=pkg/obj/go-build/trim.txt -aqL $$(go env GOROOT)/ .deps/goroot; then chmod -R +w .deps/goroot; exit 1; fi chmod -R +w .deps/goroot cat $^ | patch -f -N -r- -p1 -d .deps/goroot touch $@ +.deps/wintun/prepared: + mkdir -p .deps + curl -L#o .deps/wintun.zip.UNVERIFIED https://www.wintun.net/builds/wintun-0.9.zip + echo "69afc860c9e5b5579f09847aeb9ac7b5190ec8ff6f21b6ec799f80351f19d1dd .deps/wintun.zip.UNVERIFIED" | sha256sum -c + mv .deps/wintun.zip.UNVERIFIED .deps/wintun.zip + unzip -d .deps .deps/wintun.zip + touch $@ + %.ico: %.svg convert -background none $< -define icon:auto-resize="256,192,128,96,64,48,32,24,16" $@ resources_amd64.syso: $(RESOURCE_FILES) - x86_64-w64-mingw32-windres -i $< -o $@ -O coff + x86_64-w64-mingw32-windres $(RCFLAGS) -I .deps/wintun/bin/amd64 -i $< -o $@ resources_386.syso: $(RESOURCE_FILES) - i686-w64-mingw32-windres -i $< -o $@ -O coff + i686-w64-mingw32-windres $(RCFLAGS) -I .deps/wintun/bin/x86 -i $< -o $@ + +resources_arm.syso: $(RESOURCE_FILES) + arm-w64-mingw32-windres $(RCFLAGS) -I .deps/wintun/bin/arm -i $< -o $@ amd64/wireguard.exe: export CC := x86_64-w64-mingw32-gcc amd64/wireguard.exe: export GOARCH := amd64 @@ -40,6 +55,12 @@ x86/wireguard.exe: export GOARCH := 386 x86/wireguard.exe: resources_386.syso $(SOURCE_FILES) GOROOT="$(CURDIR)/.deps/goroot" go build $(GOFLAGS) -o $@ +arm/wireguard.exe: export CC := arm-w64-mingw32-gcc +arm/wireguard.exe: export GOARCH := arm +arm/wireguard.exe: export GOARM := 7 +arm/wireguard.exe: resources_arm.syso $(SOURCE_FILES) + GOROOT="$(CURDIR)/.deps/goroot" go build $(GOFLAGS) -o $@ + remaster: export CC := x86_64-w64-mingw32-gcc remaster: export GOARCH := amd64 remaster: export GOPROXY := direct @@ -69,6 +90,6 @@ deploy: amd64/wireguard.exe scp $< $(DEPLOYMENT_HOST):$(DEPLOYMENT_PATH) clean: - rm -rf *.syso ui/icon/*.ico x86/ amd64/ .deps + rm -rf *.syso ui/icon/*.ico x86/ amd64/ arm/ .deps .PHONY: deploy clean fmt remaster generate all |