Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/gmp/, profiles/arch/amd64/, profiles/arch/x86/, profiles/arch/base/
Date: Thu, 01 Dec 2022 03:42:23
Message-Id: 1669866114.121152c38caefd8e94fb8c90cb51102693b6d6a8.sam@gentoo
1 commit: 121152c38caefd8e94fb8c90cb51102693b6d6a8
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 1 03:26:54 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 1 03:41:54 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=121152c3
7
8 dev-libs/gmp: allow automatic detection of host for USE=-cpudetection
9
10 Bug: https://bugs.gentoo.org/883201
11 Closes: https://bugs.gentoo.org/235697
12 Closes: https://bugs.gentoo.org/545442
13 Signed-off-by: Sam James <sam <AT> gentoo.org>
14
15 .../{gmp-6.2.1-r3.ebuild => gmp-6.2.1-r4.ebuild} | 32 +++++++++++++++++++---
16 dev-libs/gmp/metadata.xml | 13 ++++++++-
17 profiles/arch/amd64/package.use.mask | 4 ---
18 profiles/arch/base/package.use.mask | 4 ---
19 profiles/arch/x86/package.use.mask | 4 ---
20 5 files changed, 40 insertions(+), 17 deletions(-)
21
22 diff --git a/dev-libs/gmp/gmp-6.2.1-r3.ebuild b/dev-libs/gmp/gmp-6.2.1-r4.ebuild
23 similarity index 71%
24 rename from dev-libs/gmp/gmp-6.2.1-r3.ebuild
25 rename to dev-libs/gmp/gmp-6.2.1-r4.ebuild
26 index 8e7bca104d30..0a58fc8ba3b4 100644
27 --- a/dev-libs/gmp/gmp-6.2.1-r3.ebuild
28 +++ b/dev-libs/gmp/gmp-6.2.1-r4.ebuild
29 @@ -25,10 +25,10 @@ S="${WORKDIR}"/${MY_P%a}
30 LICENSE="|| ( LGPL-3+ GPL-2+ )"
31 # The subslot reflects the C & C++ SONAMEs.
32 SLOT="0/10.4"
33 -# Unkeyworded temporarily for some more testing
34 -#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"
35 +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"
36 IUSE="+asm doc +cpudetection +cxx pic static-libs"
37 REQUIRED_USE="cpudetection? ( asm )"
38 +RESTRICT="!cpudetection? ( bindist )"
39
40 BDEPEND="
41 app-arch/xz-utils
42 @@ -99,8 +99,13 @@ multilib_src_configure() {
43 # or specific-to-used-CPU (which our config.guess refresh prevents at the moment).
44 # Both Fedora and opensuse use this option to tackle the issue, bug #883201.
45 #
46 - # This only works for x86, so we're still getting non-performant
47 - # builds on other arches until we figure something out!
48 + # This only works for amd64/x86, so to get accelerated performance
49 + # (i.e. not using the generic C), one needs USE=-cpudetection if
50 + # on non-amd64/x86.
51 + #
52 + # (We do not mask USE=cpudetection on !amd64/x86 because we want
53 + # the flag to be useful on other arches to allow opting out of the
54 + # config.guess logic below.)
55 $(use_enable cpudetection fat)
56 $(use_enable cxx)
57 $(use_enable static-libs static)
58 @@ -110,6 +115,25 @@ multilib_src_configure() {
59 $(use pic && echo --with-pic)
60 )
61
62 + if use cpudetection && ! use amd64 && ! use x86 ; then
63 + elog "Using generic C implementation on non-amd64/x86 with USE=cpudetection"
64 + elog "--enable-fat is a no-op on alternative arches."
65 + elog "To obtain an optimized build, set USE=-cpudetection, but binpkgs should not then be made."
66 + fi
67 +
68 + # See bug #883201 again.
69 + if ! use cpudetection && ! tc-is-cross-compiler ; then
70 + local gmp_host=$("${S}"/config.guess || die "failed to run config.guess")
71 +
72 + if [[ -z ${gmp_host} ]] ; then
73 + die "Empty result from GMP's custom config.guess!"
74 + fi
75 +
76 + einfo "GMP guessed processor type: ${gmp_host}"
77 + ewarn "This build will only work on this machine. Enable USE=cpudetection for binary packages!"
78 + export ac_cv_host="${gmp_host}"
79 + fi
80 +
81 ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
82 }
83
84
85 diff --git a/dev-libs/gmp/metadata.xml b/dev-libs/gmp/metadata.xml
86 index 753f212d3e39..591e777c6165 100644
87 --- a/dev-libs/gmp/metadata.xml
88 +++ b/dev-libs/gmp/metadata.xml
89 @@ -7,7 +7,18 @@
90 </maintainer>
91 <use>
92 <flag name="asm">Enable use of hand optimized assembly routines (faster execution)</flag>
93 - <flag name="cpudetection">Enables runtime CPU detection (useful for binpkgs, compatibility on other CPUs)</flag>
94 + <flag name="cpudetection">
95 + Enables runtime CPU detection (useful for binpkgs, compatibility on other CPUs).
96 +
97 + This only works on amd64/x86 at present.
98 +
99 + If this flag is enabled, GMP will work on a variety of amd64/x86 CPUs and load accelerated
100 + routines for use at runtime depending on the CPU in use. This makes it suitable
101 + for binary packages (binpkgs).
102 +
103 + If this flag is disabled, GMP will be tuned for the CPU being used at build-time
104 + and may not be usable on other machines.
105 + </flag>
106 <flag name="pic">Force static libraries to be built as PIC to avoid TEXTRELs.</flag>
107 </use>
108 <upstream>
109
110 diff --git a/profiles/arch/amd64/package.use.mask b/profiles/arch/amd64/package.use.mask
111 index 4fa0267b5a1b..27207c6da3f9 100644
112 --- a/profiles/arch/amd64/package.use.mask
113 +++ b/profiles/arch/amd64/package.use.mask
114 @@ -17,10 +17,6 @@
115
116 #--- END OF EXAMPLES ---
117
118 -# Sam James <sam@g.o> (2022-11-30)
119 -# Only effective on amd64/x86.
120 -dev-libs/gmp -cpudetection
121 -
122 # Guillermo Joandet <gjoandet@×××××.com> (2022-11-22)
123 # app-text/pandoc is keyworded on this architecture
124 net-libs/gssdp -man
125
126 diff --git a/profiles/arch/base/package.use.mask b/profiles/arch/base/package.use.mask
127 index a9a1bad325ca..5a1455d90b27 100644
128 --- a/profiles/arch/base/package.use.mask
129 +++ b/profiles/arch/base/package.use.mask
130 @@ -1,10 +1,6 @@
131 # Copyright 1999-2022 Gentoo Authors
132 # Distributed under the terms of the GNU General Public License v2
133
134 -# Sam James <sam@g.o> (2022-11-30)
135 -# Only effective on amd64/x86.
136 -dev-libs/gmp cpudetection
137 -
138 # Mike Gilbert <floppym@g.o> (2022-10-16)
139 # Only supported on MIPS.
140 dev-lang/gnat-gpl fixed-point
141
142 diff --git a/profiles/arch/x86/package.use.mask b/profiles/arch/x86/package.use.mask
143 index 20ce8131ba98..a68e233ecfd9 100644
144 --- a/profiles/arch/x86/package.use.mask
145 +++ b/profiles/arch/x86/package.use.mask
146 @@ -1,10 +1,6 @@
147 # Copyright 1999-2022 Gentoo Authors
148 # Distributed under the terms of the GNU General Public License v2
149
150 -# Sam James <sam@g.o> (2022-11-30)
151 -# Only effective on amd64/x86.
152 -dev-libs/gmp -cpudetection
153 -
154 # Michał Górny <mgorny@g.o> (2022-11-16)
155 # spirv-llvm-translator is not keyworded x86.
156 dev-libs/libclc spirv