fix[build]: Avoid exporting toolchain to system PATH

Change-Id: Ic85b4a20df81d4a430ca9563d3555e38cfe97338
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
This commit is contained in:
Johnson Ding
2025-01-23 17:30:35 +08:00
committed by Herman Chen
parent 3ea5eb5a51
commit 975a0b3e69
4 changed files with 28 additions and 19 deletions

View File

@@ -5,21 +5,30 @@ set +e
MPP_PWD=`pwd`
MPP_TOP=${MPP_PWD}/../../..
DEFAULT_TOOLCHAIN=arm-linux-gnueabi-
# toolchain detection
check_cmd(){
"$@" >> /dev/null 2>&1
}
check_system_arm_linux_gcc(){
check_cmd arm-linux-gcc -v
check_gcc(){
check_cmd ${TOOLCHAIN}gcc -v
}
source ../opt_proc.sh
check_system_arm_linux_gcc
if [ -z "${TOOLCHAIN}" ]; then
echo "Using system ${DEFAULT_TOOLCHAIN} as toolchain."
TOOLCHAIN=$DEFAULT_TOOLCHAIN
fi
check_gcc
if [ $? -eq 127 ];then
MPP_TOOLCHAIN=${MPP_TOP}/../prebuilts/toolschain/usr/bin
export PATH=$PATH:${MPP_TOOLCHAIN}
echo -e "\e[31m${TOOLCHAIN}gcc is not found!\e[0m"
echo -e "Please specify valid toolchain path and it's prefix to variable 'TOOLCHAIN' with argument --toolchain."
echo -e "For example:\n \t./make-Makefiles.bin --toolchain /path-to-toolchain/arm-linux-gnueabi-"
exit 1
fi
# generate Makefile