Browse Source

Fix arm issue with clang-pie-wrapper

We need to wrap arm-linux-androideabi, not arm-linux-android.

Also, specify armv7a as clang cpu target and not just arm.
android-5
Fredrik Fornwall 8 years ago
parent
commit
07884eae94
  1. 22
      build-package.sh
  2. 2
      scripts/clang-pie-wrapper

22
build-package.sh

@ -207,7 +207,7 @@ termux_step_setup_variables() {
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/toolchain-${TERMUX_ARCH}-ndk${TERMUX_NDK_VERSION}-api${TERMUX_API_LEVEL}" TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/toolchain-${TERMUX_ARCH}-ndk${TERMUX_NDK_VERSION}-api${TERMUX_API_LEVEL}"
# Bump the below version if a change is made in toolchain setup to ensure # Bump the below version if a change is made in toolchain setup to ensure
# that everyone gets an updated toolchain: # that everyone gets an updated toolchain:
TERMUX_STANDALONE_TOOLCHAIN+="-v6" TERMUX_STANDALONE_TOOLCHAIN+="-v7"
export TERMUX_TAR="tar" export TERMUX_TAR="tar"
export TERMUX_TOUCH="touch" export TERMUX_TOUCH="touch"
@ -516,14 +516,18 @@ termux_step_setup_toolchain() {
--arch $_NDK_ARCHNAME \ --arch $_NDK_ARCHNAME \
--install-dir $_TERMUX_TOOLCHAIN_TMPDIR --install-dir $_TERMUX_TOOLCHAIN_TMPDIR
local w local wrapped plusplus CLANG_TARGET=$TERMUX_HOST_PLATFORM
for w in ${TERMUX_ARCH}-linux-android-clang clang; do if [ $TERMUX_ARCH = arm ]; then CLANG_TARGET=${CLANG_TARGET/arm-/armv7a-}; fi
cp $TERMUX_SCRIPTDIR/scripts/clang-pie-wrapper $_TERMUX_TOOLCHAIN_TMPDIR/bin/$w for wrapped in ${TERMUX_HOST_PLATFORM}-clang clang; do
sed -i 's/COMPILER/clang38/' $_TERMUX_TOOLCHAIN_TMPDIR/bin/$w for plusplus in "" "++"; do
sed -i "s/TERMUX_ARCH/$TERMUX_ARCH/" $_TERMUX_TOOLCHAIN_TMPDIR/bin/$w local FILE_TO_REPLACE=$_TERMUX_TOOLCHAIN_TMPDIR/bin/${wrapped}${plusplus}
cp $TERMUX_SCRIPTDIR/scripts/clang-pie-wrapper $_TERMUX_TOOLCHAIN_TMPDIR/bin/$w++ if [ ! -f $FILE_TO_REPLACE ]; then
sed -i 's/COMPILER/clang38++/' $_TERMUX_TOOLCHAIN_TMPDIR/bin/$w++ termux_error_exit "No toolchain file to override: $FILE_TO_REPLACE"
sed -i "s/TERMUX_ARCH/$TERMUX_ARCH/" $_TERMUX_TOOLCHAIN_TMPDIR/bin/$w++ fi
cp $TERMUX_SCRIPTDIR/scripts/clang-pie-wrapper $FILE_TO_REPLACE
sed -i "s/COMPILER/clang38$plusplus/" $FILE_TO_REPLACE
sed -i "s/CLANG_TARGET/$CLANG_TARGET/" $FILE_TO_REPLACE
done
done done
if [ "$TERMUX_ARCH" = "arm" ]; then if [ "$TERMUX_ARCH" = "arm" ]; then

2
scripts/clang-pie-wrapper

@ -25,7 +25,7 @@ arguments=()
# The ordinary wrapper from a NDK standalone toolchain # The ordinary wrapper from a NDK standalone toolchain
# with "${arguments[@]}" added. # with "${arguments[@]}" added.
if [ "$1" != "-cc1" ]; then if [ "$1" != "-cc1" ]; then
`dirname $0`/COMPILER -target TERMUX_ARCH-none-linux-android --sysroot `dirname $0`/../sysroot "${arguments[@]}" "$@" `dirname $0`/COMPILER -target CLANG_TARGET --sysroot `dirname $0`/../sysroot "${arguments[@]}" "$@"
else else
# target/triple already spelled out. # target/triple already spelled out.
`dirname $0`/COMPILER "${arguments[@]}" "$@" `dirname $0`/COMPILER "${arguments[@]}" "$@"

Loading…
Cancel
Save