1 |
commit: e17f86989bb169e3892a3181ca3fb660bcf4c8c9 |
2 |
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Nov 25 01:36:44 2019 +0000 |
4 |
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 25 01:37:01 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e17f8698 |
7 |
|
8 |
sys-libs/glibc: New 2.29 patchset / revbump |
9 |
|
10 |
Some tests fail, needs still review; no keywords thus. |
11 |
|
12 |
FAIL: elf/tst-latepthread |
13 |
FAIL: elf/tst-pldd |
14 |
XPASS: elf/tst-protected1a |
15 |
XPASS: elf/tst-protected1b |
16 |
UNSUPPORTED: misc/tst-pkey |
17 |
UNSUPPORTED: nptl/test-cond-printers |
18 |
UNSUPPORTED: nptl/test-condattr-printers |
19 |
UNSUPPORTED: nptl/test-mutex-printers |
20 |
UNSUPPORTED: nptl/test-mutexattr-printers |
21 |
UNSUPPORTED: nptl/test-rwlock-printers |
22 |
UNSUPPORTED: nptl/test-rwlockattr-printers |
23 |
FAIL: nss/tst-nss-db-endgrent |
24 |
FAIL: nss/tst-nss-db-endpwent |
25 |
FAIL: nss/tst-nss-test3 |
26 |
FAIL: resolv/tst-resolv-ai_idn |
27 |
FAIL: resolv/tst-resolv-ai_idn-latin1 |
28 |
UNSUPPORTED: time/tst-y2039 |
29 |
Summary of test results: |
30 |
7 FAIL |
31 |
5871 PASS |
32 |
8 UNSUPPORTED |
33 |
17 XFAIL |
34 |
2 XPASS |
35 |
|
36 |
Package-Manager: Portage-2.3.79, Repoman-2.3.18 |
37 |
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org> |
38 |
|
39 |
sys-libs/glibc/Manifest | 1 + |
40 |
sys-libs/glibc/glibc-2.29-r7.ebuild | 1478 +++++++++++++++++++++++++++++++++++ |
41 |
2 files changed, 1479 insertions(+) |
42 |
|
43 |
diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest |
44 |
index a379b461b06..e0d39549cae 100644 |
45 |
--- a/sys-libs/glibc/Manifest |
46 |
+++ b/sys-libs/glibc/Manifest |
47 |
@@ -15,6 +15,7 @@ DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79 |
48 |
DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438 |
49 |
DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433 SHA512 6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822 |
50 |
DIST glibc-2.29-patches-7.tar.xz 64752 BLAKE2B 766f3f2d11aedf7e1b83db94fd2793244e29abc0beb78071a3eadfb83d3589f56b07b68c8faffd77ecc859497ba52f0327e03cf984b00adbeee3e196b0c5e57c SHA512 aea61fd3e084b293d0a92c89cd83d176ca95112e23224091e31ac77f54089922926ebbd9b75748d5b750f3d88c6f55f9953f11375a07a219946c485d4bf6bcaf |
51 |
+DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a |
52 |
DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0 |
53 |
DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758 |
54 |
DIST glibc-2.30.tar.xz 16576920 BLAKE2B bd5aae4c9854f40785b91f83c3b632de6d48d811027ddfe61651cb1bc617db8017d7914c23a770cdd3feed06fcc316da841eea916cdba54179e7eace4ea45484 SHA512 37483990cd653685873e96c45dd1651b32b441b6d7919a68ebe3bae31a0c3f7ce183fc9b110f0b268b353f80312f18370559a1e7aecea0e5aa755c8f2aef1d6b |
55 |
|
56 |
diff --git a/sys-libs/glibc/glibc-2.29-r7.ebuild b/sys-libs/glibc/glibc-2.29-r7.ebuild |
57 |
new file mode 100644 |
58 |
index 00000000000..fad4d17a464 |
59 |
--- /dev/null |
60 |
+++ b/sys-libs/glibc/glibc-2.29-r7.ebuild |
61 |
@@ -0,0 +1,1478 @@ |
62 |
+# Copyright 1999-2019 Gentoo Authors |
63 |
+# Distributed under the terms of the GNU General Public License v2 |
64 |
+ |
65 |
+EAPI=7 |
66 |
+ |
67 |
+PYTHON_COMPAT=( python3_{5,6,7} ) |
68 |
+ |
69 |
+inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \ |
70 |
+ multilib systemd multiprocessing |
71 |
+ |
72 |
+DESCRIPTION="GNU libc C library" |
73 |
+HOMEPAGE="https://www.gnu.org/software/libc/" |
74 |
+LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" |
75 |
+SLOT="2.2" |
76 |
+ |
77 |
+EMULTILIB_PKG="true" |
78 |
+ |
79 |
+if [[ ${PV} == 9999* ]]; then |
80 |
+ EGIT_REPO_URI="https://sourceware.org/git/glibc.git" |
81 |
+ inherit git-r3 |
82 |
+else |
83 |
+# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86" |
84 |
+ SRC_URI="mirror://gnu/glibc/${P}.tar.xz" |
85 |
+fi |
86 |
+ |
87 |
+RELEASE_VER=${PV} |
88 |
+ |
89 |
+GCC_BOOTSTRAP_VER=20180511 |
90 |
+ |
91 |
+# Gentoo patchset |
92 |
+PATCH_VER=8 |
93 |
+PATCH_DEV=dilfridge |
94 |
+ |
95 |
+SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz" |
96 |
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
97 |
+ |
98 |
+IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla" |
99 |
+ |
100 |
+# Minimum kernel version that glibc requires |
101 |
+MIN_KERN_VER="3.2.0" |
102 |
+ |
103 |
+# Here's how the cross-compile logic breaks down ... |
104 |
+# CTARGET - machine that will target the binaries |
105 |
+# CHOST - machine that will host the binaries |
106 |
+# CBUILD - machine that will build the binaries |
107 |
+# If CTARGET != CHOST, it means you want a libc for cross-compiling. |
108 |
+# If CHOST != CBUILD, it means you want to cross-compile the libc. |
109 |
+# CBUILD = CHOST = CTARGET - native build/install |
110 |
+# CBUILD != (CHOST = CTARGET) - cross-compile a native build |
111 |
+# (CBUILD = CHOST) != CTARGET - libc for cross-compiler |
112 |
+# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler |
113 |
+# For install paths: |
114 |
+# CHOST = CTARGET - install into / |
115 |
+# CHOST != CTARGET - install into /usr/CTARGET/ |
116 |
+# |
117 |
+export CBUILD=${CBUILD:-${CHOST}} |
118 |
+export CTARGET=${CTARGET:-${CHOST}} |
119 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
120 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
121 |
+ export CTARGET=${CATEGORY#cross-} |
122 |
+ fi |
123 |
+fi |
124 |
+ |
125 |
+# Note [Disable automatic stripping] |
126 |
+# Disabling automatic stripping for a few reasons: |
127 |
+# - portage's attempt to strip breaks non-native binaries at least on |
128 |
+# arm: bug #697428 |
129 |
+# - portage's attempt to strip libpthread.so.0 breaks gdb thread |
130 |
+# enumeration: bug #697910. This is quite subtle: |
131 |
+# * gdb uses glibc's libthread_db-1.0.so to enumerate threads. |
132 |
+# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols |
133 |
+# via 'ps_pglobal_lookup' symbol defined in gdb. |
134 |
+# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all |
135 |
+# known symbols in 'libpthread.so.0'. Specifically 'nptl_version' |
136 |
+# (unexported) is used to sanity check compatibility before enabling |
137 |
+# debugging. |
138 |
+# 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 |
139 |
+# * normal 'strip' command trims '.symtab' |
140 |
+# Thus our main goal here is to prevent 'libpthread.so.0' from |
141 |
+# losing it's '.symtab' entries. |
142 |
+# As Gentoo's strip does not allow us to pass less aggressive stripping |
143 |
+# options and does not check the machine target we strip selectively. |
144 |
+ |
145 |
+# We need a new-enough binutils/gcc to match upstream baseline. |
146 |
+# Also we need to make sure our binutils/gcc supports TLS, |
147 |
+# and that gcc already contains the hardened patches. |
148 |
+BDEPEND=" |
149 |
+ ${PYTHON_DEPS} |
150 |
+ >=app-misc/pax-utils-0.1.10 |
151 |
+ sys-devel/bison |
152 |
+ !<sys-devel/bison-2.7 |
153 |
+ !<sys-devel/make-4 |
154 |
+ doc? ( sys-apps/texinfo ) |
155 |
+" |
156 |
+COMMON_DEPEND=" |
157 |
+ nscd? ( selinux? ( |
158 |
+ audit? ( sys-process/audit ) |
159 |
+ caps? ( sys-libs/libcap ) |
160 |
+ ) ) |
161 |
+ suid? ( caps? ( sys-libs/libcap ) ) |
162 |
+ selinux? ( sys-libs/libselinux ) |
163 |
+ systemtap? ( dev-util/systemtap ) |
164 |
+" |
165 |
+DEPEND="${COMMON_DEPEND} |
166 |
+ test? ( >=net-dns/libidn2-2.0.5 ) |
167 |
+" |
168 |
+RDEPEND="${COMMON_DEPEND} |
169 |
+ sys-apps/gentoo-functions |
170 |
+" |
171 |
+ |
172 |
+RESTRICT="!test? ( test )" |
173 |
+ |
174 |
+if [[ ${CATEGORY} == cross-* ]] ; then |
175 |
+ BDEPEND+=" !headers-only? ( |
176 |
+ >=${CATEGORY}/binutils-2.24 |
177 |
+ >=${CATEGORY}/gcc-6 |
178 |
+ )" |
179 |
+ [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers" |
180 |
+else |
181 |
+ BDEPEND+=" |
182 |
+ >=sys-devel/binutils-2.24 |
183 |
+ >=sys-devel/gcc-6 |
184 |
+ " |
185 |
+ DEPEND+=" virtual/os-headers " |
186 |
+ RDEPEND+=" |
187 |
+ >=net-dns/libidn2-2.0.5 |
188 |
+ vanilla? ( !sys-libs/timezone-data ) |
189 |
+ " |
190 |
+ PDEPEND+=" !vanilla? ( sys-libs/timezone-data )" |
191 |
+fi |
192 |
+ |
193 |
+# |
194 |
+# Small helper functions |
195 |
+# |
196 |
+ |
197 |
+is_crosscompile() { |
198 |
+ [[ ${CHOST} != ${CTARGET} ]] |
199 |
+} |
200 |
+ |
201 |
+just_headers() { |
202 |
+ is_crosscompile && use headers-only |
203 |
+} |
204 |
+ |
205 |
+alt_prefix() { |
206 |
+ is_crosscompile && echo /usr/${CTARGET} |
207 |
+} |
208 |
+ |
209 |
+# This prefix is applicable to CHOST when building against this |
210 |
+# glibc. It is baked into the library at configure time. |
211 |
+host_eprefix() { |
212 |
+ is_crosscompile || echo "${EPREFIX}" |
213 |
+} |
214 |
+ |
215 |
+# This prefix is applicable to CBUILD when building against this |
216 |
+# glibc. It determines the destination path at install time. |
217 |
+build_eprefix() { |
218 |
+ is_crosscompile && echo "${EPREFIX}" |
219 |
+} |
220 |
+ |
221 |
+# We need to be able to set alternative headers for compiling for non-native |
222 |
+# platform. Will also become useful for testing kernel-headers without screwing |
223 |
+# up the whole system. |
224 |
+alt_headers() { |
225 |
+ echo ${ALT_HEADERS:=$(alt_prefix)/usr/include} |
226 |
+} |
227 |
+ |
228 |
+alt_build_headers() { |
229 |
+ if [[ -z ${ALT_BUILD_HEADERS} ]] ; then |
230 |
+ ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)" |
231 |
+ if tc-is-cross-compiler ; then |
232 |
+ ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers) |
233 |
+ if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then |
234 |
+ local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h') |
235 |
+ ALT_BUILD_HEADERS=${header_path%/linux/version.h} |
236 |
+ fi |
237 |
+ fi |
238 |
+ fi |
239 |
+ echo "${ALT_BUILD_HEADERS}" |
240 |
+} |
241 |
+ |
242 |
+alt_libdir() { |
243 |
+ echo $(alt_prefix)/$(get_libdir) |
244 |
+} |
245 |
+alt_usrlibdir() { |
246 |
+ echo $(alt_prefix)/usr/$(get_libdir) |
247 |
+} |
248 |
+ |
249 |
+builddir() { |
250 |
+ echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1" |
251 |
+} |
252 |
+ |
253 |
+do_compile_test() { |
254 |
+ local ret save_cflags=${CFLAGS} |
255 |
+ CFLAGS+=" $1" |
256 |
+ shift |
257 |
+ |
258 |
+ pushd "${T}" >/dev/null |
259 |
+ |
260 |
+ rm -f glibc-test* |
261 |
+ printf '%b' "$*" > glibc-test.c |
262 |
+ |
263 |
+ nonfatal emake -s glibc-test |
264 |
+ ret=$? |
265 |
+ |
266 |
+ popd >/dev/null |
267 |
+ |
268 |
+ CFLAGS=${save_cflags} |
269 |
+ return ${ret} |
270 |
+} |
271 |
+ |
272 |
+do_run_test() { |
273 |
+ local ret |
274 |
+ |
275 |
+ if [[ ${MERGE_TYPE} == "binary" ]] ; then |
276 |
+ # ignore build failures when installing a binary package #324685 |
277 |
+ do_compile_test "" "$@" 2>/dev/null || return 0 |
278 |
+ else |
279 |
+ if ! do_compile_test "" "$@" ; then |
280 |
+ ewarn "Simple build failed ... assuming this is desired #324685" |
281 |
+ return 0 |
282 |
+ fi |
283 |
+ fi |
284 |
+ |
285 |
+ pushd "${T}" >/dev/null |
286 |
+ |
287 |
+ ./glibc-test |
288 |
+ ret=$? |
289 |
+ rm -f glibc-test* |
290 |
+ |
291 |
+ popd >/dev/null |
292 |
+ |
293 |
+ return ${ret} |
294 |
+} |
295 |
+ |
296 |
+setup_target_flags() { |
297 |
+ # This largely mucks with compiler flags. None of which should matter |
298 |
+ # when building up just the headers. |
299 |
+ just_headers && return 0 |
300 |
+ |
301 |
+ case $(tc-arch) in |
302 |
+ x86) |
303 |
+ # -march needed for #185404 #199334 |
304 |
+ # TODO: When creating the first glibc cross-compile, this test will |
305 |
+ # always fail as it does a full link which in turn requires glibc. |
306 |
+ # Probably also applies when changing multilib profile settings (e.g. |
307 |
+ # enabling x86 when the profile was amd64-only previously). |
308 |
+ # We could change main to _start and pass -nostdlib here so that we |
309 |
+ # only test the gcc code compilation. Or we could do a compile and |
310 |
+ # then look for the symbol via scanelf. |
311 |
+ 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 |
312 |
+ local t=${CTARGET_OPT:-${CTARGET}} |
313 |
+ t=${t%%-*} |
314 |
+ filter-flags '-march=*' |
315 |
+ export CFLAGS="-march=${t} ${CFLAGS}" |
316 |
+ einfo "Auto adding -march=${t} to CFLAGS #185404" |
317 |
+ fi |
318 |
+ ;; |
319 |
+ amd64) |
320 |
+ # -march needed for #185404 #199334 |
321 |
+ # Note: This test only matters when the x86 ABI is enabled, so we could |
322 |
+ # optimize a bit and elide it. |
323 |
+ # TODO: See cross-compile issues listed above for x86. |
324 |
+ 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 |
325 |
+ local t=${CTARGET_OPT:-${CTARGET}} |
326 |
+ t=${t%%-*} |
327 |
+ # Normally the target is x86_64-xxx, so turn that into the -march that |
328 |
+ # gcc actually accepts. #528708 |
329 |
+ [[ ${t} == "x86_64" ]] && t="x86-64" |
330 |
+ filter-flags '-march=*' |
331 |
+ # ugly, ugly, ugly. ugly. |
332 |
+ CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") |
333 |
+ export CFLAGS_x86="${CFLAGS_x86} -march=${t}" |
334 |
+ einfo "Auto adding -march=${t} to CFLAGS_x86 #185404" |
335 |
+ fi |
336 |
+ ;; |
337 |
+ mips) |
338 |
+ # The mips abi cannot support the GNU style hashes. #233233 |
339 |
+ filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both |
340 |
+ ;; |
341 |
+ sparc) |
342 |
+ # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though. |
343 |
+ filter-flags "-fcall-used-g7" |
344 |
+ append-flags "-fcall-used-g6" |
345 |
+ |
346 |
+ # If the CHOST is the basic one (e.g. not sparcv9-xxx already), |
347 |
+ # try to pick a better one so glibc can use cpu-specific .S files. |
348 |
+ # We key off the CFLAGS to get a good value. Also need to handle |
349 |
+ # version skew. |
350 |
+ # We can't force users to set their CHOST to their exact machine |
351 |
+ # as many of these are not recognized by config.sub/gcc and such :(. |
352 |
+ # Note: If the mcpu values don't scale, we might try probing CPP defines. |
353 |
+ # Note: Should we factor in -Wa,-AvXXX flags too ? Or -mvis/etc... ? |
354 |
+ |
355 |
+ local cpu |
356 |
+ case ${CTARGET} in |
357 |
+ sparc64-*) |
358 |
+ case $(get-flag mcpu) in |
359 |
+ niagara[234]) |
360 |
+ if ver_test -ge 2.8 ; then |
361 |
+ cpu="sparc64v2" |
362 |
+ elif ver_test -ge 2.4 ; then |
363 |
+ cpu="sparc64v" |
364 |
+ elif ver_test -ge 2.2.3 ; then |
365 |
+ cpu="sparc64b" |
366 |
+ fi |
367 |
+ ;; |
368 |
+ niagara) |
369 |
+ if ver_test -ge 2.4 ; then |
370 |
+ cpu="sparc64v" |
371 |
+ elif ver_test -ge 2.2.3 ; then |
372 |
+ cpu="sparc64b" |
373 |
+ fi |
374 |
+ ;; |
375 |
+ ultrasparc3) |
376 |
+ cpu="sparc64b" |
377 |
+ ;; |
378 |
+ *) |
379 |
+ # We need to force at least v9a because the base build doesn't |
380 |
+ # work with just v9. |
381 |
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=19477 |
382 |
+ [[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a" |
383 |
+ ;; |
384 |
+ esac |
385 |
+ ;; |
386 |
+ sparc-*) |
387 |
+ case $(get-flag mcpu) in |
388 |
+ niagara[234]) |
389 |
+ if ver_test -ge 2.8 ; then |
390 |
+ cpu="sparcv9v2" |
391 |
+ elif ver_test -ge 2.4 ; then |
392 |
+ cpu="sparcv9v" |
393 |
+ elif ver_test -ge 2.2.3 ; then |
394 |
+ cpu="sparcv9b" |
395 |
+ else |
396 |
+ cpu="sparcv9" |
397 |
+ fi |
398 |
+ ;; |
399 |
+ niagara) |
400 |
+ if ver_test -ge 2.4 ; then |
401 |
+ cpu="sparcv9v" |
402 |
+ elif ver_test -ge 2.2.3 ; then |
403 |
+ cpu="sparcv9b" |
404 |
+ else |
405 |
+ cpu="sparcv9" |
406 |
+ fi |
407 |
+ ;; |
408 |
+ ultrasparc3) |
409 |
+ cpu="sparcv9b" |
410 |
+ ;; |
411 |
+ v9|ultrasparc) |
412 |
+ cpu="sparcv9" |
413 |
+ ;; |
414 |
+ v8|supersparc|hypersparc|leon|leon3) |
415 |
+ cpu="sparcv8" |
416 |
+ ;; |
417 |
+ esac |
418 |
+ ;; |
419 |
+ esac |
420 |
+ [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}" |
421 |
+ ;; |
422 |
+ esac |
423 |
+} |
424 |
+ |
425 |
+setup_flags() { |
426 |
+ # Make sure host make.conf doesn't pollute us |
427 |
+ if is_crosscompile || tc-is-cross-compiler ; then |
428 |
+ CHOST=${CTARGET} strip-unsupported-flags |
429 |
+ fi |
430 |
+ |
431 |
+ # Store our CFLAGS because it's changed depending on which CTARGET |
432 |
+ # we are building when pulling glibc on a multilib profile |
433 |
+ CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}} |
434 |
+ CFLAGS=${CFLAGS_BASE} |
435 |
+ CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}} |
436 |
+ CXXFLAGS=${CXXFLAGS_BASE} |
437 |
+ ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}} |
438 |
+ ASFLAGS=${ASFLAGS_BASE} |
439 |
+ |
440 |
+ # Over-zealous CFLAGS can often cause problems. What may work for one |
441 |
+ # person may not work for another. To avoid a large influx of bugs |
442 |
+ # relating to failed builds, we strip most CFLAGS out to ensure as few |
443 |
+ # problems as possible. |
444 |
+ strip-flags |
445 |
+ strip-unsupported-flags |
446 |
+ filter-flags -m32 -m64 '-mabi=*' |
447 |
+ |
448 |
+ # glibc aborts if rpath is set by LDFLAGS |
449 |
+ filter-ldflags '-Wl,-rpath=*' |
450 |
+ |
451 |
+ # #492892 |
452 |
+ filter-flags -frecord-gcc-switches |
453 |
+ |
454 |
+ unset CBUILD_OPT CTARGET_OPT |
455 |
+ if use multilib ; then |
456 |
+ CTARGET_OPT=$(get_abi_CTARGET) |
457 |
+ [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST) |
458 |
+ fi |
459 |
+ |
460 |
+ setup_target_flags |
461 |
+ |
462 |
+ if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then |
463 |
+ CBUILD_OPT=${CTARGET_OPT} |
464 |
+ fi |
465 |
+ |
466 |
+ # Lock glibc at -O2; we want to be conservative here. |
467 |
+ # -fno-strict-aliasing is to work around #155906. |
468 |
+ filter-flags '-O?' |
469 |
+ append-flags -O2 -fno-strict-aliasing |
470 |
+ |
471 |
+ filter-flags '-fstack-protector*' |
472 |
+} |
473 |
+ |
474 |
+want_tls() { |
475 |
+ # Archs that can use TLS (Thread Local Storage) |
476 |
+ case $(tc-arch) in |
477 |
+ x86) |
478 |
+ # requires i486 or better #106556 |
479 |
+ [[ ${CTARGET} == i[4567]86* ]] && return 0 |
480 |
+ return 1 |
481 |
+ ;; |
482 |
+ esac |
483 |
+ return 0 |
484 |
+} |
485 |
+ |
486 |
+want__thread() { |
487 |
+ want_tls || return 1 |
488 |
+ |
489 |
+ # For some reason --with-tls --with__thread is causing segfaults on sparc32. |
490 |
+ [[ ${PROFILE_ARCH} == "sparc" ]] && return 1 |
491 |
+ |
492 |
+ [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD} |
493 |
+ |
494 |
+ # only test gcc -- can't test linking yet |
495 |
+ tc-has-tls -c ${CTARGET} |
496 |
+ WANT__THREAD=$? |
497 |
+ |
498 |
+ return ${WANT__THREAD} |
499 |
+} |
500 |
+ |
501 |
+use_multiarch() { |
502 |
+ # Allow user to disable runtime arch detection in multilib. |
503 |
+ use multiarch || return 1 |
504 |
+ # Make sure binutils is new enough to support indirect functions, |
505 |
+ # #336792. This funky sed supports gold and bfd linkers. |
506 |
+ local bver nver |
507 |
+ bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}') |
508 |
+ case $(tc-arch ${CTARGET}) in |
509 |
+ amd64|x86) nver="2.20" ;; |
510 |
+ arm) nver="2.22" ;; |
511 |
+ hppa) nver="2.23" ;; |
512 |
+ ppc|ppc64) nver="2.20" ;; |
513 |
+ # ifunc support was added in 2.23, but glibc also needs |
514 |
+ # machinemode which is in 2.24. |
515 |
+ s390) nver="2.24" ;; |
516 |
+ sparc) nver="2.21" ;; |
517 |
+ *) return 1 ;; |
518 |
+ esac |
519 |
+ ver_test ${bver} -ge ${nver} |
520 |
+} |
521 |
+ |
522 |
+# Setup toolchain variables that had historically been defined in the |
523 |
+# profiles for these archs. |
524 |
+setup_env() { |
525 |
+ # silly users |
526 |
+ unset LD_RUN_PATH |
527 |
+ unset LD_ASSUME_KERNEL |
528 |
+ |
529 |
+ if is_crosscompile || tc-is-cross-compiler ; then |
530 |
+ multilib_env ${CTARGET_OPT:-${CTARGET}} |
531 |
+ |
532 |
+ if ! use multilib ; then |
533 |
+ MULTILIB_ABIS=${DEFAULT_ABI} |
534 |
+ else |
535 |
+ MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}} |
536 |
+ fi |
537 |
+ |
538 |
+ # If the user has CFLAGS_<CTARGET> in their make.conf, use that, |
539 |
+ # and fall back on CFLAGS. |
540 |
+ local VAR=CFLAGS_${CTARGET//[-.]/_} |
541 |
+ CFLAGS=${!VAR-${CFLAGS}} |
542 |
+ einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}" |
543 |
+ fi |
544 |
+ |
545 |
+ setup_flags |
546 |
+ |
547 |
+ export ABI=${ABI:-${DEFAULT_ABI:-default}} |
548 |
+ |
549 |
+ if just_headers ; then |
550 |
+ # Avoid mixing host's CC and target's CFLAGS_${ABI}: |
551 |
+ # At this bootstrap stage we have only binutils for |
552 |
+ # target but not compiler yet. |
553 |
+ einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." |
554 |
+ return 0 |
555 |
+ fi |
556 |
+ local VAR=CFLAGS_${ABI} |
557 |
+ # We need to export CFLAGS with abi information in them because glibc's |
558 |
+ # configure script checks CFLAGS for some targets (like mips). Keep |
559 |
+ # around the original clean value to avoid appending multiple ABIs on |
560 |
+ # top of each other. |
561 |
+ : ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})} |
562 |
+ export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" |
563 |
+ einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
564 |
+} |
565 |
+ |
566 |
+foreach_abi() { |
567 |
+ setup_env |
568 |
+ |
569 |
+ local ret=0 |
570 |
+ local abilist="" |
571 |
+ if use multilib ; then |
572 |
+ abilist=$(get_install_abis) |
573 |
+ else |
574 |
+ abilist=${DEFAULT_ABI} |
575 |
+ fi |
576 |
+ local -x ABI |
577 |
+ for ABI in ${abilist:-default} ; do |
578 |
+ setup_env |
579 |
+ einfo "Running $1 for ABI ${ABI}" |
580 |
+ $1 |
581 |
+ : $(( ret |= $? )) |
582 |
+ done |
583 |
+ return ${ret} |
584 |
+} |
585 |
+ |
586 |
+glibc_banner() { |
587 |
+ local b="Gentoo ${PVR}" |
588 |
+ [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}" |
589 |
+ echo "${b}" |
590 |
+} |
591 |
+ |
592 |
+check_devpts() { |
593 |
+ # Make sure devpts is mounted correctly for use w/out setuid pt_chown. |
594 |
+ |
595 |
+ # If merely building the binary package, then there's nothing to verify. |
596 |
+ [[ ${MERGE_TYPE} == "buildonly" ]] && return |
597 |
+ |
598 |
+ # Only sanity check when installing the native glibc. |
599 |
+ [[ -n ${ROOT} ]] && return |
600 |
+ |
601 |
+ # If they're opting in to the old suid code, then no need to check. |
602 |
+ use suid && return |
603 |
+ |
604 |
+ if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then |
605 |
+ eerror "In order to use glibc with USE=-suid, you must make sure that" |
606 |
+ eerror "you have devpts mounted at /dev/pts with the gid=5 option." |
607 |
+ eerror "Openrc should do this for you, so you should check /etc/fstab" |
608 |
+ eerror "and make sure you do not have any invalid settings there." |
609 |
+ die "mount & fix your /dev/pts settings" |
610 |
+ fi |
611 |
+} |
612 |
+ |
613 |
+# The following Kernel version handling functions are mostly copied from portage |
614 |
+# source. It's better not to use linux-info.eclass here since a) it adds too |
615 |
+# much magic, see bug 326693 for some of the arguments, and b) some of the |
616 |
+# functions are just not provided. |
617 |
+ |
618 |
+g_get_running_KV() { |
619 |
+ uname -r |
620 |
+ return $? |
621 |
+} |
622 |
+ |
623 |
+g_KV_major() { |
624 |
+ [[ -z $1 ]] && return 1 |
625 |
+ local KV=$@ |
626 |
+ echo "${KV%%.*}" |
627 |
+} |
628 |
+ |
629 |
+g_KV_minor() { |
630 |
+ [[ -z $1 ]] && return 1 |
631 |
+ local KV=$@ |
632 |
+ KV=${KV#*.} |
633 |
+ echo "${KV%%.*}" |
634 |
+} |
635 |
+ |
636 |
+g_KV_micro() { |
637 |
+ [[ -z $1 ]] && return 1 |
638 |
+ local KV=$@ |
639 |
+ KV=${KV#*.*.} |
640 |
+ echo "${KV%%[^[:digit:]]*}" |
641 |
+} |
642 |
+ |
643 |
+g_KV_to_int() { |
644 |
+ [[ -z $1 ]] && return 1 |
645 |
+ local KV_MAJOR=$(g_KV_major "$1") |
646 |
+ local KV_MINOR=$(g_KV_minor "$1") |
647 |
+ local KV_MICRO=$(g_KV_micro "$1") |
648 |
+ local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) |
649 |
+ |
650 |
+ # We make version 2.2.0 the minimum version we will handle as |
651 |
+ # a sanity check ... if its less, we fail ... |
652 |
+ if [[ ${KV_int} -ge 131584 ]] ; then |
653 |
+ echo "${KV_int}" |
654 |
+ return 0 |
655 |
+ fi |
656 |
+ return 1 |
657 |
+} |
658 |
+ |
659 |
+g_int_to_KV() { |
660 |
+ local version=$1 major minor micro |
661 |
+ major=$((version / 65536)) |
662 |
+ minor=$(((version % 65536) / 256)) |
663 |
+ micro=$((version % 256)) |
664 |
+ echo ${major}.${minor}.${micro} |
665 |
+} |
666 |
+ |
667 |
+eend_KV() { |
668 |
+ [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]] |
669 |
+ eend $? |
670 |
+} |
671 |
+ |
672 |
+get_kheader_version() { |
673 |
+ printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \ |
674 |
+ $(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \ |
675 |
+ tail -n 1 |
676 |
+} |
677 |
+ |
678 |
+# We collect all sanity checks here. Consistency is not guranteed between |
679 |
+# pkg_ and src_ phases, so we call this function both in pkg_pretend and in |
680 |
+# src_unpack. |
681 |
+sanity_prechecks() { |
682 |
+ # Make sure devpts is mounted correctly for use w/out setuid pt_chown |
683 |
+ check_devpts |
684 |
+ |
685 |
+ # Prevent native builds from downgrading |
686 |
+ if [[ ${MERGE_TYPE} != "buildonly" ]] && \ |
687 |
+ [[ -z ${ROOT} ]] && \ |
688 |
+ [[ ${CBUILD} == ${CHOST} ]] && \ |
689 |
+ [[ ${CHOST} == ${CTARGET} ]] ; then |
690 |
+ |
691 |
+ # The high rev # is to allow people to downgrade between -r# |
692 |
+ # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2 |
693 |
+ # should be fine. Hopefully we never actually use a r# this |
694 |
+ # high. |
695 |
+ if has_version ">${CATEGORY}/${P}-r10000" ; then |
696 |
+ eerror "Sanity check to keep you from breaking your system:" |
697 |
+ eerror " Downgrading glibc is not supported and a sure way to destruction." |
698 |
+ [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system." |
699 |
+ fi |
700 |
+ |
701 |
+ if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then |
702 |
+ eerror "Your old kernel is broken. You need to update it to a newer" |
703 |
+ eerror "version as syscall(<bignum>) will break. See bug 279260." |
704 |
+ die "Old and broken kernel." |
705 |
+ fi |
706 |
+ fi |
707 |
+ |
708 |
+ # Users have had a chance to phase themselves, time to give em the boot |
709 |
+ if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then |
710 |
+ eerror "You still haven't deleted ${EROOT}/etc/locales.build." |
711 |
+ eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher." |
712 |
+ die "Lazy upgrader detected" |
713 |
+ fi |
714 |
+ |
715 |
+ if [[ ${CTARGET} == i386-* ]] ; then |
716 |
+ eerror "i386 CHOSTs are no longer supported." |
717 |
+ eerror "Chances are you don't actually want/need i386." |
718 |
+ eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml" |
719 |
+ die "Please fix your CHOST" |
720 |
+ fi |
721 |
+ |
722 |
+ if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then |
723 |
+ ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS." |
724 |
+ ewarn "This will result in a 50% performance penalty when running with a 32bit" |
725 |
+ ewarn "hypervisor, which is probably not what you want." |
726 |
+ fi |
727 |
+ |
728 |
+ # Check for sanity of /etc/nsswitch.conf |
729 |
+ if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then |
730 |
+ local entry |
731 |
+ for entry in passwd group shadow; do |
732 |
+ if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then |
733 |
+ eerror "Your ${EROOT}/etc/nsswitch.conf is out of date." |
734 |
+ eerror "Please make sure you have 'files' entries for" |
735 |
+ eerror "'passwd:', 'group:' and 'shadow:' databases." |
736 |
+ eerror "For more details see:" |
737 |
+ eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26" |
738 |
+ die "nsswitch.conf has no 'files' provider in '${entry}'." |
739 |
+ fi |
740 |
+ done |
741 |
+ fi |
742 |
+ |
743 |
+ # ABI-specific checks follow here. Hey, we have a lot more specific conditions that |
744 |
+ # we test for... |
745 |
+ if ! is_crosscompile ; then |
746 |
+ if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then |
747 |
+ ebegin "Checking that IA32 emulation is enabled in the running kernel" |
748 |
+ echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c" |
749 |
+ local STAT |
750 |
+ if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then |
751 |
+ "${T}/check-ia32-emulation.elf32" |
752 |
+ STAT=$? |
753 |
+ else |
754 |
+ # Don't fail here to allow single->multi ABI switch |
755 |
+ # or recover from breakage like bug #646424 |
756 |
+ ewarn "Failed to compile the ABI test. Broken host glibc?" |
757 |
+ STAT=0 |
758 |
+ fi |
759 |
+ rm -f "${T}/check-ia32-emulation.elf32" |
760 |
+ eend $STAT |
761 |
+ [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc." |
762 |
+ fi |
763 |
+ |
764 |
+ fi |
765 |
+ |
766 |
+ # When we actually have to compile something... |
767 |
+ if ! just_headers ; then |
768 |
+ ebegin "Checking gcc for __thread support" |
769 |
+ if ! eend $(want__thread ; echo $?) ; then |
770 |
+ echo |
771 |
+ eerror "Could not find a gcc that supports the __thread directive!" |
772 |
+ eerror "Please update your binutils/gcc and try again." |
773 |
+ die "No __thread support in gcc!" |
774 |
+ fi |
775 |
+ |
776 |
+ if [[ ${CTARGET} == *-linux* ]] ; then |
777 |
+ local run_kv build_kv want_kv |
778 |
+ |
779 |
+ run_kv=$(g_get_running_KV) |
780 |
+ build_kv=$(g_int_to_KV $(get_kheader_version)) |
781 |
+ want_kv=${MIN_KERN_VER} |
782 |
+ |
783 |
+ if ! is_crosscompile && ! tc-is-cross-compiler ; then |
784 |
+ # Building fails on an non-supporting kernel |
785 |
+ ebegin "Checking running kernel version (${run_kv} >= ${want_kv})" |
786 |
+ if ! eend_KV ${run_kv} ${want_kv} ; then |
787 |
+ echo |
788 |
+ eerror "You need a kernel of at least ${want_kv}!" |
789 |
+ die "Kernel version too low!" |
790 |
+ fi |
791 |
+ fi |
792 |
+ |
793 |
+ ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" |
794 |
+ if ! eend_KV ${build_kv} ${want_kv} ; then |
795 |
+ echo |
796 |
+ eerror "You need linux-headers of at least ${want_kv}!" |
797 |
+ die "linux-headers version too low!" |
798 |
+ fi |
799 |
+ fi |
800 |
+ fi |
801 |
+} |
802 |
+ |
803 |
+# |
804 |
+# the phases |
805 |
+# |
806 |
+ |
807 |
+# pkg_pretend |
808 |
+ |
809 |
+pkg_pretend() { |
810 |
+ # All the checks... |
811 |
+ einfo "Checking general environment sanity." |
812 |
+ sanity_prechecks |
813 |
+} |
814 |
+ |
815 |
+pkg_setup() { |
816 |
+ # see bug 682570 |
817 |
+ [[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup |
818 |
+} |
819 |
+ |
820 |
+# src_unpack |
821 |
+ |
822 |
+src_unpack() { |
823 |
+ # Consistency is not guaranteed between pkg_ and src_ ... |
824 |
+ sanity_prechecks |
825 |
+ |
826 |
+ use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
827 |
+ |
828 |
+ setup_env |
829 |
+ |
830 |
+ if [[ -n ${EGIT_REPO_URI} ]] ; then |
831 |
+ git-r3_src_unpack |
832 |
+ else |
833 |
+ unpack ${P}.tar.xz |
834 |
+ fi |
835 |
+ |
836 |
+ cd "${WORKDIR}" || die |
837 |
+ unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz |
838 |
+} |
839 |
+ |
840 |
+src_prepare() { |
841 |
+ if ! use vanilla ; then |
842 |
+ elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}" |
843 |
+ eapply "${WORKDIR}"/patches |
844 |
+ einfo "Done." |
845 |
+ fi |
846 |
+ |
847 |
+ default |
848 |
+ |
849 |
+ gnuconfig_update |
850 |
+ |
851 |
+ cd "${WORKDIR}" |
852 |
+ find . -name configure -exec touch {} + |
853 |
+ |
854 |
+ eprefixify extra/locale/locale-gen |
855 |
+ |
856 |
+ # Fix permissions on some of the scripts. |
857 |
+ chmod u+x "${S}"/scripts/*.sh |
858 |
+ |
859 |
+ cd "${S}" |
860 |
+} |
861 |
+ |
862 |
+glibc_do_configure() { |
863 |
+ # Glibc does not work with gold (for various reasons) #269274. |
864 |
+ tc-ld-disable-gold |
865 |
+ |
866 |
+ # CXX isnt handled by the multilib system, so if we dont unset here |
867 |
+ # we accumulate crap across abis |
868 |
+ unset CXX |
869 |
+ |
870 |
+ einfo "Configuring glibc for nptl" |
871 |
+ |
872 |
+ if use doc ; then |
873 |
+ export MAKEINFO=makeinfo |
874 |
+ else |
875 |
+ export MAKEINFO=/dev/null |
876 |
+ fi |
877 |
+ |
878 |
+ local v |
879 |
+ for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do |
880 |
+ einfo " $(printf '%15s' ${v}:) ${!v}" |
881 |
+ done |
882 |
+ |
883 |
+ # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760 |
884 |
+ # To build .S (assembly) files with the same ABI-specific flags |
885 |
+ # upstream currently recommends adding CFLAGS to CC/CXX: |
886 |
+ # https://sourceware.org/PR23273 |
887 |
+ # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS |
888 |
+ # and breaks multiarch support. See 659030#c3 for an example. |
889 |
+ # The glibc configure script doesn't properly use LDFLAGS all the time. |
890 |
+ export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}" |
891 |
+ einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
892 |
+ |
893 |
+ # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548 |
894 |
+ export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}" |
895 |
+ |
896 |
+ if is_crosscompile; then |
897 |
+ # Assume worst-case bootstrap: glibc is buil first time |
898 |
+ # when ${CTARGET}-g++ is not available yet. We avoid |
899 |
+ # building auxiliary programs that require C++: bug #683074 |
900 |
+ # It should not affect final result. |
901 |
+ export libc_cv_cxx_link_ok=no |
902 |
+ # The line above has the same effect. We set CXX explicitly |
903 |
+ # to make build logs less confusing. |
904 |
+ export CXX= |
905 |
+ fi |
906 |
+ einfo " $(printf '%15s' 'Manual CXX:') ${CXX}" |
907 |
+ |
908 |
+ echo |
909 |
+ |
910 |
+ local myconf=() |
911 |
+ |
912 |
+ case ${CTARGET} in |
913 |
+ m68k*) |
914 |
+ # setjmp() is not compatible with stack protection: |
915 |
+ # https://sourceware.org/PR24202 |
916 |
+ myconf+=( --enable-stack-protector=no ) |
917 |
+ ;; |
918 |
+ powerpc-*) |
919 |
+ # Currently gcc on powerpc32 generates invalid code for |
920 |
+ # __builtin_return_address(0) calls. Normally programs |
921 |
+ # don't do that but malloc hooks in glibc do: |
922 |
+ # https://gcc.gnu.org/PR81996 |
923 |
+ # https://bugs.gentoo.org/629054 |
924 |
+ myconf+=( --enable-stack-protector=no ) |
925 |
+ ;; |
926 |
+ *) |
927 |
+ myconf+=( --enable-stack-protector=$(usex ssp all no) ) |
928 |
+ ;; |
929 |
+ esac |
930 |
+ myconf+=( --enable-stackguard-randomization ) |
931 |
+ |
932 |
+ # Keep a whitelist of targets supporing IFUNC. glibc's ./configure |
933 |
+ # is not robust enough to detect proper support: |
934 |
+ # https://bugs.gentoo.org/641216 |
935 |
+ # https://sourceware.org/PR22634#c0 |
936 |
+ case $(tc-arch ${CTARGET}) in |
937 |
+ # Keep whitelist of targets where autodetection mostly works. |
938 |
+ amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;; |
939 |
+ # Blacklist everywhere else |
940 |
+ *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;; |
941 |
+ esac |
942 |
+ |
943 |
+ # Enable Intel Control-flow Enforcement Technology on amd64 if requested |
944 |
+ case ${CTARGET} in |
945 |
+ x86_64-*) myconf+=( $(use_enable cet) ) ;; |
946 |
+ *) ;; |
947 |
+ esac |
948 |
+ |
949 |
+ [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) |
950 |
+ |
951 |
+ myconf+=( --enable-kernel=${MIN_KERN_VER} ) |
952 |
+ |
953 |
+ # Since SELinux support is only required for nscd, only enable it if: |
954 |
+ # 1. USE selinux |
955 |
+ # 2. only for the primary ABI on multilib systems |
956 |
+ # 3. Not a crosscompile |
957 |
+ if ! is_crosscompile && use selinux ; then |
958 |
+ if use multilib ; then |
959 |
+ if is_final_abi ; then |
960 |
+ myconf+=( --with-selinux ) |
961 |
+ else |
962 |
+ myconf+=( --without-selinux ) |
963 |
+ fi |
964 |
+ else |
965 |
+ myconf+=( --with-selinux ) |
966 |
+ fi |
967 |
+ else |
968 |
+ myconf+=( --without-selinux ) |
969 |
+ fi |
970 |
+ |
971 |
+ # Force a few tests where we always know the answer but |
972 |
+ # configure is incapable of finding it. |
973 |
+ if is_crosscompile ; then |
974 |
+ export \ |
975 |
+ libc_cv_c_cleanup=yes \ |
976 |
+ libc_cv_forced_unwind=yes |
977 |
+ fi |
978 |
+ |
979 |
+ myconf+=( |
980 |
+ --without-cvs |
981 |
+ --disable-werror |
982 |
+ --enable-bind-now |
983 |
+ --build=${CBUILD_OPT:-${CBUILD}} |
984 |
+ --host=${CTARGET_OPT:-${CTARGET}} |
985 |
+ $(use_enable profile) |
986 |
+ $(use_with gd) |
987 |
+ --with-headers=$(alt_build_headers) |
988 |
+ --prefix="$(host_eprefix)/usr" |
989 |
+ --sysconfdir="$(host_eprefix)/etc" |
990 |
+ --localstatedir="$(host_eprefix)/var" |
991 |
+ --libdir='$(prefix)'/$(get_libdir) |
992 |
+ --mandir='$(prefix)'/share/man |
993 |
+ --infodir='$(prefix)'/share/info |
994 |
+ --libexecdir='$(libdir)'/misc/glibc |
995 |
+ --with-bugurl=https://bugs.gentoo.org/ |
996 |
+ --with-pkgversion="$(glibc_banner)" |
997 |
+ $(use_multiarch || echo --disable-multi-arch) |
998 |
+ $(use_enable systemtap) |
999 |
+ $(use_enable nscd) |
1000 |
+ ${EXTRA_ECONF} |
1001 |
+ ) |
1002 |
+ |
1003 |
+ # We rely on sys-libs/timezone-data for timezone tools normally. |
1004 |
+ myconf+=( $(use_enable vanilla timezone-tools) ) |
1005 |
+ |
1006 |
+ # These libs don't have configure flags. |
1007 |
+ ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no) |
1008 |
+ ac_cv_lib_cap_cap_init=$(usex caps || echo no) |
1009 |
+ |
1010 |
+ # There is no configure option for this and we need to export it |
1011 |
+ # since the glibc build will re-run configure on itself |
1012 |
+ export libc_cv_rootsbindir="$(host_eprefix)/sbin" |
1013 |
+ export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)" |
1014 |
+ |
1015 |
+ # We take care of patching our binutils to use both hash styles, |
1016 |
+ # and many people like to force gnu hash style only, so disable |
1017 |
+ # this overriding check. #347761 |
1018 |
+ export libc_cv_hashstyle=no |
1019 |
+ |
1020 |
+ local builddir=$(builddir nptl) |
1021 |
+ mkdir -p "${builddir}" |
1022 |
+ cd "${builddir}" |
1023 |
+ set -- "${S}"/configure "${myconf[@]}" |
1024 |
+ echo "$@" |
1025 |
+ "$@" || die "failed to configure glibc" |
1026 |
+ |
1027 |
+ # ia64 static cross-compilers are a pita in so much that they |
1028 |
+ # can't produce static ELFs (as the libgcc.a is broken). so |
1029 |
+ # disable building of the programs for those targets if it |
1030 |
+ # doesn't work. |
1031 |
+ # XXX: We could turn this into a compiler test, but ia64 is |
1032 |
+ # the only one that matters, so this should be fine for now. |
1033 |
+ if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then |
1034 |
+ sed -i '1i+link-static = touch $@' config.make |
1035 |
+ fi |
1036 |
+ |
1037 |
+ # If we're trying to migrate between ABI sets, we need |
1038 |
+ # to lie and use a local copy of gcc. Like if the system |
1039 |
+ # is built with MULTILIB_ABIS="amd64 x86" but we want to |
1040 |
+ # add x32 to it, gcc/glibc don't yet support x32. |
1041 |
+ # |
1042 |
+ if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
1043 |
+ echo 'main(){}' > "${T}"/test.c |
1044 |
+ if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
1045 |
+ sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
1046 |
+ fi |
1047 |
+ fi |
1048 |
+} |
1049 |
+ |
1050 |
+glibc_headers_configure() { |
1051 |
+ export ABI=default |
1052 |
+ |
1053 |
+ local builddir=$(builddir "headers") |
1054 |
+ mkdir -p "${builddir}" |
1055 |
+ cd "${builddir}" |
1056 |
+ |
1057 |
+ # if we don't have a compiler yet, we can't really test it now ... |
1058 |
+ # hopefully they don't affect header generation, so let's hope for |
1059 |
+ # the best here ... |
1060 |
+ local v vars=( |
1061 |
+ ac_cv_header_cpuid_h=yes |
1062 |
+ libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes |
1063 |
+ libc_cv_asm_cfi_directives=yes |
1064 |
+ libc_cv_broken_visibility_attribute=no |
1065 |
+ libc_cv_c_cleanup=yes |
1066 |
+ libc_cv_compiler_powerpc64le_binary128_ok=yes |
1067 |
+ libc_cv_forced_unwind=yes |
1068 |
+ libc_cv_gcc___thread=yes |
1069 |
+ libc_cv_mlong_double_128=yes |
1070 |
+ libc_cv_mlong_double_128ibm=yes |
1071 |
+ libc_cv_ppc_machine=yes |
1072 |
+ libc_cv_ppc_rel16=yes |
1073 |
+ libc_cv_predef_fortify_source=no |
1074 |
+ libc_cv_target_power8_ok=yes |
1075 |
+ libc_cv_visibility_attribute=yes |
1076 |
+ libc_cv_z_combreloc=yes |
1077 |
+ libc_cv_z_execstack=yes |
1078 |
+ libc_cv_z_initfirst=yes |
1079 |
+ libc_cv_z_nodelete=yes |
1080 |
+ libc_cv_z_nodlopen=yes |
1081 |
+ libc_cv_z_relro=yes |
1082 |
+ libc_mips_abi=${ABI} |
1083 |
+ libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard) |
1084 |
+ # These libs don't have configure flags. |
1085 |
+ ac_cv_lib_audit_audit_log_user_avc_message=no |
1086 |
+ ac_cv_lib_cap_cap_init=no |
1087 |
+ ) |
1088 |
+ |
1089 |
+ einfo "Forcing cached settings:" |
1090 |
+ for v in "${vars[@]}" ; do |
1091 |
+ einfo " ${v}" |
1092 |
+ export ${v} |
1093 |
+ done |
1094 |
+ |
1095 |
+ local headers_only_arch_CPPFLAGS=() |
1096 |
+ |
1097 |
+ # Blow away some random CC settings that screw things up. #550192 |
1098 |
+ if [[ -d ${S}/sysdeps/mips ]]; then |
1099 |
+ pushd "${S}"/sysdeps/mips >/dev/null |
1100 |
+ sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die |
1101 |
+ sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die |
1102 |
+ |
1103 |
+ # Force the mips ABI to the default. This is OK because the set of |
1104 |
+ # installed headers in this phase is the same between the 3 ABIs. |
1105 |
+ # If this ever changes, this hack will break, but that's unlikely |
1106 |
+ # as glibc discourages that behavior. |
1107 |
+ # https://crbug.com/647033 |
1108 |
+ sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die |
1109 |
+ |
1110 |
+ popd >/dev/null |
1111 |
+ fi |
1112 |
+ |
1113 |
+ case ${CTARGET} in |
1114 |
+ riscv*) |
1115 |
+ # RISC-V interrogates the compiler to determine which target to |
1116 |
+ # build. If building the headers then we don't strictly need a |
1117 |
+ # RISC-V compiler, so the built-in definitions that are provided |
1118 |
+ # along with all RISC-V compiler might not exist. This causes |
1119 |
+ # glibc's RISC-V preconfigure script to blow up. Since we're just |
1120 |
+ # building the headers any value will actually work here, so just |
1121 |
+ # pick the standard one (rv64g/lp64d) to make the build scripts |
1122 |
+ # happy for now -- the headers are all the same anyway so it |
1123 |
+ # doesn't matter. |
1124 |
+ headers_only_arch_CPPFLAGS+=( |
1125 |
+ -D__riscv_xlen=64 |
1126 |
+ -D__riscv_flen=64 |
1127 |
+ -D__riscv_float_abi_double=1 |
1128 |
+ -D__riscv_atomic=1 |
1129 |
+ ) ;; |
1130 |
+ esac |
1131 |
+ |
1132 |
+ local myconf=() |
1133 |
+ myconf+=( |
1134 |
+ --disable-sanity-checks |
1135 |
+ --enable-hacker-mode |
1136 |
+ --without-cvs |
1137 |
+ --disable-werror |
1138 |
+ --enable-bind-now |
1139 |
+ --build=${CBUILD_OPT:-${CBUILD}} |
1140 |
+ --host=${CTARGET_OPT:-${CTARGET}} |
1141 |
+ --with-headers=$(alt_build_headers) |
1142 |
+ --prefix="$(host_eprefix)/usr" |
1143 |
+ ${EXTRA_ECONF} |
1144 |
+ ) |
1145 |
+ |
1146 |
+ # Nothing is compiled here which would affect the headers for the target. |
1147 |
+ # So forcing CC/CFLAGS is sane. |
1148 |
+ local headers_only_CC=$(tc-getBUILD_CC) |
1149 |
+ local headers_only_CFLAGS="-O1 -pipe" |
1150 |
+ local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}" |
1151 |
+ local headers_only_LDFLAGS="" |
1152 |
+ set -- "${S}"/configure "${myconf[@]}" |
1153 |
+ echo \ |
1154 |
+ "CC=${headers_only_CC}" \ |
1155 |
+ "CFLAGS=${headers_only_CFLAGS}" \ |
1156 |
+ "CPPFLAGS=${headers_only_CPPFLAGS}" \ |
1157 |
+ "LDFLAGS=${headers_only_LDFLAGS}" \ |
1158 |
+ "$@" |
1159 |
+ CC=${headers_only_CC} \ |
1160 |
+ CFLAGS=${headers_only_CFLAGS} \ |
1161 |
+ CPPFLAGS=${headers_only_CPPFLAGS} \ |
1162 |
+ LDFLAGS="" \ |
1163 |
+ "$@" || die "failed to configure glibc" |
1164 |
+} |
1165 |
+ |
1166 |
+do_src_configure() { |
1167 |
+ if just_headers ; then |
1168 |
+ glibc_headers_configure |
1169 |
+ else |
1170 |
+ glibc_do_configure nptl |
1171 |
+ fi |
1172 |
+} |
1173 |
+ |
1174 |
+src_configure() { |
1175 |
+ foreach_abi do_src_configure |
1176 |
+} |
1177 |
+ |
1178 |
+do_src_compile() { |
1179 |
+ emake -C "$(builddir nptl)" |
1180 |
+} |
1181 |
+ |
1182 |
+src_compile() { |
1183 |
+ if just_headers ; then |
1184 |
+ return |
1185 |
+ fi |
1186 |
+ |
1187 |
+ foreach_abi do_src_compile |
1188 |
+} |
1189 |
+ |
1190 |
+glibc_src_test() { |
1191 |
+ cd "$(builddir nptl)" |
1192 |
+ emake check |
1193 |
+} |
1194 |
+ |
1195 |
+do_src_test() { |
1196 |
+ local ret=0 |
1197 |
+ |
1198 |
+ glibc_src_test |
1199 |
+ : $(( ret |= $? )) |
1200 |
+ |
1201 |
+ return ${ret} |
1202 |
+} |
1203 |
+ |
1204 |
+src_test() { |
1205 |
+ if just_headers ; then |
1206 |
+ return |
1207 |
+ fi |
1208 |
+ |
1209 |
+ # Give tests more time to complete. |
1210 |
+ export TIMEOUTFACTOR=5 |
1211 |
+ |
1212 |
+ foreach_abi do_src_test || die "tests failed" |
1213 |
+} |
1214 |
+ |
1215 |
+run_locale_gen() { |
1216 |
+ # if the host locales.gen contains no entries, we'll install everything |
1217 |
+ local root="$1" |
1218 |
+ local inplace="" |
1219 |
+ |
1220 |
+ if [[ "${root}" == "--inplace-glibc" ]] ; then |
1221 |
+ inplace="--inplace-glibc" |
1222 |
+ root="$2" |
1223 |
+ fi |
1224 |
+ |
1225 |
+ local locale_list="${root}/etc/locale.gen" |
1226 |
+ |
1227 |
+ pushd "${ED}"/$(get_libdir) >/dev/null |
1228 |
+ |
1229 |
+ if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then |
1230 |
+ [[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space" |
1231 |
+ locale_list="${root}/usr/share/i18n/SUPPORTED" |
1232 |
+ fi |
1233 |
+ |
1234 |
+ locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \ |
1235 |
+ --destdir "${root}" |
1236 |
+ |
1237 |
+ popd >/dev/null |
1238 |
+} |
1239 |
+ |
1240 |
+glibc_do_src_install() { |
1241 |
+ local builddir=$(builddir nptl) |
1242 |
+ cd "${builddir}" |
1243 |
+ |
1244 |
+ emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install |
1245 |
+ |
1246 |
+ # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support |
1247 |
+ # which come without headers etc. Only needed for binary packages since the |
1248 |
+ # external net-libs/libnsl has increased soversion. Keep only versioned libraries. |
1249 |
+ find "${D}" -name "libnsl.a" -delete |
1250 |
+ find "${D}" -name "libnsl.so" -delete |
1251 |
+ |
1252 |
+ # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need |
1253 |
+ # to infer upstream version: |
1254 |
+ # '#define VERSION "2.26.90"' -> '2.26.90' |
1255 |
+ local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) |
1256 |
+ |
1257 |
+ # Avoid stripping binaries not targeted by ${CHOST}. Or else |
1258 |
+ # ${CHOST}-strip would break binaries build for ${CTARGET}. |
1259 |
+ is_crosscompile && dostrip -x / |
1260 |
+ # gdb thread introspection relies on local libpthreas symbols. stripping breaks it |
1261 |
+ # See Note [Disable automatic stripping] |
1262 |
+ dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so |
1263 |
+ |
1264 |
+ if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then |
1265 |
+ # Move versioned .a file out of libdir to evade portage QA checks |
1266 |
+ # instead of using gen_usr_ldscript(). We fix ldscript as: |
1267 |
+ # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..." |
1268 |
+ sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die |
1269 |
+ dodir $(alt_usrlibdir)/${P} |
1270 |
+ mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die |
1271 |
+ fi |
1272 |
+ |
1273 |
+ # We'll take care of the cache ourselves |
1274 |
+ rm -f "${ED}"/etc/ld.so.cache |
1275 |
+ |
1276 |
+ # Everything past this point just needs to be done once ... |
1277 |
+ is_final_abi || return 0 |
1278 |
+ |
1279 |
+ # Make sure the non-native interp can be found on multilib systems even |
1280 |
+ # if the main library set isn't installed into the right place. Maybe |
1281 |
+ # we should query the active gcc for info instead of hardcoding it ? |
1282 |
+ local i ldso_abi ldso_name |
1283 |
+ local ldso_abi_list=( |
1284 |
+ # x86 |
1285 |
+ amd64 /lib64/ld-linux-x86-64.so.2 |
1286 |
+ x32 /libx32/ld-linux-x32.so.2 |
1287 |
+ x86 /lib/ld-linux.so.2 |
1288 |
+ # mips |
1289 |
+ o32 /lib/ld.so.1 |
1290 |
+ n32 /lib32/ld.so.1 |
1291 |
+ n64 /lib64/ld.so.1 |
1292 |
+ # powerpc |
1293 |
+ ppc /lib/ld.so.1 |
1294 |
+ ppc64 /lib64/ld64.so.1 |
1295 |
+ # riscv |
1296 |
+ lp64d /lib/ld-linux-riscv64-lp64d.so.1 |
1297 |
+ lp64 /lib/ld-linux-riscv64-lp64.so.1 |
1298 |
+ # s390 |
1299 |
+ s390 /lib/ld.so.1 |
1300 |
+ s390x /lib/ld64.so.1 |
1301 |
+ # sparc |
1302 |
+ sparc32 /lib/ld-linux.so.2 |
1303 |
+ sparc64 /lib64/ld-linux.so.2 |
1304 |
+ ) |
1305 |
+ case $(tc-endian) in |
1306 |
+ little) |
1307 |
+ ldso_abi_list+=( |
1308 |
+ # arm |
1309 |
+ arm64 /lib/ld-linux-aarch64.so.1 |
1310 |
+ ) |
1311 |
+ ;; |
1312 |
+ big) |
1313 |
+ ldso_abi_list+=( |
1314 |
+ # arm |
1315 |
+ arm64 /lib/ld-linux-aarch64_be.so.1 |
1316 |
+ ) |
1317 |
+ ;; |
1318 |
+ esac |
1319 |
+ if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then |
1320 |
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib |
1321 |
+ fi |
1322 |
+ for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do |
1323 |
+ ldso_abi=${ldso_abi_list[i]} |
1324 |
+ has ${ldso_abi} $(get_install_abis) || continue |
1325 |
+ |
1326 |
+ ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}" |
1327 |
+ if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then |
1328 |
+ dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name} |
1329 |
+ fi |
1330 |
+ done |
1331 |
+ |
1332 |
+ # With devpts under Linux mounted properly, we do not need the pt_chown |
1333 |
+ # binary to be setuid. This is because the default owners/perms will be |
1334 |
+ # exactly what we want. |
1335 |
+ if ! use suid ; then |
1336 |
+ find "${ED}" -name pt_chown -exec chmod -s {} + |
1337 |
+ fi |
1338 |
+ |
1339 |
+ ################################################################# |
1340 |
+ # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY # |
1341 |
+ # Make sure we install some symlink hacks so that when we build |
1342 |
+ # a 2nd stage cross-compiler, gcc finds the target system |
1343 |
+ # headers correctly. See gcc/doc/gccinstall.info |
1344 |
+ if is_crosscompile ; then |
1345 |
+ # We need to make sure that /lib and /usr/lib always exists. |
1346 |
+ # gcc likes to use relative paths to get to its multilibs like |
1347 |
+ # /usr/lib/../lib64/. So while we don't install any files into |
1348 |
+ # /usr/lib/, we do need it to exist. |
1349 |
+ keepdir $(alt_prefix)/lib |
1350 |
+ keepdir $(alt_prefix)/usr/lib |
1351 |
+ |
1352 |
+ dosym usr/include $(alt_prefix)/sys-include |
1353 |
+ return 0 |
1354 |
+ fi |
1355 |
+ |
1356 |
+ # Files for Debian-style locale updating |
1357 |
+ dodir /usr/share/i18n |
1358 |
+ sed \ |
1359 |
+ -e "/^#/d" \ |
1360 |
+ -e "/SUPPORTED-LOCALES=/d" \ |
1361 |
+ -e "s: \\\\::g" -e "s:/: :g" \ |
1362 |
+ "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ |
1363 |
+ || die "generating /usr/share/i18n/SUPPORTED failed" |
1364 |
+ cd "${WORKDIR}"/extra/locale |
1365 |
+ dosbin locale-gen |
1366 |
+ doman *.[0-8] |
1367 |
+ insinto /etc |
1368 |
+ doins locale.gen |
1369 |
+ |
1370 |
+ # Make sure all the ABI's can find the locales and so we only |
1371 |
+ # have to generate one set |
1372 |
+ local a |
1373 |
+ keepdir /usr/$(get_libdir)/locale |
1374 |
+ for a in $(get_install_abis) ; do |
1375 |
+ if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then |
1376 |
+ dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale |
1377 |
+ fi |
1378 |
+ done |
1379 |
+ |
1380 |
+ # HACK: If we're building for riscv, we need to additionally make sure that |
1381 |
+ # we can find the locale archive afterwards |
1382 |
+ case ${CTARGET} in |
1383 |
+ riscv*) |
1384 |
+ if [[ ! -e ${ED}/usr/lib/locale ]] ; then |
1385 |
+ dosym ../$(get_libdir)/locale /usr/lib/locale |
1386 |
+ fi |
1387 |
+ ;; |
1388 |
+ *) ;; |
1389 |
+ esac |
1390 |
+ |
1391 |
+ cd "${S}" |
1392 |
+ |
1393 |
+ # Install misc network config files |
1394 |
+ insinto /etc |
1395 |
+ doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf |
1396 |
+ doins "${WORKDIR}"/extra/etc/*.conf |
1397 |
+ |
1398 |
+ if use nscd ; then |
1399 |
+ doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)" |
1400 |
+ |
1401 |
+ local nscd_args=( |
1402 |
+ -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" |
1403 |
+ ) |
1404 |
+ |
1405 |
+ sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd |
1406 |
+ |
1407 |
+ systemd_dounit nscd/nscd.service |
1408 |
+ systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf |
1409 |
+ else |
1410 |
+ # Do this since extra/etc/*.conf above might have nscd.conf. |
1411 |
+ rm -f "${ED}"/etc/nscd.conf |
1412 |
+ fi |
1413 |
+ |
1414 |
+ echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc |
1415 |
+ doenvd "${T}"/00glibc |
1416 |
+ |
1417 |
+ for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do |
1418 |
+ [[ -s ${d} ]] && dodoc ${d} |
1419 |
+ done |
1420 |
+ dodoc -r ChangeLog.old |
1421 |
+ |
1422 |
+ # Prevent overwriting of the /etc/localtime symlink. We'll handle the |
1423 |
+ # creation of the "factory" symlink in pkg_postinst(). |
1424 |
+ rm -f "${ED}"/etc/localtime |
1425 |
+ |
1426 |
+ # Generate all locales if this is a native build as locale generation |
1427 |
+ if use compile-locales && ! is_crosscompile ; then |
1428 |
+ run_locale_gen --inplace-glibc "${ED}/" |
1429 |
+ sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die |
1430 |
+ fi |
1431 |
+} |
1432 |
+ |
1433 |
+glibc_headers_install() { |
1434 |
+ local builddir=$(builddir "headers") |
1435 |
+ cd "${builddir}" |
1436 |
+ emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers |
1437 |
+ |
1438 |
+ insinto $(alt_headers)/gnu |
1439 |
+ doins "${S}"/include/gnu/stubs.h |
1440 |
+ |
1441 |
+ # Make sure we install the sys-include symlink so that when |
1442 |
+ # we build a 2nd stage cross-compiler, gcc finds the target |
1443 |
+ # system headers correctly. See gcc/doc/gccinstall.info |
1444 |
+ dosym usr/include $(alt_prefix)/sys-include |
1445 |
+} |
1446 |
+ |
1447 |
+src_install() { |
1448 |
+ if just_headers ; then |
1449 |
+ export ABI=default |
1450 |
+ glibc_headers_install |
1451 |
+ return |
1452 |
+ fi |
1453 |
+ |
1454 |
+ foreach_abi glibc_do_src_install |
1455 |
+} |
1456 |
+ |
1457 |
+# Simple test to make sure our new glibc isn't completely broken. |
1458 |
+# Make sure we don't test with statically built binaries since |
1459 |
+# they will fail. Also, skip if this glibc is a cross compiler. |
1460 |
+# |
1461 |
+# If coreutils is built with USE=multicall, some of these files |
1462 |
+# will just be wrapper scripts, not actual ELFs we can test. |
1463 |
+glibc_sanity_check() { |
1464 |
+ cd / #228809 |
1465 |
+ |
1466 |
+ # We enter ${ED} so to avoid trouble if the path contains |
1467 |
+ # special characters; for instance if the path contains the |
1468 |
+ # colon character (:), then the linker will try to split it |
1469 |
+ # and look for the libraries in an unexpected place. This can |
1470 |
+ # lead to unsafe code execution if the generated prefix is |
1471 |
+ # within a world-writable directory. |
1472 |
+ # (e.g. /var/tmp/portage:${HOSTNAME}) |
1473 |
+ pushd "${ED}"/$(get_libdir) >/dev/null |
1474 |
+ |
1475 |
+ local x striptest |
1476 |
+ for x in cal date env free ls true uname uptime ; do |
1477 |
+ x=$(type -p ${x}) |
1478 |
+ [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue |
1479 |
+ striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue |
1480 |
+ case ${striptest} in |
1481 |
+ *"statically linked"*) continue;; |
1482 |
+ *"ASCII text"*) continue;; |
1483 |
+ esac |
1484 |
+ # We need to clear the locale settings as the upgrade might want |
1485 |
+ # incompatible locale data. This test is not for verifying that. |
1486 |
+ LC_ALL=C \ |
1487 |
+ ./ld-*.so --library-path . ${x} > /dev/null \ |
1488 |
+ || die "simple run test (${x}) failed" |
1489 |
+ done |
1490 |
+ |
1491 |
+ popd >/dev/null |
1492 |
+} |
1493 |
+ |
1494 |
+pkg_preinst() { |
1495 |
+ # nothing to do if just installing headers |
1496 |
+ just_headers && return |
1497 |
+ |
1498 |
+ # prepare /etc/ld.so.conf.d/ for files |
1499 |
+ mkdir -p "${EROOT}"/etc/ld.so.conf.d |
1500 |
+ |
1501 |
+ # Default /etc/hosts.conf:multi to on for systems with small dbs. |
1502 |
+ if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then |
1503 |
+ sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf |
1504 |
+ einfo "Defaulting /etc/host.conf:multi to on" |
1505 |
+ fi |
1506 |
+ |
1507 |
+ [[ -n ${ROOT} ]] && return 0 |
1508 |
+ [[ -d ${ED}/$(get_libdir) ]] || return 0 |
1509 |
+ [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check |
1510 |
+} |
1511 |
+ |
1512 |
+pkg_postinst() { |
1513 |
+ # nothing to do if just installing headers |
1514 |
+ just_headers && return |
1515 |
+ |
1516 |
+ if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then |
1517 |
+ # Generate fastloading iconv module configuration file. |
1518 |
+ "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/" |
1519 |
+ fi |
1520 |
+ |
1521 |
+ if ! is_crosscompile && [[ -z ${ROOT} ]] ; then |
1522 |
+ use compile-locales || run_locale_gen "${EROOT}/" |
1523 |
+ fi |
1524 |
+ |
1525 |
+ # Check for sanity of /etc/nsswitch.conf, take 2 |
1526 |
+ if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then |
1527 |
+ local entry |
1528 |
+ for entry in passwd group shadow; do |
1529 |
+ if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then |
1530 |
+ ewarn "" |
1531 |
+ ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been" |
1532 |
+ ewarn "removed from glibc and is now provided by the package" |
1533 |
+ ewarn " sys-auth/libnss-nis" |
1534 |
+ ewarn "Install it now to keep your NIS setup working." |
1535 |
+ ewarn "" |
1536 |
+ fi |
1537 |
+ done |
1538 |
+ fi |
1539 |
+} |