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 <hias@horus.com>

fixup scripts/build local-cc wrapper
This commit is contained in:
Matthias Reichl 2022-12-01 20:07:12 +01:00
parent 627b7c9829
commit 8022ec23bf

View File

@ -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