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

    From Sam James@21:1/5 to All on Mon Jan 17 12:40:01 2022
    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@gmail.com> (for the suggestion)
    Thanks-to: James Le Cuirot <chewi@gentoo.org> (rubberducking & sounding board) Signed-off-by: Sam James <sam@gentoo.org>
    ---
    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_too
  • From Sam James@21:1/5 to All on Mon Jan 17 12:40:02 2022
    On 17 Jan 2022, at 11:09, Sam James <sam@gentoo.org> 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 <fedora.dm0@gmail.com> (for the suggestion) Thanks-to: James Le Cuirot <chewi@gentoo.org> (rubberducking & sounding board)
    Signed-off-by: Sam James <sam@gentoo.org>
    ---
    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


    -----BEGIN PGP SIGNATURE-----

    iQGTBAEBCgB9FiEEYOpPv/uDUzOcqtTy9JIoEO6gSDsFAmHlT7lfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDYw RUE0RkJGRkI4MzUzMzM5Q0FBRDRGMkY0OTIyODEwRUVBMDQ4M0IACgkQ9JIoEO6g SDuD/ggAg467DmYHb3nA4raiJL7Q/HNtnDdfJE3TG3OOutb9rWC2OclGck0GqJWK aSAwwheDgaSA7cBHnW7zXFLdqodo+Xfr7/ua53yzWrBN8CmSxtR84H1Ikw+9I9Vv aQVJUay8120EXlfpUTnncfVeZz8Ll0B01epSbNsOsW1EeRn5qaGJtGCw9ZAzMvn9 8RDSgskM+YAHx82od1z7EBrTvaFgjqEcseYhACtkLkbUnmQU1G0eNdgntyahAA4E OeXRKtB8GXQxa3e9Y6GGH2jbiaN021wc+nrQOHPbJrNP9T3KdckRcts2CNqBc9x5 ilPyng20MGazFbC43toKBWUUWJWsZQ==
    =0ptG
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)