From e1ebe64a47b27e0741276ba38e3782ae992943b0 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 26 Oct 2018 22:35:58 +0200 Subject: 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 --- wireguard-go-bridge/Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'wireguard-go-bridge') 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)))) -- cgit v1.2.3-59-g8ed1b