Re: [gentoo-dev] [PATCH 2/4] autotools.eclass: use --system-acdir for aclocal

2022-01-17 Thread Sam James


> On 17 Jan 2022, at 11:09, Sam James  wrote:
> 
> We need to instruct aclocal that it might find macros in both
> ${BROOT} _and_ ${SYSROOT}.
> 
> - A classic example within BROOT is autoconf-archive.
> 
> - A classic example within SYSROOT is, say, libogg. A fair amount of
>  codec software installs its own macro to help locating it (but this
>  is in no ways limited to that genre/area).
> 
>  The correct position for a dependency like libogg is DEPEND, and yet
>  the status quo doesn't mean that aclocal is obligated to check in ${ESYSROOT}
>  which is where DEPEND-class dependencies are guaranteed to be installed.
> 
>  We can't rely on these being in BDEPEND -- in fact, most of the time,
>  they won't be. If we wanted to rely on macros always being provided by
>  BDEPEND, we'd have to duplicate a considerable number of dependencies
>  in both BDEPEND + DEPEND, with the unnecessary cross-compilation that would
>  entail too: it makes far more sense to just tell aclocal to look in the
>  right place (an extra location).
> 
> Bug: https://bugs.gentoo.org/710792
> Closes: https://bugs.gentoo.org/677002
> Closes: https://bugs.gentoo.org/738918
> Thanks-to: David Michael  (for the suggestion)
> Thanks-to: James Le Cuirot  (rubberducking & sounding board)
> Signed-off-by: Sam James 
> ---
> eclass/autotools.eclass | 16 +++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
> index e2572290f0cbe..2cf7c076d01ed 100644
> --- a/eclass/autotools.eclass
> +++ b/eclass/autotools.eclass
> @@ -332,8 +332,22 @@ eaclocal_amflags() {
> # They also force installing the support files for safety.
> # Respects AT_M4DIR for additional directories to search for macros.
> eaclocal() {
> + # Feed in a list of paths:
> + # - ${BROOT}/usr/share/aclocal
> + # - ${ESYSROOT}/usr/share/aclocal
> + # See bug #677002
> + if [[ ! -f "${T}"/aclocal/dirlist ]] ; then
> + mkdir "${T}"/aclocal || die
> + cat <<- EOF > "${T}"/aclocal/dirlist || die
> + ${BROOT}/usr/share/aclocal
> + ${ESYSROOT}/usr/share/aclocal
> + EOF
> + fi
> +
> + local system_acdir=" --system-acdir=${T}/aclocal"
> +
>   [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) 
> ]] && \
> - autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
> + autotools_run_tool --at-m4flags aclocal "$@" 
> $(eaclocal_amflags) ${system_acdir}
> }

I've changed this locally to just skip the add-system-acdir-logic for older 
EAPIs. Forgot to amend the commit,
Chewi had already pointed this out privately.

best,
sam



signature.asc
Description: Message signed with OpenPGP


[gentoo-dev] [PATCH 2/4] autotools.eclass: use --system-acdir for aclocal

2022-01-17 Thread Sam James
We need to instruct aclocal that it might find macros in both
${BROOT} _and_ ${SYSROOT}.

- A classic example within BROOT is autoconf-archive.

- A classic example within SYSROOT is, say, libogg. A fair amount of
  codec software installs its own macro to help locating it (but this
  is in no ways limited to that genre/area).

  The correct position for a dependency like libogg is DEPEND, and yet
  the status quo doesn't mean that aclocal is obligated to check in ${ESYSROOT}
  which is where DEPEND-class dependencies are guaranteed to be installed.

  We can't rely on these being in BDEPEND -- in fact, most of the time,
  they won't be. If we wanted to rely on macros always being provided by
  BDEPEND, we'd have to duplicate a considerable number of dependencies
  in both BDEPEND + DEPEND, with the unnecessary cross-compilation that would
  entail too: it makes far more sense to just tell aclocal to look in the
  right place (an extra location).

Bug: https://bugs.gentoo.org/710792
Closes: https://bugs.gentoo.org/677002
Closes: https://bugs.gentoo.org/738918
Thanks-to: David Michael  (for the suggestion)
Thanks-to: James Le Cuirot  (rubberducking & sounding board)
Signed-off-by: Sam James 
---
 eclass/autotools.eclass | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index e2572290f0cbe..2cf7c076d01ed 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -332,8 +332,22 @@ eaclocal_amflags() {
 # They also force installing the support files for safety.
 # Respects AT_M4DIR for additional directories to search for macros.
 eaclocal() {
+   # Feed in a list of paths:
+   # - ${BROOT}/usr/share/aclocal
+   # - ${ESYSROOT}/usr/share/aclocal
+   # See bug #677002
+   if [[ ! -f "${T}"/aclocal/dirlist ]] ; then
+   mkdir "${T}"/aclocal || die
+   cat <<- EOF > "${T}"/aclocal/dirlist || die
+   ${BROOT}/usr/share/aclocal
+   ${ESYSROOT}/usr/share/aclocal
+   EOF
+   fi
+
+   local system_acdir=" --system-acdir=${T}/aclocal"
+
[[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) 
]] && \
-   autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
+   autotools_run_tool --at-m4flags aclocal "$@" 
$(eaclocal_amflags) ${system_acdir}
 }
 
 # @FUNCTION: _elibtoolize
-- 
2.34.1