aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-04-25 14:36:33 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-04-25 14:43:46 +0200
commit1ca67cdf2d36d1d882db1addcc8540bbf8b99533 (patch)
tree217a2dfbf012f89370f47abfde790c42b5cf8050 /app
parentCurve25519: fix up spacing (diff)
downloadwireguard-android-1ca67cdf2d36d1d882db1addcc8540bbf8b99533.tar.xz
wireguard-android-1ca67cdf2d36d1d882db1addcc8540bbf8b99533.zip
Use variable map instead of shell switch
Diffstat (limited to 'app')
-rw-r--r--app/tools/libwg-go/Makefile13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/tools/libwg-go/Makefile b/app/tools/libwg-go/Makefile
index c54797c7..43af1439 100644
--- a/app/tools/libwg-go/Makefile
+++ b/app/tools/libwg-go/Makefile
@@ -2,6 +2,13 @@ containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
FILES := $(wildcard ../wireguard-go/*/*.go) $(wildcard ../wireguard-go/*.go)
FILES := $(filter-out %/main.go $(filter-out %_linux.go,$(call containing,_,$(FILES))),$(FILES))
+NDK_GO_ARCH_MAP_x86 := 386
+NDK_GO_ARCH_MAP_x86_64 := amd64
+NDK_GO_ARCH_MAP_arm := arm
+NDK_GO_ARCH_MAP_arm64 := arm64
+NDK_GO_ARCH_MAP_mips := mipsx
+NDK_GO_ARCH_MAP_mips64 := mips64x
+
export GOPATH := $(CURDIR)/gopath
export GOROOT := $(CURDIR)/goroot
export PATH := $(GOROOT)/bin:$(PATH)
@@ -9,12 +16,12 @@ CLANG_FLAGS := --target=$(ANDROID_LLVM_TRIPLE) --gcc-toolchain=$(ANDROID_TOOLCHA
export CGO_CFLAGS := $(CLANG_FLAGS) $(CFLAGS)
export CGO_LDFLAGS := $(CLANG_FLAGS) $(LDFLAGS)
export CC := $(ANDROID_C_COMPILER)
-GO_ARCH_FILTER := case "$(ANDROID_ARCH_NAME)" in x86) echo 386 ;; x86_64) echo amd64 ;; *) echo $(ANDROID_ARCH_NAME) ;; esac
-export GOARCH := $(shell $(GO_ARCH_FILTER))
+export GOARCH := $(NDK_GO_ARCH_MAP_$(ANDROID_ARCH_NAME))
export GOOS := android
export CGO_ENABLED := 1
-GORELEASETARBALL := https://dl.google.com/go/go1.10.1.$(shell uname -s | tr '[:upper:]' '[:lower:]')-amd64.tar.gz
+GORELEASEVERSION := 1.10.1
+GORELEASETARBALL := https://dl.google.com/go/go$(GORELEASEVERSION).$(shell uname -s | tr '[:upper:]' '[:lower:]')-$(NDK_GO_ARCH_MAP_$(shell uname -m)).tar.gz
default: $(DESTDIR)/libwg-go.so