Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
Date: Wed, 27 Nov 2019 22:51:08
Message-Id: 1574895059.bcf02d0a8562bb7dbd0839eecd1f0748fc40ea39.dilfridge@gentoo
1 commit: bcf02d0a8562bb7dbd0839eecd1f0748fc40ea39
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 27 22:50:46 2019 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 27 22:50:59 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcf02d0a
7
8 sys-libs/glibc: Remove old revs
9
10 Package-Manager: Portage-2.3.80, Repoman-2.3.19
11 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
12
13 sys-libs/glibc/Manifest | 2 -
14 sys-libs/glibc/glibc-2.29-r5.ebuild | 1472 ----------------------------------
15 sys-libs/glibc/glibc-2.29-r6.ebuild | 1477 -----------------------------------
16 3 files changed, 2951 deletions(-)
17
18 diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
19 index 96f7cce5fb3..304a7131733 100644
20 --- a/sys-libs/glibc/Manifest
21 +++ b/sys-libs/glibc/Manifest
22 @@ -13,8 +13,6 @@ DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea
23 DIST glibc-2.28-patches-9.tar.xz 98588 BLAKE2B 4ab583be712994f949dee2512da6e12fd7f7ad73e96393f21678552b43da98f49321b53b5b009551300cdb09ca135e7f6adc636ff750c251a1d6d7f262dbc410 SHA512 e3f40ae6e9d06471c1a11bd2bce7b5161d07c3d0a81791505a72aec4817e7faf9ef09841e98c6dcf62a0a00754dff87dd194d97ac6b6354aeb2497cf60900b96
24 DIST glibc-2.28.tar.xz 16484344 BLAKE2B 9aa8cbd5a145c2a6fde3a60b3d0a14b12b46ed79333ad1ca3e73464adcfe700277a17a9e7fd0ca36e355a0c5b0b27decfa091da320ba802741ad75cc955bbcc8 SHA512 521f820953ff07c69ece4c2186f59fc061a7f9747932cd70ef2995c2b2deee76eeb6de700d85071cdca5949179aa8ccee75eda7feca1394121ec7b821ad0a3f3
25 DIST glibc-2.29-patches-3.tar.xz 35812 BLAKE2B 90b8bc57b7a63f03617795c368b92e525eccfec462d638dbc25c581e5b7a2a72ffd5191842f5ac443a868cbc950838d7e5120e866d343a14b80c55dcbfa48f30 SHA512 4c9b78d9d1a8aa629418f2d758ef800857780b8a1fd8d3582b88348a513ca26ca7f6ac9110a8c6bae16949b360ba36840d184f42293cd4324760273592d1b438
26 -DIST glibc-2.29-patches-6.tar.xz 64076 BLAKE2B 04c1baf838eff9275e79145d4a5a642dcd6572aadcdfc6782769f2de107dcd1648b81d0690068db8c0d53229efe2130e279f4aafe8a91238e5dd6a8a7120a433 SHA512 6494dcd23441fe308de97706f7abbea1571e0015d1456e719268b8026e1fb23733c2efd5256840f4b9f0df4f02ac7827b1fad56905cbd8919bca9c25b0afe822
27 -DIST glibc-2.29-patches-7.tar.xz 64752 BLAKE2B 766f3f2d11aedf7e1b83db94fd2793244e29abc0beb78071a3eadfb83d3589f56b07b68c8faffd77ecc859497ba52f0327e03cf984b00adbeee3e196b0c5e57c SHA512 aea61fd3e084b293d0a92c89cd83d176ca95112e23224091e31ac77f54089922926ebbd9b75748d5b750f3d88c6f55f9953f11375a07a219946c485d4bf6bcaf
28 DIST glibc-2.29-patches-8.tar.xz 102712 BLAKE2B 49aacff358c0f8499c444e73eec92f402b81236d6a91d1fc9864f974c5cb72fc5c87bf5ee77700a8333db4c68892b3940948158530cea0d0fbbda51df0ae7953 SHA512 7a929e023294e6b76569120cc234bc862f3e260994e56c3a2fc2b969b7313c94a47de7ef85f4e93c9083c16fde987ca470ab9d69d881ab49a22f5fd3a721703a
29 DIST glibc-2.29.tar.xz 16515488 BLAKE2B b754e6825176538a2b8ca03fce014f0d87d333dc4d038bf0cda5ee8a2f484cd3ce93ad78ec126737e093ab64b55ceedf04cd08aecb4f8041daaa329e99717afa SHA512 146bc0769fe853d9edbf93cea7f74c5b3d84d69cb7614c62588e7acdecd1ec789a9d8949f3e8b99f8f36f2ccac740a003bed94f32b07817baf780b06cfeb6ed0
30 DIST glibc-2.30-patches-3.tar.xz 20412 BLAKE2B 8cd588284bf07985262a0289d8cbae03b0a75c48110fed6152c0431dc4f729a9695df910b1521a6072e9736b26145bf372d5b60163f64f4556f17f2f9f223e11 SHA512 0da9107518117a1cf901d282f2b84a2f4780130ab9eb7025ffd8b7e629aa6fd5f05b293dd49fc3c300bc2e74e7f81fc1f8a7cb12428b2be086a160d429715758
31
32 diff --git a/sys-libs/glibc/glibc-2.29-r5.ebuild b/sys-libs/glibc/glibc-2.29-r5.ebuild
33 deleted file mode 100644
34 index 5cb7bd73144..00000000000
35 --- a/sys-libs/glibc/glibc-2.29-r5.ebuild
36 +++ /dev/null
37 @@ -1,1472 +0,0 @@
38 -# Copyright 1999-2019 Gentoo Authors
39 -# Distributed under the terms of the GNU General Public License v2
40 -
41 -EAPI=6
42 -
43 -PYTHON_COMPAT=( python3_{5,6,7} )
44 -
45 -inherit python-any-r1 prefix eutils eapi7-ver toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
46 - multilib systemd multiprocessing
47 -
48 -DESCRIPTION="GNU libc C library"
49 -HOMEPAGE="https://www.gnu.org/software/libc/"
50 -LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
51 -SLOT="2.2"
52 -
53 -EMULTILIB_PKG="true"
54 -
55 -if [[ ${PV} == 9999* ]]; then
56 - EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
57 - inherit git-r3
58 -else
59 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
60 - SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
61 -fi
62 -
63 -RELEASE_VER=${PV}
64 -
65 -GCC_BOOTSTRAP_VER=20180511
66 -
67 -# Gentoo patchset
68 -PATCH_VER=6
69 -
70 -SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
71 -SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
72 -
73 -IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
74 -
75 -# Minimum kernel version that glibc requires
76 -MIN_KERN_VER="3.2.0"
77 -
78 -# Here's how the cross-compile logic breaks down ...
79 -# CTARGET - machine that will target the binaries
80 -# CHOST - machine that will host the binaries
81 -# CBUILD - machine that will build the binaries
82 -# If CTARGET != CHOST, it means you want a libc for cross-compiling.
83 -# If CHOST != CBUILD, it means you want to cross-compile the libc.
84 -# CBUILD = CHOST = CTARGET - native build/install
85 -# CBUILD != (CHOST = CTARGET) - cross-compile a native build
86 -# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
87 -# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
88 -# For install paths:
89 -# CHOST = CTARGET - install into /
90 -# CHOST != CTARGET - install into /usr/CTARGET/
91 -#
92 -export CBUILD=${CBUILD:-${CHOST}}
93 -export CTARGET=${CTARGET:-${CHOST}}
94 -if [[ ${CTARGET} == ${CHOST} ]] ; then
95 - if [[ ${CATEGORY} == cross-* ]] ; then
96 - export CTARGET=${CATEGORY#cross-}
97 - fi
98 -fi
99 -
100 -# Note [Disable automatic stripping]
101 -# Disabling automatic stripping for a few reasons:
102 -# - portage's attempt to strip breaks non-native binaries at least on
103 -# arm: bug #697428
104 -# - portage's attempt to strip libpthread.so.0 breaks gdb thread
105 -# enumeration: bug #697910. This is quite subtle:
106 -# * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
107 -# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
108 -# via 'ps_pglobal_lookup' symbol defined in gdb.
109 -# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
110 -# known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
111 -# (unexported) is used to sanity check compatibility before enabling
112 -# debugging.
113 -# 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
114 -# * normal 'strip' command trims '.symtab'
115 -# Thus our main goal here is to prevent 'libpthread.so.0' from
116 -# losing it's '.symtab' entries.
117 -# As Gentoo's strip does not allow us to pass less aggressive stripping
118 -# options and does not check the machine target we disable stripping
119 -# entirely.
120 -RESTRICT="strip !test? ( test )"
121 -
122 -# We need a new-enough binutils/gcc to match upstream baseline.
123 -# Also we need to make sure our binutils/gcc supports TLS,
124 -# and that gcc already contains the hardened patches.
125 -COMMON_DEPEND="
126 - nscd? ( selinux? (
127 - audit? ( sys-process/audit )
128 - caps? ( sys-libs/libcap )
129 - ) )
130 - suid? ( caps? ( sys-libs/libcap ) )
131 - selinux? ( sys-libs/libselinux )
132 - systemtap? ( dev-util/systemtap )
133 -"
134 -DEPEND="${COMMON_DEPEND}
135 - ${PYTHON_DEPS}
136 - >=app-misc/pax-utils-0.1.10
137 - sys-devel/bison
138 - !<sys-devel/bison-2.7
139 - !<sys-devel/make-4
140 - doc? ( sys-apps/texinfo )
141 - test? ( >=net-dns/libidn2-2.0.5 )
142 -"
143 -RDEPEND="${COMMON_DEPEND}
144 - sys-apps/gentoo-functions
145 -"
146 -
147 -if [[ ${CATEGORY} == cross-* ]] ; then
148 - DEPEND+=" !headers-only? (
149 - >=${CATEGORY}/binutils-2.24
150 - >=${CATEGORY}/gcc-6
151 - )"
152 - [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
153 -else
154 - DEPEND+="
155 - >=sys-devel/binutils-2.24
156 - >=sys-devel/gcc-6
157 - virtual/os-headers
158 - "
159 - RDEPEND+="
160 - >=net-dns/libidn2-2.0.5
161 - vanilla? ( !sys-libs/timezone-data )
162 - "
163 - PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
164 -fi
165 -
166 -#
167 -# Small helper functions
168 -#
169 -
170 -is_crosscompile() {
171 - [[ ${CHOST} != ${CTARGET} ]]
172 -}
173 -
174 -just_headers() {
175 - is_crosscompile && use headers-only
176 -}
177 -
178 -alt_prefix() {
179 - is_crosscompile && echo /usr/${CTARGET}
180 -}
181 -
182 -# This prefix is applicable to CHOST when building against this
183 -# glibc. It is baked into the library at configure time.
184 -host_eprefix() {
185 - is_crosscompile || echo "${EPREFIX}"
186 -}
187 -
188 -# This prefix is applicable to CBUILD when building against this
189 -# glibc. It determines the destination path at install time.
190 -build_eprefix() {
191 - is_crosscompile && echo "${EPREFIX}"
192 -}
193 -
194 -# We need to be able to set alternative headers for compiling for non-native
195 -# platform. Will also become useful for testing kernel-headers without screwing
196 -# up the whole system.
197 -alt_headers() {
198 - echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
199 -}
200 -
201 -alt_build_headers() {
202 - if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
203 - ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
204 - if tc-is-cross-compiler ; then
205 - ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
206 - if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
207 - local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
208 - ALT_BUILD_HEADERS=${header_path%/linux/version.h}
209 - fi
210 - fi
211 - fi
212 - echo "${ALT_BUILD_HEADERS}"
213 -}
214 -
215 -alt_libdir() {
216 - echo $(alt_prefix)/$(get_libdir)
217 -}
218 -alt_usrlibdir() {
219 - echo $(alt_prefix)/usr/$(get_libdir)
220 -}
221 -
222 -builddir() {
223 - echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
224 -}
225 -
226 -do_compile_test() {
227 - local ret save_cflags=${CFLAGS}
228 - CFLAGS+=" $1"
229 - shift
230 -
231 - pushd "${T}" >/dev/null
232 -
233 - rm -f glibc-test*
234 - printf '%b' "$*" > glibc-test.c
235 -
236 - nonfatal emake -s glibc-test
237 - ret=$?
238 -
239 - popd >/dev/null
240 -
241 - CFLAGS=${save_cflags}
242 - return ${ret}
243 -}
244 -
245 -do_run_test() {
246 - local ret
247 -
248 - if [[ ${MERGE_TYPE} == "binary" ]] ; then
249 - # ignore build failures when installing a binary package #324685
250 - do_compile_test "" "$@" 2>/dev/null || return 0
251 - else
252 - if ! do_compile_test "" "$@" ; then
253 - ewarn "Simple build failed ... assuming this is desired #324685"
254 - return 0
255 - fi
256 - fi
257 -
258 - pushd "${T}" >/dev/null
259 -
260 - ./glibc-test
261 - ret=$?
262 - rm -f glibc-test*
263 -
264 - popd >/dev/null
265 -
266 - return ${ret}
267 -}
268 -
269 -setup_target_flags() {
270 - # This largely mucks with compiler flags. None of which should matter
271 - # when building up just the headers.
272 - just_headers && return 0
273 -
274 - case $(tc-arch) in
275 - x86)
276 - # -march needed for #185404 #199334
277 - # TODO: When creating the first glibc cross-compile, this test will
278 - # always fail as it does a full link which in turn requires glibc.
279 - # Probably also applies when changing multilib profile settings (e.g.
280 - # enabling x86 when the profile was amd64-only previously).
281 - # We could change main to _start and pass -nostdlib here so that we
282 - # only test the gcc code compilation. Or we could do a compile and
283 - # then look for the symbol via scanelf.
284 - 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
285 - local t=${CTARGET_OPT:-${CTARGET}}
286 - t=${t%%-*}
287 - filter-flags '-march=*'
288 - export CFLAGS="-march=${t} ${CFLAGS}"
289 - einfo "Auto adding -march=${t} to CFLAGS #185404"
290 - fi
291 - ;;
292 - amd64)
293 - # -march needed for #185404 #199334
294 - # Note: This test only matters when the x86 ABI is enabled, so we could
295 - # optimize a bit and elide it.
296 - # TODO: See cross-compile issues listed above for x86.
297 - 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
298 - local t=${CTARGET_OPT:-${CTARGET}}
299 - t=${t%%-*}
300 - # Normally the target is x86_64-xxx, so turn that into the -march that
301 - # gcc actually accepts. #528708
302 - [[ ${t} == "x86_64" ]] && t="x86-64"
303 - filter-flags '-march=*'
304 - # ugly, ugly, ugly. ugly.
305 - CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}")
306 - export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
307 - einfo "Auto adding -march=${t} to CFLAGS_x86 #185404"
308 - fi
309 - ;;
310 - mips)
311 - # The mips abi cannot support the GNU style hashes. #233233
312 - filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
313 - ;;
314 - sparc)
315 - # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though.
316 - filter-flags "-fcall-used-g7"
317 - append-flags "-fcall-used-g6"
318 -
319 - # If the CHOST is the basic one (e.g. not sparcv9-xxx already),
320 - # try to pick a better one so glibc can use cpu-specific .S files.
321 - # We key off the CFLAGS to get a good value. Also need to handle
322 - # version skew.
323 - # We can't force users to set their CHOST to their exact machine
324 - # as many of these are not recognized by config.sub/gcc and such :(.
325 - # Note: If the mcpu values don't scale, we might try probing CPP defines.
326 - # Note: Should we factor in -Wa,-AvXXX flags too ? Or -mvis/etc... ?
327 -
328 - local cpu
329 - case ${CTARGET} in
330 - sparc64-*)
331 - case $(get-flag mcpu) in
332 - niagara[234])
333 - if ver_test -ge 2.8 ; then
334 - cpu="sparc64v2"
335 - elif ver_test -ge 2.4 ; then
336 - cpu="sparc64v"
337 - elif ver_test -ge 2.2.3 ; then
338 - cpu="sparc64b"
339 - fi
340 - ;;
341 - niagara)
342 - if ver_test -ge 2.4 ; then
343 - cpu="sparc64v"
344 - elif ver_test -ge 2.2.3 ; then
345 - cpu="sparc64b"
346 - fi
347 - ;;
348 - ultrasparc3)
349 - cpu="sparc64b"
350 - ;;
351 - *)
352 - # We need to force at least v9a because the base build doesn't
353 - # work with just v9.
354 - # https://sourceware.org/bugzilla/show_bug.cgi?id=19477
355 - [[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
356 - ;;
357 - esac
358 - ;;
359 - sparc-*)
360 - case $(get-flag mcpu) in
361 - niagara[234])
362 - if ver_test -ge 2.8 ; then
363 - cpu="sparcv9v2"
364 - elif ver_test -ge 2.4 ; then
365 - cpu="sparcv9v"
366 - elif ver_test -ge 2.2.3 ; then
367 - cpu="sparcv9b"
368 - else
369 - cpu="sparcv9"
370 - fi
371 - ;;
372 - niagara)
373 - if ver_test -ge 2.4 ; then
374 - cpu="sparcv9v"
375 - elif ver_test -ge 2.2.3 ; then
376 - cpu="sparcv9b"
377 - else
378 - cpu="sparcv9"
379 - fi
380 - ;;
381 - ultrasparc3)
382 - cpu="sparcv9b"
383 - ;;
384 - v9|ultrasparc)
385 - cpu="sparcv9"
386 - ;;
387 - v8|supersparc|hypersparc|leon|leon3)
388 - cpu="sparcv8"
389 - ;;
390 - esac
391 - ;;
392 - esac
393 - [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
394 - ;;
395 - esac
396 -}
397 -
398 -setup_flags() {
399 - # Make sure host make.conf doesn't pollute us
400 - if is_crosscompile || tc-is-cross-compiler ; then
401 - CHOST=${CTARGET} strip-unsupported-flags
402 - fi
403 -
404 - # Store our CFLAGS because it's changed depending on which CTARGET
405 - # we are building when pulling glibc on a multilib profile
406 - CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
407 - CFLAGS=${CFLAGS_BASE}
408 - CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
409 - CXXFLAGS=${CXXFLAGS_BASE}
410 - ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
411 - ASFLAGS=${ASFLAGS_BASE}
412 -
413 - # Over-zealous CFLAGS can often cause problems. What may work for one
414 - # person may not work for another. To avoid a large influx of bugs
415 - # relating to failed builds, we strip most CFLAGS out to ensure as few
416 - # problems as possible.
417 - strip-flags
418 - strip-unsupported-flags
419 - filter-flags -m32 -m64 '-mabi=*'
420 -
421 - # glibc aborts if rpath is set by LDFLAGS
422 - filter-ldflags '-Wl,-rpath=*'
423 -
424 - # #492892
425 - filter-flags -frecord-gcc-switches
426 -
427 - unset CBUILD_OPT CTARGET_OPT
428 - if use multilib ; then
429 - CTARGET_OPT=$(get_abi_CTARGET)
430 - [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
431 - fi
432 -
433 - setup_target_flags
434 -
435 - if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
436 - CBUILD_OPT=${CTARGET_OPT}
437 - fi
438 -
439 - # Lock glibc at -O2; we want to be conservative here.
440 - # -fno-strict-aliasing is to work around #155906.
441 - filter-flags '-O?'
442 - append-flags -O2 -fno-strict-aliasing
443 -
444 - filter-flags '-fstack-protector*'
445 -}
446 -
447 -want_tls() {
448 - # Archs that can use TLS (Thread Local Storage)
449 - case $(tc-arch) in
450 - x86)
451 - # requires i486 or better #106556
452 - [[ ${CTARGET} == i[4567]86* ]] && return 0
453 - return 1
454 - ;;
455 - esac
456 - return 0
457 -}
458 -
459 -want__thread() {
460 - want_tls || return 1
461 -
462 - # For some reason --with-tls --with__thread is causing segfaults on sparc32.
463 - [[ ${PROFILE_ARCH} == "sparc" ]] && return 1
464 -
465 - [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD}
466 -
467 - # only test gcc -- can't test linking yet
468 - tc-has-tls -c ${CTARGET}
469 - WANT__THREAD=$?
470 -
471 - return ${WANT__THREAD}
472 -}
473 -
474 -use_multiarch() {
475 - # Allow user to disable runtime arch detection in multilib.
476 - use multiarch || return 1
477 - # Make sure binutils is new enough to support indirect functions,
478 - # #336792. This funky sed supports gold and bfd linkers.
479 - local bver nver
480 - bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
481 - case $(tc-arch ${CTARGET}) in
482 - amd64|x86) nver="2.20" ;;
483 - arm) nver="2.22" ;;
484 - hppa) nver="2.23" ;;
485 - ppc|ppc64) nver="2.20" ;;
486 - # ifunc support was added in 2.23, but glibc also needs
487 - # machinemode which is in 2.24.
488 - s390) nver="2.24" ;;
489 - sparc) nver="2.21" ;;
490 - *) return 1 ;;
491 - esac
492 - ver_test ${bver} -ge ${nver}
493 -}
494 -
495 -# Setup toolchain variables that had historically been defined in the
496 -# profiles for these archs.
497 -setup_env() {
498 - # silly users
499 - unset LD_RUN_PATH
500 - unset LD_ASSUME_KERNEL
501 -
502 - if is_crosscompile || tc-is-cross-compiler ; then
503 - multilib_env ${CTARGET_OPT:-${CTARGET}}
504 -
505 - if ! use multilib ; then
506 - MULTILIB_ABIS=${DEFAULT_ABI}
507 - else
508 - MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
509 - fi
510 -
511 - # If the user has CFLAGS_<CTARGET> in their make.conf, use that,
512 - # and fall back on CFLAGS.
513 - local VAR=CFLAGS_${CTARGET//[-.]/_}
514 - CFLAGS=${!VAR-${CFLAGS}}
515 - einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}"
516 - fi
517 -
518 - setup_flags
519 -
520 - export ABI=${ABI:-${DEFAULT_ABI:-default}}
521 -
522 - if just_headers ; then
523 - # Avoid mixing host's CC and target's CFLAGS_${ABI}:
524 - # At this bootstrap stage we have only binutils for
525 - # target but not compiler yet.
526 - einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
527 - return 0
528 - fi
529 - local VAR=CFLAGS_${ABI}
530 - # We need to export CFLAGS with abi information in them because glibc's
531 - # configure script checks CFLAGS for some targets (like mips). Keep
532 - # around the original clean value to avoid appending multiple ABIs on
533 - # top of each other.
534 - : ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})}
535 - export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
536 - einfo " $(printf '%15s' 'Manual CC:') ${CC}"
537 -}
538 -
539 -foreach_abi() {
540 - setup_env
541 -
542 - local ret=0
543 - local abilist=""
544 - if use multilib ; then
545 - abilist=$(get_install_abis)
546 - else
547 - abilist=${DEFAULT_ABI}
548 - fi
549 - local -x ABI
550 - for ABI in ${abilist:-default} ; do
551 - setup_env
552 - einfo "Running $1 for ABI ${ABI}"
553 - $1
554 - : $(( ret |= $? ))
555 - done
556 - return ${ret}
557 -}
558 -
559 -glibc_banner() {
560 - local b="Gentoo ${PVR}"
561 - [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
562 - echo "${b}"
563 -}
564 -
565 -check_devpts() {
566 - # Make sure devpts is mounted correctly for use w/out setuid pt_chown.
567 -
568 - # If merely building the binary package, then there's nothing to verify.
569 - [[ ${MERGE_TYPE} == "buildonly" ]] && return
570 -
571 - # Only sanity check when installing the native glibc.
572 - [[ ${ROOT} != "/" ]] && return
573 -
574 - # If they're opting in to the old suid code, then no need to check.
575 - use suid && return
576 -
577 - if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
578 - eerror "In order to use glibc with USE=-suid, you must make sure that"
579 - eerror "you have devpts mounted at /dev/pts with the gid=5 option."
580 - eerror "Openrc should do this for you, so you should check /etc/fstab"
581 - eerror "and make sure you do not have any invalid settings there."
582 - die "mount & fix your /dev/pts settings"
583 - fi
584 -}
585 -
586 -# The following Kernel version handling functions are mostly copied from portage
587 -# source. It's better not to use linux-info.eclass here since a) it adds too
588 -# much magic, see bug 326693 for some of the arguments, and b) some of the
589 -# functions are just not provided.
590 -
591 -g_get_running_KV() {
592 - uname -r
593 - return $?
594 -}
595 -
596 -g_KV_major() {
597 - [[ -z $1 ]] && return 1
598 - local KV=$@
599 - echo "${KV%%.*}"
600 -}
601 -
602 -g_KV_minor() {
603 - [[ -z $1 ]] && return 1
604 - local KV=$@
605 - KV=${KV#*.}
606 - echo "${KV%%.*}"
607 -}
608 -
609 -g_KV_micro() {
610 - [[ -z $1 ]] && return 1
611 - local KV=$@
612 - KV=${KV#*.*.}
613 - echo "${KV%%[^[:digit:]]*}"
614 -}
615 -
616 -g_KV_to_int() {
617 - [[ -z $1 ]] && return 1
618 - local KV_MAJOR=$(g_KV_major "$1")
619 - local KV_MINOR=$(g_KV_minor "$1")
620 - local KV_MICRO=$(g_KV_micro "$1")
621 - local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
622 -
623 - # We make version 2.2.0 the minimum version we will handle as
624 - # a sanity check ... if its less, we fail ...
625 - if [[ ${KV_int} -ge 131584 ]] ; then
626 - echo "${KV_int}"
627 - return 0
628 - fi
629 - return 1
630 -}
631 -
632 -g_int_to_KV() {
633 - local version=$1 major minor micro
634 - major=$((version / 65536))
635 - minor=$(((version % 65536) / 256))
636 - micro=$((version % 256))
637 - echo ${major}.${minor}.${micro}
638 -}
639 -
640 -eend_KV() {
641 - [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
642 - eend $?
643 -}
644 -
645 -get_kheader_version() {
646 - printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
647 - $(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
648 - tail -n 1
649 -}
650 -
651 -# We collect all sanity checks here. Consistency is not guranteed between
652 -# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
653 -# src_unpack.
654 -sanity_prechecks() {
655 - # Make sure devpts is mounted correctly for use w/out setuid pt_chown
656 - check_devpts
657 -
658 - # Prevent native builds from downgrading
659 - if [[ ${MERGE_TYPE} != "buildonly" ]] && \
660 - [[ ${ROOT} == "/" ]] && \
661 - [[ ${CBUILD} == ${CHOST} ]] && \
662 - [[ ${CHOST} == ${CTARGET} ]] ; then
663 -
664 - # The high rev # is to allow people to downgrade between -r#
665 - # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
666 - # should be fine. Hopefully we never actually use a r# this
667 - # high.
668 - if has_version ">${CATEGORY}/${P}-r10000" ; then
669 - eerror "Sanity check to keep you from breaking your system:"
670 - eerror " Downgrading glibc is not supported and a sure way to destruction."
671 - [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
672 - fi
673 -
674 - if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
675 - eerror "Your old kernel is broken. You need to update it to a newer"
676 - eerror "version as syscall(<bignum>) will break. See bug 279260."
677 - die "Old and broken kernel."
678 - fi
679 - fi
680 -
681 - # Users have had a chance to phase themselves, time to give em the boot
682 - if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
683 - eerror "You still haven't deleted ${EROOT}/etc/locales.build."
684 - eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
685 - die "Lazy upgrader detected"
686 - fi
687 -
688 - if [[ ${CTARGET} == i386-* ]] ; then
689 - eerror "i386 CHOSTs are no longer supported."
690 - eerror "Chances are you don't actually want/need i386."
691 - eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
692 - die "Please fix your CHOST"
693 - fi
694 -
695 - if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
696 - ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
697 - ewarn "This will result in a 50% performance penalty when running with a 32bit"
698 - ewarn "hypervisor, which is probably not what you want."
699 - fi
700 -
701 - # Check for sanity of /etc/nsswitch.conf
702 - if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
703 - local entry
704 - for entry in passwd group shadow; do
705 - if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
706 - eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
707 - eerror "Please make sure you have 'files' entries for"
708 - eerror "'passwd:', 'group:' and 'shadow:' databases."
709 - eerror "For more details see:"
710 - eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
711 - die "nsswitch.conf has no 'files' provider in '${entry}'."
712 - fi
713 - done
714 - fi
715 -
716 - # ABI-specific checks follow here. Hey, we have a lot more specific conditions that
717 - # we test for...
718 - if ! is_crosscompile ; then
719 - if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
720 - ebegin "Checking that IA32 emulation is enabled in the running kernel"
721 - echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c"
722 - local STAT
723 - if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then
724 - "${T}/check-ia32-emulation.elf32"
725 - STAT=$?
726 - else
727 - # Don't fail here to allow single->multi ABI switch
728 - # or recover from breakage like bug #646424
729 - ewarn "Failed to compile the ABI test. Broken host glibc?"
730 - STAT=0
731 - fi
732 - rm -f "${T}/check-ia32-emulation.elf32"
733 - eend $STAT
734 - [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
735 - fi
736 -
737 - fi
738 -
739 - # When we actually have to compile something...
740 - if ! just_headers ; then
741 - ebegin "Checking gcc for __thread support"
742 - if ! eend $(want__thread ; echo $?) ; then
743 - echo
744 - eerror "Could not find a gcc that supports the __thread directive!"
745 - eerror "Please update your binutils/gcc and try again."
746 - die "No __thread support in gcc!"
747 - fi
748 -
749 - if [[ ${CTARGET} == *-linux* ]] ; then
750 - local run_kv build_kv want_kv
751 -
752 - run_kv=$(g_get_running_KV)
753 - build_kv=$(g_int_to_KV $(get_kheader_version))
754 - want_kv=${MIN_KERN_VER}
755 -
756 - if ! is_crosscompile && ! tc-is-cross-compiler ; then
757 - # Building fails on an non-supporting kernel
758 - ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
759 - if ! eend_KV ${run_kv} ${want_kv} ; then
760 - echo
761 - eerror "You need a kernel of at least ${want_kv}!"
762 - die "Kernel version too low!"
763 - fi
764 - fi
765 -
766 - ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
767 - if ! eend_KV ${build_kv} ${want_kv} ; then
768 - echo
769 - eerror "You need linux-headers of at least ${want_kv}!"
770 - die "linux-headers version too low!"
771 - fi
772 - fi
773 - fi
774 -}
775 -
776 -#
777 -# the phases
778 -#
779 -
780 -# pkg_pretend
781 -
782 -pkg_pretend() {
783 - # All the checks...
784 - einfo "Checking general environment sanity."
785 - sanity_prechecks
786 -}
787 -
788 -pkg_setup() {
789 - # see bug 682570
790 - [[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
791 -}
792 -
793 -# src_unpack
794 -
795 -src_unpack() {
796 - # Consistency is not guaranteed between pkg_ and src_ ...
797 - sanity_prechecks
798 -
799 - use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
800 -
801 - setup_env
802 -
803 - if [[ -n ${EGIT_REPO_URI} ]] ; then
804 - git-r3_src_unpack
805 - else
806 - unpack ${P}.tar.xz
807 - fi
808 -
809 - cd "${WORKDIR}" || die
810 - unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
811 -}
812 -
813 -src_prepare() {
814 - if ! use vanilla ; then
815 - elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
816 - eapply "${WORKDIR}"/patches
817 - einfo "Done."
818 - fi
819 -
820 - default
821 -
822 - gnuconfig_update
823 -
824 - cd "${WORKDIR}"
825 - find . -name configure -exec touch {} +
826 -
827 - eprefixify extra/locale/locale-gen
828 -
829 - # Fix permissions on some of the scripts.
830 - chmod u+x "${S}"/scripts/*.sh
831 -
832 - cd "${S}"
833 -}
834 -
835 -glibc_do_configure() {
836 - # Glibc does not work with gold (for various reasons) #269274.
837 - tc-ld-disable-gold
838 -
839 - # CXX isnt handled by the multilib system, so if we dont unset here
840 - # we accumulate crap across abis
841 - unset CXX
842 -
843 - einfo "Configuring glibc for nptl"
844 -
845 - if use doc ; then
846 - export MAKEINFO=makeinfo
847 - else
848 - export MAKEINFO=/dev/null
849 - fi
850 -
851 - local v
852 - for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do
853 - einfo " $(printf '%15s' ${v}:) ${!v}"
854 - done
855 -
856 - # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
857 - # To build .S (assembly) files with the same ABI-specific flags
858 - # upstream currently recommends adding CFLAGS to CC/CXX:
859 - # https://sourceware.org/PR23273
860 - # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
861 - # and breaks multiarch support. See 659030#c3 for an example.
862 - # The glibc configure script doesn't properly use LDFLAGS all the time.
863 - export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}"
864 - einfo " $(printf '%15s' 'Manual CC:') ${CC}"
865 -
866 - # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
867 - export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
868 -
869 - if is_crosscompile; then
870 - # Assume worst-case bootstrap: glibc is buil first time
871 - # when ${CTARGET}-g++ is not available yet. We avoid
872 - # building auxiliary programs that require C++: bug #683074
873 - # It should not affect final result.
874 - export libc_cv_cxx_link_ok=no
875 - # The line above has the same effect. We set CXX explicitly
876 - # to make build logs less confusing.
877 - export CXX=
878 - fi
879 - einfo " $(printf '%15s' 'Manual CXX:') ${CXX}"
880 -
881 - echo
882 -
883 - local myconf=()
884 -
885 - case ${CTARGET} in
886 - m68k*)
887 - # setjmp() is not compatible with stack protection:
888 - # https://sourceware.org/PR24202
889 - myconf+=( --enable-stack-protector=no )
890 - ;;
891 - powerpc-*)
892 - # Currently gcc on powerpc32 generates invalid code for
893 - # __builtin_return_address(0) calls. Normally programs
894 - # don't do that but malloc hooks in glibc do:
895 - # https://gcc.gnu.org/PR81996
896 - # https://bugs.gentoo.org/629054
897 - myconf+=( --enable-stack-protector=no )
898 - ;;
899 - *)
900 - myconf+=( --enable-stack-protector=$(usex ssp all no) )
901 - ;;
902 - esac
903 - myconf+=( --enable-stackguard-randomization )
904 -
905 - # Keep a whitelist of targets supporing IFUNC. glibc's ./configure
906 - # is not robust enough to detect proper support:
907 - # https://bugs.gentoo.org/641216
908 - # https://sourceware.org/PR22634#c0
909 - case $(tc-arch ${CTARGET}) in
910 - # Keep whitelist of targets where autodetection mostly works.
911 - amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
912 - # Blacklist everywhere else
913 - *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
914 - esac
915 -
916 - # Enable Intel Control-flow Enforcement Technology on amd64 if requested
917 - case ${CTARGET} in
918 - x86_64-*) myconf+=( $(use_enable cet) ) ;;
919 - *) ;;
920 - esac
921 -
922 - [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
923 -
924 - myconf+=( --enable-kernel=${MIN_KERN_VER} )
925 -
926 - # Since SELinux support is only required for nscd, only enable it if:
927 - # 1. USE selinux
928 - # 2. only for the primary ABI on multilib systems
929 - # 3. Not a crosscompile
930 - if ! is_crosscompile && use selinux ; then
931 - if use multilib ; then
932 - if is_final_abi ; then
933 - myconf+=( --with-selinux )
934 - else
935 - myconf+=( --without-selinux )
936 - fi
937 - else
938 - myconf+=( --with-selinux )
939 - fi
940 - else
941 - myconf+=( --without-selinux )
942 - fi
943 -
944 - # Force a few tests where we always know the answer but
945 - # configure is incapable of finding it.
946 - if is_crosscompile ; then
947 - export \
948 - libc_cv_c_cleanup=yes \
949 - libc_cv_forced_unwind=yes
950 - fi
951 -
952 - myconf+=(
953 - --without-cvs
954 - --disable-werror
955 - --enable-bind-now
956 - --build=${CBUILD_OPT:-${CBUILD}}
957 - --host=${CTARGET_OPT:-${CTARGET}}
958 - $(use_enable profile)
959 - $(use_with gd)
960 - --with-headers=$(alt_build_headers)
961 - --prefix="$(host_eprefix)/usr"
962 - --sysconfdir="$(host_eprefix)/etc"
963 - --localstatedir="$(host_eprefix)/var"
964 - --libdir='$(prefix)'/$(get_libdir)
965 - --mandir='$(prefix)'/share/man
966 - --infodir='$(prefix)'/share/info
967 - --libexecdir='$(libdir)'/misc/glibc
968 - --with-bugurl=https://bugs.gentoo.org/
969 - --with-pkgversion="$(glibc_banner)"
970 - $(use_multiarch || echo --disable-multi-arch)
971 - $(use_enable systemtap)
972 - $(use_enable nscd)
973 - ${EXTRA_ECONF}
974 - )
975 -
976 - # We rely on sys-libs/timezone-data for timezone tools normally.
977 - myconf+=( $(use_enable vanilla timezone-tools) )
978 -
979 - # These libs don't have configure flags.
980 - ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
981 - ac_cv_lib_cap_cap_init=$(usex caps || echo no)
982 -
983 - # There is no configure option for this and we need to export it
984 - # since the glibc build will re-run configure on itself
985 - export libc_cv_rootsbindir="$(host_eprefix)/sbin"
986 - export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
987 -
988 - # We take care of patching our binutils to use both hash styles,
989 - # and many people like to force gnu hash style only, so disable
990 - # this overriding check. #347761
991 - export libc_cv_hashstyle=no
992 -
993 - local builddir=$(builddir nptl)
994 - mkdir -p "${builddir}"
995 - cd "${builddir}"
996 - set -- "${S}"/configure "${myconf[@]}"
997 - echo "$@"
998 - "$@" || die "failed to configure glibc"
999 -
1000 - # ia64 static cross-compilers are a pita in so much that they
1001 - # can't produce static ELFs (as the libgcc.a is broken). so
1002 - # disable building of the programs for those targets if it
1003 - # doesn't work.
1004 - # XXX: We could turn this into a compiler test, but ia64 is
1005 - # the only one that matters, so this should be fine for now.
1006 - if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
1007 - sed -i '1i+link-static = touch $@' config.make
1008 - fi
1009 -
1010 - # If we're trying to migrate between ABI sets, we need
1011 - # to lie and use a local copy of gcc. Like if the system
1012 - # is built with MULTILIB_ABIS="amd64 x86" but we want to
1013 - # add x32 to it, gcc/glibc don't yet support x32.
1014 - #
1015 - if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
1016 - echo 'main(){}' > "${T}"/test.c
1017 - if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
1018 - sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
1019 - fi
1020 - fi
1021 -}
1022 -
1023 -glibc_headers_configure() {
1024 - export ABI=default
1025 -
1026 - local builddir=$(builddir "headers")
1027 - mkdir -p "${builddir}"
1028 - cd "${builddir}"
1029 -
1030 - # if we don't have a compiler yet, we can't really test it now ...
1031 - # hopefully they don't affect header generation, so let's hope for
1032 - # the best here ...
1033 - local v vars=(
1034 - ac_cv_header_cpuid_h=yes
1035 - libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
1036 - libc_cv_asm_cfi_directives=yes
1037 - libc_cv_broken_visibility_attribute=no
1038 - libc_cv_c_cleanup=yes
1039 - libc_cv_compiler_powerpc64le_binary128_ok=yes
1040 - libc_cv_forced_unwind=yes
1041 - libc_cv_gcc___thread=yes
1042 - libc_cv_mlong_double_128=yes
1043 - libc_cv_mlong_double_128ibm=yes
1044 - libc_cv_ppc_machine=yes
1045 - libc_cv_ppc_rel16=yes
1046 - libc_cv_predef_fortify_source=no
1047 - libc_cv_target_power8_ok=yes
1048 - libc_cv_visibility_attribute=yes
1049 - libc_cv_z_combreloc=yes
1050 - libc_cv_z_execstack=yes
1051 - libc_cv_z_initfirst=yes
1052 - libc_cv_z_nodelete=yes
1053 - libc_cv_z_nodlopen=yes
1054 - libc_cv_z_relro=yes
1055 - libc_mips_abi=${ABI}
1056 - libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
1057 - # These libs don't have configure flags.
1058 - ac_cv_lib_audit_audit_log_user_avc_message=no
1059 - ac_cv_lib_cap_cap_init=no
1060 - )
1061 -
1062 - einfo "Forcing cached settings:"
1063 - for v in "${vars[@]}" ; do
1064 - einfo " ${v}"
1065 - export ${v}
1066 - done
1067 -
1068 - local headers_only_arch_CPPFLAGS=()
1069 -
1070 - # Blow away some random CC settings that screw things up. #550192
1071 - if [[ -d ${S}/sysdeps/mips ]]; then
1072 - pushd "${S}"/sysdeps/mips >/dev/null
1073 - sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
1074 - sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
1075 -
1076 - # Force the mips ABI to the default. This is OK because the set of
1077 - # installed headers in this phase is the same between the 3 ABIs.
1078 - # If this ever changes, this hack will break, but that's unlikely
1079 - # as glibc discourages that behavior.
1080 - # https://crbug.com/647033
1081 - sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
1082 -
1083 - popd >/dev/null
1084 - fi
1085 -
1086 - case ${CTARGET} in
1087 - riscv*)
1088 - # RISC-V interrogates the compiler to determine which target to
1089 - # build. If building the headers then we don't strictly need a
1090 - # RISC-V compiler, so the built-in definitions that are provided
1091 - # along with all RISC-V compiler might not exist. This causes
1092 - # glibc's RISC-V preconfigure script to blow up. Since we're just
1093 - # building the headers any value will actually work here, so just
1094 - # pick the standard one (rv64g/lp64d) to make the build scripts
1095 - # happy for now -- the headers are all the same anyway so it
1096 - # doesn't matter.
1097 - headers_only_arch_CPPFLAGS+=(
1098 - -D__riscv_xlen=64
1099 - -D__riscv_flen=64
1100 - -D__riscv_float_abi_double=1
1101 - -D__riscv_atomic=1
1102 - ) ;;
1103 - esac
1104 -
1105 - local myconf=()
1106 - myconf+=(
1107 - --disable-sanity-checks
1108 - --enable-hacker-mode
1109 - --without-cvs
1110 - --disable-werror
1111 - --enable-bind-now
1112 - --build=${CBUILD_OPT:-${CBUILD}}
1113 - --host=${CTARGET_OPT:-${CTARGET}}
1114 - --with-headers=$(alt_build_headers)
1115 - --prefix="$(host_eprefix)/usr"
1116 - ${EXTRA_ECONF}
1117 - )
1118 -
1119 - # Nothing is compiled here which would affect the headers for the target.
1120 - # So forcing CC/CFLAGS is sane.
1121 - local headers_only_CC=$(tc-getBUILD_CC)
1122 - local headers_only_CFLAGS="-O1 -pipe"
1123 - local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
1124 - local headers_only_LDFLAGS=""
1125 - set -- "${S}"/configure "${myconf[@]}"
1126 - echo \
1127 - "CC=${headers_only_CC}" \
1128 - "CFLAGS=${headers_only_CFLAGS}" \
1129 - "CPPFLAGS=${headers_only_CPPFLAGS}" \
1130 - "LDFLAGS=${headers_only_LDFLAGS}" \
1131 - "$@"
1132 - CC=${headers_only_CC} \
1133 - CFLAGS=${headers_only_CFLAGS} \
1134 - CPPFLAGS=${headers_only_CPPFLAGS} \
1135 - LDFLAGS="" \
1136 - "$@" || die "failed to configure glibc"
1137 -}
1138 -
1139 -do_src_configure() {
1140 - if just_headers ; then
1141 - glibc_headers_configure
1142 - else
1143 - glibc_do_configure nptl
1144 - fi
1145 -}
1146 -
1147 -src_configure() {
1148 - foreach_abi do_src_configure
1149 -}
1150 -
1151 -do_src_compile() {
1152 - emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
1153 -}
1154 -
1155 -src_compile() {
1156 - if just_headers ; then
1157 - return
1158 - fi
1159 -
1160 - foreach_abi do_src_compile
1161 -}
1162 -
1163 -glibc_src_test() {
1164 - cd "$(builddir nptl)"
1165 - emake check
1166 -}
1167 -
1168 -do_src_test() {
1169 - local ret=0
1170 -
1171 - glibc_src_test
1172 - : $(( ret |= $? ))
1173 -
1174 - return ${ret}
1175 -}
1176 -
1177 -src_test() {
1178 - if just_headers ; then
1179 - return
1180 - fi
1181 -
1182 - # Give tests more time to complete.
1183 - export TIMEOUTFACTOR=5
1184 -
1185 - foreach_abi do_src_test || die "tests failed"
1186 -}
1187 -
1188 -run_locale_gen() {
1189 - # if the host locales.gen contains no entries, we'll install everything
1190 - local root="$1"
1191 - local inplace=""
1192 -
1193 - if [[ "${root}" == "--inplace-glibc" ]] ; then
1194 - inplace="--inplace-glibc"
1195 - root="$2"
1196 - fi
1197 -
1198 - local locale_list="${root}/etc/locale.gen"
1199 -
1200 - pushd "${ED}"/$(get_libdir)
1201 -
1202 - if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
1203 - [[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
1204 - locale_list="${root}/usr/share/i18n/SUPPORTED"
1205 - fi
1206 -
1207 - locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
1208 - --destdir "${root}"
1209 -
1210 - popd
1211 -}
1212 -
1213 -glibc_do_src_install() {
1214 - local builddir=$(builddir nptl)
1215 - cd "${builddir}"
1216 -
1217 - emake install_root="${D}$(build_eprefix)$(alt_prefix)" install || die
1218 -
1219 - # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
1220 - # which come without headers etc. Only needed for binary packages since the
1221 - # external net-libs/libnsl has increased soversion. Keep only versioned libraries.
1222 - find "${D}" -name "libnsl.a" -delete
1223 - find "${D}" -name "libnsl.so" -delete
1224 -
1225 - # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
1226 - # to infer upstream version:
1227 - # '#define VERSION "2.26.90"' -> '2.26.90'
1228 - local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
1229 -
1230 - if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
1231 - # Move versioned .a file out of libdir to evade portage QA checks
1232 - # instead of using gen_usr_ldscript(). We fix ldscript as:
1233 - # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
1234 - sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
1235 - dodir $(alt_usrlibdir)/${P}
1236 - mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
1237 - fi
1238 -
1239 - # We'll take care of the cache ourselves
1240 - rm -f "${ED}"/etc/ld.so.cache
1241 -
1242 - # Everything past this point just needs to be done once ...
1243 - is_final_abi || return 0
1244 -
1245 - # Make sure the non-native interp can be found on multilib systems even
1246 - # if the main library set isn't installed into the right place. Maybe
1247 - # we should query the active gcc for info instead of hardcoding it ?
1248 - local i ldso_abi ldso_name
1249 - local ldso_abi_list=(
1250 - # x86
1251 - amd64 /lib64/ld-linux-x86-64.so.2
1252 - x32 /libx32/ld-linux-x32.so.2
1253 - x86 /lib/ld-linux.so.2
1254 - # mips
1255 - o32 /lib/ld.so.1
1256 - n32 /lib32/ld.so.1
1257 - n64 /lib64/ld.so.1
1258 - # powerpc
1259 - ppc /lib/ld.so.1
1260 - ppc64 /lib64/ld64.so.1
1261 - # riscv
1262 - lp64d /lib/ld-linux-riscv64-lp64d.so.1
1263 - lp64 /lib/ld-linux-riscv64-lp64.so.1
1264 - # s390
1265 - s390 /lib/ld.so.1
1266 - s390x /lib/ld64.so.1
1267 - # sparc
1268 - sparc32 /lib/ld-linux.so.2
1269 - sparc64 /lib64/ld-linux.so.2
1270 - )
1271 - case $(tc-endian) in
1272 - little)
1273 - ldso_abi_list+=(
1274 - # arm
1275 - arm64 /lib/ld-linux-aarch64.so.1
1276 - )
1277 - ;;
1278 - big)
1279 - ldso_abi_list+=(
1280 - # arm
1281 - arm64 /lib/ld-linux-aarch64_be.so.1
1282 - )
1283 - ;;
1284 - esac
1285 - if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
1286 - dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
1287 - fi
1288 - for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
1289 - ldso_abi=${ldso_abi_list[i]}
1290 - has ${ldso_abi} $(get_install_abis) || continue
1291 -
1292 - ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
1293 - if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
1294 - dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
1295 - fi
1296 - done
1297 -
1298 - # With devpts under Linux mounted properly, we do not need the pt_chown
1299 - # binary to be setuid. This is because the default owners/perms will be
1300 - # exactly what we want.
1301 - if ! use suid ; then
1302 - find "${ED}" -name pt_chown -exec chmod -s {} +
1303 - fi
1304 -
1305 - #################################################################
1306 - # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
1307 - # Make sure we install some symlink hacks so that when we build
1308 - # a 2nd stage cross-compiler, gcc finds the target system
1309 - # headers correctly. See gcc/doc/gccinstall.info
1310 - if is_crosscompile ; then
1311 - # We need to make sure that /lib and /usr/lib always exists.
1312 - # gcc likes to use relative paths to get to its multilibs like
1313 - # /usr/lib/../lib64/. So while we don't install any files into
1314 - # /usr/lib/, we do need it to exist.
1315 - keepdir $(alt_prefix)/lib
1316 - keepdir $(alt_prefix)/usr/lib
1317 -
1318 - dosym usr/include $(alt_prefix)/sys-include
1319 - return 0
1320 - fi
1321 -
1322 - # Files for Debian-style locale updating
1323 - dodir /usr/share/i18n
1324 - sed \
1325 - -e "/^#/d" \
1326 - -e "/SUPPORTED-LOCALES=/d" \
1327 - -e "s: \\\\::g" -e "s:/: :g" \
1328 - "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
1329 - || die "generating /usr/share/i18n/SUPPORTED failed"
1330 - cd "${WORKDIR}"/extra/locale
1331 - dosbin locale-gen
1332 - doman *.[0-8]
1333 - insinto /etc
1334 - doins locale.gen
1335 -
1336 - # Make sure all the ABI's can find the locales and so we only
1337 - # have to generate one set
1338 - local a
1339 - keepdir /usr/$(get_libdir)/locale
1340 - for a in $(get_install_abis) ; do
1341 - if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
1342 - dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
1343 - fi
1344 - done
1345 -
1346 - # HACK: If we're building for riscv, we need to additionally make sure that
1347 - # we can find the locale archive afterwards
1348 - case ${CTARGET} in
1349 - riscv*)
1350 - if [[ ! -e ${ED}/usr/lib/locale ]] ; then
1351 - dosym ../$(get_libdir)/locale /usr/lib/locale
1352 - fi
1353 - ;;
1354 - *) ;;
1355 - esac
1356 -
1357 - cd "${S}"
1358 -
1359 - # Install misc network config files
1360 - insinto /etc
1361 - doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
1362 - doins "${WORKDIR}"/extra/etc/*.conf
1363 -
1364 - if use nscd ; then
1365 - doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
1366 -
1367 - local nscd_args=(
1368 - -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
1369 - )
1370 -
1371 - sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
1372 -
1373 - systemd_dounit nscd/nscd.service
1374 - systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
1375 - else
1376 - # Do this since extra/etc/*.conf above might have nscd.conf.
1377 - rm -f "${ED}"/etc/nscd.conf
1378 - fi
1379 -
1380 - echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
1381 - doenvd "${T}"/00glibc
1382 -
1383 - for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
1384 - [[ -s ${d} ]] && dodoc ${d}
1385 - done
1386 - dodoc -r ChangeLog.old
1387 -
1388 - # Prevent overwriting of the /etc/localtime symlink. We'll handle the
1389 - # creation of the "factory" symlink in pkg_postinst().
1390 - rm -f "${ED}"/etc/localtime
1391 -
1392 - # Generate all locales if this is a native build as locale generation
1393 - if use compile-locales && ! is_crosscompile ; then
1394 - run_locale_gen --inplace-glibc "${ED}"
1395 - sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
1396 - fi
1397 -}
1398 -
1399 -glibc_headers_install() {
1400 - local builddir=$(builddir "headers")
1401 - cd "${builddir}"
1402 - emake install_root="${D}$(build_eprefix)$(alt_prefix)" install-headers
1403 -
1404 - insinto $(alt_headers)/gnu
1405 - doins "${S}"/include/gnu/stubs.h
1406 -
1407 - # Make sure we install the sys-include symlink so that when
1408 - # we build a 2nd stage cross-compiler, gcc finds the target
1409 - # system headers correctly. See gcc/doc/gccinstall.info
1410 - dosym usr/include $(alt_prefix)/sys-include
1411 -}
1412 -
1413 -src_install() {
1414 - if just_headers ; then
1415 - export ABI=default
1416 - glibc_headers_install
1417 - return
1418 - fi
1419 -
1420 - foreach_abi glibc_do_src_install
1421 -}
1422 -
1423 -# Simple test to make sure our new glibc isn't completely broken.
1424 -# Make sure we don't test with statically built binaries since
1425 -# they will fail. Also, skip if this glibc is a cross compiler.
1426 -#
1427 -# If coreutils is built with USE=multicall, some of these files
1428 -# will just be wrapper scripts, not actual ELFs we can test.
1429 -glibc_sanity_check() {
1430 - cd / #228809
1431 -
1432 - # We enter ${ED} so to avoid trouble if the path contains
1433 - # special characters; for instance if the path contains the
1434 - # colon character (:), then the linker will try to split it
1435 - # and look for the libraries in an unexpected place. This can
1436 - # lead to unsafe code execution if the generated prefix is
1437 - # within a world-writable directory.
1438 - # (e.g. /var/tmp/portage:${HOSTNAME})
1439 - pushd "${ED}"/$(get_libdir) >/dev/null
1440 -
1441 - local x striptest
1442 - for x in cal date env free ls true uname uptime ; do
1443 - x=$(type -p ${x})
1444 - [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
1445 - striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
1446 - case ${striptest} in
1447 - *"statically linked"*) continue;;
1448 - *"ASCII text"*) continue;;
1449 - esac
1450 - # We need to clear the locale settings as the upgrade might want
1451 - # incompatible locale data. This test is not for verifying that.
1452 - LC_ALL=C \
1453 - ./ld-*.so --library-path . ${x} > /dev/null \
1454 - || die "simple run test (${x}) failed"
1455 - done
1456 -
1457 - popd >/dev/null
1458 -}
1459 -
1460 -pkg_preinst() {
1461 - # nothing to do if just installing headers
1462 - just_headers && return
1463 -
1464 - # prepare /etc/ld.so.conf.d/ for files
1465 - mkdir -p "${EROOT}"/etc/ld.so.conf.d
1466 -
1467 - # Default /etc/hosts.conf:multi to on for systems with small dbs.
1468 - if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
1469 - sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
1470 - einfo "Defaulting /etc/host.conf:multi to on"
1471 - fi
1472 -
1473 - [[ ${ROOT} != "/" ]] && return 0
1474 - [[ -d ${ED}/$(get_libdir) ]] || return 0
1475 - [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
1476 -}
1477 -
1478 -pkg_postinst() {
1479 - # nothing to do if just installing headers
1480 - just_headers && return
1481 -
1482 - if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
1483 - # Generate fastloading iconv module configuration file.
1484 - "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
1485 - fi
1486 -
1487 - if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
1488 - # Reload init ... if in a chroot or a diff init package, ignore
1489 - # errors from this step #253697
1490 - /sbin/telinit U 2>/dev/null
1491 -
1492 - use compile-locales || run_locale_gen "${EROOT}"
1493 - fi
1494 -
1495 - # Check for sanity of /etc/nsswitch.conf, take 2
1496 - if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then
1497 - local entry
1498 - for entry in passwd group shadow; do
1499 - if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then
1500 - ewarn ""
1501 - ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been"
1502 - ewarn "removed from glibc and is now provided by the package"
1503 - ewarn " sys-auth/libnss-nis"
1504 - ewarn "Install it now to keep your NIS setup working."
1505 - ewarn ""
1506 - fi
1507 - done
1508 - fi
1509 -}
1510
1511 diff --git a/sys-libs/glibc/glibc-2.29-r6.ebuild b/sys-libs/glibc/glibc-2.29-r6.ebuild
1512 deleted file mode 100644
1513 index 8f88020a9c2..00000000000
1514 --- a/sys-libs/glibc/glibc-2.29-r6.ebuild
1515 +++ /dev/null
1516 @@ -1,1477 +0,0 @@
1517 -# Copyright 1999-2019 Gentoo Authors
1518 -# Distributed under the terms of the GNU General Public License v2
1519 -
1520 -EAPI=7
1521 -
1522 -PYTHON_COMPAT=( python3_{5,6,7} )
1523 -
1524 -inherit python-any-r1 prefix eutils toolchain-funcs flag-o-matic gnuconfig usr-ldscript \
1525 - multilib systemd multiprocessing
1526 -
1527 -DESCRIPTION="GNU libc C library"
1528 -HOMEPAGE="https://www.gnu.org/software/libc/"
1529 -LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
1530 -SLOT="2.2"
1531 -
1532 -EMULTILIB_PKG="true"
1533 -
1534 -if [[ ${PV} == 9999* ]]; then
1535 - EGIT_REPO_URI="https://sourceware.org/git/glibc.git"
1536 - inherit git-r3
1537 -else
1538 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
1539 - SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
1540 -fi
1541 -
1542 -RELEASE_VER=${PV}
1543 -
1544 -GCC_BOOTSTRAP_VER=20180511
1545 -
1546 -# Gentoo patchset
1547 -PATCH_VER=7
1548 -
1549 -SRC_URI+=" https://dev.gentoo.org/~slyfox/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
1550 -SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
1551 -
1552 -IUSE="audit caps cet compile-locales doc gd headers-only +multiarch multilib nscd profile selinux +ssp suid systemtap test vanilla"
1553 -
1554 -# Minimum kernel version that glibc requires
1555 -MIN_KERN_VER="3.2.0"
1556 -
1557 -# Here's how the cross-compile logic breaks down ...
1558 -# CTARGET - machine that will target the binaries
1559 -# CHOST - machine that will host the binaries
1560 -# CBUILD - machine that will build the binaries
1561 -# If CTARGET != CHOST, it means you want a libc for cross-compiling.
1562 -# If CHOST != CBUILD, it means you want to cross-compile the libc.
1563 -# CBUILD = CHOST = CTARGET - native build/install
1564 -# CBUILD != (CHOST = CTARGET) - cross-compile a native build
1565 -# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
1566 -# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
1567 -# For install paths:
1568 -# CHOST = CTARGET - install into /
1569 -# CHOST != CTARGET - install into /usr/CTARGET/
1570 -#
1571 -export CBUILD=${CBUILD:-${CHOST}}
1572 -export CTARGET=${CTARGET:-${CHOST}}
1573 -if [[ ${CTARGET} == ${CHOST} ]] ; then
1574 - if [[ ${CATEGORY} == cross-* ]] ; then
1575 - export CTARGET=${CATEGORY#cross-}
1576 - fi
1577 -fi
1578 -
1579 -# Note [Disable automatic stripping]
1580 -# Disabling automatic stripping for a few reasons:
1581 -# - portage's attempt to strip breaks non-native binaries at least on
1582 -# arm: bug #697428
1583 -# - portage's attempt to strip libpthread.so.0 breaks gdb thread
1584 -# enumeration: bug #697910. This is quite subtle:
1585 -# * gdb uses glibc's libthread_db-1.0.so to enumerate threads.
1586 -# * libthread_db-1.0.so needs access to libpthread.so.0 local symbols
1587 -# via 'ps_pglobal_lookup' symbol defined in gdb.
1588 -# * 'ps_pglobal_lookup' uses '.symtab' section table to resolve all
1589 -# known symbols in 'libpthread.so.0'. Specifically 'nptl_version'
1590 -# (unexported) is used to sanity check compatibility before enabling
1591 -# debugging.
1592 -# 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
1593 -# * normal 'strip' command trims '.symtab'
1594 -# Thus our main goal here is to prevent 'libpthread.so.0' from
1595 -# losing it's '.symtab' entries.
1596 -# As Gentoo's strip does not allow us to pass less aggressive stripping
1597 -# options and does not check the machine target we strip selectively.
1598 -
1599 -# We need a new-enough binutils/gcc to match upstream baseline.
1600 -# Also we need to make sure our binutils/gcc supports TLS,
1601 -# and that gcc already contains the hardened patches.
1602 -BDEPEND="
1603 - ${PYTHON_DEPS}
1604 - >=app-misc/pax-utils-0.1.10
1605 - sys-devel/bison
1606 - !<sys-devel/bison-2.7
1607 - !<sys-devel/make-4
1608 - doc? ( sys-apps/texinfo )
1609 -"
1610 -COMMON_DEPEND="
1611 - nscd? ( selinux? (
1612 - audit? ( sys-process/audit )
1613 - caps? ( sys-libs/libcap )
1614 - ) )
1615 - suid? ( caps? ( sys-libs/libcap ) )
1616 - selinux? ( sys-libs/libselinux )
1617 - systemtap? ( dev-util/systemtap )
1618 -"
1619 -DEPEND="${COMMON_DEPEND}
1620 - test? ( >=net-dns/libidn2-2.0.5 )
1621 -"
1622 -RDEPEND="${COMMON_DEPEND}
1623 - sys-apps/gentoo-functions
1624 -"
1625 -
1626 -RESTRICT="!test? ( test )"
1627 -
1628 -if [[ ${CATEGORY} == cross-* ]] ; then
1629 - BDEPEND+=" !headers-only? (
1630 - >=${CATEGORY}/binutils-2.24
1631 - >=${CATEGORY}/gcc-6
1632 - )"
1633 - [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
1634 -else
1635 - BDEPEND+="
1636 - >=sys-devel/binutils-2.24
1637 - >=sys-devel/gcc-6
1638 - "
1639 - DEPEND+=" virtual/os-headers "
1640 - RDEPEND+="
1641 - >=net-dns/libidn2-2.0.5
1642 - vanilla? ( !sys-libs/timezone-data )
1643 - "
1644 - PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
1645 -fi
1646 -
1647 -#
1648 -# Small helper functions
1649 -#
1650 -
1651 -is_crosscompile() {
1652 - [[ ${CHOST} != ${CTARGET} ]]
1653 -}
1654 -
1655 -just_headers() {
1656 - is_crosscompile && use headers-only
1657 -}
1658 -
1659 -alt_prefix() {
1660 - is_crosscompile && echo /usr/${CTARGET}
1661 -}
1662 -
1663 -# This prefix is applicable to CHOST when building against this
1664 -# glibc. It is baked into the library at configure time.
1665 -host_eprefix() {
1666 - is_crosscompile || echo "${EPREFIX}"
1667 -}
1668 -
1669 -# This prefix is applicable to CBUILD when building against this
1670 -# glibc. It determines the destination path at install time.
1671 -build_eprefix() {
1672 - is_crosscompile && echo "${EPREFIX}"
1673 -}
1674 -
1675 -# We need to be able to set alternative headers for compiling for non-native
1676 -# platform. Will also become useful for testing kernel-headers without screwing
1677 -# up the whole system.
1678 -alt_headers() {
1679 - echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
1680 -}
1681 -
1682 -alt_build_headers() {
1683 - if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
1684 - ALT_BUILD_HEADERS="$(host_eprefix)$(alt_headers)"
1685 - if tc-is-cross-compiler ; then
1686 - ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers)
1687 - if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
1688 - local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
1689 - ALT_BUILD_HEADERS=${header_path%/linux/version.h}
1690 - fi
1691 - fi
1692 - fi
1693 - echo "${ALT_BUILD_HEADERS}"
1694 -}
1695 -
1696 -alt_libdir() {
1697 - echo $(alt_prefix)/$(get_libdir)
1698 -}
1699 -alt_usrlibdir() {
1700 - echo $(alt_prefix)/usr/$(get_libdir)
1701 -}
1702 -
1703 -builddir() {
1704 - echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1"
1705 -}
1706 -
1707 -do_compile_test() {
1708 - local ret save_cflags=${CFLAGS}
1709 - CFLAGS+=" $1"
1710 - shift
1711 -
1712 - pushd "${T}" >/dev/null
1713 -
1714 - rm -f glibc-test*
1715 - printf '%b' "$*" > glibc-test.c
1716 -
1717 - nonfatal emake -s glibc-test
1718 - ret=$?
1719 -
1720 - popd >/dev/null
1721 -
1722 - CFLAGS=${save_cflags}
1723 - return ${ret}
1724 -}
1725 -
1726 -do_run_test() {
1727 - local ret
1728 -
1729 - if [[ ${MERGE_TYPE} == "binary" ]] ; then
1730 - # ignore build failures when installing a binary package #324685
1731 - do_compile_test "" "$@" 2>/dev/null || return 0
1732 - else
1733 - if ! do_compile_test "" "$@" ; then
1734 - ewarn "Simple build failed ... assuming this is desired #324685"
1735 - return 0
1736 - fi
1737 - fi
1738 -
1739 - pushd "${T}" >/dev/null
1740 -
1741 - ./glibc-test
1742 - ret=$?
1743 - rm -f glibc-test*
1744 -
1745 - popd >/dev/null
1746 -
1747 - return ${ret}
1748 -}
1749 -
1750 -setup_target_flags() {
1751 - # This largely mucks with compiler flags. None of which should matter
1752 - # when building up just the headers.
1753 - just_headers && return 0
1754 -
1755 - case $(tc-arch) in
1756 - x86)
1757 - # -march needed for #185404 #199334
1758 - # TODO: When creating the first glibc cross-compile, this test will
1759 - # always fail as it does a full link which in turn requires glibc.
1760 - # Probably also applies when changing multilib profile settings (e.g.
1761 - # enabling x86 when the profile was amd64-only previously).
1762 - # We could change main to _start and pass -nostdlib here so that we
1763 - # only test the gcc code compilation. Or we could do a compile and
1764 - # then look for the symbol via scanelf.
1765 - 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
1766 - local t=${CTARGET_OPT:-${CTARGET}}
1767 - t=${t%%-*}
1768 - filter-flags '-march=*'
1769 - export CFLAGS="-march=${t} ${CFLAGS}"
1770 - einfo "Auto adding -march=${t} to CFLAGS #185404"
1771 - fi
1772 - ;;
1773 - amd64)
1774 - # -march needed for #185404 #199334
1775 - # Note: This test only matters when the x86 ABI is enabled, so we could
1776 - # optimize a bit and elide it.
1777 - # TODO: See cross-compile issues listed above for x86.
1778 - 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
1779 - local t=${CTARGET_OPT:-${CTARGET}}
1780 - t=${t%%-*}
1781 - # Normally the target is x86_64-xxx, so turn that into the -march that
1782 - # gcc actually accepts. #528708
1783 - [[ ${t} == "x86_64" ]] && t="x86-64"
1784 - filter-flags '-march=*'
1785 - # ugly, ugly, ugly. ugly.
1786 - CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}")
1787 - export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
1788 - einfo "Auto adding -march=${t} to CFLAGS_x86 #185404"
1789 - fi
1790 - ;;
1791 - mips)
1792 - # The mips abi cannot support the GNU style hashes. #233233
1793 - filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both
1794 - ;;
1795 - sparc)
1796 - # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though.
1797 - filter-flags "-fcall-used-g7"
1798 - append-flags "-fcall-used-g6"
1799 -
1800 - # If the CHOST is the basic one (e.g. not sparcv9-xxx already),
1801 - # try to pick a better one so glibc can use cpu-specific .S files.
1802 - # We key off the CFLAGS to get a good value. Also need to handle
1803 - # version skew.
1804 - # We can't force users to set their CHOST to their exact machine
1805 - # as many of these are not recognized by config.sub/gcc and such :(.
1806 - # Note: If the mcpu values don't scale, we might try probing CPP defines.
1807 - # Note: Should we factor in -Wa,-AvXXX flags too ? Or -mvis/etc... ?
1808 -
1809 - local cpu
1810 - case ${CTARGET} in
1811 - sparc64-*)
1812 - case $(get-flag mcpu) in
1813 - niagara[234])
1814 - if ver_test -ge 2.8 ; then
1815 - cpu="sparc64v2"
1816 - elif ver_test -ge 2.4 ; then
1817 - cpu="sparc64v"
1818 - elif ver_test -ge 2.2.3 ; then
1819 - cpu="sparc64b"
1820 - fi
1821 - ;;
1822 - niagara)
1823 - if ver_test -ge 2.4 ; then
1824 - cpu="sparc64v"
1825 - elif ver_test -ge 2.2.3 ; then
1826 - cpu="sparc64b"
1827 - fi
1828 - ;;
1829 - ultrasparc3)
1830 - cpu="sparc64b"
1831 - ;;
1832 - *)
1833 - # We need to force at least v9a because the base build doesn't
1834 - # work with just v9.
1835 - # https://sourceware.org/bugzilla/show_bug.cgi?id=19477
1836 - [[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a"
1837 - ;;
1838 - esac
1839 - ;;
1840 - sparc-*)
1841 - case $(get-flag mcpu) in
1842 - niagara[234])
1843 - if ver_test -ge 2.8 ; then
1844 - cpu="sparcv9v2"
1845 - elif ver_test -ge 2.4 ; then
1846 - cpu="sparcv9v"
1847 - elif ver_test -ge 2.2.3 ; then
1848 - cpu="sparcv9b"
1849 - else
1850 - cpu="sparcv9"
1851 - fi
1852 - ;;
1853 - niagara)
1854 - if ver_test -ge 2.4 ; then
1855 - cpu="sparcv9v"
1856 - elif ver_test -ge 2.2.3 ; then
1857 - cpu="sparcv9b"
1858 - else
1859 - cpu="sparcv9"
1860 - fi
1861 - ;;
1862 - ultrasparc3)
1863 - cpu="sparcv9b"
1864 - ;;
1865 - v9|ultrasparc)
1866 - cpu="sparcv9"
1867 - ;;
1868 - v8|supersparc|hypersparc|leon|leon3)
1869 - cpu="sparcv8"
1870 - ;;
1871 - esac
1872 - ;;
1873 - esac
1874 - [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}"
1875 - ;;
1876 - esac
1877 -}
1878 -
1879 -setup_flags() {
1880 - # Make sure host make.conf doesn't pollute us
1881 - if is_crosscompile || tc-is-cross-compiler ; then
1882 - CHOST=${CTARGET} strip-unsupported-flags
1883 - fi
1884 -
1885 - # Store our CFLAGS because it's changed depending on which CTARGET
1886 - # we are building when pulling glibc on a multilib profile
1887 - CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
1888 - CFLAGS=${CFLAGS_BASE}
1889 - CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
1890 - CXXFLAGS=${CXXFLAGS_BASE}
1891 - ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
1892 - ASFLAGS=${ASFLAGS_BASE}
1893 -
1894 - # Over-zealous CFLAGS can often cause problems. What may work for one
1895 - # person may not work for another. To avoid a large influx of bugs
1896 - # relating to failed builds, we strip most CFLAGS out to ensure as few
1897 - # problems as possible.
1898 - strip-flags
1899 - strip-unsupported-flags
1900 - filter-flags -m32 -m64 '-mabi=*'
1901 -
1902 - # glibc aborts if rpath is set by LDFLAGS
1903 - filter-ldflags '-Wl,-rpath=*'
1904 -
1905 - # #492892
1906 - filter-flags -frecord-gcc-switches
1907 -
1908 - unset CBUILD_OPT CTARGET_OPT
1909 - if use multilib ; then
1910 - CTARGET_OPT=$(get_abi_CTARGET)
1911 - [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
1912 - fi
1913 -
1914 - setup_target_flags
1915 -
1916 - if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
1917 - CBUILD_OPT=${CTARGET_OPT}
1918 - fi
1919 -
1920 - # Lock glibc at -O2; we want to be conservative here.
1921 - # -fno-strict-aliasing is to work around #155906.
1922 - filter-flags '-O?'
1923 - append-flags -O2 -fno-strict-aliasing
1924 -
1925 - filter-flags '-fstack-protector*'
1926 -}
1927 -
1928 -want_tls() {
1929 - # Archs that can use TLS (Thread Local Storage)
1930 - case $(tc-arch) in
1931 - x86)
1932 - # requires i486 or better #106556
1933 - [[ ${CTARGET} == i[4567]86* ]] && return 0
1934 - return 1
1935 - ;;
1936 - esac
1937 - return 0
1938 -}
1939 -
1940 -want__thread() {
1941 - want_tls || return 1
1942 -
1943 - # For some reason --with-tls --with__thread is causing segfaults on sparc32.
1944 - [[ ${PROFILE_ARCH} == "sparc" ]] && return 1
1945 -
1946 - [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD}
1947 -
1948 - # only test gcc -- can't test linking yet
1949 - tc-has-tls -c ${CTARGET}
1950 - WANT__THREAD=$?
1951 -
1952 - return ${WANT__THREAD}
1953 -}
1954 -
1955 -use_multiarch() {
1956 - # Allow user to disable runtime arch detection in multilib.
1957 - use multiarch || return 1
1958 - # Make sure binutils is new enough to support indirect functions,
1959 - # #336792. This funky sed supports gold and bfd linkers.
1960 - local bver nver
1961 - bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
1962 - case $(tc-arch ${CTARGET}) in
1963 - amd64|x86) nver="2.20" ;;
1964 - arm) nver="2.22" ;;
1965 - hppa) nver="2.23" ;;
1966 - ppc|ppc64) nver="2.20" ;;
1967 - # ifunc support was added in 2.23, but glibc also needs
1968 - # machinemode which is in 2.24.
1969 - s390) nver="2.24" ;;
1970 - sparc) nver="2.21" ;;
1971 - *) return 1 ;;
1972 - esac
1973 - ver_test ${bver} -ge ${nver}
1974 -}
1975 -
1976 -# Setup toolchain variables that had historically been defined in the
1977 -# profiles for these archs.
1978 -setup_env() {
1979 - # silly users
1980 - unset LD_RUN_PATH
1981 - unset LD_ASSUME_KERNEL
1982 -
1983 - if is_crosscompile || tc-is-cross-compiler ; then
1984 - multilib_env ${CTARGET_OPT:-${CTARGET}}
1985 -
1986 - if ! use multilib ; then
1987 - MULTILIB_ABIS=${DEFAULT_ABI}
1988 - else
1989 - MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
1990 - fi
1991 -
1992 - # If the user has CFLAGS_<CTARGET> in their make.conf, use that,
1993 - # and fall back on CFLAGS.
1994 - local VAR=CFLAGS_${CTARGET//[-.]/_}
1995 - CFLAGS=${!VAR-${CFLAGS}}
1996 - einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}"
1997 - fi
1998 -
1999 - setup_flags
2000 -
2001 - export ABI=${ABI:-${DEFAULT_ABI:-default}}
2002 -
2003 - if just_headers ; then
2004 - # Avoid mixing host's CC and target's CFLAGS_${ABI}:
2005 - # At this bootstrap stage we have only binutils for
2006 - # target but not compiler yet.
2007 - einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
2008 - return 0
2009 - fi
2010 - local VAR=CFLAGS_${ABI}
2011 - # We need to export CFLAGS with abi information in them because glibc's
2012 - # configure script checks CFLAGS for some targets (like mips). Keep
2013 - # around the original clean value to avoid appending multiple ABIs on
2014 - # top of each other.
2015 - : ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})}
2016 - export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
2017 - einfo " $(printf '%15s' 'Manual CC:') ${CC}"
2018 -}
2019 -
2020 -foreach_abi() {
2021 - setup_env
2022 -
2023 - local ret=0
2024 - local abilist=""
2025 - if use multilib ; then
2026 - abilist=$(get_install_abis)
2027 - else
2028 - abilist=${DEFAULT_ABI}
2029 - fi
2030 - local -x ABI
2031 - for ABI in ${abilist:-default} ; do
2032 - setup_env
2033 - einfo "Running $1 for ABI ${ABI}"
2034 - $1
2035 - : $(( ret |= $? ))
2036 - done
2037 - return ${ret}
2038 -}
2039 -
2040 -glibc_banner() {
2041 - local b="Gentoo ${PVR}"
2042 - [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
2043 - echo "${b}"
2044 -}
2045 -
2046 -check_devpts() {
2047 - # Make sure devpts is mounted correctly for use w/out setuid pt_chown.
2048 -
2049 - # If merely building the binary package, then there's nothing to verify.
2050 - [[ ${MERGE_TYPE} == "buildonly" ]] && return
2051 -
2052 - # Only sanity check when installing the native glibc.
2053 - [[ -n ${ROOT} ]] && return
2054 -
2055 - # If they're opting in to the old suid code, then no need to check.
2056 - use suid && return
2057 -
2058 - if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then
2059 - eerror "In order to use glibc with USE=-suid, you must make sure that"
2060 - eerror "you have devpts mounted at /dev/pts with the gid=5 option."
2061 - eerror "Openrc should do this for you, so you should check /etc/fstab"
2062 - eerror "and make sure you do not have any invalid settings there."
2063 - die "mount & fix your /dev/pts settings"
2064 - fi
2065 -}
2066 -
2067 -# The following Kernel version handling functions are mostly copied from portage
2068 -# source. It's better not to use linux-info.eclass here since a) it adds too
2069 -# much magic, see bug 326693 for some of the arguments, and b) some of the
2070 -# functions are just not provided.
2071 -
2072 -g_get_running_KV() {
2073 - uname -r
2074 - return $?
2075 -}
2076 -
2077 -g_KV_major() {
2078 - [[ -z $1 ]] && return 1
2079 - local KV=$@
2080 - echo "${KV%%.*}"
2081 -}
2082 -
2083 -g_KV_minor() {
2084 - [[ -z $1 ]] && return 1
2085 - local KV=$@
2086 - KV=${KV#*.}
2087 - echo "${KV%%.*}"
2088 -}
2089 -
2090 -g_KV_micro() {
2091 - [[ -z $1 ]] && return 1
2092 - local KV=$@
2093 - KV=${KV#*.*.}
2094 - echo "${KV%%[^[:digit:]]*}"
2095 -}
2096 -
2097 -g_KV_to_int() {
2098 - [[ -z $1 ]] && return 1
2099 - local KV_MAJOR=$(g_KV_major "$1")
2100 - local KV_MINOR=$(g_KV_minor "$1")
2101 - local KV_MICRO=$(g_KV_micro "$1")
2102 - local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
2103 -
2104 - # We make version 2.2.0 the minimum version we will handle as
2105 - # a sanity check ... if its less, we fail ...
2106 - if [[ ${KV_int} -ge 131584 ]] ; then
2107 - echo "${KV_int}"
2108 - return 0
2109 - fi
2110 - return 1
2111 -}
2112 -
2113 -g_int_to_KV() {
2114 - local version=$1 major minor micro
2115 - major=$((version / 65536))
2116 - minor=$(((version % 65536) / 256))
2117 - micro=$((version % 256))
2118 - echo ${major}.${minor}.${micro}
2119 -}
2120 -
2121 -eend_KV() {
2122 - [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]]
2123 - eend $?
2124 -}
2125 -
2126 -get_kheader_version() {
2127 - printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
2128 - $(tc-getCPP ${CTARGET}) -I "$(build_eprefix)$(alt_build_headers)" - | \
2129 - tail -n 1
2130 -}
2131 -
2132 -# We collect all sanity checks here. Consistency is not guranteed between
2133 -# pkg_ and src_ phases, so we call this function both in pkg_pretend and in
2134 -# src_unpack.
2135 -sanity_prechecks() {
2136 - # Make sure devpts is mounted correctly for use w/out setuid pt_chown
2137 - check_devpts
2138 -
2139 - # Prevent native builds from downgrading
2140 - if [[ ${MERGE_TYPE} != "buildonly" ]] && \
2141 - [[ -z ${ROOT} ]] && \
2142 - [[ ${CBUILD} == ${CHOST} ]] && \
2143 - [[ ${CHOST} == ${CTARGET} ]] ; then
2144 -
2145 - # The high rev # is to allow people to downgrade between -r#
2146 - # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2
2147 - # should be fine. Hopefully we never actually use a r# this
2148 - # high.
2149 - if has_version ">${CATEGORY}/${P}-r10000" ; then
2150 - eerror "Sanity check to keep you from breaking your system:"
2151 - eerror " Downgrading glibc is not supported and a sure way to destruction."
2152 - [[ ${I_ALLOW_TO_BREAK_MY_SYSTEM} = yes ]] || die "Aborting to save your system."
2153 - fi
2154 -
2155 - if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then
2156 - eerror "Your old kernel is broken. You need to update it to a newer"
2157 - eerror "version as syscall(<bignum>) will break. See bug 279260."
2158 - die "Old and broken kernel."
2159 - fi
2160 - fi
2161 -
2162 - # Users have had a chance to phase themselves, time to give em the boot
2163 - if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
2164 - eerror "You still haven't deleted ${EROOT}/etc/locales.build."
2165 - eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
2166 - die "Lazy upgrader detected"
2167 - fi
2168 -
2169 - if [[ ${CTARGET} == i386-* ]] ; then
2170 - eerror "i386 CHOSTs are no longer supported."
2171 - eerror "Chances are you don't actually want/need i386."
2172 - eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
2173 - die "Please fix your CHOST"
2174 - fi
2175 -
2176 - if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
2177 - ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
2178 - ewarn "This will result in a 50% performance penalty when running with a 32bit"
2179 - ewarn "hypervisor, which is probably not what you want."
2180 - fi
2181 -
2182 - # Check for sanity of /etc/nsswitch.conf
2183 - if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
2184 - local entry
2185 - for entry in passwd group shadow; do
2186 - if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
2187 - eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
2188 - eerror "Please make sure you have 'files' entries for"
2189 - eerror "'passwd:', 'group:' and 'shadow:' databases."
2190 - eerror "For more details see:"
2191 - eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
2192 - die "nsswitch.conf has no 'files' provider in '${entry}'."
2193 - fi
2194 - done
2195 - fi
2196 -
2197 - # ABI-specific checks follow here. Hey, we have a lot more specific conditions that
2198 - # we test for...
2199 - if ! is_crosscompile ; then
2200 - if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then
2201 - ebegin "Checking that IA32 emulation is enabled in the running kernel"
2202 - echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c"
2203 - local STAT
2204 - if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then
2205 - "${T}/check-ia32-emulation.elf32"
2206 - STAT=$?
2207 - else
2208 - # Don't fail here to allow single->multi ABI switch
2209 - # or recover from breakage like bug #646424
2210 - ewarn "Failed to compile the ABI test. Broken host glibc?"
2211 - STAT=0
2212 - fi
2213 - rm -f "${T}/check-ia32-emulation.elf32"
2214 - eend $STAT
2215 - [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc."
2216 - fi
2217 -
2218 - fi
2219 -
2220 - # When we actually have to compile something...
2221 - if ! just_headers ; then
2222 - ebegin "Checking gcc for __thread support"
2223 - if ! eend $(want__thread ; echo $?) ; then
2224 - echo
2225 - eerror "Could not find a gcc that supports the __thread directive!"
2226 - eerror "Please update your binutils/gcc and try again."
2227 - die "No __thread support in gcc!"
2228 - fi
2229 -
2230 - if [[ ${CTARGET} == *-linux* ]] ; then
2231 - local run_kv build_kv want_kv
2232 -
2233 - run_kv=$(g_get_running_KV)
2234 - build_kv=$(g_int_to_KV $(get_kheader_version))
2235 - want_kv=${MIN_KERN_VER}
2236 -
2237 - if ! is_crosscompile && ! tc-is-cross-compiler ; then
2238 - # Building fails on an non-supporting kernel
2239 - ebegin "Checking running kernel version (${run_kv} >= ${want_kv})"
2240 - if ! eend_KV ${run_kv} ${want_kv} ; then
2241 - echo
2242 - eerror "You need a kernel of at least ${want_kv}!"
2243 - die "Kernel version too low!"
2244 - fi
2245 - fi
2246 -
2247 - ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
2248 - if ! eend_KV ${build_kv} ${want_kv} ; then
2249 - echo
2250 - eerror "You need linux-headers of at least ${want_kv}!"
2251 - die "linux-headers version too low!"
2252 - fi
2253 - fi
2254 - fi
2255 -}
2256 -
2257 -#
2258 -# the phases
2259 -#
2260 -
2261 -# pkg_pretend
2262 -
2263 -pkg_pretend() {
2264 - # All the checks...
2265 - einfo "Checking general environment sanity."
2266 - sanity_prechecks
2267 -}
2268 -
2269 -pkg_setup() {
2270 - # see bug 682570
2271 - [[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
2272 -}
2273 -
2274 -# src_unpack
2275 -
2276 -src_unpack() {
2277 - # Consistency is not guaranteed between pkg_ and src_ ...
2278 - sanity_prechecks
2279 -
2280 - use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
2281 -
2282 - setup_env
2283 -
2284 - if [[ -n ${EGIT_REPO_URI} ]] ; then
2285 - git-r3_src_unpack
2286 - else
2287 - unpack ${P}.tar.xz
2288 - fi
2289 -
2290 - cd "${WORKDIR}" || die
2291 - unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
2292 -}
2293 -
2294 -src_prepare() {
2295 - if ! use vanilla ; then
2296 - elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
2297 - eapply "${WORKDIR}"/patches
2298 - einfo "Done."
2299 - fi
2300 -
2301 - default
2302 -
2303 - gnuconfig_update
2304 -
2305 - cd "${WORKDIR}"
2306 - find . -name configure -exec touch {} +
2307 -
2308 - eprefixify extra/locale/locale-gen
2309 -
2310 - # Fix permissions on some of the scripts.
2311 - chmod u+x "${S}"/scripts/*.sh
2312 -
2313 - cd "${S}"
2314 -}
2315 -
2316 -glibc_do_configure() {
2317 - # Glibc does not work with gold (for various reasons) #269274.
2318 - tc-ld-disable-gold
2319 -
2320 - # CXX isnt handled by the multilib system, so if we dont unset here
2321 - # we accumulate crap across abis
2322 - unset CXX
2323 -
2324 - einfo "Configuring glibc for nptl"
2325 -
2326 - if use doc ; then
2327 - export MAKEINFO=makeinfo
2328 - else
2329 - export MAKEINFO=/dev/null
2330 - fi
2331 -
2332 - local v
2333 - for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do
2334 - einfo " $(printf '%15s' ${v}:) ${!v}"
2335 - done
2336 -
2337 - # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
2338 - # To build .S (assembly) files with the same ABI-specific flags
2339 - # upstream currently recommends adding CFLAGS to CC/CXX:
2340 - # https://sourceware.org/PR23273
2341 - # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
2342 - # and breaks multiarch support. See 659030#c3 for an example.
2343 - # The glibc configure script doesn't properly use LDFLAGS all the time.
2344 - export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}"
2345 - einfo " $(printf '%15s' 'Manual CC:') ${CC}"
2346 -
2347 - # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
2348 - export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
2349 -
2350 - if is_crosscompile; then
2351 - # Assume worst-case bootstrap: glibc is buil first time
2352 - # when ${CTARGET}-g++ is not available yet. We avoid
2353 - # building auxiliary programs that require C++: bug #683074
2354 - # It should not affect final result.
2355 - export libc_cv_cxx_link_ok=no
2356 - # The line above has the same effect. We set CXX explicitly
2357 - # to make build logs less confusing.
2358 - export CXX=
2359 - fi
2360 - einfo " $(printf '%15s' 'Manual CXX:') ${CXX}"
2361 -
2362 - echo
2363 -
2364 - local myconf=()
2365 -
2366 - case ${CTARGET} in
2367 - m68k*)
2368 - # setjmp() is not compatible with stack protection:
2369 - # https://sourceware.org/PR24202
2370 - myconf+=( --enable-stack-protector=no )
2371 - ;;
2372 - powerpc-*)
2373 - # Currently gcc on powerpc32 generates invalid code for
2374 - # __builtin_return_address(0) calls. Normally programs
2375 - # don't do that but malloc hooks in glibc do:
2376 - # https://gcc.gnu.org/PR81996
2377 - # https://bugs.gentoo.org/629054
2378 - myconf+=( --enable-stack-protector=no )
2379 - ;;
2380 - *)
2381 - myconf+=( --enable-stack-protector=$(usex ssp all no) )
2382 - ;;
2383 - esac
2384 - myconf+=( --enable-stackguard-randomization )
2385 -
2386 - # Keep a whitelist of targets supporing IFUNC. glibc's ./configure
2387 - # is not robust enough to detect proper support:
2388 - # https://bugs.gentoo.org/641216
2389 - # https://sourceware.org/PR22634#c0
2390 - case $(tc-arch ${CTARGET}) in
2391 - # Keep whitelist of targets where autodetection mostly works.
2392 - amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
2393 - # Blacklist everywhere else
2394 - *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
2395 - esac
2396 -
2397 - # Enable Intel Control-flow Enforcement Technology on amd64 if requested
2398 - case ${CTARGET} in
2399 - x86_64-*) myconf+=( $(use_enable cet) ) ;;
2400 - *) ;;
2401 - esac
2402 -
2403 - [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
2404 -
2405 - myconf+=( --enable-kernel=${MIN_KERN_VER} )
2406 -
2407 - # Since SELinux support is only required for nscd, only enable it if:
2408 - # 1. USE selinux
2409 - # 2. only for the primary ABI on multilib systems
2410 - # 3. Not a crosscompile
2411 - if ! is_crosscompile && use selinux ; then
2412 - if use multilib ; then
2413 - if is_final_abi ; then
2414 - myconf+=( --with-selinux )
2415 - else
2416 - myconf+=( --without-selinux )
2417 - fi
2418 - else
2419 - myconf+=( --with-selinux )
2420 - fi
2421 - else
2422 - myconf+=( --without-selinux )
2423 - fi
2424 -
2425 - # Force a few tests where we always know the answer but
2426 - # configure is incapable of finding it.
2427 - if is_crosscompile ; then
2428 - export \
2429 - libc_cv_c_cleanup=yes \
2430 - libc_cv_forced_unwind=yes
2431 - fi
2432 -
2433 - myconf+=(
2434 - --without-cvs
2435 - --disable-werror
2436 - --enable-bind-now
2437 - --build=${CBUILD_OPT:-${CBUILD}}
2438 - --host=${CTARGET_OPT:-${CTARGET}}
2439 - $(use_enable profile)
2440 - $(use_with gd)
2441 - --with-headers=$(alt_build_headers)
2442 - --prefix="$(host_eprefix)/usr"
2443 - --sysconfdir="$(host_eprefix)/etc"
2444 - --localstatedir="$(host_eprefix)/var"
2445 - --libdir='$(prefix)'/$(get_libdir)
2446 - --mandir='$(prefix)'/share/man
2447 - --infodir='$(prefix)'/share/info
2448 - --libexecdir='$(libdir)'/misc/glibc
2449 - --with-bugurl=https://bugs.gentoo.org/
2450 - --with-pkgversion="$(glibc_banner)"
2451 - $(use_multiarch || echo --disable-multi-arch)
2452 - $(use_enable systemtap)
2453 - $(use_enable nscd)
2454 - ${EXTRA_ECONF}
2455 - )
2456 -
2457 - # We rely on sys-libs/timezone-data for timezone tools normally.
2458 - myconf+=( $(use_enable vanilla timezone-tools) )
2459 -
2460 - # These libs don't have configure flags.
2461 - ac_cv_lib_audit_audit_log_user_avc_message=$(usex audit || echo no)
2462 - ac_cv_lib_cap_cap_init=$(usex caps || echo no)
2463 -
2464 - # There is no configure option for this and we need to export it
2465 - # since the glibc build will re-run configure on itself
2466 - export libc_cv_rootsbindir="$(host_eprefix)/sbin"
2467 - export libc_cv_slibdir="$(host_eprefix)/$(get_libdir)"
2468 -
2469 - # We take care of patching our binutils to use both hash styles,
2470 - # and many people like to force gnu hash style only, so disable
2471 - # this overriding check. #347761
2472 - export libc_cv_hashstyle=no
2473 -
2474 - local builddir=$(builddir nptl)
2475 - mkdir -p "${builddir}"
2476 - cd "${builddir}"
2477 - set -- "${S}"/configure "${myconf[@]}"
2478 - echo "$@"
2479 - "$@" || die "failed to configure glibc"
2480 -
2481 - # ia64 static cross-compilers are a pita in so much that they
2482 - # can't produce static ELFs (as the libgcc.a is broken). so
2483 - # disable building of the programs for those targets if it
2484 - # doesn't work.
2485 - # XXX: We could turn this into a compiler test, but ia64 is
2486 - # the only one that matters, so this should be fine for now.
2487 - if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
2488 - sed -i '1i+link-static = touch $@' config.make
2489 - fi
2490 -
2491 - # If we're trying to migrate between ABI sets, we need
2492 - # to lie and use a local copy of gcc. Like if the system
2493 - # is built with MULTILIB_ABIS="amd64 x86" but we want to
2494 - # add x32 to it, gcc/glibc don't yet support x32.
2495 - #
2496 - if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
2497 - echo 'main(){}' > "${T}"/test.c
2498 - if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
2499 - sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
2500 - fi
2501 - fi
2502 -}
2503 -
2504 -glibc_headers_configure() {
2505 - export ABI=default
2506 -
2507 - local builddir=$(builddir "headers")
2508 - mkdir -p "${builddir}"
2509 - cd "${builddir}"
2510 -
2511 - # if we don't have a compiler yet, we can't really test it now ...
2512 - # hopefully they don't affect header generation, so let's hope for
2513 - # the best here ...
2514 - local v vars=(
2515 - ac_cv_header_cpuid_h=yes
2516 - libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
2517 - libc_cv_asm_cfi_directives=yes
2518 - libc_cv_broken_visibility_attribute=no
2519 - libc_cv_c_cleanup=yes
2520 - libc_cv_compiler_powerpc64le_binary128_ok=yes
2521 - libc_cv_forced_unwind=yes
2522 - libc_cv_gcc___thread=yes
2523 - libc_cv_mlong_double_128=yes
2524 - libc_cv_mlong_double_128ibm=yes
2525 - libc_cv_ppc_machine=yes
2526 - libc_cv_ppc_rel16=yes
2527 - libc_cv_predef_fortify_source=no
2528 - libc_cv_target_power8_ok=yes
2529 - libc_cv_visibility_attribute=yes
2530 - libc_cv_z_combreloc=yes
2531 - libc_cv_z_execstack=yes
2532 - libc_cv_z_initfirst=yes
2533 - libc_cv_z_nodelete=yes
2534 - libc_cv_z_nodlopen=yes
2535 - libc_cv_z_relro=yes
2536 - libc_mips_abi=${ABI}
2537 - libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
2538 - # These libs don't have configure flags.
2539 - ac_cv_lib_audit_audit_log_user_avc_message=no
2540 - ac_cv_lib_cap_cap_init=no
2541 - )
2542 -
2543 - einfo "Forcing cached settings:"
2544 - for v in "${vars[@]}" ; do
2545 - einfo " ${v}"
2546 - export ${v}
2547 - done
2548 -
2549 - local headers_only_arch_CPPFLAGS=()
2550 -
2551 - # Blow away some random CC settings that screw things up. #550192
2552 - if [[ -d ${S}/sysdeps/mips ]]; then
2553 - pushd "${S}"/sysdeps/mips >/dev/null
2554 - sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
2555 - sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
2556 -
2557 - # Force the mips ABI to the default. This is OK because the set of
2558 - # installed headers in this phase is the same between the 3 ABIs.
2559 - # If this ever changes, this hack will break, but that's unlikely
2560 - # as glibc discourages that behavior.
2561 - # https://crbug.com/647033
2562 - sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
2563 -
2564 - popd >/dev/null
2565 - fi
2566 -
2567 - case ${CTARGET} in
2568 - riscv*)
2569 - # RISC-V interrogates the compiler to determine which target to
2570 - # build. If building the headers then we don't strictly need a
2571 - # RISC-V compiler, so the built-in definitions that are provided
2572 - # along with all RISC-V compiler might not exist. This causes
2573 - # glibc's RISC-V preconfigure script to blow up. Since we're just
2574 - # building the headers any value will actually work here, so just
2575 - # pick the standard one (rv64g/lp64d) to make the build scripts
2576 - # happy for now -- the headers are all the same anyway so it
2577 - # doesn't matter.
2578 - headers_only_arch_CPPFLAGS+=(
2579 - -D__riscv_xlen=64
2580 - -D__riscv_flen=64
2581 - -D__riscv_float_abi_double=1
2582 - -D__riscv_atomic=1
2583 - ) ;;
2584 - esac
2585 -
2586 - local myconf=()
2587 - myconf+=(
2588 - --disable-sanity-checks
2589 - --enable-hacker-mode
2590 - --without-cvs
2591 - --disable-werror
2592 - --enable-bind-now
2593 - --build=${CBUILD_OPT:-${CBUILD}}
2594 - --host=${CTARGET_OPT:-${CTARGET}}
2595 - --with-headers=$(alt_build_headers)
2596 - --prefix="$(host_eprefix)/usr"
2597 - ${EXTRA_ECONF}
2598 - )
2599 -
2600 - # Nothing is compiled here which would affect the headers for the target.
2601 - # So forcing CC/CFLAGS is sane.
2602 - local headers_only_CC=$(tc-getBUILD_CC)
2603 - local headers_only_CFLAGS="-O1 -pipe"
2604 - local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}"
2605 - local headers_only_LDFLAGS=""
2606 - set -- "${S}"/configure "${myconf[@]}"
2607 - echo \
2608 - "CC=${headers_only_CC}" \
2609 - "CFLAGS=${headers_only_CFLAGS}" \
2610 - "CPPFLAGS=${headers_only_CPPFLAGS}" \
2611 - "LDFLAGS=${headers_only_LDFLAGS}" \
2612 - "$@"
2613 - CC=${headers_only_CC} \
2614 - CFLAGS=${headers_only_CFLAGS} \
2615 - CPPFLAGS=${headers_only_CPPFLAGS} \
2616 - LDFLAGS="" \
2617 - "$@" || die "failed to configure glibc"
2618 -}
2619 -
2620 -do_src_configure() {
2621 - if just_headers ; then
2622 - glibc_headers_configure
2623 - else
2624 - glibc_do_configure nptl
2625 - fi
2626 -}
2627 -
2628 -src_configure() {
2629 - foreach_abi do_src_configure
2630 -}
2631 -
2632 -do_src_compile() {
2633 - emake -C "$(builddir nptl)"
2634 -}
2635 -
2636 -src_compile() {
2637 - if just_headers ; then
2638 - return
2639 - fi
2640 -
2641 - foreach_abi do_src_compile
2642 -}
2643 -
2644 -glibc_src_test() {
2645 - cd "$(builddir nptl)"
2646 - emake check
2647 -}
2648 -
2649 -do_src_test() {
2650 - local ret=0
2651 -
2652 - glibc_src_test
2653 - : $(( ret |= $? ))
2654 -
2655 - return ${ret}
2656 -}
2657 -
2658 -src_test() {
2659 - if just_headers ; then
2660 - return
2661 - fi
2662 -
2663 - # Give tests more time to complete.
2664 - export TIMEOUTFACTOR=5
2665 -
2666 - foreach_abi do_src_test || die "tests failed"
2667 -}
2668 -
2669 -run_locale_gen() {
2670 - # if the host locales.gen contains no entries, we'll install everything
2671 - local root="$1"
2672 - local inplace=""
2673 -
2674 - if [[ "${root}" == "--inplace-glibc" ]] ; then
2675 - inplace="--inplace-glibc"
2676 - root="$2"
2677 - fi
2678 -
2679 - local locale_list="${root}/etc/locale.gen"
2680 -
2681 - pushd "${ED}"/$(get_libdir) >/dev/null
2682 -
2683 - if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
2684 - [[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
2685 - locale_list="${root}/usr/share/i18n/SUPPORTED"
2686 - fi
2687 -
2688 - locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
2689 - --destdir "${root}"
2690 -
2691 - popd >/dev/null
2692 -}
2693 -
2694 -glibc_do_src_install() {
2695 - local builddir=$(builddir nptl)
2696 - cd "${builddir}"
2697 -
2698 - emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install
2699 -
2700 - # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
2701 - # which come without headers etc. Only needed for binary packages since the
2702 - # external net-libs/libnsl has increased soversion. Keep only versioned libraries.
2703 - find "${D}" -name "libnsl.a" -delete
2704 - find "${D}" -name "libnsl.so" -delete
2705 -
2706 - # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
2707 - # to infer upstream version:
2708 - # '#define VERSION "2.26.90"' -> '2.26.90'
2709 - local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
2710 -
2711 - # Avoid stripping binaries not targeted by ${CHOST}. Or else
2712 - # ${CHOST}-strip would break binaries build for ${CTARGET}.
2713 - is_crosscompile && dostrip -x /
2714 - # gdb thread introspection relies on local libpthreas symbols. stripping breaks it
2715 - # See Note [Disable automatic stripping]
2716 - dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
2717 -
2718 - if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
2719 - # Move versioned .a file out of libdir to evade portage QA checks
2720 - # instead of using gen_usr_ldscript(). We fix ldscript as:
2721 - # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
2722 - sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"/$(alt_usrlibdir)/libm.a || die
2723 - dodir $(alt_usrlibdir)/${P}
2724 - mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
2725 - fi
2726 -
2727 - # We'll take care of the cache ourselves
2728 - rm -f "${ED}"/etc/ld.so.cache
2729 -
2730 - # Everything past this point just needs to be done once ...
2731 - is_final_abi || return 0
2732 -
2733 - # Make sure the non-native interp can be found on multilib systems even
2734 - # if the main library set isn't installed into the right place. Maybe
2735 - # we should query the active gcc for info instead of hardcoding it ?
2736 - local i ldso_abi ldso_name
2737 - local ldso_abi_list=(
2738 - # x86
2739 - amd64 /lib64/ld-linux-x86-64.so.2
2740 - x32 /libx32/ld-linux-x32.so.2
2741 - x86 /lib/ld-linux.so.2
2742 - # mips
2743 - o32 /lib/ld.so.1
2744 - n32 /lib32/ld.so.1
2745 - n64 /lib64/ld.so.1
2746 - # powerpc
2747 - ppc /lib/ld.so.1
2748 - ppc64 /lib64/ld64.so.1
2749 - # riscv
2750 - lp64d /lib/ld-linux-riscv64-lp64d.so.1
2751 - lp64 /lib/ld-linux-riscv64-lp64.so.1
2752 - # s390
2753 - s390 /lib/ld.so.1
2754 - s390x /lib/ld64.so.1
2755 - # sparc
2756 - sparc32 /lib/ld-linux.so.2
2757 - sparc64 /lib64/ld-linux.so.2
2758 - )
2759 - case $(tc-endian) in
2760 - little)
2761 - ldso_abi_list+=(
2762 - # arm
2763 - arm64 /lib/ld-linux-aarch64.so.1
2764 - )
2765 - ;;
2766 - big)
2767 - ldso_abi_list+=(
2768 - # arm
2769 - arm64 /lib/ld-linux-aarch64_be.so.1
2770 - )
2771 - ;;
2772 - esac
2773 - if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
2774 - dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
2775 - fi
2776 - for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
2777 - ldso_abi=${ldso_abi_list[i]}
2778 - has ${ldso_abi} $(get_install_abis) || continue
2779 -
2780 - ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
2781 - if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
2782 - dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
2783 - fi
2784 - done
2785 -
2786 - # With devpts under Linux mounted properly, we do not need the pt_chown
2787 - # binary to be setuid. This is because the default owners/perms will be
2788 - # exactly what we want.
2789 - if ! use suid ; then
2790 - find "${ED}" -name pt_chown -exec chmod -s {} +
2791 - fi
2792 -
2793 - #################################################################
2794 - # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
2795 - # Make sure we install some symlink hacks so that when we build
2796 - # a 2nd stage cross-compiler, gcc finds the target system
2797 - # headers correctly. See gcc/doc/gccinstall.info
2798 - if is_crosscompile ; then
2799 - # We need to make sure that /lib and /usr/lib always exists.
2800 - # gcc likes to use relative paths to get to its multilibs like
2801 - # /usr/lib/../lib64/. So while we don't install any files into
2802 - # /usr/lib/, we do need it to exist.
2803 - keepdir $(alt_prefix)/lib
2804 - keepdir $(alt_prefix)/usr/lib
2805 -
2806 - dosym usr/include $(alt_prefix)/sys-include
2807 - return 0
2808 - fi
2809 -
2810 - # Files for Debian-style locale updating
2811 - dodir /usr/share/i18n
2812 - sed \
2813 - -e "/^#/d" \
2814 - -e "/SUPPORTED-LOCALES=/d" \
2815 - -e "s: \\\\::g" -e "s:/: :g" \
2816 - "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
2817 - || die "generating /usr/share/i18n/SUPPORTED failed"
2818 - cd "${WORKDIR}"/extra/locale
2819 - dosbin locale-gen
2820 - doman *.[0-8]
2821 - insinto /etc
2822 - doins locale.gen
2823 -
2824 - # Make sure all the ABI's can find the locales and so we only
2825 - # have to generate one set
2826 - local a
2827 - keepdir /usr/$(get_libdir)/locale
2828 - for a in $(get_install_abis) ; do
2829 - if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
2830 - dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
2831 - fi
2832 - done
2833 -
2834 - # HACK: If we're building for riscv, we need to additionally make sure that
2835 - # we can find the locale archive afterwards
2836 - case ${CTARGET} in
2837 - riscv*)
2838 - if [[ ! -e ${ED}/usr/lib/locale ]] ; then
2839 - dosym ../$(get_libdir)/locale /usr/lib/locale
2840 - fi
2841 - ;;
2842 - *) ;;
2843 - esac
2844 -
2845 - cd "${S}"
2846 -
2847 - # Install misc network config files
2848 - insinto /etc
2849 - doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
2850 - doins "${WORKDIR}"/extra/etc/*.conf
2851 -
2852 - if use nscd ; then
2853 - doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
2854 -
2855 - local nscd_args=(
2856 - -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
2857 - )
2858 -
2859 - sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
2860 -
2861 - systemd_dounit nscd/nscd.service
2862 - systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
2863 - else
2864 - # Do this since extra/etc/*.conf above might have nscd.conf.
2865 - rm -f "${ED}"/etc/nscd.conf
2866 - fi
2867 -
2868 - echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
2869 - doenvd "${T}"/00glibc
2870 -
2871 - for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
2872 - [[ -s ${d} ]] && dodoc ${d}
2873 - done
2874 - dodoc -r ChangeLog.old
2875 -
2876 - # Prevent overwriting of the /etc/localtime symlink. We'll handle the
2877 - # creation of the "factory" symlink in pkg_postinst().
2878 - rm -f "${ED}"/etc/localtime
2879 -
2880 - # Generate all locales if this is a native build as locale generation
2881 - if use compile-locales && ! is_crosscompile ; then
2882 - run_locale_gen --inplace-glibc "${ED}/"
2883 - sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
2884 - fi
2885 -}
2886 -
2887 -glibc_headers_install() {
2888 - local builddir=$(builddir "headers")
2889 - cd "${builddir}"
2890 - emake install_root="${D}/$(build_eprefix)$(alt_prefix)" install-headers
2891 -
2892 - insinto $(alt_headers)/gnu
2893 - doins "${S}"/include/gnu/stubs.h
2894 -
2895 - # Make sure we install the sys-include symlink so that when
2896 - # we build a 2nd stage cross-compiler, gcc finds the target
2897 - # system headers correctly. See gcc/doc/gccinstall.info
2898 - dosym usr/include $(alt_prefix)/sys-include
2899 -}
2900 -
2901 -src_install() {
2902 - if just_headers ; then
2903 - export ABI=default
2904 - glibc_headers_install
2905 - return
2906 - fi
2907 -
2908 - foreach_abi glibc_do_src_install
2909 -}
2910 -
2911 -# Simple test to make sure our new glibc isn't completely broken.
2912 -# Make sure we don't test with statically built binaries since
2913 -# they will fail. Also, skip if this glibc is a cross compiler.
2914 -#
2915 -# If coreutils is built with USE=multicall, some of these files
2916 -# will just be wrapper scripts, not actual ELFs we can test.
2917 -glibc_sanity_check() {
2918 - cd / #228809
2919 -
2920 - # We enter ${ED} so to avoid trouble if the path contains
2921 - # special characters; for instance if the path contains the
2922 - # colon character (:), then the linker will try to split it
2923 - # and look for the libraries in an unexpected place. This can
2924 - # lead to unsafe code execution if the generated prefix is
2925 - # within a world-writable directory.
2926 - # (e.g. /var/tmp/portage:${HOSTNAME})
2927 - pushd "${ED}"/$(get_libdir) >/dev/null
2928 -
2929 - local x striptest
2930 - for x in cal date env free ls true uname uptime ; do
2931 - x=$(type -p ${x})
2932 - [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
2933 - striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
2934 - case ${striptest} in
2935 - *"statically linked"*) continue;;
2936 - *"ASCII text"*) continue;;
2937 - esac
2938 - # We need to clear the locale settings as the upgrade might want
2939 - # incompatible locale data. This test is not for verifying that.
2940 - LC_ALL=C \
2941 - ./ld-*.so --library-path . ${x} > /dev/null \
2942 - || die "simple run test (${x}) failed"
2943 - done
2944 -
2945 - popd >/dev/null
2946 -}
2947 -
2948 -pkg_preinst() {
2949 - # nothing to do if just installing headers
2950 - just_headers && return
2951 -
2952 - # prepare /etc/ld.so.conf.d/ for files
2953 - mkdir -p "${EROOT}"/etc/ld.so.conf.d
2954 -
2955 - # Default /etc/hosts.conf:multi to on for systems with small dbs.
2956 - if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
2957 - sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
2958 - einfo "Defaulting /etc/host.conf:multi to on"
2959 - fi
2960 -
2961 - [[ -n ${ROOT} ]] && return 0
2962 - [[ -d ${ED}/$(get_libdir) ]] || return 0
2963 - [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
2964 -}
2965 -
2966 -pkg_postinst() {
2967 - # nothing to do if just installing headers
2968 - just_headers && return
2969 -
2970 - if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
2971 - # Generate fastloading iconv module configuration file.
2972 - "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
2973 - fi
2974 -
2975 - if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
2976 - use compile-locales || run_locale_gen "${EROOT}/"
2977 - fi
2978 -
2979 - # Check for sanity of /etc/nsswitch.conf, take 2
2980 - if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then
2981 - local entry
2982 - for entry in passwd group shadow; do
2983 - if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then
2984 - ewarn ""
2985 - ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been"
2986 - ewarn "removed from glibc and is now provided by the package"
2987 - ewarn " sys-auth/libnss-nis"
2988 - ewarn "Install it now to keep your NIS setup working."
2989 - ewarn ""
2990 - fi
2991 - done
2992 - fi
2993 -}