package/pkg-meson.mk: handle possibly non existing compilers

To avoid populating the cross-file with non existing compilers,
we tie them to /bin/false.

As explained by @eliebrokeit on the meson IRC channel:

    If you don't have one [a compiler] defined, cross builds won't try
    to autodetect one, IIRC...
    ... however setting it to /bin/false will result in it detecting
    that that doesn't work
    I guess the safest bet is to deliberately poison it with /bin/false

So there we go.

Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
[yann.morin.1998@free.fr: expand with IRC snippet]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Guillaume W. Bres 2022-08-16 12:37:10 +02:00 committed by Yann E. MORIN
parent db15505180
commit 13faa449e1

View File

@ -68,15 +68,29 @@ else
PKG_MESON_TARGET_CPU_FAMILY = $(ARCH)
endif
# To avoid populating the cross-file with non existing compilers,
# we tie them to /bin/false
ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
PKG_MESON_TARGET_CXX = $(TARGET_CXX)
else
PKG_MESON_TARGET_CXX = /bin/false
endif
ifeq ($(BR2_TOOLCHAIN_HAS_FORTRAN),y)
PKG_MESON_TARGET_FC = $(TARGET_FC)
else
PKG_MESON_TARGET_FC = /bin/false
endif
# Generates sed patterns for patching the cross-compilation.conf template,
# since Flags might contain commas the arguments are passed indirectly by
# variable name (stripped to deal with whitespaces).
# Arguments are variable containing cflags, cxxflags, ldflags, fcflags
define PKG_MESON_CROSSCONFIG_SED
-e "s%@TARGET_CC@%$(TARGET_CC)%g" \
-e "s%@TARGET_CXX@%$(TARGET_CXX)%g" \
-e "s%@TARGET_CXX@%$(PKG_MESON_TARGET_CXX)%g" \
-e "s%@TARGET_AR@%$(TARGET_AR)%g" \
-e "s%@TARGET_FC@%$(TARGET_FC)%g" \
-e "s%@TARGET_FC@%$(PKG_MESON_TARGET_FC)%g" \
-e "s%@TARGET_STRIP@%$(TARGET_STRIP)%g" \
-e "s%@TARGET_ARCH@%$(PKG_MESON_TARGET_CPU_FAMILY)%g" \
-e "s%@TARGET_CPU@%$(GCC_TARGET_CPU)%g" \