On Thu, May 22, 2025 at 01:08:07AM -0400, Ionen Wolkens wrote:
> On Thu, May 22, 2025 at 12:35:48AM -0400, Eli Schwartz wrote:
> > This has been bothering me for a while. Meson will detect
> > find_program('python3') as the dummy shim in ${T} defined by the eclass,
> > and py.find_installation() may be the python that *Meson* was built
> > with. In DISTUTILS_USE_PEP517=meson-python a dedicated machine file is
> > created by the build backend but we should set this for other types of
> > packages as well.
> > 
> > Signed-off-by: Eli Schwartz <eschwa...@gentoo.org>
> > ---
> >  eclass/meson.eclass | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/eclass/meson.eclass b/eclass/meson.eclass
> > index a2bc5537e458..ab82234942d5 100644
> > --- a/eclass/meson.eclass
> > +++ b/eclass/meson.eclass
> > @@ -1,4 +1,4 @@
> > -# Copyright 2017-2024 Gentoo Authors
> > +# Copyright 2017-2025 Gentoo Authors
> >  # Distributed under the terms of the GNU General Public License v2
> >  
> >  # @ECLASS: meson.eclass
> > @@ -224,7 +224,16 @@ _meson_create_native_file() {
> >     pkg-config = '$(tc-getBUILD_PKG_CONFIG)'
> >     strip = $(_meson_env_array "$(tc-getBUILD_STRIP)")
> >     windres = $(_meson_env_array "$(tc-getBUILD_PROG RC windres)")
> > +   EOF
> > +
> > +   if [[ -n ${EPYTHON} ]]; then
> > +           cat >> "${fn}" <<-EOF
> > +           python = '${EPREFIX}/usr/bin/${EPYTHON}'
> > +           python3 = '${EPREFIX}/usr/bin/${EPYTHON}'
> > +           EOF
> > +   fi
> 
> One problem is that there is two potential usecase here.
> 
> 1. build system storing path for runtime use (rare'ish)
> 2. using at build time for some script (more common)
> 
> 1 should indeed be ${EPREFIX}/usr/bin/${EPYTHON}
> 2 should be either the wrapper or ${PYTHON} which includes BROOT

To add to this, guess we "could" use ${PYTHON} here as it'll be right
when ROOT is unset and not break build-time usage for crossdev, but
feel that just makes wrong-runtime-path issues harder to notice (vs
the ${T} one) given we'll only spot issues with ROOT.

tl;dr think the current situation is better even if means needing
ebuild workarounds for #1.

> 
> So I think this breaks ROOT builds unless I'm missing something.
> 
> >  
> > +   cat >> "${fn}" <<-EOF
> >     [built-in options]
> >     c_args = $(_meson_env_array "${BUILD_CFLAGS} ${BUILD_CPPFLAGS}")
> >     c_link_args = $(_meson_env_array "${BUILD_CFLAGS} ${BUILD_LDFLAGS}")
> > -- 
> > 2.49.0
> > 
> > 
> 
> -- 
> ionen



-- 
ionen

Attachment: signature.asc
Description: PGP signature

Reply via email to