commit:     2e58af672b41a624f84eb7fada145ab2f6c2b1b6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  6 10:48:07 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec  6 10:52:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e58af67

dev-libs/gmp: further econf fixes

* Use gnuconfig.eclass to update configfsf.{guess,sub} before the wrapped
  versions call them.
* Export CBUILD too just in case for the deduced host from upstream's wrapped
  config.guess (not the same as gnuconfig's at all, see bugs for details).
* Save/restore upstream's config.{guess,sub} to make sure that for the second
  multilib build we still have it available to run. In practice, this may not
  have mattered too much, as the exported ac_cv_host should've persisted, but
  it's still worth being (clearly) correct as is the case now.
* Move cpudetection warning into pkg_pretend so it's easier to spot and
  we also don't then repeat it for each ABI.

Bug: https://bugs.gentoo.org/235697
Bug: https://bugs.gentoo.org/545442
Bug: https://bugs.gentoo.org/883201
See: 78b4d4ebbcee12f5ef4c1dfa89f80c98a582db9d
See: 3fe1b5370c0cc1537d1249e8ec9d2fbcd8619499
See: bf286a7973d8b95dbef90f17cc8e2d66c19a47c8
See: 121152c38caefd8e94fb8c90cb51102693b6d6a8
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../{gmp-6.2.1-r4.ebuild => gmp-6.2.1-r5.ebuild}   | 32 ++++++++++++++++++----
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/dev-libs/gmp/gmp-6.2.1-r4.ebuild b/dev-libs/gmp/gmp-6.2.1-r5.ebuild
similarity index 84%
rename from dev-libs/gmp/gmp-6.2.1-r4.ebuild
rename to dev-libs/gmp/gmp-6.2.1-r5.ebuild
index 0a58fc8ba3b4..2e867d0047e9 100644
--- a/dev-libs/gmp/gmp-6.2.1-r4.ebuild
+++ b/dev-libs/gmp/gmp-6.2.1-r5.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit libtool multilib-minimal toolchain-funcs
+inherit gnuconfig libtool multilib-minimal toolchain-funcs
 
 MY_PV=${PV/_p*}
 MY_PV=${MY_PV/_/-}
@@ -47,6 +47,14 @@ PATCHES=(
        "${FILESDIR}"/${P}-CVE-2021-43618.patch
 )
 
+pkg_pretend() {
+       if use cpudetection && ! use amd64 && ! use x86 ; then
+               elog "Using generic C implementation on non-amd64/x86 with 
USE=cpudetection"
+               elog "--enable-fat is a no-op on alternative arches."
+               elog "To obtain an optimized build, set USE=-cpudetection, but 
binpkgs should not then be made."
+       fi
+}
+
 src_prepare() {
        default
 
@@ -68,6 +76,19 @@ src_prepare() {
 
        # Patches to original configure might have lost the +x bit.
        chmod a+rx configure{,.wrapped} || die
+
+       # Save the upstream files named config.{guess,sub} which are
+       # wrappers around the gnuconfig versions.
+       mkdir "${T}"/gmp-gnuconfig || die
+       mv config.guess "${T}"/gmp-gnuconfig/config.guess || die
+       mv config.sub "${T}"/gmp-gnuconfig/config.sub || die
+       # Grab fresh copies from gnuconfig.
+       touch config.guess config.sub || die
+       gnuconfig_update
+       # Rename the fresh copies to the filenames the wrappers from GMP
+       # expect.
+       mv config.guess configfsf.guess || die
+       mv config.sub configfsf.sub || die
 }
 
 multilib_src_configure() {
@@ -115,11 +136,9 @@ multilib_src_configure() {
                $(use pic && echo --with-pic)
        )
 
-       if use cpudetection && ! use amd64 && ! use x86 ; then
-               elog "Using generic C implementation on non-amd64/x86 with 
USE=cpudetection"
-               elog "--enable-fat is a no-op on alternative arches."
-               elog "To obtain an optimized build, set USE=-cpudetection, but 
binpkgs should not then be made."
-       fi
+       # Move the wrappers from GMP back into place (may have been destroyed 
by previous econf run)
+       cp "${T}"/gmp-gnuconfig/config.guess "${S}"/config.guess || die
+       cp "${T}"/gmp-gnuconfig/config.sub "${S}"/config.sub || die
 
        # See bug #883201 again.
        if ! use cpudetection && ! tc-is-cross-compiler ; then
@@ -131,6 +150,7 @@ multilib_src_configure() {
 
                einfo "GMP guessed processor type: ${gmp_host}"
                ewarn "This build will only work on this machine. Enable 
USE=cpudetection for binary packages!"
+               export ac_cv_build="${gmp_host}"
                export ac_cv_host="${gmp_host}"
        fi
 

Reply via email to