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