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