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