1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-23 04:41:16 +00:00

Build without cgo

This commit is contained in:
Lode Hoste 2016-02-10 19:07:38 +01:00
parent e7433fa392
commit fce35f1501
2 changed files with 6 additions and 46 deletions

View file

@ -6,11 +6,6 @@ RESET=1
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -z "$ANDROID_NDK" ]; then
echo "Error: unspecified ANDROID_NDK"
exit 1
fi
if [ -z "$GOROOT_BOOTSTRAP" ]; then
# We need Go 1.4 to bootstrap Go 1.5
if [ -z $GOROOT ] || [[ $(go version) != go\ version\ go1.4* ]] ; then
@ -28,34 +23,19 @@ fi
case "$1" in
arm)
if [ ! -d "${MYDIR}/build/ndk-$1" ]; then
sh ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=arm-linux-androideabi-4.9 --install-dir=${MYDIR}/build/ndk-$1
fi
export CC_FOR_TARGET=${MYDIR}/build/ndk-arm/bin/arm-linux-androideabi-gcc
export CXX_FOR_TARGET=${MYDIR}/build/ndk-arm/bin/arm-linux-androideabi-g++
export CGO_ENABLED=1
export CGO_ENABLED=0
export GOOS=android
export GOARCH=arm
export GOARM=5
;;
386)
if [ ! -d "${MYDIR}/build/ndk-$1" ]; then
sh ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=x86-4.9 --install-dir=${MYDIR}/build/ndk-$1
fi
export CC_FOR_TARGET=${MYDIR}/build/ndk-386/bin/i686-linux-android-gcc
export CXX_FOR_TARGET=${MYDIR}/build/ndk-386/bin/i686-linux-android-g++
export CGO_ENABLED=1
export CGO_ENABLED=0
export GOOS=android
export GOARCH=386
export GO386=387
;;
amd64)
if [ ! -d "${MYDIR}/build/ndk-$1" ]; then
sh ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh --platform=android-21 --toolchain=x86_64-4.9 --install-dir=${MYDIR}/build/ndk-$1
fi
export CC_FOR_TARGET=${MYDIR}/build/ndk-amd64/bin/x86_64-linux-android-gcc
export CXX_FOR_TARGET=${MYDIR}/build/ndk-amd64/bin/x86_64-linux-android-g++
export CGO_ENABLED=1
export CGO_ENABLED=0
export GOOS=android
export GOARCH=amd64
;;

View file

@ -6,43 +6,23 @@ RESET=1
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -z "$ANDROID_NDK" ]; then
echo "Error: unspecified ANDROID_NDK"
exit 1
fi
case "$1" in
arm)
if [ ! -d "${MYDIR}/build/ndk-$1" ]; then
sh ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=arm-linux-androideabi-4.9 --install-dir=${MYDIR}/build/ndk-$1
fi
export CC=${MYDIR}/build/ndk-$1/bin/arm-linux-androideabi-gcc
export CXX=${MYDIR}/build/ndk-$1/bin/arm-linux-androideabi-g++
export CGO_ENABLED=1
export CGO_ENABLED=0
export GOOS=android
export GOARCH=arm
export GOARM=5
export TARGETDIR=${MYDIR}/libs/armeabi
;;
386)
if [ ! -d "${MYDIR}/build/ndk-$1" ]; then
sh ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=x86-4.9 --install-dir=${MYDIR}/build/ndk-$1
fi
export CC_FOR_TARGET=${MYDIR}/build/ndk-$1/bin/i686-linux-android-gcc
export CXX_FOR_TARGET=${MYDIR}/build/ndk-$1/bin/i686-linux-android-g++
export CGO_ENABLED=1
export CGO_ENABLED=0
export GOOS=android
export GOARCH=386
export GO386=387
export TARGETDIR=${MYDIR}/libs/x86
;;
amd64)
if [ ! -d "${MYDIR}/build/ndk-$1" ]; then
sh ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=x86_64-4.9 --install-dir=${MYDIR}/build/ndk-$1
fi
export CC_FOR_TARGET=${MYDIR}/build/ndk-$1/bin/x86_64-linux-android-gcc
export CXX_FOR_TARGET=${MYDIR}/build/ndk-$1/bin/x86_64-linux-android-g++
export CGO_ENABLED=1
export CGO_ENABLED=0
export GOOS=android
export GOARCH=amd64
export TARGETDIR=${MYDIR}/libs/x86_64