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