From d022bc8c3ab51c35d9014c3d669d241c46ead13f Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Thu, 1 Dec 2022 14:28:04 +0100 Subject: [PATCH] config/functions: add local-cc flag for building with local build-host cc This is needed for host packages built in very early stages, before host-cc (which typically uses ccache) is available. Set CC/CXX to LOCAL_CC/CXX in this case. Signed-off-by: Matthias Reichl --- config/functions | 9 +++++++-- packages/readme.md | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/functions b/config/functions index 9ddf319095..cc287404eb 100644 --- a/config/functions +++ b/config/functions @@ -492,8 +492,13 @@ setup_toolchain() { host:*|bootstrap:*) export DESTIMAGE="host" export AWK="gawk" - export CC="$TOOLCHAIN/bin/host-gcc" - export CXX="$TOOLCHAIN/bin/host-g++" + if [ "$1" = "host" ] && flag_enabled "local-cc" "no"; then + export CC="${LOCAL_CC}" + export CXX="${LOCAL_CXX}" + else + export CC="$TOOLCHAIN/bin/host-gcc" + export CXX="$TOOLCHAIN/bin/host-g++" + fi export CPP="cpp" export LD="ld" export AS="as" diff --git a/packages/readme.md b/packages/readme.md index 7c4f4984bc..45318ca522 100644 --- a/packages/readme.md +++ b/packages/readme.md @@ -132,6 +132,7 @@ Set the variable `PKG_BUILD_FLAGS` in the `package.mk` to enable/disable the sin | parallel | enabled | all | `make` or `ninja` builds with multiple threads/processes (or not) | | strip | enabled | target | strips executables (or not) | | sysroot | enabled | target | installs the package to the sysroot folder (or not) | +| local-cc | disabled | host | use compiler from buildhost instead of host-gcc/g++ in toolchain | ###### Example ```