aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-08-11 17:12:36 +0200
committerToni Uhlig <matzeton@googlemail.com>2024-05-08 09:02:27 +0200
commitb785d10e6eca8b74210680c7aa774a8579651efb (patch)
tree6c94249aa1a7915644ed0e6f8a4c2ac61d8e0a2a
parentc04fdc0518bf37070c8dacc2370b21fb82d5a128 (diff)
sdkevn.sh: added env vars for golang xcompile
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rwxr-xr-xsdkenv.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/sdkenv.sh b/sdkenv.sh
index 67f282bb10..8550e527fe 100755
--- a/sdkenv.sh
+++ b/sdkenv.sh
@@ -30,6 +30,19 @@ export LDFLAGS="-L${TARGET_DIR}/usr/lib -L${TARGET_DIR_ROOT}/usr/lib"
export PKG_CONFIG_PATH="${TARGET_DIR}/usr/lib/pkgconfig"
export PKG_CONFIG_LIBDIR="${TARGET_DIR}/usr/lib/pkgconfig"
+# set some optional CGO vars for xcompile
+export CGO_ENABLED=1
+export GO_EXTLINK_ENABLED=1
+export GOARCH="${ARCH}"
+if cat "${OWRT}/.config" | grep -qoE 'CONFIG_arm_v7'; then
+ echo "* GOARM=7"
+ export GOARM=7
+fi
+if cat "${OWRT}/.config" | grep -qoE 'CONFIG_arm_v6'; then
+ echo "* GOARM=6"
+ export GOARM=6
+fi
+
check_dirs[0]="${TOOLCHAIN_DIR}"
check_dirs[1]="${TARGET_DIR}"
check_dirs[2]="${TARGET_DIR_ROOT}"