1 |
commit: a98db11637ac67d5a244678db470d2e1837a9386 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 6 07:00:43 2020 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 6 07:01:28 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a98db116 |
7 |
|
8 |
sys-libs/glibc: drop old |
9 |
|
10 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
11 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
12 |
|
13 |
sys-libs/glibc/Manifest | 8 - |
14 |
sys-libs/glibc/glibc-2.26-r7.ebuild | 857 --------------------- |
15 |
sys-libs/glibc/glibc-2.27-r6.ebuild | 1415 ---------------------------------- |
16 |
sys-libs/glibc/glibc-2.28-r6.ebuild | 1412 ---------------------------------- |
17 |
sys-libs/glibc/glibc-2.29-r8.ebuild | 1431 ----------------------------------- |
18 |
5 files changed, 5123 deletions(-) |
19 |
|
20 |
diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest |
21 |
index 9bbebceba8d..d9dbb5ba599 100644 |
22 |
--- a/sys-libs/glibc/Manifest |
23 |
+++ b/sys-libs/glibc/Manifest |
24 |
@@ -4,14 +4,6 @@ DIST glibc-2.19-patches-9.tar.bz2 24584 BLAKE2B a96e930a5bd20fa75d9f259cc2117fa5 |
25 |
DIST glibc-2.19.tar.xz 12083312 BLAKE2B 9dc03346e0f0df4bf009a92d894b0a9f964ff92b7f4c9663cedf1cb6cf90435f28a15539d33791ecf43ee578fa4e26f916af0367651312ef8f9c1c38ce0dafa2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d |
26 |
DIST glibc-2.25-patches-15.tar.bz2 78320 BLAKE2B 70c62cc10db13e2844de4d8a18972e0f4d01ba52fbd40db57c11d7b1c2c0d571b894f01e762bb26632fd696a77c299ef0766e2f129d2eda896f58325a754a13c SHA512 7204218ea82b677e0f278c4752ddb90aa0c08ac2349d061de81ec91dac204b0f10fe223d7b1055b9e0c21dac97c835f913a90c0168a5000d3be00dd20027c185 |
27 |
DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e |
28 |
-DIST glibc-2.26-patches-7.tar.bz2 413976 BLAKE2B 18263201cf33abf911eb7b802ed539b217391156f897a8db50f65a69627d8f8cceded78414168986ee98eba038364a6b2f3599b23f95e7b0ad2643481c399718 SHA512 0c812a343fcc68c10d92117cb2a0cf1c255470e81f0a7a04d6db2fe35445e410ef37f15162f145c2eb772b08ab55af246f5b52f5e57c2e91038181f6f027abc3 |
29 |
-DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0 |
30 |
-DIST glibc-2.27-patches-3.tar.bz2 166511 BLAKE2B 1dc54bef6e82112935c7411f7a5cd07c1edb24c3edaa1e0243b846b3832a40af1ba3a7b77aef04c54a173388156b464ea442fa8310a02e6f44e2ed5b78994286 SHA512 12496e9b0c60630dbec4c2febdd6d20df1f3d7a2c243cc55b595202b27f682b9208e16cd8c387687c0cc9e18b36c3caeef8d1b1148eb3ee8081431997270db5e |
31 |
-DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147 |
32 |
-DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96 |
33 |
-DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3 |
34 |
-DIST glibc-2.29-patches-9.tar.xz 104444 BLAKE2B 3c20891ee5c435925e67bbb641da54b6b7fe0114f5f1d3ea9e616414f9bafb4d32b4303f4f798507ee4e42227d68a543da203450b9bd10b61628cd0b3547725c SHA512 c38f23e78e313fe2a9e223b720e8fd93c7c57e8408c6bc3ceacbfde354fa5d963e3cb525fe75aad7aaf7347066c0e4a671c0553fe490888478ff909492fdd164 |
35 |
-DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0 |
36 |
DIST glibc-2.30-patches-10.tar.xz 72808 BLAKE2B a7a95c99482524b2896d15539766f1e6b1fe34a22f32119248c6dd44f42632076e86fdcbbdc2d604ec73ceccdd8a7f5936a62a6f4c3d039fae8f6901dfc6be77 SHA512 af5e213ff08bf38f6f529816c36b4e38df27207c2df254609ebe45b2f039ab553bbe563aa6f64b6667d328fd2c120dc21b6e2676540bdd94e58079237089eac3 |
37 |
DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b |
38 |
DIST glibc-2.31-patches-4.tar.xz 40464 BLAKE2B 8c79b446a37be8f33c10b9fe987d2f55f285bf672a48bf307b60cbc322aadad1eec209b8d2ab88c023fcc718b08d089a151797e2b7352672234044ccd5eb9a9d SHA512 385de24a814646af3c8504ac1b76aa9d8ee5043d1e666656f7b31fc4a66c32b7c2a7b361b1a77e910182c07ff44bb1d228fd8de13a1915210035cad71251001a |
39 |
|
40 |
diff --git a/sys-libs/glibc/glibc-2.26-r7.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild |
41 |
deleted file mode 100644 |
42 |
index 95efd5f5139..00000000000 |
43 |
--- a/sys-libs/glibc/glibc-2.26-r7.ebuild |
44 |
+++ /dev/null |
45 |
@@ -1,857 +0,0 @@ |
46 |
-# Copyright 1999-2020 Gentoo Authors |
47 |
-# Distributed under the terms of the GNU General Public License v2 |
48 |
- |
49 |
-EAPI=6 |
50 |
- |
51 |
-inherit prefix toolchain-funcs toolchain-glibc |
52 |
- |
53 |
-DESCRIPTION="GNU libc C library" |
54 |
-HOMEPAGE="https://www.gnu.org/software/libc/" |
55 |
- |
56 |
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" |
57 |
-EMULTILIB_PKG="true" |
58 |
- |
59 |
-# Configuration variables |
60 |
- |
61 |
-if [[ ${PV} == 9999* ]]; then |
62 |
- EGIT_REPO_URI="https://sourceware.org/git/glibc.git" |
63 |
- inherit git-r3 |
64 |
-else |
65 |
- KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86" |
66 |
- SRC_URI="mirror://gnu/glibc/${P}.tar.xz" |
67 |
-fi |
68 |
- |
69 |
-RELEASE_VER=${PV} |
70 |
- |
71 |
-GCC_BOOTSTRAP_VER=20180511 |
72 |
- |
73 |
-# Gentoo patchset |
74 |
-PATCH_VER=7 |
75 |
- |
76 |
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2" |
77 |
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
78 |
- |
79 |
-IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only" |
80 |
- |
81 |
-# Min kernel version glibc requires |
82 |
-: ${NPTL_KERN_VER:="3.2.0"} |
83 |
- |
84 |
-# Here's how the cross-compile logic breaks down ... |
85 |
-# CTARGET - machine that will target the binaries |
86 |
-# CHOST - machine that will host the binaries |
87 |
-# CBUILD - machine that will build the binaries |
88 |
-# If CTARGET != CHOST, it means you want a libc for cross-compiling. |
89 |
-# If CHOST != CBUILD, it means you want to cross-compile the libc. |
90 |
-# CBUILD = CHOST = CTARGET - native build/install |
91 |
-# CBUILD != (CHOST = CTARGET) - cross-compile a native build |
92 |
-# (CBUILD = CHOST) != CTARGET - libc for cross-compiler |
93 |
-# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler |
94 |
-# For install paths: |
95 |
-# CHOST = CTARGET - install into / |
96 |
-# CHOST != CTARGET - install into /usr/CTARGET/ |
97 |
- |
98 |
-export CBUILD=${CBUILD:-${CHOST}} |
99 |
-export CTARGET=${CTARGET:-${CHOST}} |
100 |
-if [[ ${CTARGET} == ${CHOST} ]] ; then |
101 |
- if [[ ${CATEGORY} == cross-* ]] ; then |
102 |
- export CTARGET=${CATEGORY#cross-} |
103 |
- fi |
104 |
-fi |
105 |
- |
106 |
-# Note [Disable automatic stripping] |
107 |
-# Disabling automatic stripping for a few reasons: |
108 |
-# - portage's attempt to strip breaks non-native binaries at least on |
109 |
-# arm: bug #697428 |
110 |
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread |
111 |
-# enumeration: bug #697910. This is quite subtle: |
112 |
-# * gdb uses glibc's libthread_db-1.0.so to enumerate threads. |
113 |
-# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols |
114 |
-# via 'ps_pglobal_lookup' symbol defined in gdb. |
115 |
-# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all |
116 |
-# known symbols in 'libpthread.so.0'. Specifically 'nptl_version' |
117 |
-# (unexported) is used to sanity check compatibility before enabling |
118 |
-# debugging. |
119 |
-# Also see https://sourceware.org/gdb/wiki/FAQ#GDB_does_not_see_any_threads_besides_the_one_in_which_crash_occurred.3B_or_SIGTRAP_kills_my_program_when_I_set_a_breakpoint |
120 |
-# * normal 'strip' command trims '.symtab' |
121 |
-# Thus our main goal here is to prevent 'libpthread.so.0' from |
122 |
-# losing it's '.symtab' entries. |
123 |
-# As Gentoo's strip does not allow us to pass less aggressive stripping |
124 |
-# options and does not check the machine target we disable stripping |
125 |
-# entirely. |
126 |
-RESTRICT=strip |
127 |
- |
128 |
-is_crosscompile() { |
129 |
- [[ ${CHOST} != ${CTARGET} ]] |
130 |
-} |
131 |
- |
132 |
-SLOT="2.2" |
133 |
- |
134 |
-# General: We need a new-enough binutils/gcc to match upstream baseline. |
135 |
-# arch: we need to make sure our binutils/gcc supports TLS. |
136 |
-COMMON_DEPEND=" |
137 |
- nscd? ( selinux? ( |
138 |
- audit? ( sys-process/audit ) |
139 |
- caps? ( sys-libs/libcap ) |
140 |
- ) ) |
141 |
- suid? ( caps? ( sys-libs/libcap ) ) |
142 |
- selinux? ( sys-libs/libselinux ) |
143 |
- systemtap? ( dev-util/systemtap ) |
144 |
-" |
145 |
-DEPEND="${COMMON_DEPEND} |
146 |
- >=app-misc/pax-utils-0.1.10 |
147 |
- doc? ( sys-apps/texinfo ) |
148 |
-" |
149 |
-RDEPEND="${COMMON_DEPEND} |
150 |
- sys-apps/gentoo-functions |
151 |
-" |
152 |
- |
153 |
-if [[ ${CATEGORY} == cross-* ]] ; then |
154 |
- DEPEND+=" !headers-only? ( |
155 |
- >=${CATEGORY}/binutils-2.24 |
156 |
- >=${CATEGORY}/gcc-4.9 |
157 |
- )" |
158 |
- [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" |
159 |
-else |
160 |
- DEPEND+=" |
161 |
- >=sys-devel/binutils-2.24 |
162 |
- >=sys-devel/gcc-4.9 |
163 |
- virtual/os-headers |
164 |
- " |
165 |
- RDEPEND+=" vanilla? ( !sys-libs/timezone-data )" |
166 |
- PDEPEND+=" !vanilla? ( sys-libs/timezone-data )" |
167 |
-fi |
168 |
- |
169 |
-# |
170 |
-# the phases |
171 |
-# |
172 |
- |
173 |
-pkg_pretend() { |
174 |
- # Make sure devpts is mounted correctly for use w/out setuid pt_chown |
175 |
- check_devpts |
176 |
- |
177 |
- # Prevent native builds from downgrading |
178 |
- if [[ ${MERGE_TYPE} != "buildonly" ]] && \ |
179 |
- [[ ${ROOT} == "/" ]] && \ |
180 |
- [[ ${CBUILD} == ${CHOST} ]] && \ |
181 |
- [[ ${CHOST} == ${CTARGET} ]] ; then |
182 |
- # The high rev # is to allow people to downgrade between -r# versions. |
183 |
- # We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine. |
184 |
- # Hopefully we never actually use a r# this high. |
185 |
- if has_version ">${CATEGORY}/${P}-r10000" ; then |
186 |
- eerror "Sanity check to keep you from breaking your system:" |
187 |
- eerror " Downgrading glibc is not supported and a sure way to destruction" |
188 |
- [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system." |
189 |
- fi |
190 |
- |
191 |
- if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n' |
192 |
- then |
193 |
- eerror "Your patched vendor kernel is broken. You need to get an" |
194 |
- eerror "update from whoever is providing the kernel to you." |
195 |
- eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227" |
196 |
- eerror "https://bugs.gentoo.org/262698" |
197 |
- die "Keeping your system alive, say thank you" |
198 |
- fi |
199 |
- |
200 |
- if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' |
201 |
- then |
202 |
- eerror "Your old kernel is broken. You need to update it to" |
203 |
- eerror "a newer version as syscall(<bignum>) will break." |
204 |
- eerror "https://bugs.gentoo.org/279260" |
205 |
- die "Keeping your system alive, say thank you" |
206 |
- fi |
207 |
- fi |
208 |
- |
209 |
- # Users have had a chance to phase themselves, time to give em the boot |
210 |
- if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then |
211 |
- eerror "You still haven't deleted ${EROOT}/etc/locales.build." |
212 |
- eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher." |
213 |
- die "Lazy upgrader detected" |
214 |
- fi |
215 |
- |
216 |
- if [[ ${CTARGET} == i386-* ]] ; then |
217 |
- eerror "i386 CHOSTs are no longer supported." |
218 |
- eerror "Chances are you don't actually want/need i386." |
219 |
- eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml" |
220 |
- die "Please fix your CHOST" |
221 |
- fi |
222 |
- |
223 |
- if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then |
224 |
- ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS." |
225 |
- ewarn "This will result in a 50% performance penalty when running with a 32bit" |
226 |
- ewarn "hypervisor, which is probably not what you want." |
227 |
- fi |
228 |
- |
229 |
- # Make sure host system is up to date #394453 |
230 |
- if has_version '<sys-libs/glibc-2.13' && \ |
231 |
- [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]] |
232 |
- then |
233 |
- ebegin "Scanning system for __guard to see if you need to rebuild first ..." |
234 |
- local files=$( |
235 |
- scanelf -qys__guard -F'#s%F' \ |
236 |
- "${EROOT}"/*bin/ \ |
237 |
- "${EROOT}"/lib* \ |
238 |
- "${EROOT}"/usr/*bin/ \ |
239 |
- "${EROOT}"/usr/lib* | \ |
240 |
- egrep -v \ |
241 |
- -e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \ |
242 |
- -e "^${EROOT}/sbin/(ldconfig|sln)$" |
243 |
- ) |
244 |
- [[ -z ${files} ]] |
245 |
- if ! eend $? ; then |
246 |
- eerror "Your system still has old SSP __guard symbols. You need to" |
247 |
- eerror "rebuild all the packages that provide these files first:" |
248 |
- eerror "${files}" |
249 |
- die "old __guard detected" |
250 |
- fi |
251 |
- fi |
252 |
- |
253 |
- # Check for sanity of /etc/nsswitch.conf |
254 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then |
255 |
- local entry |
256 |
- for entry in passwd group shadow; do |
257 |
- if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then |
258 |
- eerror "Your ${EROOT}/etc/nsswitch.conf is out of date." |
259 |
- eerror "Please make sure you have 'files' entries for" |
260 |
- eerror "'passwd:', 'group:' and 'shadow:' databases." |
261 |
- eerror "For more details see:" |
262 |
- eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26" |
263 |
- die "nsswitch.conf has no 'files' provider in '${entry}'." |
264 |
- fi |
265 |
- done |
266 |
- fi |
267 |
-} |
268 |
- |
269 |
-src_unpack() { |
270 |
- use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
271 |
- |
272 |
- setup_env |
273 |
- |
274 |
- # Check NPTL support _before_ we unpack things to save some time |
275 |
- check_nptl_support |
276 |
- |
277 |
- if [[ -n ${EGIT_REPO_URI} ]] ; then |
278 |
- git-r3_src_unpack |
279 |
- else |
280 |
- unpack ${P}.tar.xz |
281 |
- fi |
282 |
- |
283 |
- cd "${S}" |
284 |
- touch locale/C-translit.h #185476 #218003 |
285 |
- |
286 |
- cd "${WORKDIR}" |
287 |
- unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2 |
288 |
-} |
289 |
- |
290 |
-src_prepare() { |
291 |
- if ! use vanilla ; then |
292 |
- elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}" |
293 |
- eapply "${WORKDIR}"/patches |
294 |
- einfo "Done." |
295 |
- fi |
296 |
- |
297 |
- if just_headers ; then |
298 |
- if [[ -e ports/sysdeps/mips/preconfigure ]] ; then |
299 |
- # mips peeps like to screw with us. if building headers, |
300 |
- # we don't have a real compiler, so we can't let them |
301 |
- # insert -mabi on us. |
302 |
- sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die |
303 |
- find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} + |
304 |
- fi |
305 |
- fi |
306 |
- |
307 |
- default |
308 |
- |
309 |
- gnuconfig_update |
310 |
- |
311 |
- cd "${WORKDIR}" |
312 |
- find . -name configure -exec touch {} + |
313 |
- |
314 |
- eprefixify extra/locale/locale-gen |
315 |
- |
316 |
- # Fix permissions on some of the scripts. |
317 |
- chmod u+x "${S}"/scripts/*.sh |
318 |
- |
319 |
- cd "${S}" |
320 |
- |
321 |
- if use hardened ; then |
322 |
- # We don't enable these for non-hardened as the output is very terse -- |
323 |
- # it only states that a crash happened. The default upstream behavior |
324 |
- # includes backtraces and symbols. |
325 |
- einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler" |
326 |
- cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die |
327 |
- cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die |
328 |
- |
329 |
- if use debug ; then |
330 |
- # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested. |
331 |
- sed -i \ |
332 |
- -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ |
333 |
- -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ |
334 |
- debug/Makefile || die |
335 |
- fi |
336 |
- fi |
337 |
-} |
338 |
- |
339 |
-glibc_do_configure() { |
340 |
- # Glibc does not work with gold (for various reasons) #269274. |
341 |
- tc-ld-disable-gold |
342 |
- |
343 |
- # CXX isnt handled by the multilib system, so if we dont unset here |
344 |
- # we accumulate crap across abis |
345 |
- unset CXX |
346 |
- |
347 |
- einfo "Configuring glibc for $1" |
348 |
- |
349 |
- if use doc ; then |
350 |
- export MAKEINFO=makeinfo |
351 |
- else |
352 |
- export MAKEINFO=/dev/null |
353 |
- fi |
354 |
- |
355 |
- local v |
356 |
- for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do |
357 |
- einfo " $(printf '%15s' ${v}:) ${!v}" |
358 |
- done |
359 |
- |
360 |
- # The glibc configure script doesn't properly use LDFLAGS all the time. |
361 |
- export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}" |
362 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
363 |
- |
364 |
- # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 |
365 |
- export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS)" |
366 |
- einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" |
367 |
- |
368 |
- echo |
369 |
- |
370 |
- local myconf=() |
371 |
- |
372 |
- # set addons |
373 |
- pushd "${S}" > /dev/null |
374 |
- local addons=$(echo */configure | sed \ |
375 |
- -e 's:/configure::g' \ |
376 |
- -e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \ |
377 |
- -e 's: \+$::' \ |
378 |
- -e 's! !,!g' \ |
379 |
- -e 's!^!,!' \ |
380 |
- -e '/^,\*$/d') |
381 |
- [[ -d ports ]] && addons+=",ports" |
382 |
- popd > /dev/null |
383 |
- |
384 |
- case ${CTARGET} in |
385 |
- powerpc-*) |
386 |
- # Currently gcc on powerpc32 generates invalid code for |
387 |
- # __builtin_return_address(0) calls. Normally programs |
388 |
- # don't do that but malloc hooks in glibc do: |
389 |
- # https://gcc.gnu.org/PR81996 |
390 |
- # https://bugs.gentoo.org/629054 |
391 |
- myconf+=( --enable-stack-protector=no ) |
392 |
- ;; |
393 |
- *) |
394 |
- myconf+=( --enable-stack-protector=all ) |
395 |
- ;; |
396 |
- esac |
397 |
- myconf+=( --enable-stackguard-randomization ) |
398 |
- |
399 |
- # Keep a whitelist of targets supporing IFUNC. glibc's ./configure |
400 |
- # is not robust enough to detect proper support: |
401 |
- # https://bugs.gentoo.org/641216 |
402 |
- # https://sourceware.org/PR22634#c0 |
403 |
- case $(tc-arch ${CTARGET}) in |
404 |
- # Keep whitelist of targets where autodetection mostly works. |
405 |
- amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;; |
406 |
- # Blacklist everywhere else |
407 |
- *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;; |
408 |
- esac |
409 |
- |
410 |
- [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) |
411 |
- |
412 |
- if [[ $1 == "nptl" ]] ; then |
413 |
- myconf+=( --enable-kernel=${NPTL_KERN_VER} ) |
414 |
- else |
415 |
- die "invalid pthread option" |
416 |
- fi |
417 |
- myconf+=( --enable-add-ons="${addons#,}" ) |
418 |
- |
419 |
- # Since SELinux support is only required for nscd, only enable it if: |
420 |
- # 1. USE selinux |
421 |
- # 2. only for the primary ABI on multilib systems |
422 |
- # 3. Not a crosscompile |
423 |
- if ! is_crosscompile && use selinux ; then |
424 |
- if use multilib ; then |
425 |
- if is_final_abi ; then |
426 |
- myconf+=( --with-selinux ) |
427 |
- else |
428 |
- myconf+=( --without-selinux ) |
429 |
- fi |
430 |
- else |
431 |
- myconf+=( --with-selinux ) |
432 |
- fi |
433 |
- else |
434 |
- myconf+=( --without-selinux ) |
435 |
- fi |
436 |
- |
437 |
- # Force a few tests where we always know the answer but |
438 |
- # configure is incapable of finding it. |
439 |
- if is_crosscompile ; then |
440 |
- export \ |
441 |
- libc_cv_c_cleanup=yes \ |
442 |
- libc_cv_forced_unwind=yes |
443 |
- fi |
444 |
- |
445 |
- myconf+=( |
446 |
- --without-cvs |
447 |
- --disable-werror |
448 |
- --enable-bind-now |
449 |
- --build=${CBUILD_OPT:-${CBUILD}} |
450 |
- --host=${CTARGET_OPT:-${CTARGET}} |
451 |
- $(use_enable profile) |
452 |
- $(use_with gd) |
453 |
- --with-headers=$(alt_build_headers) |
454 |
- --prefix="${EPREFIX}/usr" |
455 |
- --sysconfdir="${EPREFIX}/etc" |
456 |
- --localstatedir="${EPREFIX}/var" |
457 |
- --libdir='$(prefix)'/$(get_libdir) |
458 |
- --mandir='$(prefix)'/share/man |
459 |
- --infodir='$(prefix)'/share/info |
460 |
- --libexecdir='$(libdir)'/misc/glibc |
461 |
- --with-bugurl=https://bugs.gentoo.org/ |
462 |
- --with-pkgversion="$(glibc_banner)" |
463 |
- $(use_multiarch || echo --disable-multi-arch) |
464 |
- $(in_iuse systemtap && use_enable systemtap) |
465 |
- $(in_iuse nscd && use_enable nscd) |
466 |
- ${EXTRA_ECONF} |
467 |
- ) |
468 |
- |
469 |
- # We rely on sys-libs/timezone-data for timezone tools normally. |
470 |
- myconf+=( $(use_enable vanilla timezone-tools) ) |
471 |
- |
472 |
- # These libs don't have configure flags. |
473 |
- ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no) |
474 |
- ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no) |
475 |
- |
476 |
- # There is no configure option for this and we need to export it |
477 |
- # since the glibc build will re-run configure on itself |
478 |
- export libc_cv_rootsbindir="${EPREFIX}/sbin" |
479 |
- export libc_cv_slibdir="${EPREFIX}/$(get_libdir)" |
480 |
- |
481 |
- # We take care of patching our binutils to use both hash styles, |
482 |
- # and many people like to force gnu hash style only, so disable |
483 |
- # this overriding check. #347761 |
484 |
- export libc_cv_hashstyle=no |
485 |
- |
486 |
- local builddir=$(builddir "$1") |
487 |
- mkdir -p "${builddir}" |
488 |
- cd "${builddir}" |
489 |
- set -- "${S}"/configure "${myconf[@]}" |
490 |
- echo "$@" |
491 |
- "$@" || die "failed to configure glibc" |
492 |
- |
493 |
- # ia64 static cross-compilers are a pita in so much that they |
494 |
- # can't produce static ELFs (as the libgcc.a is broken). so |
495 |
- # disable building of the programs for those targets if it |
496 |
- # doesn't work. |
497 |
- # XXX: We could turn this into a compiler test, but ia64 is |
498 |
- # the only one that matters, so this should be fine for now. |
499 |
- if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then |
500 |
- sed -i '1i+link-static = touch $@' config.make |
501 |
- fi |
502 |
- |
503 |
- # If we're trying to migrate between ABI sets, we need |
504 |
- # to lie and use a local copy of gcc. Like if the system |
505 |
- # is built with MULTILIB_ABIS="amd64 x86" but we want to |
506 |
- # add x32 to it, gcc/glibc don't yet support x32. |
507 |
- if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
508 |
- echo 'main(){}' > "${T}"/test.c |
509 |
- if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
510 |
- sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
511 |
- fi |
512 |
- fi |
513 |
-} |
514 |
- |
515 |
-glibc_headers_configure() { |
516 |
- export ABI=default |
517 |
- |
518 |
- local builddir=$(builddir "headers") |
519 |
- mkdir -p "${builddir}" |
520 |
- cd "${builddir}" |
521 |
- |
522 |
- # if we don't have a compiler yet, we can't really test it now ... |
523 |
- # hopefully they don't affect header generation, so let's hope for |
524 |
- # the best here ... |
525 |
- local v vars=( |
526 |
- ac_cv_header_cpuid_h=yes |
527 |
- libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes |
528 |
- libc_cv_asm_cfi_directives=yes |
529 |
- libc_cv_broken_visibility_attribute=no |
530 |
- libc_cv_c_cleanup=yes |
531 |
- libc_cv_forced_unwind=yes |
532 |
- libc_cv_gcc___thread=yes |
533 |
- libc_cv_mlong_double_128=yes |
534 |
- libc_cv_mlong_double_128ibm=yes |
535 |
- libc_cv_ppc_machine=yes |
536 |
- libc_cv_ppc_rel16=yes |
537 |
- libc_cv_predef_fortify_source=no |
538 |
- libc_cv_visibility_attribute=yes |
539 |
- libc_cv_z_combreloc=yes |
540 |
- libc_cv_z_execstack=yes |
541 |
- libc_cv_z_initfirst=yes |
542 |
- libc_cv_z_nodelete=yes |
543 |
- libc_cv_z_nodlopen=yes |
544 |
- libc_cv_z_relro=yes |
545 |
- libc_mips_abi=${ABI} |
546 |
- libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard) |
547 |
- # These libs don't have configure flags. |
548 |
- ac_cv_lib_audit_audit_log_user_avc_message=no |
549 |
- ac_cv_lib_cap_cap_init=no |
550 |
- ) |
551 |
- |
552 |
- einfo "Forcing cached settings:" |
553 |
- for v in "${vars[@]}" ; do |
554 |
- einfo " ${v}" |
555 |
- export ${v} |
556 |
- done |
557 |
- |
558 |
- # Blow away some random CC settings that screw things up. #550192 |
559 |
- if [[ -d ${S}/sysdeps/mips ]]; then |
560 |
- pushd "${S}"/sysdeps/mips >/dev/null |
561 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die |
562 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die |
563 |
- |
564 |
- # Force the mips ABI to the default. This is OK because the set of |
565 |
- # installed headers in this phase is the same between the 3 ABIs. |
566 |
- # If this ever changes, this hack will break, but that's unlikely |
567 |
- # as glibc discourages that behavior. |
568 |
- # https://crbug.com/647033 |
569 |
- sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die |
570 |
- |
571 |
- popd >/dev/null |
572 |
- fi |
573 |
- |
574 |
- local myconf=() |
575 |
- myconf+=( |
576 |
- --disable-sanity-checks |
577 |
- --enable-hacker-mode |
578 |
- --without-cvs |
579 |
- --disable-werror |
580 |
- --enable-bind-now |
581 |
- --build=${CBUILD_OPT:-${CBUILD}} |
582 |
- --host=${CTARGET_OPT:-${CTARGET}} |
583 |
- --with-headers=$(alt_build_headers) |
584 |
- --prefix="${EPREFIX}/usr" |
585 |
- ${EXTRA_ECONF} |
586 |
- ) |
587 |
- |
588 |
- local addons |
589 |
- [[ -d ${S}/ports ]] && addons+=",ports" |
590 |
- myconf+=( --enable-add-ons="${addons#,}" ) |
591 |
- |
592 |
- # Nothing is compiled here which would affect the headers for the target. |
593 |
- # So forcing CC/CFLAGS is sane. |
594 |
- local headers_only_CC=$(tc-getBUILD_CC) |
595 |
- local headers_only_CFLAGS="-O1 -pipe" |
596 |
- local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE" |
597 |
- local headers_only_LDFLAGS="" |
598 |
- set -- "${S}"/configure "${myconf[@]}" |
599 |
- echo \ |
600 |
- "CC=${headers_only_CC}" \ |
601 |
- "CFLAGS=${headers_only_CFLAGS}" \ |
602 |
- "CPPFLAGS=${headers_only_CPPFLAGS}" \ |
603 |
- "LDFLAGS=${headers_only_LDFLAGS}" \ |
604 |
- "$@" |
605 |
- CC=${headers_only_CC} \ |
606 |
- CFLAGS=${headers_only_CFLAGS} \ |
607 |
- CPPFLAGS=${headers_only_CPPFLAGS} \ |
608 |
- LDFLAGS="" \ |
609 |
- "$@" || die "failed to configure glibc" |
610 |
-} |
611 |
- |
612 |
-do_src_configure() { |
613 |
- if just_headers ; then |
614 |
- glibc_headers_configure |
615 |
- else |
616 |
- glibc_do_configure nptl |
617 |
- fi |
618 |
-} |
619 |
- |
620 |
-src_configure() { |
621 |
- foreach_abi do_src_configure |
622 |
-} |
623 |
- |
624 |
-do_src_compile() { |
625 |
- emake -C "$(builddir nptl)" |
626 |
-} |
627 |
- |
628 |
-src_compile() { |
629 |
- if just_headers ; then |
630 |
- return |
631 |
- fi |
632 |
- |
633 |
- foreach_abi do_src_compile |
634 |
-} |
635 |
- |
636 |
-glibc_src_test() { |
637 |
- cd "$(builddir $1)" |
638 |
- emake check |
639 |
-} |
640 |
- |
641 |
-do_src_test() { |
642 |
- local ret=0 |
643 |
- |
644 |
- glibc_src_test nptl |
645 |
- : $(( ret |= $? )) |
646 |
- |
647 |
- return ${ret} |
648 |
-} |
649 |
- |
650 |
-src_test() { |
651 |
- if just_headers ; then |
652 |
- return |
653 |
- fi |
654 |
- # Give tests more time to complete. |
655 |
- export TIMEOUTFACTOR=5 |
656 |
- |
657 |
- foreach_abi do_src_test || die "tests failed" |
658 |
-} |
659 |
- |
660 |
-glibc_do_src_install() { |
661 |
- local builddir=$(builddir nptl) |
662 |
- cd "${builddir}" |
663 |
- |
664 |
- emake install_root="${D}$(alt_prefix)" install |
665 |
- |
666 |
- # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support |
667 |
- # which come without headers etc. Only needed for binary packages since the |
668 |
- # external net-libs/libnsl has increased soversion. Keep only versioned libraries. |
669 |
- find "${D}" -name "libnsl.a" -delete |
670 |
- find "${D}" -name "libnsl.so" -delete |
671 |
- |
672 |
- # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need |
673 |
- # to infer upstream version: |
674 |
- # '#define VERSION "2.26.90"' -> '2.26.90' |
675 |
- local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) |
676 |
- |
677 |
- if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then |
678 |
- # Move versioned .a file out of libdir to evade portage QA checks |
679 |
- # instead of using gen_usr_ldscript(). We fix ldscript as: |
680 |
- # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..." |
681 |
- sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die |
682 |
- dodir $(alt_usrlibdir)/${P} |
683 |
- mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die |
684 |
- fi |
685 |
- |
686 |
- # We'll take care of the cache ourselves |
687 |
- rm -f "${ED}"/etc/ld.so.cache |
688 |
- |
689 |
- # Everything past this point just needs to be done once ... |
690 |
- is_final_abi || return 0 |
691 |
- |
692 |
- # Make sure the non-native interp can be found on multilib systems even |
693 |
- # if the main library set isn't installed into the right place. Maybe |
694 |
- # we should query the active gcc for info instead of hardcoding it ? |
695 |
- local i ldso_abi ldso_name |
696 |
- local ldso_abi_list=( |
697 |
- # x86 |
698 |
- amd64 /lib64/ld-linux-x86-64.so.2 |
699 |
- x32 /libx32/ld-linux-x32.so.2 |
700 |
- x86 /lib/ld-linux.so.2 |
701 |
- # mips |
702 |
- o32 /lib/ld.so.1 |
703 |
- n32 /lib32/ld.so.1 |
704 |
- n64 /lib64/ld.so.1 |
705 |
- # powerpc |
706 |
- ppc /lib/ld.so.1 |
707 |
- ppc64 /lib64/ld64.so.1 |
708 |
- # s390 |
709 |
- s390 /lib/ld.so.1 |
710 |
- s390x /lib/ld64.so.1 |
711 |
- # sparc |
712 |
- sparc32 /lib/ld-linux.so.2 |
713 |
- sparc64 /lib64/ld-linux.so.2 |
714 |
- ) |
715 |
- case $(tc-endian) in |
716 |
- little) |
717 |
- ldso_abi_list+=( |
718 |
- # arm |
719 |
- arm64 /lib/ld-linux-aarch64.so.1 |
720 |
- ) |
721 |
- ;; |
722 |
- big) |
723 |
- ldso_abi_list+=( |
724 |
- # arm |
725 |
- arm64 /lib/ld-linux-aarch64_be.so.1 |
726 |
- ) |
727 |
- ;; |
728 |
- esac |
729 |
- if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then |
730 |
- dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib |
731 |
- fi |
732 |
- for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do |
733 |
- ldso_abi=${ldso_abi_list[i]} |
734 |
- has ${ldso_abi} $(get_install_abis) || continue |
735 |
- |
736 |
- ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}" |
737 |
- if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then |
738 |
- dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name} |
739 |
- fi |
740 |
- done |
741 |
- |
742 |
- # With devpts under Linux mounted properly, we do not need the pt_chown |
743 |
- # binary to be setuid. This is because the default owners/perms will be |
744 |
- # exactly what we want. |
745 |
- if in_iuse suid && ! use suid ; then |
746 |
- find "${ED}" -name pt_chown -exec chmod -s {} + |
747 |
- fi |
748 |
- |
749 |
- ################################################################# |
750 |
- # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY # |
751 |
- # Make sure we install some symlink hacks so that when we build |
752 |
- # a 2nd stage cross-compiler, gcc finds the target system |
753 |
- # headers correctly. See gcc/doc/gccinstall.info |
754 |
- if is_crosscompile ; then |
755 |
- # We need to make sure that /lib and /usr/lib always exists. |
756 |
- # gcc likes to use relative paths to get to its multilibs like |
757 |
- # /usr/lib/../lib64/. So while we don't install any files into |
758 |
- # /usr/lib/, we do need it to exist. |
759 |
- cd "${ED}"$(alt_libdir)/.. |
760 |
- [[ -e lib ]] || mkdir lib |
761 |
- cd "${ED}"$(alt_usrlibdir)/.. |
762 |
- [[ -e lib ]] || mkdir lib |
763 |
- |
764 |
- dosym usr/include $(alt_prefix)/sys-include |
765 |
- return 0 |
766 |
- fi |
767 |
- |
768 |
- # Files for Debian-style locale updating |
769 |
- dodir /usr/share/i18n |
770 |
- sed \ |
771 |
- -e "/^#/d" \ |
772 |
- -e "/SUPPORTED-LOCALES=/d" \ |
773 |
- -e "s: \\\\::g" -e "s:/: :g" \ |
774 |
- "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ |
775 |
- || die "generating /usr/share/i18n/SUPPORTED failed" |
776 |
- cd "${WORKDIR}"/extra/locale |
777 |
- dosbin locale-gen |
778 |
- doman *.[0-8] |
779 |
- insinto /etc |
780 |
- doins locale.gen |
781 |
- |
782 |
- # Make sure all the ABI's can find the locales and so we only |
783 |
- # have to generate one set |
784 |
- local a |
785 |
- keepdir /usr/$(get_libdir)/locale |
786 |
- for a in $(get_install_abis) ; do |
787 |
- if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then |
788 |
- dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale |
789 |
- fi |
790 |
- done |
791 |
- |
792 |
- cd "${S}" |
793 |
- |
794 |
- # Install misc network config files |
795 |
- insinto /etc |
796 |
- doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf |
797 |
- doins "${WORKDIR}"/extra/etc/*.conf |
798 |
- |
799 |
- if use nscd ; then |
800 |
- doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)" |
801 |
- |
802 |
- local nscd_args=( |
803 |
- -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" |
804 |
- ) |
805 |
- |
806 |
- sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd |
807 |
- |
808 |
- systemd_dounit nscd/nscd.service |
809 |
- systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf |
810 |
- else |
811 |
- # Do this since extra/etc/*.conf above might have nscd.conf. |
812 |
- rm -f "${ED}"/etc/nscd.conf |
813 |
- fi |
814 |
- |
815 |
- echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc |
816 |
- doenvd "${T}"/00glibc |
817 |
- |
818 |
- for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do |
819 |
- [[ -s ${d} ]] && dodoc ${d} |
820 |
- done |
821 |
- |
822 |
- # Prevent overwriting of the /etc/localtime symlink. We'll handle the |
823 |
- # creation of the "factory" symlink in pkg_postinst(). |
824 |
- rm -f "${ED}"/etc/localtime |
825 |
-} |
826 |
- |
827 |
-glibc_headers_install() { |
828 |
- local builddir=$(builddir "headers") |
829 |
- cd "${builddir}" |
830 |
- emake install_root="${D}$(alt_prefix)" install-headers |
831 |
- |
832 |
- insinto $(alt_headers)/gnu |
833 |
- doins "${S}"/include/gnu/stubs.h |
834 |
- |
835 |
- # Make sure we install the sys-include symlink so that when |
836 |
- # we build a 2nd stage cross-compiler, gcc finds the target |
837 |
- # system headers correctly. See gcc/doc/gccinstall.info |
838 |
- dosym usr/include $(alt_prefix)/sys-include |
839 |
-} |
840 |
- |
841 |
-src_install() { |
842 |
- if just_headers ; then |
843 |
- export ABI=default |
844 |
- glibc_headers_install |
845 |
- return |
846 |
- fi |
847 |
- |
848 |
- foreach_abi glibc_do_src_install |
849 |
-} |
850 |
- |
851 |
-pkg_preinst() { |
852 |
- # nothing to do if just installing headers |
853 |
- just_headers && return |
854 |
- |
855 |
- # prepare /etc/ld.so.conf.d/ for files |
856 |
- mkdir -p "${EROOT}"/etc/ld.so.conf.d |
857 |
- |
858 |
- # Default /etc/hosts.conf:multi to on for systems with small dbs. |
859 |
- if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then |
860 |
- sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf |
861 |
- einfo "Defaulting /etc/host.conf:multi to on" |
862 |
- fi |
863 |
- |
864 |
- [[ ${ROOT} != "/" ]] && return 0 |
865 |
- [[ -d ${ED}/$(get_libdir) ]] || return 0 |
866 |
- [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check |
867 |
-} |
868 |
- |
869 |
-pkg_postinst() { |
870 |
- # nothing to do if just installing headers |
871 |
- just_headers && return |
872 |
- |
873 |
- if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then |
874 |
- # Generate fastloading iconv module configuration file. |
875 |
- "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}" |
876 |
- fi |
877 |
- |
878 |
- if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then |
879 |
- # if the host locales.gen contains no entries, we'll install everything |
880 |
- local locale_list="${EROOT}etc/locale.gen" |
881 |
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then |
882 |
- ewarn "Generating all locales; edit /etc/locale.gen to save time/space" |
883 |
- locale_list="${EROOT}usr/share/i18n/SUPPORTED" |
884 |
- fi |
885 |
- locale-gen -j $(makeopts_jobs) --config "${locale_list}" |
886 |
- fi |
887 |
- |
888 |
- # Check for sanity of /etc/nsswitch.conf, take 2 |
889 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then |
890 |
- local entry |
891 |
- for entry in passwd group shadow; do |
892 |
- if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then |
893 |
- ewarn "" |
894 |
- ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" |
895 |
- ewarn "removed from glibc and is now provided by the package" |
896 |
- ewarn " sys-auth/libnss-nis" |
897 |
- ewarn "Install it now to keep your NIS setup working." |
898 |
- ewarn "" |
899 |
- fi |
900 |
- done |
901 |
- fi |
902 |
-} |
903 |
|
904 |
diff --git a/sys-libs/glibc/glibc-2.27-r6.ebuild b/sys-libs/glibc/glibc-2.27-r6.ebuild |
905 |
deleted file mode 100644 |
906 |
index 70de8f8358b..00000000000 |
907 |
--- a/sys-libs/glibc/glibc-2.27-r6.ebuild |
908 |
+++ /dev/null |
909 |
@@ -1,1415 +0,0 @@ |
910 |
-# Copyright 1999-2020 Gentoo Authors |
911 |
-# Distributed under the terms of the GNU General Public License v2 |
912 |
- |
913 |
-EAPI=6 |
914 |
- |
915 |
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \ |
916 |
- multilib systemd multiprocessing |
917 |
- |
918 |
-DESCRIPTION="GNU libc C library" |
919 |
-HOMEPAGE="https://www.gnu.org/software/libc/" |
920 |
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" |
921 |
-SLOT="2.2" |
922 |
- |
923 |
-EMULTILIB_PKG="true" |
924 |
- |
925 |
-if [[ ${PV} == 9999* ]]; then |
926 |
- EGIT_REPO_URI="https://sourceware.org/git/glibc.git" |
927 |
- inherit git-r3 |
928 |
-else |
929 |
- KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86" |
930 |
- SRC_URI="mirror://gnu/glibc/${P}.tar.xz" |
931 |
-fi |
932 |
- |
933 |
-RELEASE_VER=${PV} |
934 |
- |
935 |
-GCC_BOOTSTRAP_VER=20180511 |
936 |
- |
937 |
-# Gentoo patchset |
938 |
-PATCH_VER=3 |
939 |
- |
940 |
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2" |
941 |
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
942 |
- |
943 |
-IUSE="audit caps compile-locales doc gd hardened headers-only +multiarch multilib nscd profile selinux suid systemtap vanilla" |
944 |
- |
945 |
-# Minimum kernel version that glibc requires |
946 |
-MIN_KERN_VER="3.2.0" |
947 |
- |
948 |
-# Here's how the cross-compile logic breaks down ... |
949 |
-# CTARGET - machine that will target the binaries |
950 |
-# CHOST - machine that will host the binaries |
951 |
-# CBUILD - machine that will build the binaries |
952 |
-# If CTARGET != CHOST, it means you want a libc for cross-compiling. |
953 |
-# If CHOST != CBUILD, it means you want to cross-compile the libc. |
954 |
-# CBUILD = CHOST = CTARGET - native build/install |
955 |
-# CBUILD != (CHOST = CTARGET) - cross-compile a native build |
956 |
-# (CBUILD = CHOST) != CTARGET - libc for cross-compiler |
957 |
-# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler |
958 |
-# For install paths: |
959 |
-# CHOST = CTARGET - install into / |
960 |
-# CHOST != CTARGET - install into /usr/CTARGET/ |
961 |
-# |
962 |
-export CBUILD=${CBUILD:-${CHOST}} |
963 |
-export CTARGET=${CTARGET:-${CHOST}} |
964 |
-if [[ ${CTARGET} == ${CHOST} ]] ; then |
965 |
- if [[ ${CATEGORY} == cross-* ]] ; then |
966 |
- export CTARGET=${CATEGORY#cross-} |
967 |
- fi |
968 |
-fi |
969 |
- |
970 |
-# Note [Disable automatic stripping] |
971 |
-# Disabling automatic stripping for a few reasons: |
972 |
-# - portage's attempt to strip breaks non-native binaries at least on |
973 |
-# arm: bug #697428 |
974 |
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread |
975 |
-# enumeration: bug #697910. This is quite subtle: |
976 |
-# * gdb uses glibc's libthread_db-1.0.so to enumerate threads. |
977 |
-# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols |
978 |
-# via 'ps_pglobal_lookup' symbol defined in gdb. |
979 |
-# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all |
980 |
-# known symbols in 'libpthread.so.0'. Specifically 'nptl_version' |
981 |
-# (unexported) is used to sanity check compatibility before enabling |
982 |
-# debugging. |
983 |
-# Also see https://sourceware.org/gdb/wiki/FAQ#GDB_does_not_see_any_threads_besides_the_one_in_which_crash_occurred.3B_or_SIGTRAP_kills_my_program_when_I_set_a_breakpoint |
984 |
-# * normal 'strip' command trims '.symtab' |
985 |
-# Thus our main goal here is to prevent 'libpthread.so.0' from |
986 |
-# losing it's '.symtab' entries. |
987 |
-# As Gentoo's strip does not allow us to pass less aggressive stripping |
988 |
-# options and does not check the machine target we disable stripping |
989 |
-# entirely. |
990 |
-RESTRICT=strip |
991 |
- |
992 |
-# We need a new-enough binutils/gcc to match upstream baseline. |
993 |
-# Also we need to make sure our binutils/gcc supports TLS. |
994 |
-COMMON_DEPEND=" |
995 |
- nscd? ( selinux? ( |
996 |
- audit? ( sys-process/audit ) |
997 |
- caps? ( sys-libs/libcap ) |
998 |
- ) ) |
999 |
- suid? ( caps? ( sys-libs/libcap ) ) |
1000 |
- selinux? ( sys-libs/libselinux ) |
1001 |
- systemtap? ( dev-util/systemtap ) |
1002 |
-" |
1003 |
-DEPEND="${COMMON_DEPEND} |
1004 |
- >=app-misc/pax-utils-0.1.10 |
1005 |
- sys-devel/bison |
1006 |
- !<sys-devel/bison-2.7 |
1007 |
- doc? ( sys-apps/texinfo ) |
1008 |
-" |
1009 |
-RDEPEND="${COMMON_DEPEND} |
1010 |
- sys-apps/gentoo-functions |
1011 |
-" |
1012 |
- |
1013 |
-if [[ ${CATEGORY} == cross-* ]] ; then |
1014 |
- DEPEND+=" !headers-only? ( |
1015 |
- >=${CATEGORY}/binutils-2.24 |
1016 |
- >=${CATEGORY}/gcc-4.9 |
1017 |
- )" |
1018 |
- [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" |
1019 |
-else |
1020 |
- DEPEND+=" |
1021 |
- >=sys-devel/binutils-2.24 |
1022 |
- >=sys-devel/gcc-4.9 |
1023 |
- virtual/os-headers |
1024 |
- " |
1025 |
- RDEPEND+=" vanilla? ( !sys-libs/timezone-data )" |
1026 |
- PDEPEND+=" !vanilla? ( sys-libs/timezone-data )" |
1027 |
-fi |
1028 |
- |
1029 |
-# |
1030 |
-# Small helper functions |
1031 |
-# |
1032 |
- |
1033 |
-is_crosscompile() { |
1034 |
- [[ ${CHOST} != ${CTARGET} ]] |
1035 |
-} |
1036 |
- |
1037 |
-just_headers() { |
1038 |
- is_crosscompile && use headers-only |
1039 |
-} |
1040 |
- |
1041 |
-alt_prefix() { |
1042 |
- is_crosscompile && echo /usr/${CTARGET} |
1043 |
-} |
1044 |
- |
1045 |
-# We need to be able to set alternative headers for compiling for non-native |
1046 |
-# platform. Will also become useful for testing kernel-headers without screwing |
1047 |
-# up the whole system. |
1048 |
-alt_headers() { |
1049 |
- echo ${ALT_HEADERS:=$(alt_prefix)/usr/include} |
1050 |
-} |
1051 |
- |
1052 |
-alt_build_headers() { |
1053 |
- if [[ -z ${ALT_BUILD_HEADERS} ]] ; then |
1054 |
- ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)" |
1055 |
- if tc-is-cross-compiler ; then |
1056 |
- ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers) |
1057 |
- if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then |
1058 |
- local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h') |
1059 |
- ALT_BUILD_HEADERS=${header_path%/linux/version.h} |
1060 |
- fi |
1061 |
- fi |
1062 |
- fi |
1063 |
- echo "${ALT_BUILD_HEADERS}" |
1064 |
-} |
1065 |
- |
1066 |
-alt_libdir() { |
1067 |
- echo $(alt_prefix)/$(get_libdir) |
1068 |
-} |
1069 |
-alt_usrlibdir() { |
1070 |
- echo $(alt_prefix)/usr/$(get_libdir) |
1071 |
-} |
1072 |
- |
1073 |
-builddir() { |
1074 |
- echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1" |
1075 |
-} |
1076 |
- |
1077 |
-do_compile_test() { |
1078 |
- local ret save_cflags=${CFLAGS} |
1079 |
- CFLAGS+=" $1" |
1080 |
- shift |
1081 |
- |
1082 |
- pushd "${T}" >/dev/null |
1083 |
- |
1084 |
- rm -f glibc-test* |
1085 |
- printf '%b' "$*" > glibc-test.c |
1086 |
- |
1087 |
- nonfatal emake -s glibc-test |
1088 |
- ret=$? |
1089 |
- |
1090 |
- popd >/dev/null |
1091 |
- |
1092 |
- CFLAGS=${save_cflags} |
1093 |
- return ${ret} |
1094 |
-} |
1095 |
- |
1096 |
-do_run_test() { |
1097 |
- local ret |
1098 |
- |
1099 |
- if [[ ${MERGE_TYPE} == "binary" ]] ; then |
1100 |
- # ignore build failures when installing a binary package #324685 |
1101 |
- do_compile_test "" "$@" 2>/dev/null || return 0 |
1102 |
- else |
1103 |
- if ! do_compile_test "" "$@" ; then |
1104 |
- ewarn "Simple build failed ... assuming this is desired #324685" |
1105 |
- return 0 |
1106 |
- fi |
1107 |
- fi |
1108 |
- |
1109 |
- pushd "${T}" >/dev/null |
1110 |
- |
1111 |
- ./glibc-test |
1112 |
- ret=$? |
1113 |
- rm -f glibc-test* |
1114 |
- |
1115 |
- popd >/dev/null |
1116 |
- |
1117 |
- return ${ret} |
1118 |
-} |
1119 |
- |
1120 |
-setup_target_flags() { |
1121 |
- # This largely mucks with compiler flags. None of which should matter |
1122 |
- # when building up just the headers. |
1123 |
- just_headers && return 0 |
1124 |
- |
1125 |
- case $(tc-arch) in |
1126 |
- x86) |
1127 |
- # -march needed for #185404 #199334 |
1128 |
- # TODO: When creating the first glibc cross-compile, this test will |
1129 |
- # always fail as it does a full link which in turn requires glibc. |
1130 |
- # Probably also applies when changing multilib profile settings (e.g. |
1131 |
- # enabling x86 when the profile was amd64-only previously). |
1132 |
- # We could change main to _start and pass -nostdlib here so that we |
1133 |
- # only test the gcc code compilation. Or we could do a compile and |
1134 |
- # then look for the symbol via scanelf. |
1135 |
- if ! do_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then |
1136 |
- local t=${CTARGET_OPT:-${CTARGET}} |
1137 |
- t=${t%%-*} |
1138 |
- filter-flags '-march=*' |
1139 |
- export CFLAGS="-march=${t} ${CFLAGS}" |
1140 |
- einfo "Auto adding -march=${t} to CFLAGS #185404" |
1141 |
- fi |
1142 |
- ;; |
1143 |
- amd64) |
1144 |
- # -march needed for #185404 #199334 |
1145 |
- # Note: This test only matters when the x86 ABI is enabled, so we could |
1146 |
- # optimize a bit and elide it. |
1147 |
- # TODO: See cross-compile issues listed above for x86. |
1148 |
- if ! do_compile_test "${CFLAGS_x86}" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then |
1149 |
- local t=${CTARGET_OPT:-${CTARGET}} |
1150 |
- t=${t%%-*} |
1151 |
- # Normally the target is x86_64-xxx, so turn that into the -march that |
1152 |
- # gcc actually accepts. #528708 |
1153 |
- [[ ${t} == "x86_64" ]] && t="x86-64" |
1154 |
- filter-flags '-march=*' |
1155 |
- # ugly, ugly, ugly. ugly. |
1156 |
- CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") |
1157 |
- export CFLAGS_x86="${CFLAGS_x86} -march=${t}" |
1158 |
- einfo "Auto adding -march=${t} to CFLAGS_x86 #185404" |
1159 |
- fi |
1160 |
- ;; |
1161 |
- mips) |
1162 |
- # The mips abi cannot support the GNU style hashes. #233233 |
1163 |
- filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both |
1164 |
- ;; |
1165 |
- sparc) |
1166 |
- # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though. |
1167 |
- filter-flags "-fcall-used-g7" |
1168 |
- append-flags "-fcall-used-g6" |
1169 |
- |
1170 |
- # If the CHOST is the basic one (e.g. not sparcv9-xxx already), |
1171 |
- # try to pick a better one so glibc can use cpu-specific .S files. |
1172 |
- # We key off the CFLAGS to get a good value. Also need to handle |
1173 |
- # version skew. |
1174 |
- # We can't force users to set their CHOST to their exact machine |
1175 |
- # as many of these are not recognized by config.sub/gcc and such :(. |
1176 |
- # Note: If the mcpu values don't scale, we might try probing CPP defines. |
1177 |
- # Note: Should we factor in -Wa,-AvXXX flags too ? Or -mvis/etc... ? |
1178 |
- |
1179 |
- local cpu |
1180 |
- case ${CTARGET} in |
1181 |
- sparc64-*) |
1182 |
- case $(get-flag mcpu) in |
1183 |
- niagara[234]) |
1184 |
- if version_is_at_least 2.8 ; then |
1185 |
- cpu="sparc64v2" |
1186 |
- elif version_is_at_least 2.4 ; then |
1187 |
- cpu="sparc64v" |
1188 |
- elif version_is_at_least 2.2.3 ; then |
1189 |
- cpu="sparc64b" |
1190 |
- fi |
1191 |
- ;; |
1192 |
- niagara) |
1193 |
- if version_is_at_least 2.4 ; then |
1194 |
- cpu="sparc64v" |
1195 |
- elif version_is_at_least 2.2.3 ; then |
1196 |
- cpu="sparc64b" |
1197 |
- fi |
1198 |
- ;; |
1199 |
- ultrasparc3) |
1200 |
- cpu="sparc64b" |
1201 |
- ;; |
1202 |
- *) |
1203 |
- # We need to force at least v9a because the base build doesn't |
1204 |
- # work with just v9. |
1205 |
- # https://sourceware.org/bugzilla/show_bug.cgi?id=19477 |
1206 |
- [[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a" |
1207 |
- ;; |
1208 |
- esac |
1209 |
- ;; |
1210 |
- sparc-*) |
1211 |
- case $(get-flag mcpu) in |
1212 |
- niagara[234]) |
1213 |
- if version_is_at_least 2.8 ; then |
1214 |
- cpu="sparcv9v2" |
1215 |
- elif version_is_at_least 2.4 ; then |
1216 |
- cpu="sparcv9v" |
1217 |
- elif version_is_at_least 2.2.3 ; then |
1218 |
- cpu="sparcv9b" |
1219 |
- else |
1220 |
- cpu="sparcv9" |
1221 |
- fi |
1222 |
- ;; |
1223 |
- niagara) |
1224 |
- if version_is_at_least 2.4 ; then |
1225 |
- cpu="sparcv9v" |
1226 |
- elif version_is_at_least 2.2.3 ; then |
1227 |
- cpu="sparcv9b" |
1228 |
- else |
1229 |
- cpu="sparcv9" |
1230 |
- fi |
1231 |
- ;; |
1232 |
- ultrasparc3) |
1233 |
- cpu="sparcv9b" |
1234 |
- ;; |
1235 |
- v9|ultrasparc) |
1236 |
- cpu="sparcv9" |
1237 |
- ;; |
1238 |
- v8|supersparc|hypersparc|leon|leon3) |
1239 |
- cpu="sparcv8" |
1240 |
- ;; |
1241 |
- esac |
1242 |
- ;; |
1243 |
- esac |
1244 |
- [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}" |
1245 |
- ;; |
1246 |
- esac |
1247 |
-} |
1248 |
- |
1249 |
-setup_flags() { |
1250 |
- # Make sure host make.conf doesn't pollute us |
1251 |
- if is_crosscompile || tc-is-cross-compiler ; then |
1252 |
- CHOST=${CTARGET} strip-unsupported-flags |
1253 |
- fi |
1254 |
- |
1255 |
- # Store our CFLAGS because it's changed depending on which CTARGET |
1256 |
- # we are building when pulling glibc on a multilib profile |
1257 |
- CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}} |
1258 |
- CFLAGS=${CFLAGS_BASE} |
1259 |
- CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}} |
1260 |
- CXXFLAGS=${CXXFLAGS_BASE} |
1261 |
- ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}} |
1262 |
- ASFLAGS=${ASFLAGS_BASE} |
1263 |
- |
1264 |
- # Over-zealous CFLAGS can often cause problems. What may work for one |
1265 |
- # person may not work for another. To avoid a large influx of bugs |
1266 |
- # relating to failed builds, we strip most CFLAGS out to ensure as few |
1267 |
- # problems as possible. |
1268 |
- strip-flags |
1269 |
- strip-unsupported-flags |
1270 |
- filter-flags -m32 -m64 '-mabi=*' |
1271 |
- |
1272 |
- # glibc aborts if rpath is set by LDFLAGS |
1273 |
- filter-ldflags '-Wl,-rpath=*' |
1274 |
- |
1275 |
- # #492892 |
1276 |
- filter-flags -frecord-gcc-switches |
1277 |
- |
1278 |
- unset CBUILD_OPT CTARGET_OPT |
1279 |
- if use multilib ; then |
1280 |
- CTARGET_OPT=$(get_abi_CTARGET) |
1281 |
- [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST) |
1282 |
- fi |
1283 |
- |
1284 |
- setup_target_flags |
1285 |
- |
1286 |
- if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then |
1287 |
- CBUILD_OPT=${CTARGET_OPT} |
1288 |
- fi |
1289 |
- |
1290 |
- # Lock glibc at -O2; we want to be conservative here. |
1291 |
- # -fno-strict-aliasing is to work around #155906. |
1292 |
- filter-flags '-O?' |
1293 |
- append-flags -O2 -fno-strict-aliasing |
1294 |
- |
1295 |
- filter-flags '-fstack-protector*' |
1296 |
- |
1297 |
- # Starting with gcc-6 (and fully upstreamed pie patches) we control |
1298 |
- # default enabled/disabled pie via use flags. So nothing to do |
1299 |
- # here then. #618160 |
1300 |
- if [[ $(gcc-major-version) -lt 6 ]]; then |
1301 |
- if use hardened && tc-enables-pie ; then |
1302 |
- # Force PIC macro definition for all compilations since they're all |
1303 |
- # either -fPIC or -fPIE with the default-PIE compiler. |
1304 |
- append-cppflags -DPIC |
1305 |
- else |
1306 |
- # Don't build -fPIE without the default-PIE compiler and the |
1307 |
- # hardened-pie patch |
1308 |
- filter-flags -fPIE |
1309 |
- fi |
1310 |
- fi |
1311 |
-} |
1312 |
- |
1313 |
-want_tls() { |
1314 |
- # Archs that can use TLS (Thread Local Storage) |
1315 |
- case $(tc-arch) in |
1316 |
- x86) |
1317 |
- # requires i486 or better #106556 |
1318 |
- [[ ${CTARGET} == i[4567]86* ]] && return 0 |
1319 |
- return 1 |
1320 |
- ;; |
1321 |
- esac |
1322 |
- return 0 |
1323 |
-} |
1324 |
- |
1325 |
-want__thread() { |
1326 |
- want_tls || return 1 |
1327 |
- |
1328 |
- # For some reason --with-tls --with__thread is causing segfaults on sparc32. |
1329 |
- [[ ${PROFILE_ARCH} == "sparc" ]] && return 1 |
1330 |
- |
1331 |
- [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD} |
1332 |
- |
1333 |
- # only test gcc -- can't test linking yet |
1334 |
- tc-has-tls -c ${CTARGET} |
1335 |
- WANT__THREAD=$? |
1336 |
- |
1337 |
- return ${WANT__THREAD} |
1338 |
-} |
1339 |
- |
1340 |
-use_multiarch() { |
1341 |
- # Allow user to disable runtime arch detection in multilib. |
1342 |
- use multiarch || return 1 |
1343 |
- # Make sure binutils is new enough to support indirect functions, |
1344 |
- # #336792. This funky sed supports gold and bfd linkers. |
1345 |
- local bver nver |
1346 |
- bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}') |
1347 |
- case $(tc-arch ${CTARGET}) in |
1348 |
- amd64|x86) nver="2.20" ;; |
1349 |
- arm) nver="2.22" ;; |
1350 |
- hppa) nver="2.23" ;; |
1351 |
- ppc|ppc64) nver="2.20" ;; |
1352 |
- # ifunc support was added in 2.23, but glibc also needs |
1353 |
- # machinemode which is in 2.24. |
1354 |
- s390) nver="2.24" ;; |
1355 |
- sparc) nver="2.21" ;; |
1356 |
- *) return 1 ;; |
1357 |
- esac |
1358 |
- version_is_at_least ${nver} ${bver} |
1359 |
-} |
1360 |
- |
1361 |
-# Setup toolchain variables that had historically been defined in the |
1362 |
-# profiles for these archs. |
1363 |
-setup_env() { |
1364 |
- # silly users |
1365 |
- unset LD_RUN_PATH |
1366 |
- unset LD_ASSUME_KERNEL |
1367 |
- |
1368 |
- if is_crosscompile || tc-is-cross-compiler ; then |
1369 |
- multilib_env ${CTARGET_OPT:-${CTARGET}} |
1370 |
- |
1371 |
- if ! use multilib ; then |
1372 |
- MULTILIB_ABIS=${DEFAULT_ABI} |
1373 |
- else |
1374 |
- MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}} |
1375 |
- fi |
1376 |
- |
1377 |
- # If the user has CFLAGS_<CTARGET> in their make.conf, use that, |
1378 |
- # and fall back on CFLAGS. |
1379 |
- local VAR=CFLAGS_${CTARGET//[-.]/_} |
1380 |
- CFLAGS=${!VAR-${CFLAGS}} |
1381 |
- einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}" |
1382 |
- fi |
1383 |
- |
1384 |
- setup_flags |
1385 |
- |
1386 |
- export ABI=${ABI:-${DEFAULT_ABI:-default}} |
1387 |
- |
1388 |
- if just_headers ; then |
1389 |
- # Avoid mixing host's CC and target's CFLAGS_${ABI}: |
1390 |
- # At this bootstrap stage we have only binutils for |
1391 |
- # target but not compiler yet. |
1392 |
- einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." |
1393 |
- return 0 |
1394 |
- fi |
1395 |
- local VAR=CFLAGS_${ABI} |
1396 |
- # We need to export CFLAGS with abi information in them because glibc's |
1397 |
- # configure script checks CFLAGS for some targets (like mips). Keep |
1398 |
- # around the original clean value to avoid appending multiple ABIs on |
1399 |
- # top of each other. |
1400 |
- : ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})} |
1401 |
- export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" |
1402 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
1403 |
-} |
1404 |
- |
1405 |
-foreach_abi() { |
1406 |
- setup_env |
1407 |
- |
1408 |
- local ret=0 |
1409 |
- local abilist="" |
1410 |
- if use multilib ; then |
1411 |
- abilist=$(get_install_abis) |
1412 |
- else |
1413 |
- abilist=${DEFAULT_ABI} |
1414 |
- fi |
1415 |
- local -x ABI |
1416 |
- for ABI in ${abilist:-default} ; do |
1417 |
- setup_env |
1418 |
- einfo "Running $1 for ABI ${ABI}" |
1419 |
- $1 |
1420 |
- : $(( ret |= $? )) |
1421 |
- done |
1422 |
- return ${ret} |
1423 |
-} |
1424 |
- |
1425 |
-glibc_banner() { |
1426 |
- local b="Gentoo ${PVR}" |
1427 |
- [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}" |
1428 |
- echo "${b}" |
1429 |
-} |
1430 |
- |
1431 |
-check_devpts() { |
1432 |
- # Make sure devpts is mounted correctly for use w/out setuid pt_chown. |
1433 |
- |
1434 |
- # If merely building the binary package, then there's nothing to verify. |
1435 |
- [[ ${MERGE_TYPE} == "buildonly" ]] && return |
1436 |
- |
1437 |
- # Only sanity check when installing the native glibc. |
1438 |
- [[ ${ROOT} != "/" ]] && return |
1439 |
- |
1440 |
- # If they're opting in to the old suid code, then no need to check. |
1441 |
- use suid && return |
1442 |
- |
1443 |
- if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then |
1444 |
- eerror "In order to use glibc with USE=-suid, you must make sure that" |
1445 |
- eerror "you have devpts mounted at /dev/pts with the gid=5 option." |
1446 |
- eerror "Openrc should do this for you, so you should check /etc/fstab" |
1447 |
- eerror "and make sure you do not have any invalid settings there." |
1448 |
- die "mount & fix your /dev/pts settings" |
1449 |
- fi |
1450 |
-} |
1451 |
- |
1452 |
-# The following Kernel version handling functions are mostly copied from portage |
1453 |
-# source. It's better not to use linux-info.eclass here since a) it adds too |
1454 |
-# much magic, see bug 326693 for some of the arguments, and b) some of the |
1455 |
-# functions are just not provided. |
1456 |
- |
1457 |
-g_get_running_KV() { |
1458 |
- uname -r |
1459 |
- return $? |
1460 |
-} |
1461 |
- |
1462 |
-g_KV_major() { |
1463 |
- [[ -z $1 ]] && return 1 |
1464 |
- local KV=$@ |
1465 |
- echo "${KV%%.*}" |
1466 |
-} |
1467 |
- |
1468 |
-g_KV_minor() { |
1469 |
- [[ -z $1 ]] && return 1 |
1470 |
- local KV=$@ |
1471 |
- KV=${KV#*.} |
1472 |
- echo "${KV%%.*}" |
1473 |
-} |
1474 |
- |
1475 |
-g_KV_micro() { |
1476 |
- [[ -z $1 ]] && return 1 |
1477 |
- local KV=$@ |
1478 |
- KV=${KV#*.*.} |
1479 |
- echo "${KV%%[^[:digit:]]*}" |
1480 |
-} |
1481 |
- |
1482 |
-g_KV_to_int() { |
1483 |
- [[ -z $1 ]] && return 1 |
1484 |
- local KV_MAJOR=$(g_KV_major "$1") |
1485 |
- local KV_MINOR=$(g_KV_minor "$1") |
1486 |
- local KV_MICRO=$(g_KV_micro "$1") |
1487 |
- local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) |
1488 |
- |
1489 |
- # We make version 2.2.0 the minimum version we will handle as |
1490 |
- # a sanity check ... if its less, we fail ... |
1491 |
- if [[ ${KV_int} -ge 131584 ]] ; then |
1492 |
- echo "${KV_int}" |
1493 |
- return 0 |
1494 |
- fi |
1495 |
- return 1 |
1496 |
-} |
1497 |
- |
1498 |
-g_int_to_KV() { |
1499 |
- local version=$1 major minor micro |
1500 |
- major=$((version / 65536)) |
1501 |
- minor=$(((version % 65536) / 256)) |
1502 |
- micro=$((version % 256)) |
1503 |
- echo ${major}.${minor}.${micro} |
1504 |
-} |
1505 |
- |
1506 |
-eend_KV() { |
1507 |
- [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]] |
1508 |
- eend $? |
1509 |
-} |
1510 |
- |
1511 |
-get_kheader_version() { |
1512 |
- printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \ |
1513 |
- $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \ |
1514 |
- tail -n 1 |
1515 |
-} |
1516 |
- |
1517 |
-# We collect all sanity checks here. Consistency is not guranteed between |
1518 |
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in |
1519 |
-# src_unpack. |
1520 |
-sanity_prechecks() { |
1521 |
- # Make sure devpts is mounted correctly for use w/out setuid pt_chown |
1522 |
- check_devpts |
1523 |
- |
1524 |
- # Prevent native builds from downgrading |
1525 |
- if [[ ${MERGE_TYPE} != "buildonly" ]] && \ |
1526 |
- [[ ${ROOT} == "/" ]] && \ |
1527 |
- [[ ${CBUILD} == ${CHOST} ]] && \ |
1528 |
- [[ ${CHOST} == ${CTARGET} ]] ; then |
1529 |
- |
1530 |
- # The high rev # is to allow people to downgrade between -r# |
1531 |
- # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2 |
1532 |
- # should be fine. Hopefully we never actually use a r# this |
1533 |
- # high. |
1534 |
- if has_version ">${CATEGORY}/${P}-r10000" ; then |
1535 |
- eerror "Sanity check to keep you from breaking your system:" |
1536 |
- eerror " Downgrading glibc is not supported and a sure way to destruction." |
1537 |
- [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system." |
1538 |
- fi |
1539 |
- |
1540 |
- if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then |
1541 |
- eerror "Your old kernel is broken. You need to update it to a newer" |
1542 |
- eerror "version as syscall(<bignum>) will break. See bug 279260." |
1543 |
- die "Old and broken kernel." |
1544 |
- fi |
1545 |
- fi |
1546 |
- |
1547 |
- # Users have had a chance to phase themselves, time to give em the boot |
1548 |
- if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then |
1549 |
- eerror "You still haven't deleted ${EROOT}/etc/locales.build." |
1550 |
- eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher." |
1551 |
- die "Lazy upgrader detected" |
1552 |
- fi |
1553 |
- |
1554 |
- if [[ ${CTARGET} == i386-* ]] ; then |
1555 |
- eerror "i386 CHOSTs are no longer supported." |
1556 |
- eerror "Chances are you don't actually want/need i386." |
1557 |
- eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml" |
1558 |
- die "Please fix your CHOST" |
1559 |
- fi |
1560 |
- |
1561 |
- if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then |
1562 |
- ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS." |
1563 |
- ewarn "This will result in a 50% performance penalty when running with a 32bit" |
1564 |
- ewarn "hypervisor, which is probably not what you want." |
1565 |
- fi |
1566 |
- |
1567 |
- # Check for sanity of /etc/nsswitch.conf |
1568 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then |
1569 |
- local entry |
1570 |
- for entry in passwd group shadow; do |
1571 |
- if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then |
1572 |
- eerror "Your ${EROOT}/etc/nsswitch.conf is out of date." |
1573 |
- eerror "Please make sure you have 'files' entries for" |
1574 |
- eerror "'passwd:', 'group:' and 'shadow:' databases." |
1575 |
- eerror "For more details see:" |
1576 |
- eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26" |
1577 |
- die "nsswitch.conf has no 'files' provider in '${entry}'." |
1578 |
- fi |
1579 |
- done |
1580 |
- fi |
1581 |
- |
1582 |
- # ABI-specific checks follow here. Hey, we have a lot more specific conditions that |
1583 |
- # we test for... |
1584 |
- if ! is_crosscompile ; then |
1585 |
- if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then |
1586 |
- ebegin "Checking that IA32 emulation is enabled in the running kernel" |
1587 |
- echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c" |
1588 |
- local STAT |
1589 |
- if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then |
1590 |
- "${T}/check-ia32-emulation.elf32" |
1591 |
- STAT=$? |
1592 |
- else |
1593 |
- # Don't fail here to allow single->multi ABI switch |
1594 |
- # or recover from breakage like bug #646424 |
1595 |
- ewarn "Failed to compile the ABI test. Broken host glibc?" |
1596 |
- STAT=0 |
1597 |
- fi |
1598 |
- rm -f "${T}/check-ia32-emulation.elf32" |
1599 |
- eend $STAT |
1600 |
- [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc." |
1601 |
- fi |
1602 |
- |
1603 |
- fi |
1604 |
- |
1605 |
- # When we actually have to compile something... |
1606 |
- if ! just_headers ; then |
1607 |
- local run_kv build_kv want_kv |
1608 |
- |
1609 |
- run_kv=$(g_get_running_KV) |
1610 |
- build_kv=$(g_int_to_KV $(get_kheader_version)) |
1611 |
- want_kv=${MIN_KERN_VER} |
1612 |
- |
1613 |
- ebegin "Checking gcc for __thread support" |
1614 |
- if ! eend $(want__thread ; echo $?) ; then |
1615 |
- echo |
1616 |
- eerror "Could not find a gcc that supports the __thread directive!" |
1617 |
- eerror "Please update your binutils/gcc and try again." |
1618 |
- die "No __thread support in gcc!" |
1619 |
- fi |
1620 |
- |
1621 |
- if ! is_crosscompile && ! tc-is-cross-compiler ; then |
1622 |
- # Building fails on an non-supporting kernel |
1623 |
- ebegin "Checking running kernel version (${run_kv} >= ${want_kv})" |
1624 |
- if ! eend_KV ${run_kv} ${want_kv} ; then |
1625 |
- echo |
1626 |
- eerror "You need a kernel of at least ${want_kv}!" |
1627 |
- die "Kernel version too low!" |
1628 |
- fi |
1629 |
- fi |
1630 |
- |
1631 |
- ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" |
1632 |
- if ! eend_KV ${build_kv} ${want_kv} ; then |
1633 |
- echo |
1634 |
- eerror "You need linux-headers of at least ${want_kv}!" |
1635 |
- die "linux-headers version too low!" |
1636 |
- fi |
1637 |
- fi |
1638 |
-} |
1639 |
- |
1640 |
-# |
1641 |
-# the phases |
1642 |
-# |
1643 |
- |
1644 |
-# pkg_pretend |
1645 |
- |
1646 |
-pkg_pretend() { |
1647 |
- # All the checks... |
1648 |
- einfo "Checking general environment sanity." |
1649 |
- sanity_prechecks |
1650 |
-} |
1651 |
- |
1652 |
-# src_unpack |
1653 |
- |
1654 |
-src_unpack() { |
1655 |
- # Consistency is not guaranteed between pkg_ and src_ ... |
1656 |
- sanity_prechecks |
1657 |
- |
1658 |
- use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
1659 |
- |
1660 |
- setup_env |
1661 |
- |
1662 |
- if [[ -n ${EGIT_REPO_URI} ]] ; then |
1663 |
- git-r3_src_unpack |
1664 |
- else |
1665 |
- unpack ${P}.tar.xz |
1666 |
- fi |
1667 |
- |
1668 |
- cd "${S}" || die |
1669 |
- touch locale/C-translit.h || die #185476 #218003 |
1670 |
- |
1671 |
- cd "${WORKDIR}" || die |
1672 |
- unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2 |
1673 |
-} |
1674 |
- |
1675 |
-src_prepare() { |
1676 |
- if ! use vanilla ; then |
1677 |
- elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}" |
1678 |
- eapply "${WORKDIR}"/patches |
1679 |
- einfo "Done." |
1680 |
- fi |
1681 |
- |
1682 |
- default |
1683 |
- |
1684 |
- gnuconfig_update |
1685 |
- |
1686 |
- cd "${WORKDIR}" |
1687 |
- find . -name configure -exec touch {} + |
1688 |
- |
1689 |
- eprefixify extra/locale/locale-gen |
1690 |
- |
1691 |
- # Fix permissions on some of the scripts. |
1692 |
- chmod u+x "${S}"/scripts/*.sh |
1693 |
- |
1694 |
- cd "${S}" |
1695 |
-} |
1696 |
- |
1697 |
-glibc_do_configure() { |
1698 |
- # Glibc does not work with gold (for various reasons) #269274. |
1699 |
- tc-ld-disable-gold |
1700 |
- |
1701 |
- # CXX isnt handled by the multilib system, so if we dont unset here |
1702 |
- # we accumulate crap across abis |
1703 |
- unset CXX |
1704 |
- |
1705 |
- einfo "Configuring glibc for nptl" |
1706 |
- |
1707 |
- if use doc ; then |
1708 |
- export MAKEINFO=makeinfo |
1709 |
- else |
1710 |
- export MAKEINFO=/dev/null |
1711 |
- fi |
1712 |
- |
1713 |
- local v |
1714 |
- for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do |
1715 |
- einfo " $(printf '%15s' ${v}:) ${!v}" |
1716 |
- done |
1717 |
- |
1718 |
- # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 |
1719 |
- # To build .S (assembly) files with the same ABI-specific flags |
1720 |
- # upstream currently recommends adding CFLAGS to CC/CXX: |
1721 |
- # https://sourceware.org/PR23273 |
1722 |
- # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS |
1723 |
- # and breaks multiarch support. See 659030#c3 for an example. |
1724 |
- |
1725 |
- # The glibc configure script doesn't properly use LDFLAGS all the time. |
1726 |
- export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}" |
1727 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
1728 |
- |
1729 |
- # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 |
1730 |
- export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}" |
1731 |
- einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" |
1732 |
- |
1733 |
- echo |
1734 |
- |
1735 |
- local myconf=() |
1736 |
- |
1737 |
- case ${CTARGET} in |
1738 |
- m68k*) |
1739 |
- # setjmp() is not compatible with stack protection: |
1740 |
- # https://sourceware.org/PR24202 |
1741 |
- myconf+=( --enable-stack-protector=no ) |
1742 |
- ;; |
1743 |
- powerpc-*) |
1744 |
- # Currently gcc on powerpc32 generates invalid code for |
1745 |
- # __builtin_return_address(0) calls. Normally programs |
1746 |
- # don't do that but malloc hooks in glibc do: |
1747 |
- # https://gcc.gnu.org/PR81996 |
1748 |
- # https://bugs.gentoo.org/629054 |
1749 |
- myconf+=( --enable-stack-protector=no ) |
1750 |
- ;; |
1751 |
- *) |
1752 |
- myconf+=( --enable-stack-protector=all ) |
1753 |
- ;; |
1754 |
- esac |
1755 |
- myconf+=( --enable-stackguard-randomization ) |
1756 |
- |
1757 |
- # Keep a whitelist of targets supporing IFUNC. glibc's ./configure |
1758 |
- # is not robust enough to detect proper support: |
1759 |
- # https://bugs.gentoo.org/641216 |
1760 |
- # https://sourceware.org/PR22634#c0 |
1761 |
- case $(tc-arch ${CTARGET}) in |
1762 |
- # Keep whitelist of targets where autodetection mostly works. |
1763 |
- amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;; |
1764 |
- # Blacklist everywhere else |
1765 |
- *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;; |
1766 |
- esac |
1767 |
- |
1768 |
- [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) |
1769 |
- |
1770 |
- myconf+=( --enable-kernel=${MIN_KERN_VER} ) |
1771 |
- |
1772 |
- # Since SELinux support is only required for nscd, only enable it if: |
1773 |
- # 1. USE selinux |
1774 |
- # 2. only for the primary ABI on multilib systems |
1775 |
- # 3. Not a crosscompile |
1776 |
- if ! is_crosscompile && use selinux ; then |
1777 |
- if use multilib ; then |
1778 |
- if is_final_abi ; then |
1779 |
- myconf+=( --with-selinux ) |
1780 |
- else |
1781 |
- myconf+=( --without-selinux ) |
1782 |
- fi |
1783 |
- else |
1784 |
- myconf+=( --with-selinux ) |
1785 |
- fi |
1786 |
- else |
1787 |
- myconf+=( --without-selinux ) |
1788 |
- fi |
1789 |
- |
1790 |
- # Force a few tests where we always know the answer but |
1791 |
- # configure is incapable of finding it. |
1792 |
- if is_crosscompile ; then |
1793 |
- export \ |
1794 |
- libc_cv_c_cleanup=yes \ |
1795 |
- libc_cv_forced_unwind=yes |
1796 |
- fi |
1797 |
- |
1798 |
- myconf+=( |
1799 |
- --without-cvs |
1800 |
- --disable-werror |
1801 |
- --enable-bind-now |
1802 |
- --build=${CBUILD_OPT:-${CBUILD}} |
1803 |
- --host=${CTARGET_OPT:-${CTARGET}} |
1804 |
- $(use_enable profile) |
1805 |
- $(use_with gd) |
1806 |
- --with-headers=$(alt_build_headers) |
1807 |
- --prefix="${EPREFIX}/usr" |
1808 |
- --sysconfdir="${EPREFIX}/etc" |
1809 |
- --localstatedir="${EPREFIX}/var" |
1810 |
- --libdir='$(prefix)'/$(get_libdir) |
1811 |
- --mandir='$(prefix)'/share/man |
1812 |
- --infodir='$(prefix)'/share/info |
1813 |
- --libexecdir='$(libdir)'/misc/glibc |
1814 |
- --with-bugurl=https://bugs.gentoo.org/ |
1815 |
- --with-pkgversion="$(glibc_banner)" |
1816 |
- $(use_multiarch || echo --disable-multi-arch) |
1817 |
- $(use_enable systemtap) |
1818 |
- $(use_enable nscd) |
1819 |
- ${EXTRA_ECONF} |
1820 |
- ) |
1821 |
- |
1822 |
- # We rely on sys-libs/timezone-data for timezone tools normally. |
1823 |
- myconf+=( $(use_enable vanilla timezone-tools) ) |
1824 |
- |
1825 |
- # These libs don't have configure flags. |
1826 |
- ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no) |
1827 |
- ac_cv_lib_cap_cap_init=$(usex caps || echo no) |
1828 |
- |
1829 |
- # There is no configure option for this and we need to export it |
1830 |
- # since the glibc build will re-run configure on itself |
1831 |
- export libc_cv_rootsbindir="${EPREFIX}/sbin" |
1832 |
- export libc_cv_slibdir="${EPREFIX}/$(get_libdir)" |
1833 |
- |
1834 |
- # We take care of patching our binutils to use both hash styles, |
1835 |
- # and many people like to force gnu hash style only, so disable |
1836 |
- # this overriding check. #347761 |
1837 |
- export libc_cv_hashstyle=no |
1838 |
- |
1839 |
- local builddir=$(builddir nptl) |
1840 |
- mkdir -p "${builddir}" |
1841 |
- cd "${builddir}" |
1842 |
- set -- "${S}"/configure "${myconf[@]}" |
1843 |
- echo "$@" |
1844 |
- "$@" || die "failed to configure glibc" |
1845 |
- |
1846 |
- # ia64 static cross-compilers are a pita in so much that they |
1847 |
- # can't produce static ELFs (as the libgcc.a is broken). so |
1848 |
- # disable building of the programs for those targets if it |
1849 |
- # doesn't work. |
1850 |
- # XXX: We could turn this into a compiler test, but ia64 is |
1851 |
- # the only one that matters, so this should be fine for now. |
1852 |
- if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then |
1853 |
- sed -i '1i+link-static = touch $@' config.make |
1854 |
- fi |
1855 |
- |
1856 |
- # If we're trying to migrate between ABI sets, we need |
1857 |
- # to lie and use a local copy of gcc. Like if the system |
1858 |
- # is built with MULTILIB_ABIS="amd64 x86" but we want to |
1859 |
- # add x32 to it, gcc/glibc don't yet support x32. |
1860 |
- # |
1861 |
- if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
1862 |
- echo 'main(){}' > "${T}"/test.c |
1863 |
- if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
1864 |
- sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
1865 |
- fi |
1866 |
- fi |
1867 |
-} |
1868 |
- |
1869 |
-glibc_headers_configure() { |
1870 |
- export ABI=default |
1871 |
- |
1872 |
- local builddir=$(builddir "headers") |
1873 |
- mkdir -p "${builddir}" |
1874 |
- cd "${builddir}" |
1875 |
- |
1876 |
- # if we don't have a compiler yet, we can't really test it now ... |
1877 |
- # hopefully they don't affect header generation, so let's hope for |
1878 |
- # the best here ... |
1879 |
- local v vars=( |
1880 |
- ac_cv_header_cpuid_h=yes |
1881 |
- libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes |
1882 |
- libc_cv_asm_cfi_directives=yes |
1883 |
- libc_cv_broken_visibility_attribute=no |
1884 |
- libc_cv_c_cleanup=yes |
1885 |
- libc_cv_compiler_powerpc64le_binary128_ok=yes |
1886 |
- libc_cv_forced_unwind=yes |
1887 |
- libc_cv_gcc___thread=yes |
1888 |
- libc_cv_mlong_double_128=yes |
1889 |
- libc_cv_mlong_double_128ibm=yes |
1890 |
- libc_cv_ppc_machine=yes |
1891 |
- libc_cv_ppc_rel16=yes |
1892 |
- libc_cv_predef_fortify_source=no |
1893 |
- libc_cv_target_power8_ok=yes |
1894 |
- libc_cv_visibility_attribute=yes |
1895 |
- libc_cv_z_combreloc=yes |
1896 |
- libc_cv_z_execstack=yes |
1897 |
- libc_cv_z_initfirst=yes |
1898 |
- libc_cv_z_nodelete=yes |
1899 |
- libc_cv_z_nodlopen=yes |
1900 |
- libc_cv_z_relro=yes |
1901 |
- libc_mips_abi=${ABI} |
1902 |
- libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard) |
1903 |
- # These libs don't have configure flags. |
1904 |
- ac_cv_lib_audit_audit_log_user_avc_message=no |
1905 |
- ac_cv_lib_cap_cap_init=no |
1906 |
- ) |
1907 |
- |
1908 |
- einfo "Forcing cached settings:" |
1909 |
- for v in "${vars[@]}" ; do |
1910 |
- einfo " ${v}" |
1911 |
- export ${v} |
1912 |
- done |
1913 |
- |
1914 |
- local headers_only_arch_CPPFLAGS=() |
1915 |
- |
1916 |
- # Blow away some random CC settings that screw things up. #550192 |
1917 |
- if [[ -d ${S}/sysdeps/mips ]]; then |
1918 |
- pushd "${S}"/sysdeps/mips >/dev/null |
1919 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die |
1920 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die |
1921 |
- |
1922 |
- # Force the mips ABI to the default. This is OK because the set of |
1923 |
- # installed headers in this phase is the same between the 3 ABIs. |
1924 |
- # If this ever changes, this hack will break, but that's unlikely |
1925 |
- # as glibc discourages that behavior. |
1926 |
- # https://crbug.com/647033 |
1927 |
- sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die |
1928 |
- |
1929 |
- popd >/dev/null |
1930 |
- fi |
1931 |
- |
1932 |
- case ${CTARGET} in |
1933 |
- riscv*) |
1934 |
- # RISC-V interrogates the compiler to determine which target to |
1935 |
- # build. If building the headers then we don't strictly need a |
1936 |
- # RISC-V compiler, so the built-in definitions that are provided |
1937 |
- # along with all RISC-V compiler might not exist. This causes |
1938 |
- # glibc's RISC-V preconfigure script to blow up. Since we're just |
1939 |
- # building the headers any value will actually work here, so just |
1940 |
- # pick the standard one (rv64g/lp64d) to make the build scripts |
1941 |
- # happy for now -- the headers are all the same anyway so it |
1942 |
- # doesn't matter. |
1943 |
- headers_only_arch_CPPFLAGS+=( |
1944 |
- -D__riscv_xlen=64 |
1945 |
- -D__riscv_flen=64 |
1946 |
- -D__riscv_float_abi_double=1 |
1947 |
- -D__riscv_atomic=1 |
1948 |
- ) ;; |
1949 |
- esac |
1950 |
- |
1951 |
- local myconf=() |
1952 |
- myconf+=( |
1953 |
- --disable-sanity-checks |
1954 |
- --enable-hacker-mode |
1955 |
- --without-cvs |
1956 |
- --disable-werror |
1957 |
- --enable-bind-now |
1958 |
- --build=${CBUILD_OPT:-${CBUILD}} |
1959 |
- --host=${CTARGET_OPT:-${CTARGET}} |
1960 |
- --with-headers=$(alt_build_headers) |
1961 |
- --prefix="${EPREFIX}/usr" |
1962 |
- ${EXTRA_ECONF} |
1963 |
- ) |
1964 |
- |
1965 |
- # Nothing is compiled here which would affect the headers for the target. |
1966 |
- # So forcing CC/CFLAGS is sane. |
1967 |
- local headers_only_CC=$(tc-getBUILD_CC) |
1968 |
- local headers_only_CFLAGS="-O1 -pipe" |
1969 |
- local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}" |
1970 |
- local headers_only_LDFLAGS="" |
1971 |
- set -- "${S}"/configure "${myconf[@]}" |
1972 |
- echo \ |
1973 |
- "CC=${headers_only_CC}" \ |
1974 |
- "CFLAGS=${headers_only_CFLAGS}" \ |
1975 |
- "CPPFLAGS=${headers_only_CPPFLAGS}" \ |
1976 |
- "LDFLAGS=${headers_only_LDFLAGS}" \ |
1977 |
- "$@" |
1978 |
- CC=${headers_only_CC} \ |
1979 |
- CFLAGS=${headers_only_CFLAGS} \ |
1980 |
- CPPFLAGS=${headers_only_CPPFLAGS} \ |
1981 |
- LDFLAGS="" \ |
1982 |
- "$@" || die "failed to configure glibc" |
1983 |
-} |
1984 |
- |
1985 |
-do_src_configure() { |
1986 |
- if just_headers ; then |
1987 |
- glibc_headers_configure |
1988 |
- else |
1989 |
- glibc_do_configure nptl |
1990 |
- fi |
1991 |
-} |
1992 |
- |
1993 |
-src_configure() { |
1994 |
- foreach_abi do_src_configure |
1995 |
-} |
1996 |
- |
1997 |
-do_src_compile() { |
1998 |
- emake -C "$(builddir nptl)" |
1999 |
-} |
2000 |
- |
2001 |
-src_compile() { |
2002 |
- if just_headers ; then |
2003 |
- return |
2004 |
- fi |
2005 |
- |
2006 |
- foreach_abi do_src_compile |
2007 |
-} |
2008 |
- |
2009 |
-glibc_src_test() { |
2010 |
- cd "$(builddir nptl)" |
2011 |
- emake check |
2012 |
-} |
2013 |
- |
2014 |
-do_src_test() { |
2015 |
- local ret=0 |
2016 |
- |
2017 |
- glibc_src_test |
2018 |
- : $(( ret |= $? )) |
2019 |
- |
2020 |
- return ${ret} |
2021 |
-} |
2022 |
- |
2023 |
-src_test() { |
2024 |
- if just_headers ; then |
2025 |
- return |
2026 |
- fi |
2027 |
- |
2028 |
- # Give tests more time to complete. |
2029 |
- export TIMEOUTFACTOR=5 |
2030 |
- |
2031 |
- foreach_abi do_src_test || die "tests failed" |
2032 |
-} |
2033 |
- |
2034 |
-run_locale_gen() { |
2035 |
- # if the host locales.gen contains no entries, we'll install everything |
2036 |
- local root="$1" |
2037 |
- local locale_list="${root}/etc/locale.gen" |
2038 |
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then |
2039 |
- ewarn "Generating all locales; edit /etc/locale.gen to save time/space" |
2040 |
- locale_list="${root}/usr/share/i18n/SUPPORTED" |
2041 |
- fi |
2042 |
- |
2043 |
- locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \ |
2044 |
- --destdir "${root}" |
2045 |
-} |
2046 |
- |
2047 |
-glibc_do_src_install() { |
2048 |
- local builddir=$(builddir nptl) |
2049 |
- cd "${builddir}" |
2050 |
- |
2051 |
- emake install_root="${D}$(alt_prefix)" install |
2052 |
- |
2053 |
- # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support |
2054 |
- # which come without headers etc. Only needed for binary packages since the |
2055 |
- # external net-libs/libnsl has increased soversion. Keep only versioned libraries. |
2056 |
- find "${D}" -name "libnsl.a" -delete |
2057 |
- find "${D}" -name "libnsl.so" -delete |
2058 |
- |
2059 |
- # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need |
2060 |
- # to infer upstream version: |
2061 |
- # '#define VERSION "2.26.90"' -> '2.26.90' |
2062 |
- local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) |
2063 |
- |
2064 |
- if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then |
2065 |
- # Move versioned .a file out of libdir to evade portage QA checks |
2066 |
- # instead of using gen_usr_ldscript(). We fix ldscript as: |
2067 |
- # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..." |
2068 |
- sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die |
2069 |
- dodir $(alt_usrlibdir)/${P} |
2070 |
- mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die |
2071 |
- fi |
2072 |
- |
2073 |
- # We'll take care of the cache ourselves |
2074 |
- rm -f "${ED}"/etc/ld.so.cache |
2075 |
- |
2076 |
- # Everything past this point just needs to be done once ... |
2077 |
- is_final_abi || return 0 |
2078 |
- |
2079 |
- # Make sure the non-native interp can be found on multilib systems even |
2080 |
- # if the main library set isn't installed into the right place. Maybe |
2081 |
- # we should query the active gcc for info instead of hardcoding it ? |
2082 |
- local i ldso_abi ldso_name |
2083 |
- local ldso_abi_list=( |
2084 |
- # x86 |
2085 |
- amd64 /lib64/ld-linux-x86-64.so.2 |
2086 |
- x32 /libx32/ld-linux-x32.so.2 |
2087 |
- x86 /lib/ld-linux.so.2 |
2088 |
- # mips |
2089 |
- o32 /lib/ld.so.1 |
2090 |
- n32 /lib32/ld.so.1 |
2091 |
- n64 /lib64/ld.so.1 |
2092 |
- # powerpc |
2093 |
- ppc /lib/ld.so.1 |
2094 |
- ppc64 /lib64/ld64.so.1 |
2095 |
- # s390 |
2096 |
- s390 /lib/ld.so.1 |
2097 |
- s390x /lib/ld64.so.1 |
2098 |
- # sparc |
2099 |
- sparc32 /lib/ld-linux.so.2 |
2100 |
- sparc64 /lib64/ld-linux.so.2 |
2101 |
- ) |
2102 |
- case $(tc-endian) in |
2103 |
- little) |
2104 |
- ldso_abi_list+=( |
2105 |
- # arm |
2106 |
- arm64 /lib/ld-linux-aarch64.so.1 |
2107 |
- ) |
2108 |
- ;; |
2109 |
- big) |
2110 |
- ldso_abi_list+=( |
2111 |
- # arm |
2112 |
- arm64 /lib/ld-linux-aarch64_be.so.1 |
2113 |
- ) |
2114 |
- ;; |
2115 |
- esac |
2116 |
- if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then |
2117 |
- dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib |
2118 |
- fi |
2119 |
- for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do |
2120 |
- ldso_abi=${ldso_abi_list[i]} |
2121 |
- has ${ldso_abi} $(get_install_abis) || continue |
2122 |
- |
2123 |
- ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}" |
2124 |
- if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then |
2125 |
- dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name} |
2126 |
- fi |
2127 |
- done |
2128 |
- |
2129 |
- # With devpts under Linux mounted properly, we do not need the pt_chown |
2130 |
- # binary to be setuid. This is because the default owners/perms will be |
2131 |
- # exactly what we want. |
2132 |
- if ! use suid ; then |
2133 |
- find "${ED}" -name pt_chown -exec chmod -s {} + |
2134 |
- fi |
2135 |
- |
2136 |
- ################################################################# |
2137 |
- # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY # |
2138 |
- # Make sure we install some symlink hacks so that when we build |
2139 |
- # a 2nd stage cross-compiler, gcc finds the target system |
2140 |
- # headers correctly. See gcc/doc/gccinstall.info |
2141 |
- if is_crosscompile ; then |
2142 |
- # We need to make sure that /lib and /usr/lib always exists. |
2143 |
- # gcc likes to use relative paths to get to its multilibs like |
2144 |
- # /usr/lib/../lib64/. So while we don't install any files into |
2145 |
- # /usr/lib/, we do need it to exist. |
2146 |
- keepdir $(alt_prefix)/lib |
2147 |
- keepdir $(alt_prefix)/usr/lib |
2148 |
- |
2149 |
- dosym usr/include $(alt_prefix)/sys-include |
2150 |
- return 0 |
2151 |
- fi |
2152 |
- |
2153 |
- # Files for Debian-style locale updating |
2154 |
- dodir /usr/share/i18n |
2155 |
- sed \ |
2156 |
- -e "/^#/d" \ |
2157 |
- -e "/SUPPORTED-LOCALES=/d" \ |
2158 |
- -e "s: \\\\::g" -e "s:/: :g" \ |
2159 |
- "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ |
2160 |
- || die "generating /usr/share/i18n/SUPPORTED failed" |
2161 |
- cd "${WORKDIR}"/extra/locale |
2162 |
- dosbin locale-gen |
2163 |
- doman *.[0-8] |
2164 |
- insinto /etc |
2165 |
- doins locale.gen |
2166 |
- |
2167 |
- # Make sure all the ABI's can find the locales and so we only |
2168 |
- # have to generate one set |
2169 |
- local a |
2170 |
- keepdir /usr/$(get_libdir)/locale |
2171 |
- for a in $(get_install_abis) ; do |
2172 |
- if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then |
2173 |
- dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale |
2174 |
- fi |
2175 |
- done |
2176 |
- |
2177 |
- cd "${S}" |
2178 |
- |
2179 |
- # Install misc network config files |
2180 |
- insinto /etc |
2181 |
- doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf |
2182 |
- doins "${WORKDIR}"/extra/etc/*.conf |
2183 |
- |
2184 |
- if use nscd ; then |
2185 |
- doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)" |
2186 |
- |
2187 |
- local nscd_args=( |
2188 |
- -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" |
2189 |
- ) |
2190 |
- |
2191 |
- sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd |
2192 |
- |
2193 |
- systemd_dounit nscd/nscd.service |
2194 |
- systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf |
2195 |
- else |
2196 |
- # Do this since extra/etc/*.conf above might have nscd.conf. |
2197 |
- rm -f "${ED}"/etc/nscd.conf |
2198 |
- fi |
2199 |
- |
2200 |
- echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc |
2201 |
- doenvd "${T}"/00glibc |
2202 |
- |
2203 |
- for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do |
2204 |
- [[ -s ${d} ]] && dodoc ${d} |
2205 |
- done |
2206 |
- dodoc -r ChangeLog.old |
2207 |
- |
2208 |
- # Prevent overwriting of the /etc/localtime symlink. We'll handle the |
2209 |
- # creation of the "factory" symlink in pkg_postinst(). |
2210 |
- rm -f "${ED}"/etc/localtime |
2211 |
- |
2212 |
- # Generate all locales if this is a native build as locale generation |
2213 |
- if use compile-locales && ! is_crosscompile ; then |
2214 |
- run_locale_gen "${ED}" |
2215 |
- fi |
2216 |
-} |
2217 |
- |
2218 |
-glibc_headers_install() { |
2219 |
- local builddir=$(builddir "headers") |
2220 |
- cd "${builddir}" |
2221 |
- emake install_root="${D}$(alt_prefix)" install-headers |
2222 |
- |
2223 |
- insinto $(alt_headers)/gnu |
2224 |
- doins "${S}"/include/gnu/stubs.h |
2225 |
- |
2226 |
- # Make sure we install the sys-include symlink so that when |
2227 |
- # we build a 2nd stage cross-compiler, gcc finds the target |
2228 |
- # system headers correctly. See gcc/doc/gccinstall.info |
2229 |
- dosym usr/include $(alt_prefix)/sys-include |
2230 |
-} |
2231 |
- |
2232 |
-src_install() { |
2233 |
- if just_headers ; then |
2234 |
- export ABI=default |
2235 |
- glibc_headers_install |
2236 |
- return |
2237 |
- fi |
2238 |
- |
2239 |
- foreach_abi glibc_do_src_install |
2240 |
-} |
2241 |
- |
2242 |
-# Simple test to make sure our new glibc isn't completely broken. |
2243 |
-# Make sure we don't test with statically built binaries since |
2244 |
-# they will fail. Also, skip if this glibc is a cross compiler. |
2245 |
-# |
2246 |
-# If coreutils is built with USE=multicall, some of these files |
2247 |
-# will just be wrapper scripts, not actual ELFs we can test. |
2248 |
-glibc_sanity_check() { |
2249 |
- cd / #228809 |
2250 |
- |
2251 |
- # We enter ${ED} so to avoid trouble if the path contains |
2252 |
- # special characters; for instance if the path contains the |
2253 |
- # colon character (:), then the linker will try to split it |
2254 |
- # and look for the libraries in an unexpected place. This can |
2255 |
- # lead to unsafe code execution if the generated prefix is |
2256 |
- # within a world-writable directory. |
2257 |
- # (e.g. /var/tmp/portage:${HOSTNAME}) |
2258 |
- pushd "${ED}"/$(get_libdir) >/dev/null |
2259 |
- |
2260 |
- local x striptest |
2261 |
- for x in cal date env free ls true uname uptime ; do |
2262 |
- x=$(type -p ${x}) |
2263 |
- [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue |
2264 |
- striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue |
2265 |
- case ${striptest} in |
2266 |
- *"statically linked"*) continue;; |
2267 |
- *"ASCII text"*) continue;; |
2268 |
- esac |
2269 |
- # We need to clear the locale settings as the upgrade might want |
2270 |
- # incompatible locale data. This test is not for verifying that. |
2271 |
- LC_ALL=C \ |
2272 |
- ./ld-*.so --library-path . ${x} > /dev/null \ |
2273 |
- || die "simple run test (${x}) failed" |
2274 |
- done |
2275 |
- |
2276 |
- popd >/dev/null |
2277 |
-} |
2278 |
- |
2279 |
-pkg_preinst() { |
2280 |
- # nothing to do if just installing headers |
2281 |
- just_headers && return |
2282 |
- |
2283 |
- # prepare /etc/ld.so.conf.d/ for files |
2284 |
- mkdir -p "${EROOT}"/etc/ld.so.conf.d |
2285 |
- |
2286 |
- # Default /etc/hosts.conf:multi to on for systems with small dbs. |
2287 |
- if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then |
2288 |
- sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf |
2289 |
- einfo "Defaulting /etc/host.conf:multi to on" |
2290 |
- fi |
2291 |
- |
2292 |
- [[ ${ROOT} != "/" ]] && return 0 |
2293 |
- [[ -d ${ED}/$(get_libdir) ]] || return 0 |
2294 |
- [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check |
2295 |
-} |
2296 |
- |
2297 |
-pkg_postinst() { |
2298 |
- # nothing to do if just installing headers |
2299 |
- just_headers && return |
2300 |
- |
2301 |
- if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then |
2302 |
- # Generate fastloading iconv module configuration file. |
2303 |
- "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}" |
2304 |
- fi |
2305 |
- |
2306 |
- if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then |
2307 |
- use compile-locales || run_locale_gen "${EROOT}" |
2308 |
- fi |
2309 |
- |
2310 |
- # Check for sanity of /etc/nsswitch.conf, take 2 |
2311 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then |
2312 |
- local entry |
2313 |
- for entry in passwd group shadow; do |
2314 |
- if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then |
2315 |
- ewarn "" |
2316 |
- ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" |
2317 |
- ewarn "removed from glibc and is now provided by the package" |
2318 |
- ewarn " sys-auth/libnss-nis" |
2319 |
- ewarn "Install it now to keep your NIS setup working." |
2320 |
- ewarn "" |
2321 |
- fi |
2322 |
- done |
2323 |
- fi |
2324 |
-} |
2325 |
|
2326 |
diff --git a/sys-libs/glibc/glibc-2.28-r6.ebuild b/sys-libs/glibc/glibc-2.28-r6.ebuild |
2327 |
deleted file mode 100644 |
2328 |
index 1569309d3f9..00000000000 |
2329 |
--- a/sys-libs/glibc/glibc-2.28-r6.ebuild |
2330 |
+++ /dev/null |
2331 |
@@ -1,1412 +0,0 @@ |
2332 |
-# Copyright 1999-2020 Gentoo Authors |
2333 |
-# Distributed under the terms of the GNU General Public License v2 |
2334 |
- |
2335 |
-EAPI=6 |
2336 |
- |
2337 |
-inherit prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig \ |
2338 |
- multilib systemd multiprocessing |
2339 |
- |
2340 |
-DESCRIPTION="GNU libc C library" |
2341 |
-HOMEPAGE="https://www.gnu.org/software/libc/" |
2342 |
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" |
2343 |
-SLOT="2.2" |
2344 |
- |
2345 |
-EMULTILIB_PKG="true" |
2346 |
- |
2347 |
-if [[ ${PV} == 9999* ]]; then |
2348 |
- EGIT_REPO_URI="https://sourceware.org/git/glibc.git" |
2349 |
- inherit git-r3 |
2350 |
-else |
2351 |
- KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86" |
2352 |
- SRC_URI="mirror://gnu/glibc/${P}.tar.xz" |
2353 |
-fi |
2354 |
- |
2355 |
-RELEASE_VER=${PV} |
2356 |
- |
2357 |
-GCC_BOOTSTRAP_VER=20180511 |
2358 |
- |
2359 |
-# Gentoo patchset |
2360 |
-PATCH_VER=9 |
2361 |
- |
2362 |
-SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.xz" |
2363 |
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
2364 |
- |
2365 |
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla" |
2366 |
- |
2367 |
-# Minimum kernel version that glibc requires |
2368 |
-MIN_KERN_VER="3.2.0" |
2369 |
- |
2370 |
-# Here's how the cross-compile logic breaks down ... |
2371 |
-# CTARGET - machine that will target the binaries |
2372 |
-# CHOST - machine that will host the binaries |
2373 |
-# CBUILD - machine that will build the binaries |
2374 |
-# If CTARGET != CHOST, it means you want a libc for cross-compiling. |
2375 |
-# If CHOST != CBUILD, it means you want to cross-compile the libc. |
2376 |
-# CBUILD = CHOST = CTARGET - native build/install |
2377 |
-# CBUILD != (CHOST = CTARGET) - cross-compile a native build |
2378 |
-# (CBUILD = CHOST) != CTARGET - libc for cross-compiler |
2379 |
-# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler |
2380 |
-# For install paths: |
2381 |
-# CHOST = CTARGET - install into / |
2382 |
-# CHOST != CTARGET - install into /usr/CTARGET/ |
2383 |
-# |
2384 |
-export CBUILD=${CBUILD:-${CHOST}} |
2385 |
-export CTARGET=${CTARGET:-${CHOST}} |
2386 |
-if [[ ${CTARGET} == ${CHOST} ]] ; then |
2387 |
- if [[ ${CATEGORY} == cross-* ]] ; then |
2388 |
- export CTARGET=${CATEGORY#cross-} |
2389 |
- fi |
2390 |
-fi |
2391 |
- |
2392 |
-# Note [Disable automatic stripping] |
2393 |
-# Disabling automatic stripping for a few reasons: |
2394 |
-# - portage's attempt to strip breaks non-native binaries at least on |
2395 |
-# arm: bug #697428 |
2396 |
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread |
2397 |
-# enumeration: bug #697910. This is quite subtle: |
2398 |
-# * gdb uses glibc's libthread_db-1.0.so to enumerate threads. |
2399 |
-# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols |
2400 |
-# via 'ps_pglobal_lookup' symbol defined in gdb. |
2401 |
-# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all |
2402 |
-# known symbols in 'libpthread.so.0'. Specifically 'nptl_version' |
2403 |
-# (unexported) is used to sanity check compatibility before enabling |
2404 |
-# debugging. |
2405 |
-# Also see https://sourceware.org/gdb/wiki/FAQ#GDB_does_not_see_any_threads_besides_the_one_in_which_crash_occurred.3B_or_SIGTRAP_kills_my_program_when_I_set_a_breakpoint |
2406 |
-# * normal 'strip' command trims '.symtab' |
2407 |
-# Thus our main goal here is to prevent 'libpthread.so.0' from |
2408 |
-# losing it's '.symtab' entries. |
2409 |
-# As Gentoo's strip does not allow us to pass less aggressive stripping |
2410 |
-# options and does not check the machine target we disable stripping |
2411 |
-# entirely. |
2412 |
-RESTRICT="strip !test? ( test )" |
2413 |
- |
2414 |
-# We need a new-enough binutils/gcc to match upstream baseline. |
2415 |
-# Also we need to make sure our binutils/gcc supports TLS, |
2416 |
-# and that gcc already contains the hardened patches. |
2417 |
-COMMON_DEPEND=" |
2418 |
- nscd? ( selinux? ( |
2419 |
- audit? ( sys-process/audit ) |
2420 |
- caps? ( sys-libs/libcap ) |
2421 |
- ) ) |
2422 |
- suid? ( caps? ( sys-libs/libcap ) ) |
2423 |
- selinux? ( sys-libs/libselinux ) |
2424 |
- systemtap? ( dev-util/systemtap ) |
2425 |
-" |
2426 |
-DEPEND="${COMMON_DEPEND} |
2427 |
- >=app-misc/pax-utils-0.1.10 |
2428 |
- sys-devel/bison |
2429 |
- !<sys-devel/bison-2.7 |
2430 |
- doc? ( sys-apps/texinfo ) |
2431 |
- test? ( >=net-dns/libidn2-2.0.5 ) |
2432 |
-" |
2433 |
-RDEPEND="${COMMON_DEPEND} |
2434 |
- sys-apps/gentoo-functions |
2435 |
-" |
2436 |
- |
2437 |
-if [[ ${CATEGORY} == cross-* ]] ; then |
2438 |
- DEPEND+=" !headers-only? ( |
2439 |
- >=${CATEGORY}/binutils-2.24 |
2440 |
- >=${CATEGORY}/gcc-6 |
2441 |
- )" |
2442 |
- [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" |
2443 |
-else |
2444 |
- DEPEND+=" |
2445 |
- >=sys-devel/binutils-2.24 |
2446 |
- >=sys-devel/gcc-6 |
2447 |
- virtual/os-headers |
2448 |
- " |
2449 |
- RDEPEND+=" |
2450 |
- >=net-dns/libidn2-2.0.5 |
2451 |
- vanilla? ( !sys-libs/timezone-data ) |
2452 |
- " |
2453 |
- PDEPEND+=" !vanilla? ( sys-libs/timezone-data )" |
2454 |
-fi |
2455 |
- |
2456 |
-# |
2457 |
-# Small helper functions |
2458 |
-# |
2459 |
- |
2460 |
-is_crosscompile() { |
2461 |
- [[ ${CHOST} != ${CTARGET} ]] |
2462 |
-} |
2463 |
- |
2464 |
-just_headers() { |
2465 |
- is_crosscompile && use headers-only |
2466 |
-} |
2467 |
- |
2468 |
-alt_prefix() { |
2469 |
- is_crosscompile && echo /usr/${CTARGET} |
2470 |
-} |
2471 |
- |
2472 |
-# We need to be able to set alternative headers for compiling for non-native |
2473 |
-# platform. Will also become useful for testing kernel-headers without screwing |
2474 |
-# up the whole system. |
2475 |
-alt_headers() { |
2476 |
- echo ${ALT_HEADERS:=$(alt_prefix)/usr/include} |
2477 |
-} |
2478 |
- |
2479 |
-alt_build_headers() { |
2480 |
- if [[ -z ${ALT_BUILD_HEADERS} ]] ; then |
2481 |
- ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)" |
2482 |
- if tc-is-cross-compiler ; then |
2483 |
- ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers) |
2484 |
- if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then |
2485 |
- local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h') |
2486 |
- ALT_BUILD_HEADERS=${header_path%/linux/version.h} |
2487 |
- fi |
2488 |
- fi |
2489 |
- fi |
2490 |
- echo "${ALT_BUILD_HEADERS}" |
2491 |
-} |
2492 |
- |
2493 |
-alt_libdir() { |
2494 |
- echo $(alt_prefix)/$(get_libdir) |
2495 |
-} |
2496 |
-alt_usrlibdir() { |
2497 |
- echo $(alt_prefix)/usr/$(get_libdir) |
2498 |
-} |
2499 |
- |
2500 |
-builddir() { |
2501 |
- echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1" |
2502 |
-} |
2503 |
- |
2504 |
-do_compile_test() { |
2505 |
- local ret save_cflags=${CFLAGS} |
2506 |
- CFLAGS+=" $1" |
2507 |
- shift |
2508 |
- |
2509 |
- pushd "${T}" >/dev/null |
2510 |
- |
2511 |
- rm -f glibc-test* |
2512 |
- printf '%b' "$*" > glibc-test.c |
2513 |
- |
2514 |
- nonfatal emake -s glibc-test |
2515 |
- ret=$? |
2516 |
- |
2517 |
- popd >/dev/null |
2518 |
- |
2519 |
- CFLAGS=${save_cflags} |
2520 |
- return ${ret} |
2521 |
-} |
2522 |
- |
2523 |
-do_run_test() { |
2524 |
- local ret |
2525 |
- |
2526 |
- if [[ ${MERGE_TYPE} == "binary" ]] ; then |
2527 |
- # ignore build failures when installing a binary package #324685 |
2528 |
- do_compile_test "" "$@" 2>/dev/null || return 0 |
2529 |
- else |
2530 |
- if ! do_compile_test "" "$@" ; then |
2531 |
- ewarn "Simple build failed ... assuming this is desired #324685" |
2532 |
- return 0 |
2533 |
- fi |
2534 |
- fi |
2535 |
- |
2536 |
- pushd "${T}" >/dev/null |
2537 |
- |
2538 |
- ./glibc-test |
2539 |
- ret=$? |
2540 |
- rm -f glibc-test* |
2541 |
- |
2542 |
- popd >/dev/null |
2543 |
- |
2544 |
- return ${ret} |
2545 |
-} |
2546 |
- |
2547 |
-setup_target_flags() { |
2548 |
- # This largely mucks with compiler flags. None of which should matter |
2549 |
- # when building up just the headers. |
2550 |
- just_headers && return 0 |
2551 |
- |
2552 |
- case $(tc-arch) in |
2553 |
- x86) |
2554 |
- # -march needed for #185404 #199334 |
2555 |
- # TODO: When creating the first glibc cross-compile, this test will |
2556 |
- # always fail as it does a full link which in turn requires glibc. |
2557 |
- # Probably also applies when changing multilib profile settings (e.g. |
2558 |
- # enabling x86 when the profile was amd64-only previously). |
2559 |
- # We could change main to _start and pass -nostdlib here so that we |
2560 |
- # only test the gcc code compilation. Or we could do a compile and |
2561 |
- # then look for the symbol via scanelf. |
2562 |
- if ! do_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then |
2563 |
- local t=${CTARGET_OPT:-${CTARGET}} |
2564 |
- t=${t%%-*} |
2565 |
- filter-flags '-march=*' |
2566 |
- export CFLAGS="-march=${t} ${CFLAGS}" |
2567 |
- einfo "Auto adding -march=${t} to CFLAGS #185404" |
2568 |
- fi |
2569 |
- ;; |
2570 |
- amd64) |
2571 |
- # -march needed for #185404 #199334 |
2572 |
- # Note: This test only matters when the x86 ABI is enabled, so we could |
2573 |
- # optimize a bit and elide it. |
2574 |
- # TODO: See cross-compile issues listed above for x86. |
2575 |
- if ! do_compile_test "${CFLAGS_x86}" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then |
2576 |
- local t=${CTARGET_OPT:-${CTARGET}} |
2577 |
- t=${t%%-*} |
2578 |
- # Normally the target is x86_64-xxx, so turn that into the -march that |
2579 |
- # gcc actually accepts. #528708 |
2580 |
- [[ ${t} == "x86_64" ]] && t="x86-64" |
2581 |
- filter-flags '-march=*' |
2582 |
- # ugly, ugly, ugly. ugly. |
2583 |
- CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") |
2584 |
- export CFLAGS_x86="${CFLAGS_x86} -march=${t}" |
2585 |
- einfo "Auto adding -march=${t} to CFLAGS_x86 #185404" |
2586 |
- fi |
2587 |
- ;; |
2588 |
- mips) |
2589 |
- # The mips abi cannot support the GNU style hashes. #233233 |
2590 |
- filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both |
2591 |
- ;; |
2592 |
- sparc) |
2593 |
- # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though. |
2594 |
- filter-flags "-fcall-used-g7" |
2595 |
- append-flags "-fcall-used-g6" |
2596 |
- |
2597 |
- # If the CHOST is the basic one (e.g. not sparcv9-xxx already), |
2598 |
- # try to pick a better one so glibc can use cpu-specific .S files. |
2599 |
- # We key off the CFLAGS to get a good value. Also need to handle |
2600 |
- # version skew. |
2601 |
- # We can't force users to set their CHOST to their exact machine |
2602 |
- # as many of these are not recognized by config.sub/gcc and such :(. |
2603 |
- # Note: If the mcpu values don't scale, we might try probing CPP defines. |
2604 |
- # Note: Should we factor in -Wa,-AvXXX flags too ? Or -mvis/etc... ? |
2605 |
- |
2606 |
- local cpu |
2607 |
- case ${CTARGET} in |
2608 |
- sparc64-*) |
2609 |
- case $(get-flag mcpu) in |
2610 |
- niagara[234]) |
2611 |
- if ver_test -ge 2.8 ; then |
2612 |
- cpu="sparc64v2" |
2613 |
- elif ver_test -ge 2.4 ; then |
2614 |
- cpu="sparc64v" |
2615 |
- elif ver_test -ge 2.2.3 ; then |
2616 |
- cpu="sparc64b" |
2617 |
- fi |
2618 |
- ;; |
2619 |
- niagara) |
2620 |
- if ver_test -ge 2.4 ; then |
2621 |
- cpu="sparc64v" |
2622 |
- elif ver_test -ge 2.2.3 ; then |
2623 |
- cpu="sparc64b" |
2624 |
- fi |
2625 |
- ;; |
2626 |
- ultrasparc3) |
2627 |
- cpu="sparc64b" |
2628 |
- ;; |
2629 |
- *) |
2630 |
- # We need to force at least v9a because the base build doesn't |
2631 |
- # work with just v9. |
2632 |
- # https://sourceware.org/bugzilla/show_bug.cgi?id=19477 |
2633 |
- [[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a" |
2634 |
- ;; |
2635 |
- esac |
2636 |
- ;; |
2637 |
- sparc-*) |
2638 |
- case $(get-flag mcpu) in |
2639 |
- niagara[234]) |
2640 |
- if ver_test -ge 2.8 ; then |
2641 |
- cpu="sparcv9v2" |
2642 |
- elif ver_test -ge 2.4 ; then |
2643 |
- cpu="sparcv9v" |
2644 |
- elif ver_test -ge 2.2.3 ; then |
2645 |
- cpu="sparcv9b" |
2646 |
- else |
2647 |
- cpu="sparcv9" |
2648 |
- fi |
2649 |
- ;; |
2650 |
- niagara) |
2651 |
- if ver_test -ge 2.4 ; then |
2652 |
- cpu="sparcv9v" |
2653 |
- elif ver_test -ge 2.2.3 ; then |
2654 |
- cpu="sparcv9b" |
2655 |
- else |
2656 |
- cpu="sparcv9" |
2657 |
- fi |
2658 |
- ;; |
2659 |
- ultrasparc3) |
2660 |
- cpu="sparcv9b" |
2661 |
- ;; |
2662 |
- v9|ultrasparc) |
2663 |
- cpu="sparcv9" |
2664 |
- ;; |
2665 |
- v8|supersparc|hypersparc|leon|leon3) |
2666 |
- cpu="sparcv8" |
2667 |
- ;; |
2668 |
- esac |
2669 |
- ;; |
2670 |
- esac |
2671 |
- [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}" |
2672 |
- ;; |
2673 |
- esac |
2674 |
-} |
2675 |
- |
2676 |
-setup_flags() { |
2677 |
- # Make sure host make.conf doesn't pollute us |
2678 |
- if is_crosscompile || tc-is-cross-compiler ; then |
2679 |
- CHOST=${CTARGET} strip-unsupported-flags |
2680 |
- fi |
2681 |
- |
2682 |
- # Store our CFLAGS because it's changed depending on which CTARGET |
2683 |
- # we are building when pulling glibc on a multilib profile |
2684 |
- CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}} |
2685 |
- CFLAGS=${CFLAGS_BASE} |
2686 |
- CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}} |
2687 |
- CXXFLAGS=${CXXFLAGS_BASE} |
2688 |
- ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}} |
2689 |
- ASFLAGS=${ASFLAGS_BASE} |
2690 |
- |
2691 |
- # Over-zealous CFLAGS can often cause problems. What may work for one |
2692 |
- # person may not work for another. To avoid a large influx of bugs |
2693 |
- # relating to failed builds, we strip most CFLAGS out to ensure as few |
2694 |
- # problems as possible. |
2695 |
- strip-flags |
2696 |
- strip-unsupported-flags |
2697 |
- filter-flags -m32 -m64 '-mabi=*' |
2698 |
- |
2699 |
- # glibc aborts if rpath is set by LDFLAGS |
2700 |
- filter-ldflags '-Wl,-rpath=*' |
2701 |
- |
2702 |
- # #492892 |
2703 |
- filter-flags -frecord-gcc-switches |
2704 |
- |
2705 |
- unset CBUILD_OPT CTARGET_OPT |
2706 |
- if use multilib ; then |
2707 |
- CTARGET_OPT=$(get_abi_CTARGET) |
2708 |
- [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST) |
2709 |
- fi |
2710 |
- |
2711 |
- setup_target_flags |
2712 |
- |
2713 |
- if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then |
2714 |
- CBUILD_OPT=${CTARGET_OPT} |
2715 |
- fi |
2716 |
- |
2717 |
- # Lock glibc at -O2; we want to be conservative here. |
2718 |
- # -fno-strict-aliasing is to work around #155906. |
2719 |
- filter-flags '-O?' |
2720 |
- append-flags -O2 -fno-strict-aliasing |
2721 |
- |
2722 |
- filter-flags '-fstack-protector*' |
2723 |
-} |
2724 |
- |
2725 |
-want_tls() { |
2726 |
- # Archs that can use TLS (Thread Local Storage) |
2727 |
- case $(tc-arch) in |
2728 |
- x86) |
2729 |
- # requires i486 or better #106556 |
2730 |
- [[ ${CTARGET} == i[4567]86* ]] && return 0 |
2731 |
- return 1 |
2732 |
- ;; |
2733 |
- esac |
2734 |
- return 0 |
2735 |
-} |
2736 |
- |
2737 |
-want__thread() { |
2738 |
- want_tls || return 1 |
2739 |
- |
2740 |
- # For some reason --with-tls --with__thread is causing segfaults on sparc32. |
2741 |
- [[ ${PROFILE_ARCH} == "sparc" ]] && return 1 |
2742 |
- |
2743 |
- [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD} |
2744 |
- |
2745 |
- # only test gcc -- can't test linking yet |
2746 |
- tc-has-tls -c ${CTARGET} |
2747 |
- WANT__THREAD=$? |
2748 |
- |
2749 |
- return ${WANT__THREAD} |
2750 |
-} |
2751 |
- |
2752 |
-use_multiarch() { |
2753 |
- # Allow user to disable runtime arch detection in multilib. |
2754 |
- use multiarch || return 1 |
2755 |
- # Make sure binutils is new enough to support indirect functions, |
2756 |
- # #336792. This funky sed supports gold and bfd linkers. |
2757 |
- local bver nver |
2758 |
- bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}') |
2759 |
- case $(tc-arch ${CTARGET}) in |
2760 |
- amd64|x86) nver="2.20" ;; |
2761 |
- arm) nver="2.22" ;; |
2762 |
- hppa) nver="2.23" ;; |
2763 |
- ppc|ppc64) nver="2.20" ;; |
2764 |
- # ifunc support was added in 2.23, but glibc also needs |
2765 |
- # machinemode which is in 2.24. |
2766 |
- s390) nver="2.24" ;; |
2767 |
- sparc) nver="2.21" ;; |
2768 |
- *) return 1 ;; |
2769 |
- esac |
2770 |
- ver_test ${bver} -ge ${nver} |
2771 |
-} |
2772 |
- |
2773 |
-# Setup toolchain variables that had historically been defined in the |
2774 |
-# profiles for these archs. |
2775 |
-setup_env() { |
2776 |
- # silly users |
2777 |
- unset LD_RUN_PATH |
2778 |
- unset LD_ASSUME_KERNEL |
2779 |
- |
2780 |
- if is_crosscompile || tc-is-cross-compiler ; then |
2781 |
- multilib_env ${CTARGET_OPT:-${CTARGET}} |
2782 |
- |
2783 |
- if ! use multilib ; then |
2784 |
- MULTILIB_ABIS=${DEFAULT_ABI} |
2785 |
- else |
2786 |
- MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}} |
2787 |
- fi |
2788 |
- |
2789 |
- # If the user has CFLAGS_<CTARGET> in their make.conf, use that, |
2790 |
- # and fall back on CFLAGS. |
2791 |
- local VAR=CFLAGS_${CTARGET//[-.]/_} |
2792 |
- CFLAGS=${!VAR-${CFLAGS}} |
2793 |
- einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}" |
2794 |
- fi |
2795 |
- |
2796 |
- setup_flags |
2797 |
- |
2798 |
- export ABI=${ABI:-${DEFAULT_ABI:-default}} |
2799 |
- |
2800 |
- if just_headers ; then |
2801 |
- # Avoid mixing host's CC and target's CFLAGS_${ABI}: |
2802 |
- # At this bootstrap stage we have only binutils for |
2803 |
- # target but not compiler yet. |
2804 |
- einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." |
2805 |
- return 0 |
2806 |
- fi |
2807 |
- local VAR=CFLAGS_${ABI} |
2808 |
- # We need to export CFLAGS with abi information in them because glibc's |
2809 |
- # configure script checks CFLAGS for some targets (like mips). Keep |
2810 |
- # around the original clean value to avoid appending multiple ABIs on |
2811 |
- # top of each other. |
2812 |
- : ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})} |
2813 |
- export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" |
2814 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
2815 |
-} |
2816 |
- |
2817 |
-foreach_abi() { |
2818 |
- setup_env |
2819 |
- |
2820 |
- local ret=0 |
2821 |
- local abilist="" |
2822 |
- if use multilib ; then |
2823 |
- abilist=$(get_install_abis) |
2824 |
- else |
2825 |
- abilist=${DEFAULT_ABI} |
2826 |
- fi |
2827 |
- local -x ABI |
2828 |
- for ABI in ${abilist:-default} ; do |
2829 |
- setup_env |
2830 |
- einfo "Running $1 for ABI ${ABI}" |
2831 |
- $1 |
2832 |
- : $(( ret |= $? )) |
2833 |
- done |
2834 |
- return ${ret} |
2835 |
-} |
2836 |
- |
2837 |
-glibc_banner() { |
2838 |
- local b="Gentoo ${PVR}" |
2839 |
- [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}" |
2840 |
- echo "${b}" |
2841 |
-} |
2842 |
- |
2843 |
-check_devpts() { |
2844 |
- # Make sure devpts is mounted correctly for use w/out setuid pt_chown. |
2845 |
- |
2846 |
- # If merely building the binary package, then there's nothing to verify. |
2847 |
- [[ ${MERGE_TYPE} == "buildonly" ]] && return |
2848 |
- |
2849 |
- # Only sanity check when installing the native glibc. |
2850 |
- [[ ${ROOT} != "/" ]] && return |
2851 |
- |
2852 |
- # If they're opting in to the old suid code, then no need to check. |
2853 |
- use suid && return |
2854 |
- |
2855 |
- if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then |
2856 |
- eerror "In order to use glibc with USE=-suid, you must make sure that" |
2857 |
- eerror "you have devpts mounted at /dev/pts with the gid=5 option." |
2858 |
- eerror "Openrc should do this for you, so you should check /etc/fstab" |
2859 |
- eerror "and make sure you do not have any invalid settings there." |
2860 |
- die "mount & fix your /dev/pts settings" |
2861 |
- fi |
2862 |
-} |
2863 |
- |
2864 |
-# The following Kernel version handling functions are mostly copied from portage |
2865 |
-# source. It's better not to use linux-info.eclass here since a) it adds too |
2866 |
-# much magic, see bug 326693 for some of the arguments, and b) some of the |
2867 |
-# functions are just not provided. |
2868 |
- |
2869 |
-g_get_running_KV() { |
2870 |
- uname -r |
2871 |
- return $? |
2872 |
-} |
2873 |
- |
2874 |
-g_KV_major() { |
2875 |
- [[ -z $1 ]] && return 1 |
2876 |
- local KV=$@ |
2877 |
- echo "${KV%%.*}" |
2878 |
-} |
2879 |
- |
2880 |
-g_KV_minor() { |
2881 |
- [[ -z $1 ]] && return 1 |
2882 |
- local KV=$@ |
2883 |
- KV=${KV#*.} |
2884 |
- echo "${KV%%.*}" |
2885 |
-} |
2886 |
- |
2887 |
-g_KV_micro() { |
2888 |
- [[ -z $1 ]] && return 1 |
2889 |
- local KV=$@ |
2890 |
- KV=${KV#*.*.} |
2891 |
- echo "${KV%%[^[:digit:]]*}" |
2892 |
-} |
2893 |
- |
2894 |
-g_KV_to_int() { |
2895 |
- [[ -z $1 ]] && return 1 |
2896 |
- local KV_MAJOR=$(g_KV_major "$1") |
2897 |
- local KV_MINOR=$(g_KV_minor "$1") |
2898 |
- local KV_MICRO=$(g_KV_micro "$1") |
2899 |
- local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) |
2900 |
- |
2901 |
- # We make version 2.2.0 the minimum version we will handle as |
2902 |
- # a sanity check ... if its less, we fail ... |
2903 |
- if [[ ${KV_int} -ge 131584 ]] ; then |
2904 |
- echo "${KV_int}" |
2905 |
- return 0 |
2906 |
- fi |
2907 |
- return 1 |
2908 |
-} |
2909 |
- |
2910 |
-g_int_to_KV() { |
2911 |
- local version=$1 major minor micro |
2912 |
- major=$((version / 65536)) |
2913 |
- minor=$(((version % 65536) / 256)) |
2914 |
- micro=$((version % 256)) |
2915 |
- echo ${major}.${minor}.${micro} |
2916 |
-} |
2917 |
- |
2918 |
-eend_KV() { |
2919 |
- [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]] |
2920 |
- eend $? |
2921 |
-} |
2922 |
- |
2923 |
-get_kheader_version() { |
2924 |
- printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \ |
2925 |
- $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \ |
2926 |
- tail -n 1 |
2927 |
-} |
2928 |
- |
2929 |
-# We collect all sanity checks here. Consistency is not guranteed between |
2930 |
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in |
2931 |
-# src_unpack. |
2932 |
-sanity_prechecks() { |
2933 |
- # Make sure devpts is mounted correctly for use w/out setuid pt_chown |
2934 |
- check_devpts |
2935 |
- |
2936 |
- # Prevent native builds from downgrading |
2937 |
- if [[ ${MERGE_TYPE} != "buildonly" ]] && \ |
2938 |
- [[ ${ROOT} == "/" ]] && \ |
2939 |
- [[ ${CBUILD} == ${CHOST} ]] && \ |
2940 |
- [[ ${CHOST} == ${CTARGET} ]] ; then |
2941 |
- |
2942 |
- # The high rev # is to allow people to downgrade between -r# |
2943 |
- # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2 |
2944 |
- # should be fine. Hopefully we never actually use a r# this |
2945 |
- # high. |
2946 |
- if has_version ">${CATEGORY}/${P}-r10000" ; then |
2947 |
- eerror "Sanity check to keep you from breaking your system:" |
2948 |
- eerror " Downgrading glibc is not supported and a sure way to destruction." |
2949 |
- [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system." |
2950 |
- fi |
2951 |
- |
2952 |
- if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then |
2953 |
- eerror "Your old kernel is broken. You need to update it to a newer" |
2954 |
- eerror "version as syscall(<bignum>) will break. See bug 279260." |
2955 |
- die "Old and broken kernel." |
2956 |
- fi |
2957 |
- fi |
2958 |
- |
2959 |
- # Users have had a chance to phase themselves, time to give em the boot |
2960 |
- if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then |
2961 |
- eerror "You still haven't deleted ${EROOT}/etc/locales.build." |
2962 |
- eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher." |
2963 |
- die "Lazy upgrader detected" |
2964 |
- fi |
2965 |
- |
2966 |
- if [[ ${CTARGET} == i386-* ]] ; then |
2967 |
- eerror "i386 CHOSTs are no longer supported." |
2968 |
- eerror "Chances are you don't actually want/need i386." |
2969 |
- eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml" |
2970 |
- die "Please fix your CHOST" |
2971 |
- fi |
2972 |
- |
2973 |
- if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then |
2974 |
- ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS." |
2975 |
- ewarn "This will result in a 50% performance penalty when running with a 32bit" |
2976 |
- ewarn "hypervisor, which is probably not what you want." |
2977 |
- fi |
2978 |
- |
2979 |
- # Check for sanity of /etc/nsswitch.conf |
2980 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then |
2981 |
- local entry |
2982 |
- for entry in passwd group shadow; do |
2983 |
- if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then |
2984 |
- eerror "Your ${EROOT}/etc/nsswitch.conf is out of date." |
2985 |
- eerror "Please make sure you have 'files' entries for" |
2986 |
- eerror "'passwd:', 'group:' and 'shadow:' databases." |
2987 |
- eerror "For more details see:" |
2988 |
- eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26" |
2989 |
- die "nsswitch.conf has no 'files' provider in '${entry}'." |
2990 |
- fi |
2991 |
- done |
2992 |
- fi |
2993 |
- |
2994 |
- # ABI-specific checks follow here. Hey, we have a lot more specific conditions that |
2995 |
- # we test for... |
2996 |
- if ! is_crosscompile ; then |
2997 |
- if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then |
2998 |
- ebegin "Checking that IA32 emulation is enabled in the running kernel" |
2999 |
- echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c" |
3000 |
- local STAT |
3001 |
- if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then |
3002 |
- "${T}/check-ia32-emulation.elf32" |
3003 |
- STAT=$? |
3004 |
- else |
3005 |
- # Don't fail here to allow single->multi ABI switch |
3006 |
- # or recover from breakage like bug #646424 |
3007 |
- ewarn "Failed to compile the ABI test. Broken host glibc?" |
3008 |
- STAT=0 |
3009 |
- fi |
3010 |
- rm -f "${T}/check-ia32-emulation.elf32" |
3011 |
- eend $STAT |
3012 |
- [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc." |
3013 |
- fi |
3014 |
- |
3015 |
- fi |
3016 |
- |
3017 |
- # When we actually have to compile something... |
3018 |
- if ! just_headers ; then |
3019 |
- ebegin "Checking gcc for __thread support" |
3020 |
- if ! eend $(want__thread ; echo $?) ; then |
3021 |
- echo |
3022 |
- eerror "Could not find a gcc that supports the __thread directive!" |
3023 |
- eerror "Please update your binutils/gcc and try again." |
3024 |
- die "No __thread support in gcc!" |
3025 |
- fi |
3026 |
- |
3027 |
- if [[ ${CTARGET} == *-linux* ]] ; then |
3028 |
- local run_kv build_kv want_kv |
3029 |
- |
3030 |
- run_kv=$(g_get_running_KV) |
3031 |
- build_kv=$(g_int_to_KV $(get_kheader_version)) |
3032 |
- want_kv=${MIN_KERN_VER} |
3033 |
- |
3034 |
- if ! is_crosscompile && ! tc-is-cross-compiler ; then |
3035 |
- # Building fails on an non-supporting kernel |
3036 |
- ebegin "Checking running kernel version (${run_kv} >= ${want_kv})" |
3037 |
- if ! eend_KV ${run_kv} ${want_kv} ; then |
3038 |
- echo |
3039 |
- eerror "You need a kernel of at least ${want_kv}!" |
3040 |
- die "Kernel version too low!" |
3041 |
- fi |
3042 |
- fi |
3043 |
- |
3044 |
- ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" |
3045 |
- if ! eend_KV ${build_kv} ${want_kv} ; then |
3046 |
- echo |
3047 |
- eerror "You need linux-headers of at least ${want_kv}!" |
3048 |
- die "linux-headers version too low!" |
3049 |
- fi |
3050 |
- fi |
3051 |
- fi |
3052 |
-} |
3053 |
- |
3054 |
-# |
3055 |
-# the phases |
3056 |
-# |
3057 |
- |
3058 |
-# pkg_pretend |
3059 |
- |
3060 |
-pkg_pretend() { |
3061 |
- # All the checks... |
3062 |
- einfo "Checking general environment sanity." |
3063 |
- sanity_prechecks |
3064 |
-} |
3065 |
- |
3066 |
-# src_unpack |
3067 |
- |
3068 |
-src_unpack() { |
3069 |
- # Consistency is not guaranteed between pkg_ and src_ ... |
3070 |
- sanity_prechecks |
3071 |
- |
3072 |
- use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
3073 |
- |
3074 |
- setup_env |
3075 |
- |
3076 |
- if [[ -n ${EGIT_REPO_URI} ]] ; then |
3077 |
- git-r3_src_unpack |
3078 |
- else |
3079 |
- unpack ${P}.tar.xz |
3080 |
- fi |
3081 |
- |
3082 |
- cd "${S}" || die |
3083 |
- touch locale/C-translit.h || die #185476 #218003 |
3084 |
- |
3085 |
- cd "${WORKDIR}" || die |
3086 |
- unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz |
3087 |
-} |
3088 |
- |
3089 |
-src_prepare() { |
3090 |
- if ! use vanilla ; then |
3091 |
- elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}" |
3092 |
- eapply "${WORKDIR}"/patches |
3093 |
- einfo "Done." |
3094 |
- fi |
3095 |
- |
3096 |
- default |
3097 |
- |
3098 |
- gnuconfig_update |
3099 |
- |
3100 |
- cd "${WORKDIR}" |
3101 |
- find . -name configure -exec touch {} + |
3102 |
- |
3103 |
- eprefixify extra/locale/locale-gen |
3104 |
- |
3105 |
- # Fix permissions on some of the scripts. |
3106 |
- chmod u+x "${S}"/scripts/*.sh |
3107 |
- |
3108 |
- cd "${S}" |
3109 |
-} |
3110 |
- |
3111 |
-glibc_do_configure() { |
3112 |
- # Glibc does not work with gold (for various reasons) #269274. |
3113 |
- tc-ld-disable-gold |
3114 |
- |
3115 |
- # CXX isnt handled by the multilib system, so if we dont unset here |
3116 |
- # we accumulate crap across abis |
3117 |
- unset CXX |
3118 |
- |
3119 |
- einfo "Configuring glibc for nptl" |
3120 |
- |
3121 |
- if use doc ; then |
3122 |
- export MAKEINFO=makeinfo |
3123 |
- else |
3124 |
- export MAKEINFO=/dev/null |
3125 |
- fi |
3126 |
- |
3127 |
- local v |
3128 |
- for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do |
3129 |
- einfo " $(printf '%15s' ${v}:) ${!v}" |
3130 |
- done |
3131 |
- |
3132 |
- # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 |
3133 |
- # To build .S (assembly) files with the same ABI-specific flags |
3134 |
- # upstream currently recommends adding CFLAGS to CC/CXX: |
3135 |
- # https://sourceware.org/PR23273 |
3136 |
- # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS |
3137 |
- # and breaks multiarch support. See 659030#c3 for an example. |
3138 |
- # The glibc configure script doesn't properly use LDFLAGS all the time. |
3139 |
- export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}" |
3140 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
3141 |
- |
3142 |
- # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 |
3143 |
- export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}" |
3144 |
- einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" |
3145 |
- |
3146 |
- echo |
3147 |
- |
3148 |
- local myconf=() |
3149 |
- |
3150 |
- case ${CTARGET} in |
3151 |
- m68k*) |
3152 |
- # setjmp() is not compatible with stack protection: |
3153 |
- # https://sourceware.org/PR24202 |
3154 |
- myconf+=( --enable-stack-protector=no ) |
3155 |
- ;; |
3156 |
- powerpc-*) |
3157 |
- # Currently gcc on powerpc32 generates invalid code for |
3158 |
- # __builtin_return_address(0) calls. Normally programs |
3159 |
- # don't do that but malloc hooks in glibc do: |
3160 |
- # https://gcc.gnu.org/PR81996 |
3161 |
- # https://bugs.gentoo.org/629054 |
3162 |
- myconf+=( --enable-stack-protector=no ) |
3163 |
- ;; |
3164 |
- *) |
3165 |
- myconf+=( --enable-stack-protector=$(usex ssp all no) ) |
3166 |
- ;; |
3167 |
- esac |
3168 |
- myconf+=( --enable-stackguard-randomization ) |
3169 |
- |
3170 |
- # Keep a whitelist of targets supporing IFUNC. glibc's ./configure |
3171 |
- # is not robust enough to detect proper support: |
3172 |
- # https://bugs.gentoo.org/641216 |
3173 |
- # https://sourceware.org/PR22634#c0 |
3174 |
- case $(tc-arch ${CTARGET}) in |
3175 |
- # Keep whitelist of targets where autodetection mostly works. |
3176 |
- amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;; |
3177 |
- # Blacklist everywhere else |
3178 |
- *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;; |
3179 |
- esac |
3180 |
- |
3181 |
- # Enable Intel Control-flow Enforcement Technology on amd64 if requested |
3182 |
- case ${CTARGET} in |
3183 |
- x86_64-*) myconf+=( $(use_enable cet) ) ;; |
3184 |
- *) ;; |
3185 |
- esac |
3186 |
- |
3187 |
- [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) |
3188 |
- |
3189 |
- myconf+=( --enable-kernel=${MIN_KERN_VER} ) |
3190 |
- |
3191 |
- # Since SELinux support is only required for nscd, only enable it if: |
3192 |
- # 1. USE selinux |
3193 |
- # 2. only for the primary ABI on multilib systems |
3194 |
- # 3. Not a crosscompile |
3195 |
- if ! is_crosscompile && use selinux ; then |
3196 |
- if use multilib ; then |
3197 |
- if is_final_abi ; then |
3198 |
- myconf+=( --with-selinux ) |
3199 |
- else |
3200 |
- myconf+=( --without-selinux ) |
3201 |
- fi |
3202 |
- else |
3203 |
- myconf+=( --with-selinux ) |
3204 |
- fi |
3205 |
- else |
3206 |
- myconf+=( --without-selinux ) |
3207 |
- fi |
3208 |
- |
3209 |
- # Force a few tests where we always know the answer but |
3210 |
- # configure is incapable of finding it. |
3211 |
- if is_crosscompile ; then |
3212 |
- export \ |
3213 |
- libc_cv_c_cleanup=yes \ |
3214 |
- libc_cv_forced_unwind=yes |
3215 |
- fi |
3216 |
- |
3217 |
- myconf+=( |
3218 |
- --without-cvs |
3219 |
- --disable-werror |
3220 |
- --enable-bind-now |
3221 |
- --build=${CBUILD_OPT:-${CBUILD}} |
3222 |
- --host=${CTARGET_OPT:-${CTARGET}} |
3223 |
- $(use_enable profile) |
3224 |
- $(use_with gd) |
3225 |
- --with-headers=$(alt_build_headers) |
3226 |
- --prefix="${EPREFIX}/usr" |
3227 |
- --sysconfdir="${EPREFIX}/etc" |
3228 |
- --localstatedir="${EPREFIX}/var" |
3229 |
- --libdir='$(prefix)'/$(get_libdir) |
3230 |
- --mandir='$(prefix)'/share/man |
3231 |
- --infodir='$(prefix)'/share/info |
3232 |
- --libexecdir='$(libdir)'/misc/glibc |
3233 |
- --with-bugurl=https://bugs.gentoo.org/ |
3234 |
- --with-pkgversion="$(glibc_banner)" |
3235 |
- $(use_multiarch || echo --disable-multi-arch) |
3236 |
- $(use_enable systemtap) |
3237 |
- $(use_enable nscd) |
3238 |
- ${EXTRA_ECONF} |
3239 |
- ) |
3240 |
- |
3241 |
- # We rely on sys-libs/timezone-data for timezone tools normally. |
3242 |
- myconf+=( $(use_enable vanilla timezone-tools) ) |
3243 |
- |
3244 |
- # These libs don't have configure flags. |
3245 |
- ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no) |
3246 |
- ac_cv_lib_cap_cap_init=$(usex caps || echo no) |
3247 |
- |
3248 |
- # There is no configure option for this and we need to export it |
3249 |
- # since the glibc build will re-run configure on itself |
3250 |
- export libc_cv_rootsbindir="${EPREFIX}/sbin" |
3251 |
- export libc_cv_slibdir="${EPREFIX}/$(get_libdir)" |
3252 |
- |
3253 |
- # We take care of patching our binutils to use both hash styles, |
3254 |
- # and many people like to force gnu hash style only, so disable |
3255 |
- # this overriding check. #347761 |
3256 |
- export libc_cv_hashstyle=no |
3257 |
- |
3258 |
- local builddir=$(builddir nptl) |
3259 |
- mkdir -p "${builddir}" |
3260 |
- cd "${builddir}" |
3261 |
- set -- "${S}"/configure "${myconf[@]}" |
3262 |
- echo "$@" |
3263 |
- "$@" || die "failed to configure glibc" |
3264 |
- |
3265 |
- # ia64 static cross-compilers are a pita in so much that they |
3266 |
- # can't produce static ELFs (as the libgcc.a is broken). so |
3267 |
- # disable building of the programs for those targets if it |
3268 |
- # doesn't work. |
3269 |
- # XXX: We could turn this into a compiler test, but ia64 is |
3270 |
- # the only one that matters, so this should be fine for now. |
3271 |
- if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then |
3272 |
- sed -i '1i+link-static = touch $@' config.make |
3273 |
- fi |
3274 |
- |
3275 |
- # If we're trying to migrate between ABI sets, we need |
3276 |
- # to lie and use a local copy of gcc. Like if the system |
3277 |
- # is built with MULTILIB_ABIS="amd64 x86" but we want to |
3278 |
- # add x32 to it, gcc/glibc don't yet support x32. |
3279 |
- # |
3280 |
- if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
3281 |
- echo 'main(){}' > "${T}"/test.c |
3282 |
- if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
3283 |
- sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
3284 |
- fi |
3285 |
- fi |
3286 |
-} |
3287 |
- |
3288 |
-glibc_headers_configure() { |
3289 |
- export ABI=default |
3290 |
- |
3291 |
- local builddir=$(builddir "headers") |
3292 |
- mkdir -p "${builddir}" |
3293 |
- cd "${builddir}" |
3294 |
- |
3295 |
- # if we don't have a compiler yet, we can't really test it now ... |
3296 |
- # hopefully they don't affect header generation, so let's hope for |
3297 |
- # the best here ... |
3298 |
- local v vars=( |
3299 |
- ac_cv_header_cpuid_h=yes |
3300 |
- libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes |
3301 |
- libc_cv_asm_cfi_directives=yes |
3302 |
- libc_cv_broken_visibility_attribute=no |
3303 |
- libc_cv_c_cleanup=yes |
3304 |
- libc_cv_compiler_powerpc64le_binary128_ok=yes |
3305 |
- libc_cv_forced_unwind=yes |
3306 |
- libc_cv_gcc___thread=yes |
3307 |
- libc_cv_mlong_double_128=yes |
3308 |
- libc_cv_mlong_double_128ibm=yes |
3309 |
- libc_cv_ppc_machine=yes |
3310 |
- libc_cv_ppc_rel16=yes |
3311 |
- libc_cv_predef_fortify_source=no |
3312 |
- libc_cv_target_power8_ok=yes |
3313 |
- libc_cv_visibility_attribute=yes |
3314 |
- libc_cv_z_combreloc=yes |
3315 |
- libc_cv_z_execstack=yes |
3316 |
- libc_cv_z_initfirst=yes |
3317 |
- libc_cv_z_nodelete=yes |
3318 |
- libc_cv_z_nodlopen=yes |
3319 |
- libc_cv_z_relro=yes |
3320 |
- libc_mips_abi=${ABI} |
3321 |
- libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard) |
3322 |
- # These libs don't have configure flags. |
3323 |
- ac_cv_lib_audit_audit_log_user_avc_message=no |
3324 |
- ac_cv_lib_cap_cap_init=no |
3325 |
- ) |
3326 |
- |
3327 |
- einfo "Forcing cached settings:" |
3328 |
- for v in "${vars[@]}" ; do |
3329 |
- einfo " ${v}" |
3330 |
- export ${v} |
3331 |
- done |
3332 |
- |
3333 |
- local headers_only_arch_CPPFLAGS=() |
3334 |
- |
3335 |
- # Blow away some random CC settings that screw things up. #550192 |
3336 |
- if [[ -d ${S}/sysdeps/mips ]]; then |
3337 |
- pushd "${S}"/sysdeps/mips >/dev/null |
3338 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die |
3339 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die |
3340 |
- |
3341 |
- # Force the mips ABI to the default. This is OK because the set of |
3342 |
- # installed headers in this phase is the same between the 3 ABIs. |
3343 |
- # If this ever changes, this hack will break, but that's unlikely |
3344 |
- # as glibc discourages that behavior. |
3345 |
- # https://crbug.com/647033 |
3346 |
- sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die |
3347 |
- |
3348 |
- popd >/dev/null |
3349 |
- fi |
3350 |
- |
3351 |
- case ${CTARGET} in |
3352 |
- riscv*) |
3353 |
- # RISC-V interrogates the compiler to determine which target to |
3354 |
- # build. If building the headers then we don't strictly need a |
3355 |
- # RISC-V compiler, so the built-in definitions that are provided |
3356 |
- # along with all RISC-V compiler might not exist. This causes |
3357 |
- # glibc's RISC-V preconfigure script to blow up. Since we're just |
3358 |
- # building the headers any value will actually work here, so just |
3359 |
- # pick the standard one (rv64g/lp64d) to make the build scripts |
3360 |
- # happy for now -- the headers are all the same anyway so it |
3361 |
- # doesn't matter. |
3362 |
- headers_only_arch_CPPFLAGS+=( |
3363 |
- -D__riscv_xlen=64 |
3364 |
- -D__riscv_flen=64 |
3365 |
- -D__riscv_float_abi_double=1 |
3366 |
- -D__riscv_atomic=1 |
3367 |
- ) ;; |
3368 |
- esac |
3369 |
- |
3370 |
- local myconf=() |
3371 |
- myconf+=( |
3372 |
- --disable-sanity-checks |
3373 |
- --enable-hacker-mode |
3374 |
- --without-cvs |
3375 |
- --disable-werror |
3376 |
- --enable-bind-now |
3377 |
- --build=${CBUILD_OPT:-${CBUILD}} |
3378 |
- --host=${CTARGET_OPT:-${CTARGET}} |
3379 |
- --with-headers=$(alt_build_headers) |
3380 |
- --prefix="${EPREFIX}/usr" |
3381 |
- ${EXTRA_ECONF} |
3382 |
- ) |
3383 |
- |
3384 |
- # Nothing is compiled here which would affect the headers for the target. |
3385 |
- # So forcing CC/CFLAGS is sane. |
3386 |
- local headers_only_CC=$(tc-getBUILD_CC) |
3387 |
- local headers_only_CFLAGS="-O1 -pipe" |
3388 |
- local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}" |
3389 |
- local headers_only_LDFLAGS="" |
3390 |
- set -- "${S}"/configure "${myconf[@]}" |
3391 |
- echo \ |
3392 |
- "CC=${headers_only_CC}" \ |
3393 |
- "CFLAGS=${headers_only_CFLAGS}" \ |
3394 |
- "CPPFLAGS=${headers_only_CPPFLAGS}" \ |
3395 |
- "LDFLAGS=${headers_only_LDFLAGS}" \ |
3396 |
- "$@" |
3397 |
- CC=${headers_only_CC} \ |
3398 |
- CFLAGS=${headers_only_CFLAGS} \ |
3399 |
- CPPFLAGS=${headers_only_CPPFLAGS} \ |
3400 |
- LDFLAGS="" \ |
3401 |
- "$@" || die "failed to configure glibc" |
3402 |
-} |
3403 |
- |
3404 |
-do_src_configure() { |
3405 |
- if just_headers ; then |
3406 |
- glibc_headers_configure |
3407 |
- else |
3408 |
- glibc_do_configure nptl |
3409 |
- fi |
3410 |
-} |
3411 |
- |
3412 |
-src_configure() { |
3413 |
- foreach_abi do_src_configure |
3414 |
-} |
3415 |
- |
3416 |
-do_src_compile() { |
3417 |
- emake -C "$(builddir nptl)" |
3418 |
-} |
3419 |
- |
3420 |
-src_compile() { |
3421 |
- if just_headers ; then |
3422 |
- return |
3423 |
- fi |
3424 |
- |
3425 |
- foreach_abi do_src_compile |
3426 |
-} |
3427 |
- |
3428 |
-glibc_src_test() { |
3429 |
- cd "$(builddir nptl)" |
3430 |
- emake check |
3431 |
-} |
3432 |
- |
3433 |
-do_src_test() { |
3434 |
- local ret=0 |
3435 |
- |
3436 |
- glibc_src_test |
3437 |
- : $(( ret |= $? )) |
3438 |
- |
3439 |
- return ${ret} |
3440 |
-} |
3441 |
- |
3442 |
-src_test() { |
3443 |
- if just_headers ; then |
3444 |
- return |
3445 |
- fi |
3446 |
- |
3447 |
- # Give tests more time to complete. |
3448 |
- export TIMEOUTFACTOR=5 |
3449 |
- |
3450 |
- foreach_abi do_src_test || die "tests failed" |
3451 |
-} |
3452 |
- |
3453 |
-run_locale_gen() { |
3454 |
- # if the host locales.gen contains no entries, we'll install everything |
3455 |
- local root="$1" |
3456 |
- local locale_list="${root}/etc/locale.gen" |
3457 |
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then |
3458 |
- ewarn "Generating all locales; edit /etc/locale.gen to save time/space" |
3459 |
- locale_list="${root}/usr/share/i18n/SUPPORTED" |
3460 |
- fi |
3461 |
- |
3462 |
- locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \ |
3463 |
- --destdir "${root}" |
3464 |
-} |
3465 |
- |
3466 |
-glibc_do_src_install() { |
3467 |
- local builddir=$(builddir nptl) |
3468 |
- cd "${builddir}" |
3469 |
- |
3470 |
- emake install_root="${D}$(alt_prefix)" install |
3471 |
- |
3472 |
- # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support |
3473 |
- # which come without headers etc. Only needed for binary packages since the |
3474 |
- # external net-libs/libnsl has increased soversion. Keep only versioned libraries. |
3475 |
- find "${D}" -name "libnsl.a" -delete |
3476 |
- find "${D}" -name "libnsl.so" -delete |
3477 |
- |
3478 |
- # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need |
3479 |
- # to infer upstream version: |
3480 |
- # '#define VERSION "2.26.90"' -> '2.26.90' |
3481 |
- local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) |
3482 |
- |
3483 |
- if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then |
3484 |
- # Move versioned .a file out of libdir to evade portage QA checks |
3485 |
- # instead of using gen_usr_ldscript(). We fix ldscript as: |
3486 |
- # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..." |
3487 |
- sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die |
3488 |
- dodir $(alt_usrlibdir)/${P} |
3489 |
- mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die |
3490 |
- fi |
3491 |
- |
3492 |
- # We'll take care of the cache ourselves |
3493 |
- rm -f "${ED}"/etc/ld.so.cache |
3494 |
- |
3495 |
- # Everything past this point just needs to be done once ... |
3496 |
- is_final_abi || return 0 |
3497 |
- |
3498 |
- # Make sure the non-native interp can be found on multilib systems even |
3499 |
- # if the main library set isn't installed into the right place. Maybe |
3500 |
- # we should query the active gcc for info instead of hardcoding it ? |
3501 |
- local i ldso_abi ldso_name |
3502 |
- local ldso_abi_list=( |
3503 |
- # x86 |
3504 |
- amd64 /lib64/ld-linux-x86-64.so.2 |
3505 |
- x32 /libx32/ld-linux-x32.so.2 |
3506 |
- x86 /lib/ld-linux.so.2 |
3507 |
- # mips |
3508 |
- o32 /lib/ld.so.1 |
3509 |
- n32 /lib32/ld.so.1 |
3510 |
- n64 /lib64/ld.so.1 |
3511 |
- # powerpc |
3512 |
- ppc /lib/ld.so.1 |
3513 |
- ppc64 /lib64/ld64.so.1 |
3514 |
- # s390 |
3515 |
- s390 /lib/ld.so.1 |
3516 |
- s390x /lib/ld64.so.1 |
3517 |
- # sparc |
3518 |
- sparc32 /lib/ld-linux.so.2 |
3519 |
- sparc64 /lib64/ld-linux.so.2 |
3520 |
- ) |
3521 |
- case $(tc-endian) in |
3522 |
- little) |
3523 |
- ldso_abi_list+=( |
3524 |
- # arm |
3525 |
- arm64 /lib/ld-linux-aarch64.so.1 |
3526 |
- ) |
3527 |
- ;; |
3528 |
- big) |
3529 |
- ldso_abi_list+=( |
3530 |
- # arm |
3531 |
- arm64 /lib/ld-linux-aarch64_be.so.1 |
3532 |
- ) |
3533 |
- ;; |
3534 |
- esac |
3535 |
- if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then |
3536 |
- dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib |
3537 |
- fi |
3538 |
- for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do |
3539 |
- ldso_abi=${ldso_abi_list[i]} |
3540 |
- has ${ldso_abi} $(get_install_abis) || continue |
3541 |
- |
3542 |
- ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}" |
3543 |
- if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then |
3544 |
- dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name} |
3545 |
- fi |
3546 |
- done |
3547 |
- |
3548 |
- # With devpts under Linux mounted properly, we do not need the pt_chown |
3549 |
- # binary to be setuid. This is because the default owners/perms will be |
3550 |
- # exactly what we want. |
3551 |
- if ! use suid ; then |
3552 |
- find "${ED}" -name pt_chown -exec chmod -s {} + |
3553 |
- fi |
3554 |
- |
3555 |
- ################################################################# |
3556 |
- # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY # |
3557 |
- # Make sure we install some symlink hacks so that when we build |
3558 |
- # a 2nd stage cross-compiler, gcc finds the target system |
3559 |
- # headers correctly. See gcc/doc/gccinstall.info |
3560 |
- if is_crosscompile ; then |
3561 |
- # We need to make sure that /lib and /usr/lib always exists. |
3562 |
- # gcc likes to use relative paths to get to its multilibs like |
3563 |
- # /usr/lib/../lib64/. So while we don't install any files into |
3564 |
- # /usr/lib/, we do need it to exist. |
3565 |
- keepdir $(alt_prefix)/lib |
3566 |
- keepdir $(alt_prefix)/usr/lib |
3567 |
- |
3568 |
- dosym usr/include $(alt_prefix)/sys-include |
3569 |
- return 0 |
3570 |
- fi |
3571 |
- |
3572 |
- # Files for Debian-style locale updating |
3573 |
- dodir /usr/share/i18n |
3574 |
- sed \ |
3575 |
- -e "/^#/d" \ |
3576 |
- -e "/SUPPORTED-LOCALES=/d" \ |
3577 |
- -e "s: \\\\::g" -e "s:/: :g" \ |
3578 |
- "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ |
3579 |
- || die "generating /usr/share/i18n/SUPPORTED failed" |
3580 |
- cd "${WORKDIR}"/extra/locale |
3581 |
- dosbin locale-gen |
3582 |
- doman *.[0-8] |
3583 |
- insinto /etc |
3584 |
- doins locale.gen |
3585 |
- |
3586 |
- # Make sure all the ABI's can find the locales and so we only |
3587 |
- # have to generate one set |
3588 |
- local a |
3589 |
- keepdir /usr/$(get_libdir)/locale |
3590 |
- for a in $(get_install_abis) ; do |
3591 |
- if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then |
3592 |
- dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale |
3593 |
- fi |
3594 |
- done |
3595 |
- |
3596 |
- cd "${S}" |
3597 |
- |
3598 |
- # Install misc network config files |
3599 |
- insinto /etc |
3600 |
- doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf |
3601 |
- doins "${WORKDIR}"/extra/etc/*.conf |
3602 |
- |
3603 |
- if use nscd ; then |
3604 |
- doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)" |
3605 |
- |
3606 |
- local nscd_args=( |
3607 |
- -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" |
3608 |
- ) |
3609 |
- |
3610 |
- sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd |
3611 |
- |
3612 |
- systemd_dounit nscd/nscd.service |
3613 |
- systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf |
3614 |
- else |
3615 |
- # Do this since extra/etc/*.conf above might have nscd.conf. |
3616 |
- rm -f "${ED}"/etc/nscd.conf |
3617 |
- fi |
3618 |
- |
3619 |
- echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc |
3620 |
- doenvd "${T}"/00glibc |
3621 |
- |
3622 |
- for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do |
3623 |
- [[ -s ${d} ]] && dodoc ${d} |
3624 |
- done |
3625 |
- dodoc -r ChangeLog.old |
3626 |
- |
3627 |
- # Prevent overwriting of the /etc/localtime symlink. We'll handle the |
3628 |
- # creation of the "factory" symlink in pkg_postinst(). |
3629 |
- rm -f "${ED}"/etc/localtime |
3630 |
- |
3631 |
- # Generate all locales if this is a native build as locale generation |
3632 |
- if use compile-locales && ! is_crosscompile ; then |
3633 |
- run_locale_gen "${ED}" |
3634 |
- fi |
3635 |
-} |
3636 |
- |
3637 |
-glibc_headers_install() { |
3638 |
- local builddir=$(builddir "headers") |
3639 |
- cd "${builddir}" |
3640 |
- emake install_root="${D}$(alt_prefix)" install-headers |
3641 |
- |
3642 |
- insinto $(alt_headers)/gnu |
3643 |
- doins "${S}"/include/gnu/stubs.h |
3644 |
- |
3645 |
- # Make sure we install the sys-include symlink so that when |
3646 |
- # we build a 2nd stage cross-compiler, gcc finds the target |
3647 |
- # system headers correctly. See gcc/doc/gccinstall.info |
3648 |
- dosym usr/include $(alt_prefix)/sys-include |
3649 |
-} |
3650 |
- |
3651 |
-src_install() { |
3652 |
- if just_headers ; then |
3653 |
- export ABI=default |
3654 |
- glibc_headers_install |
3655 |
- return |
3656 |
- fi |
3657 |
- |
3658 |
- foreach_abi glibc_do_src_install |
3659 |
-} |
3660 |
- |
3661 |
-# Simple test to make sure our new glibc isn't completely broken. |
3662 |
-# Make sure we don't test with statically built binaries since |
3663 |
-# they will fail. Also, skip if this glibc is a cross compiler. |
3664 |
-# |
3665 |
-# If coreutils is built with USE=multicall, some of these files |
3666 |
-# will just be wrapper scripts, not actual ELFs we can test. |
3667 |
-glibc_sanity_check() { |
3668 |
- cd / #228809 |
3669 |
- |
3670 |
- # We enter ${ED} so to avoid trouble if the path contains |
3671 |
- # special characters; for instance if the path contains the |
3672 |
- # colon character (:), then the linker will try to split it |
3673 |
- # and look for the libraries in an unexpected place. This can |
3674 |
- # lead to unsafe code execution if the generated prefix is |
3675 |
- # within a world-writable directory. |
3676 |
- # (e.g. /var/tmp/portage:${HOSTNAME}) |
3677 |
- pushd "${ED}"/$(get_libdir) >/dev/null |
3678 |
- |
3679 |
- local x striptest |
3680 |
- for x in cal date env free ls true uname uptime ; do |
3681 |
- x=$(type -p ${x}) |
3682 |
- [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue |
3683 |
- striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue |
3684 |
- case ${striptest} in |
3685 |
- *"statically linked"*) continue;; |
3686 |
- *"ASCII text"*) continue;; |
3687 |
- esac |
3688 |
- # We need to clear the locale settings as the upgrade might want |
3689 |
- # incompatible locale data. This test is not for verifying that. |
3690 |
- LC_ALL=C \ |
3691 |
- ./ld-*.so --library-path . ${x} > /dev/null \ |
3692 |
- || die "simple run test (${x}) failed" |
3693 |
- done |
3694 |
- |
3695 |
- popd >/dev/null |
3696 |
-} |
3697 |
- |
3698 |
-pkg_preinst() { |
3699 |
- # nothing to do if just installing headers |
3700 |
- just_headers && return |
3701 |
- |
3702 |
- # prepare /etc/ld.so.conf.d/ for files |
3703 |
- mkdir -p "${EROOT}"/etc/ld.so.conf.d |
3704 |
- |
3705 |
- # Default /etc/hosts.conf:multi to on for systems with small dbs. |
3706 |
- if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then |
3707 |
- sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf |
3708 |
- einfo "Defaulting /etc/host.conf:multi to on" |
3709 |
- fi |
3710 |
- |
3711 |
- [[ ${ROOT} != "/" ]] && return 0 |
3712 |
- [[ -d ${ED}/$(get_libdir) ]] || return 0 |
3713 |
- [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check |
3714 |
-} |
3715 |
- |
3716 |
-pkg_postinst() { |
3717 |
- # nothing to do if just installing headers |
3718 |
- just_headers && return |
3719 |
- |
3720 |
- if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then |
3721 |
- # Generate fastloading iconv module configuration file. |
3722 |
- "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}" |
3723 |
- fi |
3724 |
- |
3725 |
- if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then |
3726 |
- use compile-locales || run_locale_gen "${EROOT}" |
3727 |
- fi |
3728 |
- |
3729 |
- # Check for sanity of /etc/nsswitch.conf, take 2 |
3730 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then |
3731 |
- local entry |
3732 |
- for entry in passwd group shadow; do |
3733 |
- if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then |
3734 |
- ewarn "" |
3735 |
- ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" |
3736 |
- ewarn "removed from glibc and is now provided by the package" |
3737 |
- ewarn " sys-auth/libnss-nis" |
3738 |
- ewarn "Install it now to keep your NIS setup working." |
3739 |
- ewarn "" |
3740 |
- fi |
3741 |
- done |
3742 |
- fi |
3743 |
-} |
3744 |
|
3745 |
diff --git a/sys-libs/glibc/glibc-2.29-r8.ebuild b/sys-libs/glibc/glibc-2.29-r8.ebuild |
3746 |
deleted file mode 100644 |
3747 |
index a6120fcc153..00000000000 |
3748 |
--- a/sys-libs/glibc/glibc-2.29-r8.ebuild |
3749 |
+++ /dev/null |
3750 |
@@ -1,1431 +0,0 @@ |
3751 |
-# Copyright 1999-2020 Gentoo Authors |
3752 |
-# Distributed under the terms of the GNU General Public License v2 |
3753 |
- |
3754 |
-EAPI=7 |
3755 |
- |
3756 |
-PYTHON_COMPAT=( python3_{6,7} ) |
3757 |
- |
3758 |
-inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig \ |
3759 |
- multilib systemd multiprocessing |
3760 |
- |
3761 |
-DESCRIPTION="GNU libc C library" |
3762 |
-HOMEPAGE="https://www.gnu.org/software/libc/" |
3763 |
-LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" |
3764 |
-SLOT="2.2" |
3765 |
- |
3766 |
-EMULTILIB_PKG="true" |
3767 |
- |
3768 |
-if [[ ${PV} == 9999* ]]; then |
3769 |
- EGIT_REPO_URI="https://sourceware.org/git/glibc.git" |
3770 |
- inherit git-r3 |
3771 |
-else |
3772 |
- KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86" |
3773 |
- SRC_URI="mirror://gnu/glibc/${P}.tar.xz" |
3774 |
-fi |
3775 |
- |
3776 |
-RELEASE_VER=${PV} |
3777 |
- |
3778 |
-GCC_BOOTSTRAP_VER=20180511 |
3779 |
- |
3780 |
-# Gentoo patchset |
3781 |
-PATCH_VER=9 |
3782 |
-PATCH_DEV=slyfox |
3783 |
- |
3784 |
-SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz" |
3785 |
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
3786 |
- |
3787 |
-IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla" |
3788 |
- |
3789 |
-# Minimum kernel version that glibc requires |
3790 |
-MIN_KERN_VER="3.2.0" |
3791 |
- |
3792 |
-# Here's how the cross-compile logic breaks down ... |
3793 |
-# CTARGET - machine that will target the binaries |
3794 |
-# CHOST - machine that will host the binaries |
3795 |
-# CBUILD - machine that will build the binaries |
3796 |
-# If CTARGET != CHOST, it means you want a libc for cross-compiling. |
3797 |
-# If CHOST != CBUILD, it means you want to cross-compile the libc. |
3798 |
-# CBUILD = CHOST = CTARGET - native build/install |
3799 |
-# CBUILD != (CHOST = CTARGET) - cross-compile a native build |
3800 |
-# (CBUILD = CHOST) != CTARGET - libc for cross-compiler |
3801 |
-# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler |
3802 |
-# For install paths: |
3803 |
-# CHOST = CTARGET - install into / |
3804 |
-# CHOST != CTARGET - install into /usr/CTARGET/ |
3805 |
-# |
3806 |
-export CBUILD=${CBUILD:-${CHOST}} |
3807 |
-export CTARGET=${CTARGET:-${CHOST}} |
3808 |
-if [[ ${CTARGET} == ${CHOST} ]] ; then |
3809 |
- if [[ ${CATEGORY} == cross-* ]] ; then |
3810 |
- export CTARGET=${CATEGORY#cross-} |
3811 |
- fi |
3812 |
-fi |
3813 |
- |
3814 |
-# Note [Disable automatic stripping] |
3815 |
-# Disabling automatic stripping for a few reasons: |
3816 |
-# - portage's attempt to strip breaks non-native binaries at least on |
3817 |
-# arm: bug #697428 |
3818 |
-# - portage's attempt to strip libpthread.so.0 breaks gdb thread |
3819 |
-# enumeration: bug #697910. This is quite subtle: |
3820 |
-# * gdb uses glibc's libthread_db-1.0.so to enumerate threads. |
3821 |
-# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols |
3822 |
-# via 'ps_pglobal_lookup' symbol defined in gdb. |
3823 |
-# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all |
3824 |
-# known symbols in 'libpthread.so.0'. Specifically 'nptl_version' |
3825 |
-# (unexported) is used to sanity check compatibility before enabling |
3826 |
-# debugging. |
3827 |
-# Also see https://sourceware.org/gdb/wiki/FAQ#GDB_does_not_see_any_threads_besides_the_one_in_which_crash_occurred.3B_or_SIGTRAP_kills_my_program_when_I_set_a_breakpoint |
3828 |
-# * normal 'strip' command trims '.symtab' |
3829 |
-# Thus our main goal here is to prevent 'libpthread.so.0' from |
3830 |
-# losing it's '.symtab' entries. |
3831 |
-# As Gentoo's strip does not allow us to pass less aggressive stripping |
3832 |
-# options and does not check the machine target we strip selectively. |
3833 |
- |
3834 |
-# We need a new-enough binutils/gcc to match upstream baseline. |
3835 |
-# Also we need to make sure our binutils/gcc supports TLS, |
3836 |
-# and that gcc already contains the hardened patches. |
3837 |
-BDEPEND=" |
3838 |
- ${PYTHON_DEPS} |
3839 |
- >=app-misc/pax-utils-0.1.10 |
3840 |
- sys-devel/bison |
3841 |
- !<sys-devel/bison-2.7 |
3842 |
- doc? ( sys-apps/texinfo ) |
3843 |
-" |
3844 |
-COMMON_DEPEND=" |
3845 |
- nscd? ( selinux? ( |
3846 |
- audit? ( sys-process/audit ) |
3847 |
- caps? ( sys-libs/libcap ) |
3848 |
- ) ) |
3849 |
- suid? ( caps? ( sys-libs/libcap ) ) |
3850 |
- selinux? ( sys-libs/libselinux ) |
3851 |
- systemtap? ( dev-util/systemtap ) |
3852 |
-" |
3853 |
-DEPEND="${COMMON_DEPEND} |
3854 |
- test? ( >=net-dns/libidn2-2.0.5 ) |
3855 |
-" |
3856 |
-RDEPEND="${COMMON_DEPEND} |
3857 |
- sys-apps/gentoo-functions |
3858 |
-" |
3859 |
- |
3860 |
-RESTRICT="!test? ( test )" |
3861 |
- |
3862 |
-if [[ ${CATEGORY} == cross-* ]] ; then |
3863 |
- BDEPEND+=" !headers-only? ( |
3864 |
- >=${CATEGORY}/binutils-2.24 |
3865 |
- >=${CATEGORY}/gcc-6 |
3866 |
- )" |
3867 |
- [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" |
3868 |
-else |
3869 |
- BDEPEND+=" |
3870 |
- >=sys-devel/binutils-2.24 |
3871 |
- >=sys-devel/gcc-6 |
3872 |
- " |
3873 |
- DEPEND+=" virtual/os-headers " |
3874 |
- RDEPEND+=" |
3875 |
- >=net-dns/libidn2-2.0.5 |
3876 |
- vanilla? ( !sys-libs/timezone-data ) |
3877 |
- " |
3878 |
- PDEPEND+=" !vanilla? ( sys-libs/timezone-data )" |
3879 |
-fi |
3880 |
- |
3881 |
-# |
3882 |
-# Small helper functions |
3883 |
-# |
3884 |
- |
3885 |
-is_crosscompile() { |
3886 |
- [[ ${CHOST} != ${CTARGET} ]] |
3887 |
-} |
3888 |
- |
3889 |
-just_headers() { |
3890 |
- is_crosscompile && use headers-only |
3891 |
-} |
3892 |
- |
3893 |
-alt_prefix() { |
3894 |
- is_crosscompile && echo /usr/${CTARGET} |
3895 |
-} |
3896 |
- |
3897 |
-# This prefix is applicable to CHOST when building against this |
3898 |
-# glibc. It is baked into the library at configure time. |
3899 |
-host_eprefix() { |
3900 |
- is_crosscompile || echo "${EPREFIX}" |
3901 |
-} |
3902 |
- |
3903 |
-# This prefix is applicable to CBUILD when building against this |
3904 |
-# glibc. It determines the destination path at install time. |
3905 |
-build_eprefix() { |
3906 |
- is_crosscompile && echo "${EPREFIX}" |
3907 |
-} |
3908 |
- |
3909 |
-# We need to be able to set alternative headers for compiling for non-native |
3910 |
-# platform. Will also become useful for testing kernel-headers without screwing |
3911 |
-# up the whole system. |
3912 |
-alt_headers() { |
3913 |
- echo ${ALT_HEADERS:=$(alt_prefix)/usr/include} |
3914 |
-} |
3915 |
- |
3916 |
-alt_build_headers() { |
3917 |
- if [[ -z ${ALT_BUILD_HEADERS} ]] ; then |
3918 |
- ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)" |
3919 |
- if tc-is-cross-compiler ; then |
3920 |
- ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers) |
3921 |
- if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then |
3922 |
- local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h') |
3923 |
- ALT_BUILD_HEADERS=${header_path%/linux/version.h} |
3924 |
- fi |
3925 |
- fi |
3926 |
- fi |
3927 |
- echo "${ALT_BUILD_HEADERS}" |
3928 |
-} |
3929 |
- |
3930 |
-alt_libdir() { |
3931 |
- echo $(alt_prefix)/$(get_libdir) |
3932 |
-} |
3933 |
-alt_usrlibdir() { |
3934 |
- echo $(alt_prefix)/usr/$(get_libdir) |
3935 |
-} |
3936 |
- |
3937 |
-builddir() { |
3938 |
- echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1" |
3939 |
-} |
3940 |
- |
3941 |
-do_compile_test() { |
3942 |
- local ret save_cflags=${CFLAGS} |
3943 |
- CFLAGS+=" $1" |
3944 |
- shift |
3945 |
- |
3946 |
- pushd "${T}" >/dev/null |
3947 |
- |
3948 |
- rm -f glibc-test* |
3949 |
- printf '%b' "$*" > glibc-test.c |
3950 |
- |
3951 |
- nonfatal emake -s glibc-test |
3952 |
- ret=$? |
3953 |
- |
3954 |
- popd >/dev/null |
3955 |
- |
3956 |
- CFLAGS=${save_cflags} |
3957 |
- return ${ret} |
3958 |
-} |
3959 |
- |
3960 |
-do_run_test() { |
3961 |
- local ret |
3962 |
- |
3963 |
- if [[ ${MERGE_TYPE} == "binary" ]] ; then |
3964 |
- # ignore build failures when installing a binary package #324685 |
3965 |
- do_compile_test "" "$@" 2>/dev/null || return 0 |
3966 |
- else |
3967 |
- if ! do_compile_test "" "$@" ; then |
3968 |
- ewarn "Simple build failed ... assuming this is desired #324685" |
3969 |
- return 0 |
3970 |
- fi |
3971 |
- fi |
3972 |
- |
3973 |
- pushd "${T}" >/dev/null |
3974 |
- |
3975 |
- ./glibc-test |
3976 |
- ret=$? |
3977 |
- rm -f glibc-test* |
3978 |
- |
3979 |
- popd >/dev/null |
3980 |
- |
3981 |
- return ${ret} |
3982 |
-} |
3983 |
- |
3984 |
-setup_target_flags() { |
3985 |
- # This largely mucks with compiler flags. None of which should matter |
3986 |
- # when building up just the headers. |
3987 |
- just_headers && return 0 |
3988 |
- |
3989 |
- case $(tc-arch) in |
3990 |
- x86) |
3991 |
- # -march needed for #185404 #199334 |
3992 |
- # TODO: When creating the first glibc cross-compile, this test will |
3993 |
- # always fail as it does a full link which in turn requires glibc. |
3994 |
- # Probably also applies when changing multilib profile settings (e.g. |
3995 |
- # enabling x86 when the profile was amd64-only previously). |
3996 |
- # We could change main to _start and pass -nostdlib here so that we |
3997 |
- # only test the gcc code compilation. Or we could do a compile and |
3998 |
- # then look for the symbol via scanelf. |
3999 |
- if ! do_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then |
4000 |
- local t=${CTARGET_OPT:-${CTARGET}} |
4001 |
- t=${t%%-*} |
4002 |
- filter-flags '-march=*' |
4003 |
- export CFLAGS="-march=${t} ${CFLAGS}" |
4004 |
- einfo "Auto adding -march=${t} to CFLAGS #185404" |
4005 |
- fi |
4006 |
- ;; |
4007 |
- amd64) |
4008 |
- # -march needed for #185404 #199334 |
4009 |
- # Note: This test only matters when the x86 ABI is enabled, so we could |
4010 |
- # optimize a bit and elide it. |
4011 |
- # TODO: See cross-compile issues listed above for x86. |
4012 |
- if ! do_compile_test "${CFLAGS_x86}" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then |
4013 |
- local t=${CTARGET_OPT:-${CTARGET}} |
4014 |
- t=${t%%-*} |
4015 |
- # Normally the target is x86_64-xxx, so turn that into the -march that |
4016 |
- # gcc actually accepts. #528708 |
4017 |
- [[ ${t} == "x86_64" ]] && t="x86-64" |
4018 |
- filter-flags '-march=*' |
4019 |
- # ugly, ugly, ugly. ugly. |
4020 |
- CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") |
4021 |
- export CFLAGS_x86="${CFLAGS_x86} -march=${t}" |
4022 |
- einfo "Auto adding -march=${t} to CFLAGS_x86 #185404" |
4023 |
- fi |
4024 |
- ;; |
4025 |
- mips) |
4026 |
- # The mips abi cannot support the GNU style hashes. #233233 |
4027 |
- filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both |
4028 |
- ;; |
4029 |
- sparc) |
4030 |
- # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though. |
4031 |
- filter-flags "-fcall-used-g7" |
4032 |
- append-flags "-fcall-used-g6" |
4033 |
- |
4034 |
- local cpu |
4035 |
- case ${CTARGET} in |
4036 |
- sparc64-*) |
4037 |
- cpu="sparc64" |
4038 |
- case $(get-flag mcpu) in |
4039 |
- v9) |
4040 |
- # We need to force at least v9a because the base build doesn't |
4041 |
- # work with just v9. |
4042 |
- # https://sourceware.org/bugzilla/show_bug.cgi?id=19477 |
4043 |
- append-flags "-Wa,-xarch=v9a" |
4044 |
- ;; |
4045 |
- esac |
4046 |
- ;; |
4047 |
- sparc-*) |
4048 |
- case $(get-flag mcpu) in |
4049 |
- v8|supersparc|hypersparc|leon|leon3) |
4050 |
- cpu="sparcv8" |
4051 |
- ;; |
4052 |
- *) |
4053 |
- cpu="sparcv9" |
4054 |
- ;; |
4055 |
- esac |
4056 |
- ;; |
4057 |
- esac |
4058 |
- [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}" |
4059 |
- ;; |
4060 |
- esac |
4061 |
-} |
4062 |
- |
4063 |
-setup_flags() { |
4064 |
- # Make sure host make.conf doesn't pollute us |
4065 |
- if is_crosscompile || tc-is-cross-compiler ; then |
4066 |
- CHOST=${CTARGET} strip-unsupported-flags |
4067 |
- fi |
4068 |
- |
4069 |
- # Store our CFLAGS because it's changed depending on which CTARGET |
4070 |
- # we are building when pulling glibc on a multilib profile |
4071 |
- CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}} |
4072 |
- CFLAGS=${CFLAGS_BASE} |
4073 |
- CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}} |
4074 |
- CXXFLAGS=${CXXFLAGS_BASE} |
4075 |
- ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}} |
4076 |
- ASFLAGS=${ASFLAGS_BASE} |
4077 |
- |
4078 |
- # Over-zealous CFLAGS can often cause problems. What may work for one |
4079 |
- # person may not work for another. To avoid a large influx of bugs |
4080 |
- # relating to failed builds, we strip most CFLAGS out to ensure as few |
4081 |
- # problems as possible. |
4082 |
- strip-flags |
4083 |
- strip-unsupported-flags |
4084 |
- filter-flags -m32 -m64 '-mabi=*' |
4085 |
- |
4086 |
- # glibc aborts if rpath is set by LDFLAGS |
4087 |
- filter-ldflags '-Wl,-rpath=*' |
4088 |
- |
4089 |
- # #492892 |
4090 |
- filter-flags -frecord-gcc-switches |
4091 |
- |
4092 |
- unset CBUILD_OPT CTARGET_OPT |
4093 |
- if use multilib ; then |
4094 |
- CTARGET_OPT=$(get_abi_CTARGET) |
4095 |
- [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST) |
4096 |
- fi |
4097 |
- |
4098 |
- setup_target_flags |
4099 |
- |
4100 |
- if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then |
4101 |
- CBUILD_OPT=${CTARGET_OPT} |
4102 |
- fi |
4103 |
- |
4104 |
- # Lock glibc at -O2; we want to be conservative here. |
4105 |
- # -fno-strict-aliasing is to work around #155906. |
4106 |
- filter-flags '-O?' |
4107 |
- append-flags -O2 -fno-strict-aliasing |
4108 |
- |
4109 |
- filter-flags '-fstack-protector*' |
4110 |
-} |
4111 |
- |
4112 |
-want_tls() { |
4113 |
- # Archs that can use TLS (Thread Local Storage) |
4114 |
- case $(tc-arch) in |
4115 |
- x86) |
4116 |
- # requires i486 or better #106556 |
4117 |
- [[ ${CTARGET} == i[4567]86* ]] && return 0 |
4118 |
- return 1 |
4119 |
- ;; |
4120 |
- esac |
4121 |
- return 0 |
4122 |
-} |
4123 |
- |
4124 |
-want__thread() { |
4125 |
- want_tls || return 1 |
4126 |
- |
4127 |
- # For some reason --with-tls --with__thread is causing segfaults on sparc32. |
4128 |
- [[ ${PROFILE_ARCH} == "sparc" ]] && return 1 |
4129 |
- |
4130 |
- [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD} |
4131 |
- |
4132 |
- # only test gcc -- can't test linking yet |
4133 |
- tc-has-tls -c ${CTARGET} |
4134 |
- WANT__THREAD=$? |
4135 |
- |
4136 |
- return ${WANT__THREAD} |
4137 |
-} |
4138 |
- |
4139 |
-use_multiarch() { |
4140 |
- # Allow user to disable runtime arch detection in multilib. |
4141 |
- use multiarch || return 1 |
4142 |
- # Make sure binutils is new enough to support indirect functions, |
4143 |
- # #336792. This funky sed supports gold and bfd linkers. |
4144 |
- local bver nver |
4145 |
- bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}') |
4146 |
- case $(tc-arch ${CTARGET}) in |
4147 |
- amd64|x86) nver="2.20" ;; |
4148 |
- arm) nver="2.22" ;; |
4149 |
- hppa) nver="2.23" ;; |
4150 |
- ppc|ppc64) nver="2.20" ;; |
4151 |
- # ifunc support was added in 2.23, but glibc also needs |
4152 |
- # machinemode which is in 2.24. |
4153 |
- s390) nver="2.24" ;; |
4154 |
- sparc) nver="2.21" ;; |
4155 |
- *) return 1 ;; |
4156 |
- esac |
4157 |
- ver_test ${bver} -ge ${nver} |
4158 |
-} |
4159 |
- |
4160 |
-# Setup toolchain variables that had historically been defined in the |
4161 |
-# profiles for these archs. |
4162 |
-setup_env() { |
4163 |
- # silly users |
4164 |
- unset LD_RUN_PATH |
4165 |
- unset LD_ASSUME_KERNEL |
4166 |
- |
4167 |
- if is_crosscompile || tc-is-cross-compiler ; then |
4168 |
- multilib_env ${CTARGET_OPT:-${CTARGET}} |
4169 |
- |
4170 |
- if ! use multilib ; then |
4171 |
- MULTILIB_ABIS=${DEFAULT_ABI} |
4172 |
- else |
4173 |
- MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}} |
4174 |
- fi |
4175 |
- |
4176 |
- # If the user has CFLAGS_<CTARGET> in their make.conf, use that, |
4177 |
- # and fall back on CFLAGS. |
4178 |
- local VAR=CFLAGS_${CTARGET//[-.]/_} |
4179 |
- CFLAGS=${!VAR-${CFLAGS}} |
4180 |
- einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}" |
4181 |
- fi |
4182 |
- |
4183 |
- setup_flags |
4184 |
- |
4185 |
- export ABI=${ABI:-${DEFAULT_ABI:-default}} |
4186 |
- |
4187 |
- if just_headers ; then |
4188 |
- # Avoid mixing host's CC and target's CFLAGS_${ABI}: |
4189 |
- # At this bootstrap stage we have only binutils for |
4190 |
- # target but not compiler yet. |
4191 |
- einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." |
4192 |
- return 0 |
4193 |
- fi |
4194 |
- local VAR=CFLAGS_${ABI} |
4195 |
- # We need to export CFLAGS with abi information in them because glibc's |
4196 |
- # configure script checks CFLAGS for some targets (like mips). Keep |
4197 |
- # around the original clean value to avoid appending multiple ABIs on |
4198 |
- # top of each other. |
4199 |
- : ${__GLIBC_CC:=$(tc-getCC ${CTARGET})} |
4200 |
- export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" |
4201 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
4202 |
-} |
4203 |
- |
4204 |
-foreach_abi() { |
4205 |
- setup_env |
4206 |
- |
4207 |
- local ret=0 |
4208 |
- local abilist="" |
4209 |
- if use multilib ; then |
4210 |
- abilist=$(get_install_abis) |
4211 |
- else |
4212 |
- abilist=${DEFAULT_ABI} |
4213 |
- fi |
4214 |
- local -x ABI |
4215 |
- for ABI in ${abilist:-default} ; do |
4216 |
- setup_env |
4217 |
- einfo "Running $1 for ABI ${ABI}" |
4218 |
- $1 |
4219 |
- : $(( ret |= $? )) |
4220 |
- done |
4221 |
- return ${ret} |
4222 |
-} |
4223 |
- |
4224 |
-glibc_banner() { |
4225 |
- local b="Gentoo ${PVR}" |
4226 |
- [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}" |
4227 |
- echo "${b}" |
4228 |
-} |
4229 |
- |
4230 |
-check_devpts() { |
4231 |
- # Make sure devpts is mounted correctly for use w/out setuid pt_chown. |
4232 |
- |
4233 |
- # If merely building the binary package, then there's nothing to verify. |
4234 |
- [[ ${MERGE_TYPE} == "buildonly" ]] && return |
4235 |
- |
4236 |
- # Only sanity check when installing the native glibc. |
4237 |
- [[ -n ${ROOT} ]] && return |
4238 |
- |
4239 |
- # If they're opting in to the old suid code, then no need to check. |
4240 |
- use suid && return |
4241 |
- |
4242 |
- if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then |
4243 |
- eerror "In order to use glibc with USE=-suid, you must make sure that" |
4244 |
- eerror "you have devpts mounted at /dev/pts with the gid=5 option." |
4245 |
- eerror "Openrc should do this for you, so you should check /etc/fstab" |
4246 |
- eerror "and make sure you do not have any invalid settings there." |
4247 |
- die "mount & fix your /dev/pts settings" |
4248 |
- fi |
4249 |
-} |
4250 |
- |
4251 |
-# The following Kernel version handling functions are mostly copied from portage |
4252 |
-# source. It's better not to use linux-info.eclass here since a) it adds too |
4253 |
-# much magic, see bug 326693 for some of the arguments, and b) some of the |
4254 |
-# functions are just not provided. |
4255 |
- |
4256 |
-g_get_running_KV() { |
4257 |
- uname -r |
4258 |
- return $? |
4259 |
-} |
4260 |
- |
4261 |
-g_KV_major() { |
4262 |
- [[ -z $1 ]] && return 1 |
4263 |
- local KV=$@ |
4264 |
- echo "${KV%%.*}" |
4265 |
-} |
4266 |
- |
4267 |
-g_KV_minor() { |
4268 |
- [[ -z $1 ]] && return 1 |
4269 |
- local KV=$@ |
4270 |
- KV=${KV#*.} |
4271 |
- echo "${KV%%.*}" |
4272 |
-} |
4273 |
- |
4274 |
-g_KV_micro() { |
4275 |
- [[ -z $1 ]] && return 1 |
4276 |
- local KV=$@ |
4277 |
- KV=${KV#*.*.} |
4278 |
- echo "${KV%%[^[:digit:]]*}" |
4279 |
-} |
4280 |
- |
4281 |
-g_KV_to_int() { |
4282 |
- [[ -z $1 ]] && return 1 |
4283 |
- local KV_MAJOR=$(g_KV_major "$1") |
4284 |
- local KV_MINOR=$(g_KV_minor "$1") |
4285 |
- local KV_MICRO=$(g_KV_micro "$1") |
4286 |
- local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) |
4287 |
- |
4288 |
- # We make version 2.2.0 the minimum version we will handle as |
4289 |
- # a sanity check ... if its less, we fail ... |
4290 |
- if [[ ${KV_int} -ge 131584 ]] ; then |
4291 |
- echo "${KV_int}" |
4292 |
- return 0 |
4293 |
- fi |
4294 |
- return 1 |
4295 |
-} |
4296 |
- |
4297 |
-g_int_to_KV() { |
4298 |
- local version=$1 major minor micro |
4299 |
- major=$((version / 65536)) |
4300 |
- minor=$(((version % 65536) / 256)) |
4301 |
- micro=$((version % 256)) |
4302 |
- echo ${major}.${minor}.${micro} |
4303 |
-} |
4304 |
- |
4305 |
-eend_KV() { |
4306 |
- [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]] |
4307 |
- eend $? |
4308 |
-} |
4309 |
- |
4310 |
-get_kheader_version() { |
4311 |
- printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \ |
4312 |
- $(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \ |
4313 |
- tail -n 1 |
4314 |
-} |
4315 |
- |
4316 |
-# We collect all sanity checks here. Consistency is not guranteed between |
4317 |
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in |
4318 |
-# src_unpack. |
4319 |
-sanity_prechecks() { |
4320 |
- # Make sure devpts is mounted correctly for use w/out setuid pt_chown |
4321 |
- check_devpts |
4322 |
- |
4323 |
- # Prevent native builds from downgrading |
4324 |
- if [[ ${MERGE_TYPE} != "buildonly" ]] && \ |
4325 |
- [[ -z ${ROOT} ]] && \ |
4326 |
- [[ ${CBUILD} == ${CHOST} ]] && \ |
4327 |
- [[ ${CHOST} == ${CTARGET} ]] ; then |
4328 |
- |
4329 |
- # The high rev # is to allow people to downgrade between -r# |
4330 |
- # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2 |
4331 |
- # should be fine. Hopefully we never actually use a r# this |
4332 |
- # high. |
4333 |
- if has_version ">${CATEGORY}/${P}-r10000" ; then |
4334 |
- eerror "Sanity check to keep you from breaking your system:" |
4335 |
- eerror " Downgrading glibc is not supported and a sure way to destruction." |
4336 |
- [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system." |
4337 |
- fi |
4338 |
- |
4339 |
- if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then |
4340 |
- eerror "Your old kernel is broken. You need to update it to a newer" |
4341 |
- eerror "version as syscall(<bignum>) will break. See bug 279260." |
4342 |
- die "Old and broken kernel." |
4343 |
- fi |
4344 |
- fi |
4345 |
- |
4346 |
- # Users have had a chance to phase themselves, time to give em the boot |
4347 |
- if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then |
4348 |
- eerror "You still haven't deleted ${EROOT}/etc/locales.build." |
4349 |
- eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher." |
4350 |
- die "Lazy upgrader detected" |
4351 |
- fi |
4352 |
- |
4353 |
- if [[ ${CTARGET} == i386-* ]] ; then |
4354 |
- eerror "i386 CHOSTs are no longer supported." |
4355 |
- eerror "Chances are you don't actually want/need i386." |
4356 |
- eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml" |
4357 |
- die "Please fix your CHOST" |
4358 |
- fi |
4359 |
- |
4360 |
- if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then |
4361 |
- ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS." |
4362 |
- ewarn "This will result in a 50% performance penalty when running with a 32bit" |
4363 |
- ewarn "hypervisor, which is probably not what you want." |
4364 |
- fi |
4365 |
- |
4366 |
- # Check for sanity of /etc/nsswitch.conf |
4367 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then |
4368 |
- local entry |
4369 |
- for entry in passwd group shadow; do |
4370 |
- if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then |
4371 |
- eerror "Your ${EROOT}/etc/nsswitch.conf is out of date." |
4372 |
- eerror "Please make sure you have 'files' entries for" |
4373 |
- eerror "'passwd:', 'group:' and 'shadow:' databases." |
4374 |
- eerror "For more details see:" |
4375 |
- eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26" |
4376 |
- die "nsswitch.conf has no 'files' provider in '${entry}'." |
4377 |
- fi |
4378 |
- done |
4379 |
- fi |
4380 |
- |
4381 |
- # ABI-specific checks follow here. Hey, we have a lot more specific conditions that |
4382 |
- # we test for... |
4383 |
- if ! is_crosscompile ; then |
4384 |
- if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then |
4385 |
- ebegin "Checking that IA32 emulation is enabled in the running kernel" |
4386 |
- echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c" |
4387 |
- local STAT |
4388 |
- if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then |
4389 |
- "${T}/check-ia32-emulation.elf32" |
4390 |
- STAT=$? |
4391 |
- else |
4392 |
- # Don't fail here to allow single->multi ABI switch |
4393 |
- # or recover from breakage like bug #646424 |
4394 |
- ewarn "Failed to compile the ABI test. Broken host glibc?" |
4395 |
- STAT=0 |
4396 |
- fi |
4397 |
- rm -f "${T}/check-ia32-emulation.elf32" |
4398 |
- eend $STAT |
4399 |
- [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc." |
4400 |
- fi |
4401 |
- |
4402 |
- fi |
4403 |
- |
4404 |
- # When we actually have to compile something... |
4405 |
- if ! just_headers ; then |
4406 |
- ebegin "Checking gcc for __thread support" |
4407 |
- if ! eend $(want__thread ; echo $?) ; then |
4408 |
- echo |
4409 |
- eerror "Could not find a gcc that supports the __thread directive!" |
4410 |
- eerror "Please update your binutils/gcc and try again." |
4411 |
- die "No __thread support in gcc!" |
4412 |
- fi |
4413 |
- |
4414 |
- if [[ ${CTARGET} == *-linux* ]] ; then |
4415 |
- local run_kv build_kv want_kv |
4416 |
- |
4417 |
- run_kv=$(g_get_running_KV) |
4418 |
- build_kv=$(g_int_to_KV $(get_kheader_version)) |
4419 |
- want_kv=${MIN_KERN_VER} |
4420 |
- |
4421 |
- if ! is_crosscompile && ! tc-is-cross-compiler ; then |
4422 |
- # Building fails on an non-supporting kernel |
4423 |
- ebegin "Checking running kernel version (${run_kv} >= ${want_kv})" |
4424 |
- if ! eend_KV ${run_kv} ${want_kv} ; then |
4425 |
- echo |
4426 |
- eerror "You need a kernel of at least ${want_kv}!" |
4427 |
- die "Kernel version too low!" |
4428 |
- fi |
4429 |
- fi |
4430 |
- |
4431 |
- ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" |
4432 |
- if ! eend_KV ${build_kv} ${want_kv} ; then |
4433 |
- echo |
4434 |
- eerror "You need linux-headers of at least ${want_kv}!" |
4435 |
- die "linux-headers version too low!" |
4436 |
- fi |
4437 |
- fi |
4438 |
- fi |
4439 |
-} |
4440 |
- |
4441 |
-# |
4442 |
-# the phases |
4443 |
-# |
4444 |
- |
4445 |
-# pkg_pretend |
4446 |
- |
4447 |
-pkg_pretend() { |
4448 |
- # All the checks... |
4449 |
- einfo "Checking general environment sanity." |
4450 |
- sanity_prechecks |
4451 |
-} |
4452 |
- |
4453 |
-pkg_setup() { |
4454 |
- # see bug 682570 |
4455 |
- [[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup |
4456 |
-} |
4457 |
- |
4458 |
-# src_unpack |
4459 |
- |
4460 |
-src_unpack() { |
4461 |
- # Consistency is not guaranteed between pkg_ and src_ ... |
4462 |
- sanity_prechecks |
4463 |
- |
4464 |
- use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
4465 |
- |
4466 |
- setup_env |
4467 |
- |
4468 |
- if [[ -n ${EGIT_REPO_URI} ]] ; then |
4469 |
- git-r3_src_unpack |
4470 |
- else |
4471 |
- unpack ${P}.tar.xz |
4472 |
- fi |
4473 |
- |
4474 |
- cd "${WORKDIR}" || die |
4475 |
- unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz |
4476 |
-} |
4477 |
- |
4478 |
-src_prepare() { |
4479 |
- if ! use vanilla ; then |
4480 |
- elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}" |
4481 |
- eapply "${WORKDIR}"/patches |
4482 |
- einfo "Done." |
4483 |
- fi |
4484 |
- |
4485 |
- default |
4486 |
- |
4487 |
- gnuconfig_update |
4488 |
- |
4489 |
- cd "${WORKDIR}" |
4490 |
- find . -name configure -exec touch {} + |
4491 |
- |
4492 |
- eprefixify extra/locale/locale-gen |
4493 |
- |
4494 |
- # Fix permissions on some of the scripts. |
4495 |
- chmod u+x "${S}"/scripts/*.sh |
4496 |
- |
4497 |
- cd "${S}" |
4498 |
-} |
4499 |
- |
4500 |
-glibc_do_configure() { |
4501 |
- # Glibc does not work with gold (for various reasons) #269274. |
4502 |
- tc-ld-disable-gold |
4503 |
- |
4504 |
- # CXX isnt handled by the multilib system, so if we dont unset here |
4505 |
- # we accumulate crap across abis |
4506 |
- unset CXX |
4507 |
- |
4508 |
- einfo "Configuring glibc for nptl" |
4509 |
- |
4510 |
- if use doc ; then |
4511 |
- export MAKEINFO=makeinfo |
4512 |
- else |
4513 |
- export MAKEINFO=/dev/null |
4514 |
- fi |
4515 |
- |
4516 |
- local v |
4517 |
- for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do |
4518 |
- einfo " $(printf '%15s' ${v}:) ${!v}" |
4519 |
- done |
4520 |
- |
4521 |
- # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 |
4522 |
- # To build .S (assembly) files with the same ABI-specific flags |
4523 |
- # upstream currently recommends adding CFLAGS to CC/CXX: |
4524 |
- # https://sourceware.org/PR23273 |
4525 |
- # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS |
4526 |
- # and breaks multiarch support. See 659030#c3 for an example. |
4527 |
- # The glibc configure script doesn't properly use LDFLAGS all the time. |
4528 |
- export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}" |
4529 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
4530 |
- |
4531 |
- # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 |
4532 |
- export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}" |
4533 |
- |
4534 |
- if is_crosscompile; then |
4535 |
- # Assume worst-case bootstrap: glibc is buil first time |
4536 |
- # when ${CTARGET}-g++ is not available yet. We avoid |
4537 |
- # building auxiliary programs that require C++: bug #683074 |
4538 |
- # It should not affect final result. |
4539 |
- export libc_cv_cxx_link_ok=no |
4540 |
- # The line above has the same effect. We set CXX explicitly |
4541 |
- # to make build logs less confusing. |
4542 |
- export CXX= |
4543 |
- fi |
4544 |
- einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" |
4545 |
- |
4546 |
- echo |
4547 |
- |
4548 |
- local myconf=() |
4549 |
- |
4550 |
- case ${CTARGET} in |
4551 |
- m68k*) |
4552 |
- # setjmp() is not compatible with stack protection: |
4553 |
- # https://sourceware.org/PR24202 |
4554 |
- myconf+=( --enable-stack-protector=no ) |
4555 |
- ;; |
4556 |
- powerpc-*) |
4557 |
- # Currently gcc on powerpc32 generates invalid code for |
4558 |
- # __builtin_return_address(0) calls. Normally programs |
4559 |
- # don't do that but malloc hooks in glibc do: |
4560 |
- # https://gcc.gnu.org/PR81996 |
4561 |
- # https://bugs.gentoo.org/629054 |
4562 |
- myconf+=( --enable-stack-protector=no ) |
4563 |
- ;; |
4564 |
- *) |
4565 |
- # Use '=strong' instead of '=all' to protect only functions |
4566 |
- # worth protecting from stack smashes. |
4567 |
- # '=all' is also known to have a problem in IFUNC resolution |
4568 |
- # tests: https://sourceware.org/PR25680, bug #712356. |
4569 |
- myconf+=( --enable-stack-protector=$(usex ssp strong no) ) |
4570 |
- ;; |
4571 |
- esac |
4572 |
- myconf+=( --enable-stackguard-randomization ) |
4573 |
- |
4574 |
- # Keep a whitelist of targets supporing IFUNC. glibc's ./configure |
4575 |
- # is not robust enough to detect proper support: |
4576 |
- # https://bugs.gentoo.org/641216 |
4577 |
- # https://sourceware.org/PR22634#c0 |
4578 |
- case $(tc-arch ${CTARGET}) in |
4579 |
- # Keep whitelist of targets where autodetection mostly works. |
4580 |
- amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;; |
4581 |
- # Blacklist everywhere else |
4582 |
- *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;; |
4583 |
- esac |
4584 |
- |
4585 |
- # Enable Intel Control-flow Enforcement Technology on amd64 if requested |
4586 |
- case ${CTARGET} in |
4587 |
- x86_64-*) myconf+=( $(use_enable cet) ) ;; |
4588 |
- *) ;; |
4589 |
- esac |
4590 |
- |
4591 |
- [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) |
4592 |
- |
4593 |
- myconf+=( --enable-kernel=${MIN_KERN_VER} ) |
4594 |
- |
4595 |
- # Since SELinux support is only required for nscd, only enable it if: |
4596 |
- # 1. USE selinux |
4597 |
- # 2. only for the primary ABI on multilib systems |
4598 |
- # 3. Not a crosscompile |
4599 |
- if ! is_crosscompile && use selinux ; then |
4600 |
- if use multilib ; then |
4601 |
- if is_final_abi ; then |
4602 |
- myconf+=( --with-selinux ) |
4603 |
- else |
4604 |
- myconf+=( --without-selinux ) |
4605 |
- fi |
4606 |
- else |
4607 |
- myconf+=( --with-selinux ) |
4608 |
- fi |
4609 |
- else |
4610 |
- myconf+=( --without-selinux ) |
4611 |
- fi |
4612 |
- |
4613 |
- # Force a few tests where we always know the answer but |
4614 |
- # configure is incapable of finding it. |
4615 |
- if is_crosscompile ; then |
4616 |
- export \ |
4617 |
- libc_cv_c_cleanup=yes \ |
4618 |
- libc_cv_forced_unwind=yes |
4619 |
- fi |
4620 |
- |
4621 |
- myconf+=( |
4622 |
- --without-cvs |
4623 |
- --disable-werror |
4624 |
- --enable-bind-now |
4625 |
- --build=${CBUILD_OPT:-${CBUILD}} |
4626 |
- --host=${CTARGET_OPT:-${CTARGET}} |
4627 |
- $(use_enable profile) |
4628 |
- $(use_with gd) |
4629 |
- --with-headers=$(alt_build_headers) |
4630 |
- --prefix="$(host_eprefix)/usr" |
4631 |
- --sysconfdir="$(host_eprefix)/etc" |
4632 |
- --localstatedir="$(host_eprefix)/var" |
4633 |
- --libdir='$(prefix)'/$(get_libdir) |
4634 |
- --mandir='$(prefix)'/share/man |
4635 |
- --infodir='$(prefix)'/share/info |
4636 |
- --libexecdir='$(libdir)'/misc/glibc |
4637 |
- --with-bugurl=https://bugs.gentoo.org/ |
4638 |
- --with-pkgversion="$(glibc_banner)" |
4639 |
- $(use_multiarch || echo --disable-multi-arch) |
4640 |
- $(use_enable systemtap) |
4641 |
- $(use_enable nscd) |
4642 |
- ${EXTRA_ECONF} |
4643 |
- ) |
4644 |
- |
4645 |
- # We rely on sys-libs/timezone-data for timezone tools normally. |
4646 |
- myconf+=( $(use_enable vanilla timezone-tools) ) |
4647 |
- |
4648 |
- # These libs don't have configure flags. |
4649 |
- ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no) |
4650 |
- ac_cv_lib_cap_cap_init=$(usex caps || echo no) |
4651 |
- |
4652 |
- # There is no configure option for this and we need to export it |
4653 |
- # since the glibc build will re-run configure on itself |
4654 |
- export libc_cv_rootsbindir="$(host_eprefix)/sbin" |
4655 |
- export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)" |
4656 |
- |
4657 |
- # We take care of patching our binutils to use both hash styles, |
4658 |
- # and many people like to force gnu hash style only, so disable |
4659 |
- # this overriding check. #347761 |
4660 |
- export libc_cv_hashstyle=no |
4661 |
- |
4662 |
- local builddir=$(builddir nptl) |
4663 |
- mkdir -p "${builddir}" |
4664 |
- cd "${builddir}" |
4665 |
- set -- "${S}"/configure "${myconf[@]}" |
4666 |
- echo "$@" |
4667 |
- "$@" || die "failed to configure glibc" |
4668 |
- |
4669 |
- # ia64 static cross-compilers are a pita in so much that they |
4670 |
- # can't produce static ELFs (as the libgcc.a is broken). so |
4671 |
- # disable building of the programs for those targets if it |
4672 |
- # doesn't work. |
4673 |
- # XXX: We could turn this into a compiler test, but ia64 is |
4674 |
- # the only one that matters, so this should be fine for now. |
4675 |
- if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then |
4676 |
- sed -i '1i+link-static = touch $@' config.make |
4677 |
- fi |
4678 |
- |
4679 |
- # If we're trying to migrate between ABI sets, we need |
4680 |
- # to lie and use a local copy of gcc. Like if the system |
4681 |
- # is built with MULTILIB_ABIS="amd64 x86" but we want to |
4682 |
- # add x32 to it, gcc/glibc don't yet support x32. |
4683 |
- # |
4684 |
- if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
4685 |
- echo 'main(){}' > "${T}"/test.c |
4686 |
- if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
4687 |
- sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
4688 |
- fi |
4689 |
- fi |
4690 |
-} |
4691 |
- |
4692 |
-glibc_headers_configure() { |
4693 |
- export ABI=default |
4694 |
- |
4695 |
- local builddir=$(builddir "headers") |
4696 |
- mkdir -p "${builddir}" |
4697 |
- cd "${builddir}" |
4698 |
- |
4699 |
- # if we don't have a compiler yet, we can't really test it now ... |
4700 |
- # hopefully they don't affect header generation, so let's hope for |
4701 |
- # the best here ... |
4702 |
- local v vars=( |
4703 |
- ac_cv_header_cpuid_h=yes |
4704 |
- libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes |
4705 |
- libc_cv_asm_cfi_directives=yes |
4706 |
- libc_cv_broken_visibility_attribute=no |
4707 |
- libc_cv_c_cleanup=yes |
4708 |
- libc_cv_compiler_powerpc64le_binary128_ok=yes |
4709 |
- libc_cv_forced_unwind=yes |
4710 |
- libc_cv_gcc___thread=yes |
4711 |
- libc_cv_mlong_double_128=yes |
4712 |
- libc_cv_mlong_double_128ibm=yes |
4713 |
- libc_cv_ppc_machine=yes |
4714 |
- libc_cv_ppc_rel16=yes |
4715 |
- libc_cv_predef_fortify_source=no |
4716 |
- libc_cv_target_power8_ok=yes |
4717 |
- libc_cv_visibility_attribute=yes |
4718 |
- libc_cv_z_combreloc=yes |
4719 |
- libc_cv_z_execstack=yes |
4720 |
- libc_cv_z_initfirst=yes |
4721 |
- libc_cv_z_nodelete=yes |
4722 |
- libc_cv_z_nodlopen=yes |
4723 |
- libc_cv_z_relro=yes |
4724 |
- libc_mips_abi=${ABI} |
4725 |
- libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard) |
4726 |
- # These libs don't have configure flags. |
4727 |
- ac_cv_lib_audit_audit_log_user_avc_message=no |
4728 |
- ac_cv_lib_cap_cap_init=no |
4729 |
- ) |
4730 |
- |
4731 |
- einfo "Forcing cached settings:" |
4732 |
- for v in "${vars[@]}" ; do |
4733 |
- einfo " ${v}" |
4734 |
- export ${v} |
4735 |
- done |
4736 |
- |
4737 |
- local headers_only_arch_CPPFLAGS=() |
4738 |
- |
4739 |
- # Blow away some random CC settings that screw things up. #550192 |
4740 |
- if [[ -d ${S}/sysdeps/mips ]]; then |
4741 |
- pushd "${S}"/sysdeps/mips >/dev/null |
4742 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die |
4743 |
- sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die |
4744 |
- |
4745 |
- # Force the mips ABI to the default. This is OK because the set of |
4746 |
- # installed headers in this phase is the same between the 3 ABIs. |
4747 |
- # If this ever changes, this hack will break, but that's unlikely |
4748 |
- # as glibc discourages that behavior. |
4749 |
- # https://crbug.com/647033 |
4750 |
- sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die |
4751 |
- |
4752 |
- popd >/dev/null |
4753 |
- fi |
4754 |
- |
4755 |
- case ${CTARGET} in |
4756 |
- riscv*) |
4757 |
- # RISC-V interrogates the compiler to determine which target to |
4758 |
- # build. If building the headers then we don't strictly need a |
4759 |
- # RISC-V compiler, so the built-in definitions that are provided |
4760 |
- # along with all RISC-V compiler might not exist. This causes |
4761 |
- # glibc's RISC-V preconfigure script to blow up. Since we're just |
4762 |
- # building the headers any value will actually work here, so just |
4763 |
- # pick the standard one (rv64g/lp64d) to make the build scripts |
4764 |
- # happy for now -- the headers are all the same anyway so it |
4765 |
- # doesn't matter. |
4766 |
- headers_only_arch_CPPFLAGS+=( |
4767 |
- -D__riscv_xlen=64 |
4768 |
- -D__riscv_flen=64 |
4769 |
- -D__riscv_float_abi_double=1 |
4770 |
- -D__riscv_atomic=1 |
4771 |
- ) ;; |
4772 |
- esac |
4773 |
- |
4774 |
- local myconf=() |
4775 |
- myconf+=( |
4776 |
- --disable-sanity-checks |
4777 |
- --enable-hacker-mode |
4778 |
- --without-cvs |
4779 |
- --disable-werror |
4780 |
- --enable-bind-now |
4781 |
- --build=${CBUILD_OPT:-${CBUILD}} |
4782 |
- --host=${CTARGET_OPT:-${CTARGET}} |
4783 |
- --with-headers=$(alt_build_headers) |
4784 |
- --prefix="$(host_eprefix)/usr" |
4785 |
- ${EXTRA_ECONF} |
4786 |
- ) |
4787 |
- |
4788 |
- # Nothing is compiled here which would affect the headers for the target. |
4789 |
- # So forcing CC/CFLAGS is sane. |
4790 |
- local headers_only_CC=$(tc-getBUILD_CC) |
4791 |
- local headers_only_CFLAGS="-O1 -pipe" |
4792 |
- local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}" |
4793 |
- local headers_only_LDFLAGS="" |
4794 |
- set -- "${S}"/configure "${myconf[@]}" |
4795 |
- echo \ |
4796 |
- "CC=${headers_only_CC}" \ |
4797 |
- "CFLAGS=${headers_only_CFLAGS}" \ |
4798 |
- "CPPFLAGS=${headers_only_CPPFLAGS}" \ |
4799 |
- "LDFLAGS=${headers_only_LDFLAGS}" \ |
4800 |
- "$@" |
4801 |
- CC=${headers_only_CC} \ |
4802 |
- CFLAGS=${headers_only_CFLAGS} \ |
4803 |
- CPPFLAGS=${headers_only_CPPFLAGS} \ |
4804 |
- LDFLAGS="" \ |
4805 |
- "$@" || die "failed to configure glibc" |
4806 |
-} |
4807 |
- |
4808 |
-do_src_configure() { |
4809 |
- if just_headers ; then |
4810 |
- glibc_headers_configure |
4811 |
- else |
4812 |
- glibc_do_configure nptl |
4813 |
- fi |
4814 |
-} |
4815 |
- |
4816 |
-src_configure() { |
4817 |
- foreach_abi do_src_configure |
4818 |
-} |
4819 |
- |
4820 |
-do_src_compile() { |
4821 |
- emake -C "$(builddir nptl)" |
4822 |
-} |
4823 |
- |
4824 |
-src_compile() { |
4825 |
- if just_headers ; then |
4826 |
- return |
4827 |
- fi |
4828 |
- |
4829 |
- foreach_abi do_src_compile |
4830 |
-} |
4831 |
- |
4832 |
-glibc_src_test() { |
4833 |
- cd "$(builddir nptl)" |
4834 |
- emake check |
4835 |
-} |
4836 |
- |
4837 |
-do_src_test() { |
4838 |
- local ret=0 |
4839 |
- |
4840 |
- glibc_src_test |
4841 |
- : $(( ret |= $? )) |
4842 |
- |
4843 |
- return ${ret} |
4844 |
-} |
4845 |
- |
4846 |
-src_test() { |
4847 |
- if just_headers ; then |
4848 |
- return |
4849 |
- fi |
4850 |
- |
4851 |
- # Give tests more time to complete. |
4852 |
- export TIMEOUTFACTOR=5 |
4853 |
- |
4854 |
- foreach_abi do_src_test || die "tests failed" |
4855 |
-} |
4856 |
- |
4857 |
-run_locale_gen() { |
4858 |
- # if the host locales.gen contains no entries, we'll install everything |
4859 |
- local root="$1" |
4860 |
- local inplace="" |
4861 |
- |
4862 |
- if [[ "${root}" == "--inplace-glibc" ]] ; then |
4863 |
- inplace="--inplace-glibc" |
4864 |
- root="$2" |
4865 |
- fi |
4866 |
- |
4867 |
- local locale_list="${root}/etc/locale.gen" |
4868 |
- |
4869 |
- pushd "${ED}"/$(get_libdir) >/dev/null |
4870 |
- |
4871 |
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then |
4872 |
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space" |
4873 |
- locale_list="${root}/usr/share/i18n/SUPPORTED" |
4874 |
- fi |
4875 |
- |
4876 |
- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \ |
4877 |
- --destdir "${root}" |
4878 |
- |
4879 |
- popd >/dev/null |
4880 |
-} |
4881 |
- |
4882 |
-glibc_do_src_install() { |
4883 |
- local builddir=$(builddir nptl) |
4884 |
- cd "${builddir}" |
4885 |
- |
4886 |
- emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install |
4887 |
- |
4888 |
- # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support |
4889 |
- # which come without headers etc. Only needed for binary packages since the |
4890 |
- # external net-libs/libnsl has increased soversion. Keep only versioned libraries. |
4891 |
- find "${D}" -name "libnsl.a" -delete |
4892 |
- find "${D}" -name "libnsl.so" -delete |
4893 |
- |
4894 |
- # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need |
4895 |
- # to infer upstream version: |
4896 |
- # '#define VERSION "2.26.90"' -> '2.26.90' |
4897 |
- local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) |
4898 |
- |
4899 |
- # Avoid stripping binaries not targeted by ${CHOST}. Or else |
4900 |
- # ${CHOST}-strip would break binaries build for ${CTARGET}. |
4901 |
- is_crosscompile && dostrip -x / |
4902 |
- # gdb thread introspection relies on local libpthreas symbols. stripping breaks it |
4903 |
- # See Note [Disable automatic stripping] |
4904 |
- dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so |
4905 |
- |
4906 |
- if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then |
4907 |
- # Move versioned .a file out of libdir to evade portage QA checks |
4908 |
- # instead of using gen_usr_ldscript(). We fix ldscript as: |
4909 |
- # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..." |
4910 |
- sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die |
4911 |
- dodir $(alt_usrlibdir)/${P} |
4912 |
- mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die |
4913 |
- fi |
4914 |
- |
4915 |
- # We'll take care of the cache ourselves |
4916 |
- rm -f "${ED}"/etc/ld.so.cache |
4917 |
- |
4918 |
- # Everything past this point just needs to be done once ... |
4919 |
- is_final_abi || return 0 |
4920 |
- |
4921 |
- # Make sure the non-native interp can be found on multilib systems even |
4922 |
- # if the main library set isn't installed into the right place. Maybe |
4923 |
- # we should query the active gcc for info instead of hardcoding it ? |
4924 |
- local i ldso_abi ldso_name |
4925 |
- local ldso_abi_list=( |
4926 |
- # x86 |
4927 |
- amd64 /lib64/ld-linux-x86-64.so.2 |
4928 |
- x32 /libx32/ld-linux-x32.so.2 |
4929 |
- x86 /lib/ld-linux.so.2 |
4930 |
- # mips |
4931 |
- o32 /lib/ld.so.1 |
4932 |
- n32 /lib32/ld.so.1 |
4933 |
- n64 /lib64/ld.so.1 |
4934 |
- # powerpc |
4935 |
- ppc /lib/ld.so.1 |
4936 |
- ppc64 /lib64/ld64.so.1 |
4937 |
- # riscv |
4938 |
- lp64d /lib/ld-linux-riscv64-lp64d.so.1 |
4939 |
- lp64 /lib/ld-linux-riscv64-lp64.so.1 |
4940 |
- # s390 |
4941 |
- s390 /lib/ld.so.1 |
4942 |
- s390x /lib/ld64.so.1 |
4943 |
- # sparc |
4944 |
- sparc32 /lib/ld-linux.so.2 |
4945 |
- sparc64 /lib64/ld-linux.so.2 |
4946 |
- ) |
4947 |
- case $(tc-endian) in |
4948 |
- little) |
4949 |
- ldso_abi_list+=( |
4950 |
- # arm |
4951 |
- arm64 /lib/ld-linux-aarch64.so.1 |
4952 |
- ) |
4953 |
- ;; |
4954 |
- big) |
4955 |
- ldso_abi_list+=( |
4956 |
- # arm |
4957 |
- arm64 /lib/ld-linux-aarch64_be.so.1 |
4958 |
- ) |
4959 |
- ;; |
4960 |
- esac |
4961 |
- if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then |
4962 |
- dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib |
4963 |
- fi |
4964 |
- for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do |
4965 |
- ldso_abi=${ldso_abi_list[i]} |
4966 |
- has ${ldso_abi} $(get_install_abis) || continue |
4967 |
- |
4968 |
- ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}" |
4969 |
- if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then |
4970 |
- dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name} |
4971 |
- fi |
4972 |
- done |
4973 |
- |
4974 |
- # With devpts under Linux mounted properly, we do not need the pt_chown |
4975 |
- # binary to be setuid. This is because the default owners/perms will be |
4976 |
- # exactly what we want. |
4977 |
- if ! use suid ; then |
4978 |
- find "${ED}" -name pt_chown -exec chmod -s {} + |
4979 |
- fi |
4980 |
- |
4981 |
- ################################################################# |
4982 |
- # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY # |
4983 |
- # Make sure we install some symlink hacks so that when we build |
4984 |
- # a 2nd stage cross-compiler, gcc finds the target system |
4985 |
- # headers correctly. See gcc/doc/gccinstall.info |
4986 |
- if is_crosscompile ; then |
4987 |
- # We need to make sure that /lib and /usr/lib always exists. |
4988 |
- # gcc likes to use relative paths to get to its multilibs like |
4989 |
- # /usr/lib/../lib64/. So while we don't install any files into |
4990 |
- # /usr/lib/, we do need it to exist. |
4991 |
- keepdir $(alt_prefix)/lib |
4992 |
- keepdir $(alt_prefix)/usr/lib |
4993 |
- |
4994 |
- dosym usr/include $(alt_prefix)/sys-include |
4995 |
- return 0 |
4996 |
- fi |
4997 |
- |
4998 |
- # Files for Debian-style locale updating |
4999 |
- dodir /usr/share/i18n |
5000 |
- sed \ |
5001 |
- -e "/^#/d" \ |
5002 |
- -e "/SUPPORTED-LOCALES=/d" \ |
5003 |
- -e "s: \\\\::g" -e "s:/: :g" \ |
5004 |
- "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ |
5005 |
- || die "generating /usr/share/i18n/SUPPORTED failed" |
5006 |
- cd "${WORKDIR}"/extra/locale |
5007 |
- dosbin locale-gen |
5008 |
- doman *.[0-8] |
5009 |
- insinto /etc |
5010 |
- doins locale.gen |
5011 |
- |
5012 |
- # Make sure all the ABI's can find the locales and so we only |
5013 |
- # have to generate one set |
5014 |
- local a |
5015 |
- keepdir /usr/$(get_libdir)/locale |
5016 |
- for a in $(get_install_abis) ; do |
5017 |
- if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then |
5018 |
- dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale |
5019 |
- fi |
5020 |
- done |
5021 |
- |
5022 |
- # HACK: If we're building for riscv, we need to additionally make sure that |
5023 |
- # we can find the locale archive afterwards |
5024 |
- case ${CTARGET} in |
5025 |
- riscv*) |
5026 |
- if [[ ! -e ${ED}/usr/lib/locale ]] ; then |
5027 |
- dosym ../$(get_libdir)/locale /usr/lib/locale |
5028 |
- fi |
5029 |
- ;; |
5030 |
- *) ;; |
5031 |
- esac |
5032 |
- |
5033 |
- cd "${S}" |
5034 |
- |
5035 |
- # Install misc network config files |
5036 |
- insinto /etc |
5037 |
- doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf |
5038 |
- doins "${WORKDIR}"/extra/etc/*.conf |
5039 |
- |
5040 |
- if use nscd ; then |
5041 |
- doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)" |
5042 |
- |
5043 |
- local nscd_args=( |
5044 |
- -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" |
5045 |
- ) |
5046 |
- |
5047 |
- sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd |
5048 |
- |
5049 |
- systemd_dounit nscd/nscd.service |
5050 |
- systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf |
5051 |
- else |
5052 |
- # Do this since extra/etc/*.conf above might have nscd.conf. |
5053 |
- rm -f "${ED}"/etc/nscd.conf |
5054 |
- fi |
5055 |
- |
5056 |
- echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc |
5057 |
- doenvd "${T}"/00glibc |
5058 |
- |
5059 |
- for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do |
5060 |
- [[ -s ${d} ]] && dodoc ${d} |
5061 |
- done |
5062 |
- dodoc -r ChangeLog.old |
5063 |
- |
5064 |
- # Prevent overwriting of the /etc/localtime symlink. We'll handle the |
5065 |
- # creation of the "factory" symlink in pkg_postinst(). |
5066 |
- rm -f "${ED}"/etc/localtime |
5067 |
- |
5068 |
- # Generate all locales if this is a native build as locale generation |
5069 |
- if use compile-locales && ! is_crosscompile ; then |
5070 |
- run_locale_gen --inplace-glibc "${ED}/" |
5071 |
- sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die |
5072 |
- fi |
5073 |
-} |
5074 |
- |
5075 |
-glibc_headers_install() { |
5076 |
- local builddir=$(builddir "headers") |
5077 |
- cd "${builddir}" |
5078 |
- emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers |
5079 |
- |
5080 |
- insinto $(alt_headers)/gnu |
5081 |
- doins "${S}"/include/gnu/stubs.h |
5082 |
- |
5083 |
- # Make sure we install the sys-include symlink so that when |
5084 |
- # we build a 2nd stage cross-compiler, gcc finds the target |
5085 |
- # system headers correctly. See gcc/doc/gccinstall.info |
5086 |
- dosym usr/include $(alt_prefix)/sys-include |
5087 |
-} |
5088 |
- |
5089 |
-src_install() { |
5090 |
- if just_headers ; then |
5091 |
- export ABI=default |
5092 |
- glibc_headers_install |
5093 |
- return |
5094 |
- fi |
5095 |
- |
5096 |
- foreach_abi glibc_do_src_install |
5097 |
-} |
5098 |
- |
5099 |
-# Simple test to make sure our new glibc isn't completely broken. |
5100 |
-# Make sure we don't test with statically built binaries since |
5101 |
-# they will fail. Also, skip if this glibc is a cross compiler. |
5102 |
-# |
5103 |
-# If coreutils is built with USE=multicall, some of these files |
5104 |
-# will just be wrapper scripts, not actual ELFs we can test. |
5105 |
-glibc_sanity_check() { |
5106 |
- cd / #228809 |
5107 |
- |
5108 |
- # We enter ${ED} so to avoid trouble if the path contains |
5109 |
- # special characters; for instance if the path contains the |
5110 |
- # colon character (:), then the linker will try to split it |
5111 |
- # and look for the libraries in an unexpected place. This can |
5112 |
- # lead to unsafe code execution if the generated prefix is |
5113 |
- # within a world-writable directory. |
5114 |
- # (e.g. /var/tmp/portage:${HOSTNAME}) |
5115 |
- pushd "${ED}"/$(get_libdir) >/dev/null |
5116 |
- |
5117 |
- local x striptest |
5118 |
- for x in cal date env free ls true uname uptime ; do |
5119 |
- x=$(type -p ${x}) |
5120 |
- [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue |
5121 |
- striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue |
5122 |
- case ${striptest} in |
5123 |
- *"statically linked"*) continue;; |
5124 |
- *"ASCII text"*) continue;; |
5125 |
- esac |
5126 |
- # We need to clear the locale settings as the upgrade might want |
5127 |
- # incompatible locale data. This test is not for verifying that. |
5128 |
- LC_ALL=C \ |
5129 |
- ./ld-*.so --library-path . ${x} > /dev/null \ |
5130 |
- || die "simple run test (${x}) failed" |
5131 |
- done |
5132 |
- |
5133 |
- popd >/dev/null |
5134 |
-} |
5135 |
- |
5136 |
-pkg_preinst() { |
5137 |
- # nothing to do if just installing headers |
5138 |
- just_headers && return |
5139 |
- |
5140 |
- # prepare /etc/ld.so.conf.d/ for files |
5141 |
- mkdir -p "${EROOT}"/etc/ld.so.conf.d |
5142 |
- |
5143 |
- # Default /etc/hosts.conf:multi to on for systems with small dbs. |
5144 |
- if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then |
5145 |
- sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf |
5146 |
- einfo "Defaulting /etc/host.conf:multi to on" |
5147 |
- fi |
5148 |
- |
5149 |
- [[ -n ${ROOT} ]] && return 0 |
5150 |
- [[ -d ${ED}/$(get_libdir) ]] || return 0 |
5151 |
- [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check |
5152 |
-} |
5153 |
- |
5154 |
-pkg_postinst() { |
5155 |
- # nothing to do if just installing headers |
5156 |
- just_headers && return |
5157 |
- |
5158 |
- if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then |
5159 |
- # Generate fastloading iconv module configuration file. |
5160 |
- "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/" |
5161 |
- fi |
5162 |
- |
5163 |
- if ! is_crosscompile && [[ -z ${ROOT} ]] ; then |
5164 |
- use compile-locales || run_locale_gen "${EROOT}/" |
5165 |
- fi |
5166 |
- |
5167 |
- # Check for sanity of /etc/nsswitch.conf, take 2 |
5168 |
- if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then |
5169 |
- local entry |
5170 |
- for entry in passwd group shadow; do |
5171 |
- if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then |
5172 |
- ewarn "" |
5173 |
- ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" |
5174 |
- ewarn "removed from glibc and is now provided by the package" |
5175 |
- ewarn " sys-auth/libnss-nis" |
5176 |
- ewarn "Install it now to keep your NIS setup working." |
5177 |
- ewarn "" |
5178 |
- fi |
5179 |
- done |
5180 |
- fi |
5181 |
-} |