Skip to content

Commit

Permalink
Merge "[V2] build.sh: Fix the behavior of specifying CC"
Browse files Browse the repository at this point in the history
  • Loading branch information
Treehugger Robot authored and Gerrit Code Review committed Aug 15, 2019
2 parents 3a869ac + a397d80 commit ee7ef66
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ SIGN_SEC=certs/signing_key.pem
SIGN_CERT=certs/signing_key.x509
SIGN_ALGO=sha512

# Save environment parameters before being overwritten by sourcing
# BUILD_CONFIG.
CC_ARG=${CC}

source "${ROOT_DIR}/build/envsetup.sh"

export MAKE_ARGS=$@
Expand All @@ -168,10 +172,14 @@ cd ${ROOT_DIR}

export CLANG_TRIPLE CROSS_COMPILE CROSS_COMPILE_ARM32 ARCH SUBARCH

# Restore the previously saved CC argument that might have been overridden by
# the BUILD_CONFIG.
[ -n "${CC_ARG}" ] && CC=${CC_ARG}

# CC=gcc is effectively a fallback to the default gcc including any target
# triplets. If the user wants to use a custom compiler, they are still able to
# pass an absolute path, e.g. CC=/usr/bin/gcc.
[ "${CC}" == "gcc" ] && unset CC
# triplets. An absolute path (e.g., CC=/usr/bin/gcc) must be specified to use a
# custom compiler.
[ "${CC}" == "gcc" ] && unset CC && unset CC_ARG

if [ -n "${CC}" ]; then
CC_ARG="CC=${CC} HOSTCC=${CC}"
Expand Down

0 comments on commit ee7ef66

Please sign in to comment.