From 84f9b697d1417c6308c3a4be9d1c2d01d26a88bf Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 11 Oct 2019 14:33:39 +0200 Subject: move installation of gomobile to install_go.sh --- go/android_build_shapeshifter.sh | 11 ++++++++++- go/install_go.sh | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/go/android_build_shapeshifter.sh b/go/android_build_shapeshifter.sh index 85204906..7a884689 100755 --- a/go/android_build_shapeshifter.sh +++ b/go/android_build_shapeshifter.sh @@ -61,6 +61,12 @@ else exit 1; fi + if [[ ! -f ./bin/gomobile && $BUILD_LIBRARY == true ]]; then + echo "gomobile not installed" + echo please run "install_go.sh first" + exit 1 + fi + # Our targets are x86, x86_64, armeabi, armeabi-v7a, armv8; # To remove targets, simply delete them from the bracket. # NOTE: We are only currently shipping the armeabi-v7a binary @@ -122,7 +128,10 @@ else echo "Starting compilation for $suffix..." if [[ BUILD_LIBRARY ]]; then - ./android_build_shapeshifter_lib.sh || quit "Failed to cross-compile shapeshifter-dispatcher-library" + echo "cross compiling shapeshifter lib..." + ./bin/gomobile bind -target=android -o ./lib/shapeshifter.aar se.leap.bitmaskclient/shapeshifter/ + cp lib/shapeshifter* ../shapeshifter/. + #./android_build_shapeshifter_lib.sh || quit "Failed to cross-compile shapeshifter-dispatcher-library" else ./golang/go/bin/go build -buildmode=pie -ldflags '-w -s -extldflags=-pie' -o ./out/${suffix}/piedispatcher github.com/OperatorFoundation/shapeshifter-dispatcher/shapeshifter-dispatcher || quit "Failed to cross-compile shapeshifter-dispatcher" diff --git a/go/install_go.sh b/go/install_go.sh index 79264b7e..1674753e 100755 --- a/go/install_go.sh +++ b/go/install_go.sh @@ -20,3 +20,17 @@ else mkdir ./golang fi tar -C ./golang -xzf $GO_VERSION.tar.gz + + +export GOPATH=`pwd` +export GO_LANG=`pwd`/golang/go/bin +export GO_COMPILED=`pwd`/bin +PATH="${GO_LANG}:${GO_COMPILED}:${PATH}" + +./golang/go/bin/go get golang.org/x/mobile/cmd/gomobile +./golang/go/bin/go env +echo "getting gomobile..." +./golang/go/bin/go get golang.org/x/mobile/cmd/gomobile +echo "initiating gomobile..." +./bin/gomobile init + -- cgit v1.2.3