[V2] build.sh: Fix the behavior of specifying CC

Update the behavior of specifying CC.
The following cases are covered:
- CC == gcc: special case in which we fall back to the default
    triplet defined by CROSS_COMPILE;
- CC == XXX != gcc != "": force the use of the specified XXX compiler;
- CC defined both in env and in BUILD_CONFIG: env has higher priority
    than BUILD_CONFIG.

This patch solves this unexpected behavior of having the CC value
specified in the environment overwritten by the one defined in
BUILD_CONFIG, preserving the behavior of the other cases.

In aosp/1090669 I forgot to add double quotes to the
variable expansion, causing the bug (Oops):

[ -n $CC_ARG ] --> [ -n "$CC_ARG" ]

Test: manual build
Bug: 138799604
Change-Id: Ie054cb7deb3ac7b1a4ae71fc5ae45857b3acaa39
Signed-off-by: Alessio Balsini <balsini@google.com>
1 file changed