Fix armc5-bin-dir and armc6-bin-dir options to all.sh

ARMC5_BIN_DIR and ARMC6_BIN_DIR were set in pre_parse_command_line() and used
by support_build_armcc() which is called by pre_initialize_variables() to
determines SUPPORTED_COMPONENTS.

As pre_initialize_variables() is called before pre_parse_command_line(),
support_build_armcc() failed to use the directories set on the command line.

However, we can't call pre_parse_command_line() before pre_initialize_variables()
since the former needs SUPPORTED_COMPONENTS!

Fix the circular dependency by parsing the command line twice, with the first
pass only to get these directories.

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove 2023-06-09 14:20:18 +01:00
parent 579e6e9a05
commit 730addc203

View file

@ -411,6 +411,18 @@ check_tools()
done
}
pre_parse_command_line_for_dirs () {
# Make an early pass through the options given, so we can set directories
# for Arm compilers, before SUPPORTED_COMPONENTS is determined.
while [ $# -gt 0 ]; do
case "$1" in
--armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";;
--armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";;
esac
shift
done
}
pre_parse_command_line () {
COMMAND_LINE_COMPONENTS=
all_except=0
@ -427,8 +439,8 @@ pre_parse_command_line () {
--arm-none-eabi-gcc-prefix) shift; ARM_NONE_EABI_GCC_PREFIX="$1";;
--arm-linux-gnueabi-gcc-prefix) shift; ARM_LINUX_GNUEABI_GCC_PREFIX="$1";;
--armcc) no_armcc=;;
--armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";;
--armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";;
--armc5-bin-dir) shift; ;; # assignment to ARMC5_BIN_DIR done in pre_parse_command_line_for_dirs
--armc6-bin-dir) shift; ;; # assignment to ARMC6_BIN_DIR done in pre_parse_command_line_for_dirs
--error-test) error_test=$((error_test + 1));;
--except) all_except=1;;
--force|-f) FORCE=1;;
@ -4447,6 +4459,7 @@ run_component () {
# Preliminary setup
pre_check_environment
pre_parse_command_line_for_dirs "$@"
pre_initialize_variables
pre_parse_command_line "$@"