diff options
author | 2018-10-26 22:35:58 +0200 | |
---|---|---|
committer | 2018-10-26 22:40:07 +0200 | |
commit | e1ebe64a47b27e0741276ba38e3782ae992943b0 (patch) | |
tree | 5858d3c62f20e00f893d9c721abbf64f92b1ab98 /wireguard-go-bridge | |
parent | MIT license (diff) | |
download | wireguard-apple-e1ebe64a47b27e0741276ba38e3782ae992943b0.tar.xz wireguard-apple-e1ebe64a47b27e0741276ba38e3782ae992943b0.zip |
bridge: go get requires arch paths
So we move it into the build phase. This makes sense, since ostensibly
different archs might have different required modules.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'wireguard-go-bridge')
-rw-r--r-- | wireguard-go-bridge/Makefile | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/wireguard-go-bridge/Makefile b/wireguard-go-bridge/Makefile index 7c00e84..330ef60 100644 --- a/wireguard-go-bridge/Makefile +++ b/wireguard-go-bridge/Makefile @@ -36,20 +36,25 @@ $(foreach FILE,$(UPSTREAM_FILES),$(eval $(call copy-src-to-build,../wireguard-go $(foreach FILE,$(DOWNSTREAM_FILES),$(eval $(call copy-src-to-build,src/,$(FILE)))) $(BUILDDIR)/.prepared: - cd "$(BUILDDIR)" && if ! GOPATH="$(BUILDDIR)/gopath" go get -tags ios; then chmod -fR +w "$(BUILDDIR)/gopath/pkg/mod"; rm -rf "$(BUILDDIR)/gopath/pkg/mod"; exit 1; fi - chmod -fR +w "$(BUILDDIR)/gopath/pkg/mod" - touch "$@" + @touch "$@" define libwg-go-a $(BUILDDIR)/libwg-go-$(1).a: $(BUILDDIR)/.prepared cd "$(BUILDDIR)" && \ - CC="$(CC_$(1))" \ + export CC="$(CC_$(1))" \ CGO_CFLAGS="$(CGO_FLAGS_$(1))" \ CGO_LDFLAGS="$(CGO_FLAGS_$(1))" \ GOARCH="$(GOARCH_$(1))" \ - GOPATH="$(BUILDDIR)/gopath" \ - go build -tags ios -v -o "$(BUILDDIR)/libwg-go-$(1).a" -buildmode c-archive - @rm -f "$(BUILDDIR)/libwg-go-$(1).h" + GOPATH="$(BUILDDIR)/gopath"; \ + if ! go get -tags ios; then \ + ret=$$$$?; \ + chmod -fR +w "$(BUILDDIR)/gopath/pkg/mod"; \ + rm -rf "$(BUILDDIR)/gopath/pkg/mod"; \ + exit $$$$ret; \ + fi; \ + chmod -fR +w "$(BUILDDIR)/gopath/pkg/mod"; \ + go build -tags ios -v -o "$(BUILDDIR)/libwg-go-$(1).a" -buildmode c-archive; \ + rm -f "$(BUILDDIR)/libwg-go-$(1).h" endef $(foreach ARCH,$(ARCHS),$(eval $(call libwg-go-a,$(ARCH)))) |