public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/gmp/, profiles/arch/amd64/, profiles/arch/x86/, profiles/arch/base/
@ 2022-12-01  3:42 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2022-12-01  3:42 UTC (permalink / raw
  To: gentoo-commits

commit:     121152c38caefd8e94fb8c90cb51102693b6d6a8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  1 03:26:54 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec  1 03:41:54 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=121152c3

dev-libs/gmp: allow automatic detection of host for USE=-cpudetection

Bug: https://bugs.gentoo.org/883201
Closes: https://bugs.gentoo.org/235697
Closes: https://bugs.gentoo.org/545442
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../{gmp-6.2.1-r3.ebuild => gmp-6.2.1-r4.ebuild}   | 32 +++++++++++++++++++---
 dev-libs/gmp/metadata.xml                          | 13 ++++++++-
 profiles/arch/amd64/package.use.mask               |  4 ---
 profiles/arch/base/package.use.mask                |  4 ---
 profiles/arch/x86/package.use.mask                 |  4 ---
 5 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/dev-libs/gmp/gmp-6.2.1-r3.ebuild b/dev-libs/gmp/gmp-6.2.1-r4.ebuild
similarity index 71%
rename from dev-libs/gmp/gmp-6.2.1-r3.ebuild
rename to dev-libs/gmp/gmp-6.2.1-r4.ebuild
index 8e7bca104d30..0a58fc8ba3b4 100644
--- a/dev-libs/gmp/gmp-6.2.1-r3.ebuild
+++ b/dev-libs/gmp/gmp-6.2.1-r4.ebuild
@@ -25,10 +25,10 @@ S="${WORKDIR}"/${MY_P%a}
 LICENSE="|| ( LGPL-3+ GPL-2+ )"
 # The subslot reflects the C & C++ SONAMEs.
 SLOT="0/10.4"
-# Unkeyworded temporarily for some more testing
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 IUSE="+asm doc +cpudetection +cxx pic static-libs"
 REQUIRED_USE="cpudetection? ( asm )"
+RESTRICT="!cpudetection? ( bindist )"
 
 BDEPEND="
 	app-arch/xz-utils
@@ -99,8 +99,13 @@ multilib_src_configure() {
 		# or specific-to-used-CPU (which our config.guess refresh prevents at the moment).
 		# Both Fedora and opensuse use this option to tackle the issue, bug #883201.
 		#
-		# This only works for x86, so we're still getting non-performant
-		# builds on other arches until we figure something out!
+		# This only works for amd64/x86, so to get accelerated performance
+		# (i.e. not using the generic C), one needs USE=-cpudetection if
+		# on non-amd64/x86.
+		#
+		# (We do not mask USE=cpudetection on !amd64/x86 because we want
+		# the flag to be useful on other arches to allow opting out of the
+		# config.guess logic below.)
 		$(use_enable cpudetection fat)
 		$(use_enable cxx)
 		$(use_enable static-libs static)
@@ -110,6 +115,25 @@ 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
+
+	# See bug #883201 again.
+	if ! use cpudetection && ! tc-is-cross-compiler ; then
+		local gmp_host=$("${S}"/config.guess || die "failed to run config.guess")
+
+		if [[ -z ${gmp_host} ]] ; then
+			die "Empty result from GMP's custom config.guess!"
+		fi
+
+		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_host="${gmp_host}"
+	fi
+
 	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
 }
 

diff --git a/dev-libs/gmp/metadata.xml b/dev-libs/gmp/metadata.xml
index 753f212d3e39..591e777c6165 100644
--- a/dev-libs/gmp/metadata.xml
+++ b/dev-libs/gmp/metadata.xml
@@ -7,7 +7,18 @@
 	</maintainer>
 	<use>
 		<flag name="asm">Enable use of hand optimized assembly routines (faster execution)</flag>
-		<flag name="cpudetection">Enables runtime CPU detection (useful for binpkgs, compatibility on other CPUs)</flag>
+		<flag name="cpudetection">
+			Enables runtime CPU detection (useful for binpkgs, compatibility on other CPUs).
+
+			This only works on amd64/x86 at present.
+
+			If this flag is enabled, GMP will work on a variety of amd64/x86 CPUs and load accelerated
+			routines for use at runtime depending on the CPU in use. This makes it suitable
+			for binary packages (binpkgs).
+
+			If this flag is disabled, GMP will be tuned for the CPU being used at build-time
+			and may not be usable on other machines.
+		</flag>
 		<flag name="pic">Force static libraries to be built as PIC to avoid TEXTRELs.</flag>
 	</use>
 	<upstream>

diff --git a/profiles/arch/amd64/package.use.mask b/profiles/arch/amd64/package.use.mask
index 4fa0267b5a1b..27207c6da3f9 100644
--- a/profiles/arch/amd64/package.use.mask
+++ b/profiles/arch/amd64/package.use.mask
@@ -17,10 +17,6 @@
 
 #--- END OF EXAMPLES ---
 
-# Sam James <sam@gentoo.org> (2022-11-30)
-# Only effective on amd64/x86.
-dev-libs/gmp -cpudetection
-
 # Guillermo Joandet <gjoandet@gmail.com> (2022-11-22)
 # app-text/pandoc is keyworded on this architecture
 net-libs/gssdp -man

diff --git a/profiles/arch/base/package.use.mask b/profiles/arch/base/package.use.mask
index a9a1bad325ca..5a1455d90b27 100644
--- a/profiles/arch/base/package.use.mask
+++ b/profiles/arch/base/package.use.mask
@@ -1,10 +1,6 @@
 # Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# Sam James <sam@gentoo.org> (2022-11-30)
-# Only effective on amd64/x86.
-dev-libs/gmp cpudetection
-
 # Mike Gilbert <floppym@gentoo.org> (2022-10-16)
 # Only supported on MIPS.
 dev-lang/gnat-gpl fixed-point

diff --git a/profiles/arch/x86/package.use.mask b/profiles/arch/x86/package.use.mask
index 20ce8131ba98..a68e233ecfd9 100644
--- a/profiles/arch/x86/package.use.mask
+++ b/profiles/arch/x86/package.use.mask
@@ -1,10 +1,6 @@
 # Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# Sam James <sam@gentoo.org> (2022-11-30)
-# Only effective on amd64/x86.
-dev-libs/gmp -cpudetection
-
 # Michał Górny <mgorny@gentoo.org> (2022-11-16)
 # spirv-llvm-translator is not keyworded x86.
 dev-libs/libclc spirv


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-01  3:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-01  3:42 [gentoo-commits] repo/gentoo:master commit in: dev-libs/gmp/, profiles/arch/amd64/, profiles/arch/x86/, profiles/arch/base/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox