Use binary distro of Golang
This is a bummer, but Gradle already specifies tons of specific versions of various binary components, so this is not materially different than the rest of how this whole thing works. It also allows us to specify the Go version that will actually build a working binary of wireguard-go, since all of the Go bugs mean not every version works equally. We do *not* want to use whatever version a distro happens to be shipping. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
83b30bed7b
commit
e6838f9cb0
@ -2,7 +2,9 @@ containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
|
|||||||
FILES := $(wildcard ../wireguard-go/*/*.go) $(wildcard ../wireguard-go/*.go)
|
FILES := $(wildcard ../wireguard-go/*/*.go) $(wildcard ../wireguard-go/*.go)
|
||||||
FILES := $(filter-out %/main.go $(filter-out %_linux.go,$(call containing,_,$(FILES))),$(FILES))
|
FILES := $(filter-out %/main.go $(filter-out %_linux.go,$(call containing,_,$(FILES))),$(FILES))
|
||||||
|
|
||||||
export GOPATH := $(CURDIR)/go
|
export GOPATH := $(CURDIR)/gopath
|
||||||
|
export GOROOT := $(CURDIR)/goroot
|
||||||
|
export PATH := $(GOROOT)/bin:$(PATH)
|
||||||
CLANG_FLAGS := --target=$(ANDROID_LLVM_TRIPLE) --gcc-toolchain=$(ANDROID_TOOLCHAIN_ROOT) --sysroot=$(ANDROID_SYSROOT)
|
CLANG_FLAGS := --target=$(ANDROID_LLVM_TRIPLE) --gcc-toolchain=$(ANDROID_TOOLCHAIN_ROOT) --sysroot=$(ANDROID_SYSROOT)
|
||||||
export CGO_CFLAGS := $(CLANG_FLAGS) $(CFLAGS)
|
export CGO_CFLAGS := $(CLANG_FLAGS) $(CFLAGS)
|
||||||
export CGO_LDFLAGS := $(CLANG_FLAGS) $(LDFLAGS)
|
export CGO_LDFLAGS := $(CLANG_FLAGS) $(LDFLAGS)
|
||||||
@ -12,7 +14,16 @@ export GOARCH := $(shell $(GO_ARCH_FILTER))
|
|||||||
export GOOS := android
|
export GOOS := android
|
||||||
export CGO_ENABLED := 1
|
export CGO_ENABLED := 1
|
||||||
|
|
||||||
$(DESTDIR)/libwg-go.so: $(FILES) api-android.go jni.c
|
GORELEASETARBALL := https://dl.google.com/go/go1.10.1.$(shell uname -s | tr '[:upper:]' '[:lower:]')-amd64.tar.gz
|
||||||
|
|
||||||
|
default: $(DESTDIR)/libwg-go.so
|
||||||
|
|
||||||
|
$(GOROOT)/bin/go:
|
||||||
|
rm -rf "$(GOROOT)"
|
||||||
|
mkdir -p "$(GOROOT)"
|
||||||
|
curl "$(GORELEASETARBALL)" | tar -C "$(GOROOT)" --strip-components=1 -xzf - || rm -rf "$(GOROOT)"
|
||||||
|
|
||||||
|
$(DESTDIR)/libwg-go.so: $(FILES) api-android.go jni.c $(GOROOT)/bin/go
|
||||||
find . -name '*.go' -type l -delete
|
find . -name '*.go' -type l -delete
|
||||||
find . -type d -empty -delete
|
find . -type d -empty -delete
|
||||||
mkdir -p $(subst ../wireguard-go/,./,$(dir $(FILES)))
|
mkdir -p $(subst ../wireguard-go/,./,$(dir $(FILES)))
|
||||||
|
Loading…
Reference in New Issue
Block a user