From 8a8156f037a0e880fe5cf09cc96a7d1466a230ad Mon Sep 17 00:00:00 2001
From: cyBerta <cyberta@riseup.net>
Date: Wed, 24 Jul 2024 20:12:25 +0200
Subject: [PATCH] take GOBIN environment variable into account when creating
 jni with gomobile

---
 build_core.sh     | 7 +++++--
 build_core_dev.sh | 6 +++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/build_core.sh b/build_core.sh
index 3abe7de..41924d9 100755
--- a/build_core.sh
+++ b/build_core.sh
@@ -86,8 +86,11 @@ showtitle "Getting gomobile"
 ./golang/go/bin/go install golang.org/x/mobile/cmd/gomobile || quit "./golang/go/bin/go install golang.org/x/mobile/cmd/gomobile"
 
 showtitle "initiating gomobile"
-./golang/bin/gomobile init || quit "./golang/bin/gomobile init"
-
+if [[ -z ${GOBIN} ]]; then
+  ./golang/bin/gomobile init || quit "./golang/bin/gomobile init"
+else
+  $GOBIN/gomobile init ||  quit "$GOBIN/gomobile init"
+fi
 
 # -------- prepare snowflake ---------------
 showtitle "Checking out snowflake repository"
diff --git a/build_core_dev.sh b/build_core_dev.sh
index 8031ef9..b2c1ff9 100755
--- a/build_core_dev.sh
+++ b/build_core_dev.sh
@@ -105,7 +105,11 @@ showtitle "Getting gomobile"
 ./golang/go/bin/go install golang.org/x/mobile/cmd/gomobile || quit "./golang/go/bin/go install golang.org/x/mobile/cmd/gomobile"
 
 showtitle "initiating gomobile"
-./golang/bin/gomobile init || quit "./golang/bin/gomobile init"
+if [[ -z ${GOBIN} ]]; then
+  ./golang/bin/gomobile init || quit "./golang/bin/gomobile init"
+else
+  $GOBIN/gomobile init ||  quit "$GOBIN/gomobile init"
+fi
 
 
 
-- 
GitLab