Gentoo Archives: gentoo-commits

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