Browse Source
build-package.sh: move golang variable configuration to termux_step_setup_toolchain.sh
Allow to use termux_setup_golang.sh for host builds.
build-on-device
Leonid Plyushch
5 years ago
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with
12 additions and
21 deletions
-
scripts/build/setup/termux_setup_golang.sh
-
scripts/build/termux_step_setup_toolchain.sh
|
|
@ -1,24 +1,5 @@ |
|
|
|
# Utility function for golang-using packages to setup a go toolchain. |
|
|
|
termux_setup_golang() { |
|
|
|
export GOOS=android |
|
|
|
export CGO_ENABLED=1 |
|
|
|
export GO_LDFLAGS="-extldflags=-pie" |
|
|
|
export CGO_LDFLAGS="$LDFLAGS" |
|
|
|
export CGO_CFLAGS="-I$TERMUX_PREFIX/include" |
|
|
|
if [ "$TERMUX_ARCH" = "arm" ]; then |
|
|
|
export GOARCH=arm |
|
|
|
export GOARM=7 |
|
|
|
elif [ "$TERMUX_ARCH" = "i686" ]; then |
|
|
|
export GOARCH=386 |
|
|
|
export GO386=sse2 |
|
|
|
elif [ "$TERMUX_ARCH" = "aarch64" ]; then |
|
|
|
export GOARCH=arm64 |
|
|
|
elif [ "$TERMUX_ARCH" = "x86_64" ]; then |
|
|
|
export GOARCH=amd64 |
|
|
|
else |
|
|
|
termux_error_exit "Unsupported arch: $TERMUX_ARCH" |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then |
|
|
|
local TERMUX_GO_VERSION=go1.13.5 |
|
|
|
local TERMUX_GO_PLATFORM=linux-amd64 |
|
|
|
|
|
@ -37,13 +37,17 @@ termux_step_setup_toolchain() { |
|
|
|
# With r13 of the ndk ruby 2.4.0 segfaults when built on arm with clang without -mthumb. |
|
|
|
CFLAGS+=" -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb" |
|
|
|
LDFLAGS+=" -march=armv7-a" |
|
|
|
export GOARCH=arm |
|
|
|
export GOARM=7 |
|
|
|
elif [ "$TERMUX_ARCH" = "i686" ]; then |
|
|
|
# From $NDK/docs/CPU-ARCH-ABIS.html: |
|
|
|
CFLAGS+=" -march=i686 -msse3 -mstackrealign -mfpmath=sse" |
|
|
|
export GOARCH=386 |
|
|
|
export GO386=sse2 |
|
|
|
elif [ "$TERMUX_ARCH" = "aarch64" ]; then |
|
|
|
: |
|
|
|
export GOARCH=arm64 |
|
|
|
elif [ "$TERMUX_ARCH" = "x86_64" ]; then |
|
|
|
: |
|
|
|
export GOARCH=amd64 |
|
|
|
else |
|
|
|
termux_error_exit "Invalid arch '$TERMUX_ARCH' - support arches are 'arm', 'i686', 'aarch64', 'x86_64'" |
|
|
|
fi |
|
|
@ -72,6 +76,12 @@ termux_step_setup_toolchain() { |
|
|
|
LDFLAGS+=" -landroid-support" |
|
|
|
fi |
|
|
|
|
|
|
|
export GOOS=android |
|
|
|
export CGO_ENABLED=1 |
|
|
|
export GO_LDFLAGS="-extldflags=-pie" |
|
|
|
export CGO_LDFLAGS="$LDFLAGS" |
|
|
|
export CGO_CFLAGS="-I$TERMUX_PREFIX/include" |
|
|
|
|
|
|
|
export ac_cv_func_getpwent=no |
|
|
|
export ac_cv_func_getpwnam=no |
|
|
|
export ac_cv_func_getpwuid=no |
|
|
|