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