From 8022ec23bfe16a88c60bda780e7e64b7a54b3e35 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Thu, 1 Dec 2022 20:07:12 +0100 Subject: [PATCH] scripts/build: use wrapper scripts when building with local-cc flag Several packages and buildsystems (most notably cmake) badly trip over CC="ccache gcc" so create local wrapper scripts in the build dir and set CC/CXX to them to work around that - like we do for host-gcc and gcc in toolchain. Signed-off-by: Matthias Reichl fixup scripts/build local-cc wrapper --- scripts/build | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/build b/scripts/build index 23243a6aca..7c961ee548 100755 --- a/scripts/build +++ b/scripts/build @@ -238,6 +238,23 @@ if [ -f "${PKG_CONFIGURE_SCRIPT}" -o -f "${PKG_CMAKE_SCRIPT}" -o -f "${PKG_MESON MESON_CONF="${PKG_REAL_BUILD}/meson.conf" fi +# create wrapper scripts in build dir and use them for CC/CXX when +# building for host and local-cc build flag is set +if [ "${TARGET}" = "host" ] && flag_enabled "local-cc" "no"; then + cat > libreelec-local-cc << EOF +#!/bin/sh +exec ${CC} "\$@" +EOF + chmod +x libreelec-local-cc + export CC=$(pwd)/libreelec-local-cc + cat > libreelec-local-cxx << EOF +#!/bin/sh +exec ${CXX} "\$@" +EOF + chmod +x libreelec-local-cxx + export CXX=$(pwd)/libreelec-local-cxx +fi + # configure if [ -n "${PKG_DEPENDS_CONFIG}" -a -n "${PKG_INSTALL}" ]; then for pkg in ${PKG_DEPENDS_CONFIG}; do