commit:     d9e28f40be32f76224ef0dbe2f3163e0615896f1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  9 04:19:23 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec  9 04:24:29 2021 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=d9e28f40

general-concepts/autotools: use EAPI 8 in examples and autotools.eclass helpers

- Use EAPI 8 in examples
- Use eaclocal, eautoconf
- Define WANT_AUTOCONF/WANT_AUTOMAKE in global scope before inheriting
  autotools.eclass. The eclass declares these as @PRE_INHERIT which
  is necessary for e.g. ensuring dependencies are set.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 general-concepts/autotools/text.xml | 45 ++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/general-concepts/autotools/text.xml 
b/general-concepts/autotools/text.xml
index b7170ba..11cacf3 100644
--- a/general-concepts/autotools/text.xml
+++ b/general-concepts/autotools/text.xml
@@ -116,23 +116,28 @@ either <c>Makefile.am</c> or <c>configure.ac</c>:
 </p>
 
 <codesample lang="ebuild">
-EAPI=5
+EAPI=8
 
+WANT_AUTOCONF=2.5
+WANT_AUTOMAKE=1.9
 inherit autotools
 
+IUSE="nls"
+
+BDEPEND="nls? ( sys-devel/gettext )"
+
 src_prepare() {
+       default
+
        # Remove problematic LDFLAGS declaration
        sed -i -e '/^LDFLAGS/d' src/Makefile.am || die
 
        # Rerun autotools
-       einfo "Regenerating autotools files..."
-       WANT_AUTOCONF=2.5 eautoconf
-       WANT_AUTOMAKE=1.9 eautomake
+       eautoreconf
 }
 
-src_compile() {
+src_configure() {
        econf $(use_enable nls)
-       emake
 }
 </codesample>
 
@@ -591,10 +596,17 @@ In the first case you usually want to do something like:
 </p>
 
 <codesample lang="ebuild">
-einfo "Regenerating autotools files..."
-cp "${WORKDIR}/gentoo-m4" "${S}/m4" || die "m4 copy failed"
-WANT_AUTOCONF="2.5" aclocal -I "${S}/m4" || die "aclocal failed"
-WANT_AUTOCONF="2.5" autoconf || die "autoconf failed"
+WANT_AUTOCONF="2.5"
+inherit autotools
+
+src_prepare() {
+       default
+
+       einfo "Regenerating autotools files..."
+       cp "${WORKDIR}/gentoo-m4" "${S}/m4" || die "m4 copy failed"
+       eaclocal -I "${S}/m4"
+       eautoconf
+}
 </codesample>
 
 <p>
@@ -602,9 +614,16 @@ and so on. In the second case you can simplify it in this 
way:
 </p>
 
 <codesample lang="ebuild">
-einfo "Regenerating autotools files..."
-WANT_AUTOCONF="2.5" aclocal -I "${WORKDIR}/gentoo-m4" || die "aclocal failed"
-WANT_AUTOCONF="2.5" autoconf || die "autoconf failed"
+WANT_AUTOCONF="2.5"
+inherit autotools
+
+src_prepare() {
+       default
+
+       einfo "Regenerating autotools files..."
+       eaclocal -I "${WORKDIR}/gentoo-m4"
+       eautoconf
+}
 </codesample>
 
 <p>

Reply via email to