#!/data/data/com.termux/files/usr/bin/bash
ARCH=$(dpkg --print-architecture)
PLATFORM=${ARCH}-linux-android
if [ $ARCH == "arm" ];
then export PLATFORM=arm-linux-androideabi
fi
cd /data/data/com.termux/files/usr/bin/
if [ -a /data/data/com.termux/files/usr/bin/gcc-10 ];  then
ln -sf gcc-10 gcc
ln -sf gcc cc
ln -sf g++-10 g++
ln -sf g++ c++
ln -sf cpp-10 cpp
ln -sf gfortran-10 gfortran 
ln -sf gcc ${PLATFORM}-gcc
ln -sf g++ ${PLATFORM}-g++
ln -sf cpp ${PLATFORM}-cpp
ln -sf g++ ${PLATFORM}-clang++
ln -sf gcc ${PLATFORM}-clang
ln -sf /data/data/com.termux/files/usr/lib/libgfortran.so.5 /data/data/com.termux/files/usr/lib/libgfortran.so
if [ -a /data/data/com.termux/files/usr/bin/gcov-10 ]; then
ln -sf gcov-10 gcov
ln -sf gcov-tool-10 gcov-tool
ln -sf gcov-dump-10 gcov-dump
fi
if [ -a /data/data/com.termux/files/usr/bin/gnat-10 ]; then
	for GNAT in gnat*-10 ; do
		GNAT3=$(echo ${GNAT:0:-2} )
		ln -sf $GNAT $GNAT3
	done
fi
echo "gcc now points to gcc-10"
else 
echo "gcc-10 is not installed"
fi
# The reason i change the platform-clang as well is because python configuration uses that for linker.
