diff mbox series

[v1,1/1] package/pkg-meson.mk: handle possibly non existing compilers

Message ID 20220816103710.1278-1-guillaume.bressaix@gmail.com
State Accepted
Headers show
Series [v1,1/1] package/pkg-meson.mk: handle possibly non existing compilers | expand

Commit Message

Guillaume Bres Aug. 16, 2022, 10:37 a.m. UTC
To avoid populating the cross-file with non existing compilers,
we tie them to /bin/false

Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
---
 package/pkg-meson.mk | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

Arnout Vandecappelle Aug. 16, 2022, 8:54 p.m. UTC | #1
On 16/08/2022 12:37, Guillaume W. Bres wrote:
> To avoid populating the cross-file with non existing compilers,
> we tie them to /bin/false
> 
> Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
> ---
>   package/pkg-meson.mk | 18 ++++++++++++++++--
>   1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 0632ab21cf..d675f7f733 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -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

  Perhaps we should do this in package/Makefile.in instead? I.e. define 
TARGET_CXX itself as false.

  This does have rather heavy implications, but I *think* it should be fine... 
And anyway, the autobuilders will tell us :-)

  Regards,
  Arnout

> +
>   # 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" \
Yann E. MORIN Aug. 16, 2022, 9:10 p.m. UTC | #2
Guillaume, Arnout, All,

On 2022-08-16 22:54 +0200, Arnout Vandecappelle spake thusly:
> On 16/08/2022 12:37, Guillaume W. Bres wrote:
> >To avoid populating the cross-file with non existing compilers,
> >we tie them to /bin/false

Guillaume, you should probably have copied in the commit log, the
explanations I provided where I reported the suggestion from the
meson guys.

> >Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
> >---
> >  package/pkg-meson.mk | 18 ++++++++++++++++--
> >  1 file changed, 16 insertions(+), 2 deletions(-)
> >
> >diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> >index 0632ab21cf..d675f7f733 100644
> >--- a/package/pkg-meson.mk
> >+++ b/package/pkg-meson.mk
> >@@ -68,15 +68,29 @@ else
[--SNIP--]
>  Perhaps we should do this in package/Makefile.in instead? I.e. define
> TARGET_CXX itself as false.
>  This does have rather heavy implications, but I *think* it should be
> fine... And anyway, the autobuilders will tell us :-)

Please, no. This goes contrary to what I explained in the other thread.

Disabling or forcing detection of a tool should be part of the
infrastructure. meson has its way (do not set it, or poison it with
/bin/false as suggested by them). auotools has its own way (set it to
no). cmake has probably a way of its own...

And even if they eventually come to be all use /binfalse except
autotools,  would still prefer that, because it semantically belong to
that buildsystem infra.

Regards,
Yann E. MORIN.

>  Regards,
>  Arnout
> 
> >+
> >  # 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" \
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni Aug. 16, 2022, 9:24 p.m. UTC | #3
On Tue, 16 Aug 2022 22:54:04 +0200
Arnout Vandecappelle <arnout@mind.be> wrote:

> > +# 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  
> 
>   Perhaps we should do this in package/Makefile.in instead? I.e. define 
> TARGET_CXX itself as false.
> 
>   This does have rather heavy implications, but I *think* it should be fine... 
> And anyway, the autobuilders will tell us :-)

See the discussion on the RFC of this patch, where I proposed exactly
this, and Yann gave a recollection of historical details that showed
that no, it's not a good idea to do it in package/Makefile.in,
unfortunately.

Thomas
Yann E. MORIN Aug. 20, 2022, 9:01 p.m. UTC | #4
Guillaume, All,

On 2022-08-16 12:37 +0200, Guillaume W. Bres spake thusly:
> To avoid populating the cross-file with non existing compilers,
> we tie them to /bin/false
> 
> Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>

Applied to next, thanks.

Regards,
Yann E. MORIN.

> ---
>  package/pkg-meson.mk | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 0632ab21cf..d675f7f733 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -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" \
> -- 
> 2.20.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 0632ab21cf..d675f7f733 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -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" \