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