|
|
@ -81,48 +81,51 @@ termux_step_setup_toolchain() { |
|
|
|
elif [ "$TERMUX_ARCH" = "i686" ]; then |
|
|
|
_NDK_ARCHNAME=x86 |
|
|
|
fi |
|
|
|
|
|
|
|
"$NDK/build/tools/make_standalone_toolchain.py" \ |
|
|
|
--api "$TERMUX_PKG_API_LEVEL" \ |
|
|
|
--arch $_NDK_ARCHNAME \ |
|
|
|
--stl=libc++ \ |
|
|
|
--install-dir $_TERMUX_TOOLCHAIN_TMPDIR |
|
|
|
cp $NDK/toolchains/llvm/prebuilt/linux-x86_64 $_TERMUX_TOOLCHAIN_TMPDIR -r |
|
|
|
|
|
|
|
# Remove android-support header wrapping not needed on android-21: |
|
|
|
rm -Rf $_TERMUX_TOOLCHAIN_TMPDIR/sysroot/usr/local |
|
|
|
|
|
|
|
if [ "$TERMUX_ARCH" = "aarch64" ]; then |
|
|
|
# Use gold by default to work around https://github.com/android-ndk/ndk/issues/148 |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/aarch64-linux-android-ld.gold \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/aarch64-linux-android-ld |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld.gold \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "$TERMUX_ARCH" = "arm" ]; then |
|
|
|
# Linker wrapper script to add '--exclude-libs libgcc.a', see |
|
|
|
# https://github.com/android-ndk/ndk/issues/379 |
|
|
|
# https://android-review.googlesource.com/#/c/389852/ |
|
|
|
local linker |
|
|
|
for linker in ld ld.bfd ld.gold; do |
|
|
|
local wrap_linker=$_TERMUX_TOOLCHAIN_TMPDIR/$TERMUX_HOST_PLATFORM/bin/$linker |
|
|
|
local real_linker=$_TERMUX_TOOLCHAIN_TMPDIR/$TERMUX_HOST_PLATFORM/bin/$linker.real |
|
|
|
local wrap_linker=$_TERMUX_TOOLCHAIN_TMPDIR/arm-linux-androideabi/bin/$linker |
|
|
|
local real_linker=$_TERMUX_TOOLCHAIN_TMPDIR/arm-linux-androideabi/bin/$linker.real |
|
|
|
cp $wrap_linker $real_linker |
|
|
|
echo '#!/bin/bash' > $wrap_linker |
|
|
|
echo -n '$(dirname $0)/' >> $wrap_linker |
|
|
|
echo -n $linker.real >> $wrap_linker |
|
|
|
echo ' --exclude-libs libunwind.a --exclude-libs libgcc_real.a "$@"' >> $wrap_linker |
|
|
|
done |
|
|
|
fi |
|
|
|
for HOST_PLAT in aarch64-linux-android armv7a-linux-androideabi i686-linux-android x86_64-linux-android; do |
|
|
|
|
|
|
|
# Setup the cpp preprocessor: |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-clang \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-cpp |
|
|
|
sed -i 's/clang80/clang80 -E/' \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-cpp |
|
|
|
|
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT$TERMUX_PKG_API_LEVEL-clang \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT$TERMUX_PKG_API_LEVEL-clang++ \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang++ |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT$TERMUX_PKG_API_LEVEL-clang \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-cpp |
|
|
|
sed -i 's/clang/clang -E/' \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-cpp |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-gcc |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang++ \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-gcc |
|
|
|
done |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/armv7a-linux-androideabi$TERMUX_PKG_API_LEVEL-clang \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/arm-linux-androideabi-clang |
|
|
|
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/armv7a-linux-androideabi$TERMUX_PKG_API_LEVEL-clang++ \ |
|
|
|
$_TERMUX_TOOLCHAIN_TMPDIR/bin/arm-linux-androideabi-clang++ |
|
|
|
cd $_TERMUX_TOOLCHAIN_TMPDIR/sysroot |
|
|
|
|
|
|
|
for f in $TERMUX_SCRIPTDIR/ndk-patches/*.patch; do |
|
|
|
sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" "$f" | \ |
|
|
|
sed "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" | \ |
|
|
|