commit:     5593ef751758f5e45b470f678134b93dd6b17078
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 14 19:21:28 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 22 22:22:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5593ef75

autotools.eclass: use --system-acdir for aclocal

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 <fedora.dm0 <AT> gmail.com> (for the suggestion)
Thanks-to: James Le Cuirot <chewi <AT> gentoo.org> (rubberducking & sounding 
board)
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/autotools.eclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index e2572290f0cb..771673f4641a 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -332,8 +332,26 @@ 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 [[ ${EAPI} != [56] ]] ; then
+               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"
+       else
+               local system_acdir=""
+       fi
+
        [[ ! -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

Reply via email to