else
: ${TERMUX_STANDALONE_TOOLCHAIN:="$HOME/lib/android-standalone-toolchain-${TERMUX_ARCH}-api${TERMUX_API_LEVEL}-clang38"}
fi
-: ${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="23.0.2"}
+: ${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="23.0.3"}
# We do not put all of build-tools/$TERMUX_ANDROID_BUILD_TOOLS_VERSION/ into PATH
# to avoid stuff like arm-linux-androideabi-ld there to conflict with ones from
# the standalone toolchain.
export CXX=$TERMUX_HOST_PLATFORM-g++
_SPECSFLAG="-specs=$TERMUX_SCRIPTDIR/termux.spec"
else
- export AS=${TERMUX_HOST_PLATFORM}-clang
+ export AS=${TERMUX_HOST_PLATFORM}-gcc
export CC=$TERMUX_HOST_PLATFORM-clang
export CXX=$TERMUX_HOST_PLATFORM-clang++
# TODO: clang does not have specs file, how to ensure pie
export LDFLAGS="$_SPECSFLAG -L${TERMUX_PREFIX}/lib"
if [ "$TERMUX_ARCH" = "arm" ]; then
- # For hard support: http://blog.alexrp.com/2014/02/18/android-hard-float-support/
- # "First, to utilize the hard float ABI, you must either compile every last component of your application
- # as hard float (the -mhard-float GCC/Clang switch), or mark individual functions with the appropriate
- # __attribute__ to indicate the desired ABI. For example, to mark a function so that it’s called with the
- # soft float ABI, stick __attribute__((pcs("aapcs"))) on it.
- # Note that the NDK will link to a libm which uses the aforementioned attribute on all of its functions.
- # This means that if you use libm functions a lot, you’re not likely to get much of a boost in those places.
- # The way to fix this is to add -mhard-float -D_NDK_MATH_NO_SOFTFP=1 to your GCC/Clang command line. Then
- # add -lm_hard to your linker command line (or -Wl,-lm_hard if you just invoke GCC/Clang to link). This will
- # make your application link statically to a libm compiled for the hard float ABI. The only downside of this
- # is that your application will increase somewhat in size."
- CFLAGS+=" -march=armv7-a -mfpu=neon -mhard-float -Wl,--no-warn-mismatch"
- LDFLAGS+=" -march=armv7-a -Wl,--no-warn-mismatch"
+ CFLAGS+=" -march=armv7-a -mfpu=neon -mfloat-abi=softfp"
+ # "first flag instructs the linker to pick libgcc.a, libgcov.a, and
+ # crt*.o, which are tailored for armv7-a"
+ # - https://developer.android.com/ndk/guides/standalone_toolchain.html
+ LDFLAGS+=" -march=armv7-a -Wl,--fix-cortex-a8"
elif [ $TERMUX_ARCH = "i686" ]; then
# From $NDK/docs/CPU-ARCH-ABIS.html:
CFLAGS+=" -march=i686 -msse3 -mstackrealign -mfpmath=sse"
patch -p1;
echo "PATCHING FILE $f done!"
done
- # sha1.h was removed from android ndk for platforms above 19, but needed by the aapt package
- # JNIHelp.h is also used by aapt
- # sysexits.h is header-only and used by some unix code
- cp $TERMUX_SCRIPTDIR/ndk_patches/{sha1.h,sysexits.h,JNIHelp.h} $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/include
+ # elf.h is taken from glibc since the elf.h in the NDK is lacking.
+ # sysexits.h is header-only and used by a few programs.
+ cp $TERMUX_SCRIPTDIR/ndk_patches/{elf.h,sysexits.h} $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/include
fi
export TERMUX_COMMON_CACHEDIR="$TERMUX_TOPDIR/_cache"
mkdir -p $TERMUX_COMMON_CACHEDIR $TERMUX_COMMON_DEBDIR
# Get fresh versions of config.sub and config.guess
-for f in config.sub config.guess; do test ! -f $TERMUX_COMMON_CACHEDIR/$f && curl "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=${f};hb=HEAD" > $TERMUX_COMMON_CACHEDIR/$f; done
+for f in config.sub config.guess; do
+ if [ ! -f $TERMUX_COMMON_CACHEDIR/$f ]; then
+ termux_download "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=${f};hb=HEAD" $TERMUX_COMMON_CACHEDIR/$f
+ fi
+done
+
# Have a debian-binary file ready for deb packaging:
test ! -f $TERMUX_COMMON_CACHEDIR/debian-binary && echo "2.0" > $TERMUX_COMMON_CACHEDIR/debian-binary
# The host tuple that may be given to --host configure flag, but normally autodetected so not needed explicitly
filename=`basename $TERMUX_PKG_SRCURL`
file=$TERMUX_PKG_CACHEDIR/$filename
# Set "TERMUX_PKG_NO_SRC_CACHE=yes" in package to never cache packages, such as in git builds:
- test -n ${TERMUX_PKG_NO_SRC_CACHE-""} -o ! -f $file && curl --retry 3 -o $file -L $TERMUX_PKG_SRCURL
+ test -n ${TERMUX_PKG_NO_SRC_CACHE-""} -o ! -f $file && termux_download $TERMUX_PKG_SRCURL $file
if [ "x$TERMUX_PKG_FOLDERNAME" = "x" ]; then
folder=`basename $filename .tar.bz2` && folder=`basename $folder .tar.gz` && folder=`basename $folder .tar.xz` && folder=`basename $folder .tar.lz` && folder=`basename $folder .tgz` && folder=`basename $folder .zip`
folder=`echo $folder | sed 's/_/-/'` # dpkg uses _ in tar filename, but - in folder
return
}
+termux_download() {
+ URL="$1"
+ DESTINATION="$2"
+
+ TMPFILE=`mktemp $TERMUX_PKG_TMPDIR/download.XXXXXXXXX`
+ for i in 1 2 3; do
+ if curl -L --fail --retry 2 -o "$TMPFILE" "$URL"; then
+ mv "$TMPFILE" "$DESTINATION"
+ return
+ else
+ echo "Download of $1 failed (attempt $i/3)" 1>&2
+ sleep 6
+ fi
+ done
+ echo "Failed to download $1 - exiting" 1>&2
+ exit 1
+}
+
termux_setup_golang () {
export GOOS=android
export CGO_ENABLED=1
exit 1
fi
- local TERMUX_GO_VERSION=go1.6.1
+ local TERMUX_GO_VERSION=go1.6.2
local TERMUX_GO_PLATFORM=linux-amd64
test `uname` = "Darwin" && TERMUX_GO_PLATFORM=darwin-amd64
local TERMUX_BUILDGO_TAR=$TERMUX_COMMON_CACHEDIR/${TERMUX_GO_VERSION}.${TERMUX_GO_PLATFORM}.tar.gz
rm -Rf $TERMUX_COMMON_CACHEDIR/go $TERMUX_BUILDGO_FOLDER
- curl -o $TERMUX_BUILDGO_TAR https://storage.googleapis.com/golang/${TERMUX_GO_VERSION}.${TERMUX_GO_PLATFORM}.tar.gz
+ termux_download https://storage.googleapis.com/golang/${TERMUX_GO_VERSION}.${TERMUX_GO_PLATFORM}.tar.gz $TERMUX_BUILDGO_TAR
( cd $TERMUX_COMMON_CACHEDIR; tar xf $TERMUX_BUILDGO_TAR; mv go $TERMUX_BUILDGO_FOLDER; rm $TERMUX_BUILDGO_TAR )
}