Gentoo Archives: gentoo-commits

From: "Andreas Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/
Date: Thu, 08 Feb 2018 23:50:20
Message-Id: 1518133780.fa2244fedca8e63902ba8d879dbf0f4d9548d754.dilfridge@gentoo
1 commit: fa2244fedca8e63902ba8d879dbf0f4d9548d754
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 8 23:49:17 2018 +0000
4 Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 8 23:49:40 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa2244fe
7
8 sys-libs/glibc: Revbump 2.26-r6 with next patchset (patchlevel 6)
9
10 10 test failures need investigating:
11 ===
12 FAIL: elf/tst-prelink-cmp
13 XPASS: elf/tst-protected1a
14 XPASS: elf/tst-protected1b
15 FAIL: malloc/tst-malloc-tcache-leak
16 FAIL: math/test-float128-finite-tgamma
17 FAIL: math/test-float128-finite-trunc
18 FAIL: math/test-float128-tgamma
19 FAIL: math/test-float128-trunc
20 FAIL: math/test-ifloat128-tgamma
21 FAIL: math/test-ifloat128-trunc
22 FAIL: misc/tst-ttyname
23 UNSUPPORTED: nptl/test-cond-printers
24 UNSUPPORTED: nptl/test-condattr-printers
25 UNSUPPORTED: nptl/test-mutex-printers
26 UNSUPPORTED: nptl/test-mutexattr-printers
27 UNSUPPORTED: nptl/test-rwlock-printers
28 UNSUPPORTED: nptl/test-rwlockattr-printers
29 FAIL: nss/tst-nss-files-hosts-multi
30 Summary of test results:
31 10 FAIL
32 4113 PASS
33 6 UNSUPPORTED
34 29 XFAIL
35 2 XPASS
36 ===
37
38 Bug: https://bugs.gentoo.org/646492
39 Bug: https://bugs.gentoo.org/646490
40 Bug: https://bugs.gentoo.org/641644
41 Bug: https://bugs.gentoo.org/644278
42 Package-Manager: Portage-2.3.21, Repoman-2.3.6
43
44 sys-libs/glibc/Manifest | 1 +
45 sys-libs/glibc/glibc-2.26-r6.ebuild | 836 ++++++++++++++++++++++++++++++++++++
46 2 files changed, 837 insertions(+)
47
48 diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest
49 index 78d5765e530..650786e1209 100644
50 --- a/sys-libs/glibc/Manifest
51 +++ b/sys-libs/glibc/Manifest
52 @@ -17,6 +17,7 @@ DIST glibc-2.25-patches-12.tar.bz2 65396 BLAKE2B b23d5d681314c03b8dd5ad20516324c
53 DIST glibc-2.25-patches-13.tar.bz2 71481 BLAKE2B bf5691afabf03b579b8d634da30a2a967ab62d5e470a23b0946ff3354aa974b3b65821aca2f33dd30dd864a82459f4750178bf6ae01a5117ccfde62efd8f594e SHA512 7c80e4aba9edf0310e1707b03a6945f657d71267a4d0d67c24b979c841544a6a623d7c2dbb0a0d55863e25831439d717d096ecf377f936b731baeb04f21704a7
54 DIST glibc-2.25.tar.xz 13873900 BLAKE2B 73ef792fff059f6ad154c9af2155ea15b7869ec1b93e557b6c58129bfb50f863c06f8b49425d75fd2df537dd9c4a68bad790cff770c50a6889732d66f507d349 SHA512 5b7a2418d5b8a1b6a907c6c7fb6477ee2a473151cb45e03d0d4cdd9a33497c90b1ee39e2e7e885e2b25743dcd3747336ef114b4a73eb001da1fd79f29e0f9a6e
55 DIST glibc-2.26-patches-5.tar.bz2 357699 BLAKE2B 98a0cb231bf35a132747f1fa6e654a9ad2eff8b445f002a0239c9a45f5a896ad490570aedee2b43e6cfa94794ae5c8b5e312e369838c3770823f28b61b51b592 SHA512 0040469e4a85f5c2aac972e42aeb06b0adfc3a132b32b19306be9f1877339fe6651a2fbd4d90d502b07ae4460f74efbd1cd103d38a2038df9402b0a380f03c2a
56 +DIST glibc-2.26-patches-6.tar.bz2 413639 BLAKE2B 51853dcfd6237a1abcf233e339cc32cfc9d1f9e4d35360971d7dcc95161dc020d6e36e2ba683cb571d3a23e935ce0186da0640c2290de44018c3526dd1de000c SHA512 728d9cf98f48084c9a23e948e7446b6f748db4d57abb0045cf09c2ad847912256a7b1fed16b2f85bb4bb80878ce3485bbd6a311ec7aa0921550f3b357db4c304
57 DIST glibc-2.26.tar.xz 14682748 BLAKE2B c1c9dbec110dd4e25b2f463a96d8afc43b8e3ebfe3c958107032beaa879710252be3bc4122bb62166408725d43785f233544df6159d29cce0fc5b2c08f45adbe SHA512 6ed368523bc55f00976f96c5177f114e3f714b27273d7bffc252812c8b98fb81970403c1f5b5f0a61da678811532fb446530745492d2b49bfefc0d5bd71ce8c0
58 DIST glibc-2.27-patches-1.tar.bz2 15950 BLAKE2B ef2d2ede447b98c5e20f1bf1328f1379fd781b603a888f0fd7f1dbb6172e42222c9198d61dd75d9aafbed5c395a277a3c0d00ef4b70932fafb500b111e013963 SHA512 9e3ed7e271313c104eefcd383e6259c235b4e2f7a41be2ba8a1bfb469f8f54835ffde63ae89fa40af47b444911addb0db002a05d033bcc2832710b51650c91e3
59 DIST glibc-2.27.tar.xz 15395316 BLAKE2B ea206d304c8c9aa86d69db981a14bea008602cea06a6c151c4971a8df059949ffe5632b42a67ab0ffcd7c4d7ce1ec02ac48815dac4dade1c4dd41eaee8a6ed33 SHA512 7c5581154487d38d173ce1feb944e60207139cca148bccf066eaae322c0c2d219423bdcfa15c7f9be1b5e45dfc43c641cc5d80d3c3c65837d08a83cdb4e2a147
60
61 diff --git a/sys-libs/glibc/glibc-2.26-r6.ebuild b/sys-libs/glibc/glibc-2.26-r6.ebuild
62 new file mode 100644
63 index 00000000000..509801b287d
64 --- /dev/null
65 +++ b/sys-libs/glibc/glibc-2.26-r6.ebuild
66 @@ -0,0 +1,836 @@
67 +# Copyright 1999-2018 Gentoo Foundation
68 +# Distributed under the terms of the GNU General Public License v2
69 +
70 +EAPI=6
71 +
72 +inherit prefix toolchain-glibc
73 +
74 +DESCRIPTION="GNU libc C library"
75 +HOMEPAGE="https://www.gnu.org/software/libc/"
76 +
77 +LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE"
78 +RESTRICT="strip" # Strip ourself #46186
79 +EMULTILIB_PKG="true"
80 +
81 +# Configuration variables
82 +
83 +if [[ ${PV} == 9999* ]]; then
84 + EGIT_REPO_URI="git://sourceware.org/git/glibc.git"
85 + inherit git-r3
86 +else
87 + #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
88 + SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
89 +fi
90 +
91 +RELEASE_VER=${PV}
92 +
93 +GCC_BOOTSTRAP_VER="4.7.3-r1"
94 +
95 +# Gentoo patchset
96 +PATCH_VER=6
97 +
98 +SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2"
99 +SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )"
100 +
101 +IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only"
102 +
103 +# Min kernel version glibc requires
104 +: ${NPTL_KERN_VER:="3.2.0"}
105 +
106 +# Here's how the cross-compile logic breaks down ...
107 +# CTARGET - machine that will target the binaries
108 +# CHOST - machine that will host the binaries
109 +# CBUILD - machine that will build the binaries
110 +# If CTARGET != CHOST, it means you want a libc for cross-compiling.
111 +# If CHOST != CBUILD, it means you want to cross-compile the libc.
112 +# CBUILD = CHOST = CTARGET - native build/install
113 +# CBUILD != (CHOST = CTARGET) - cross-compile a native build
114 +# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
115 +# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
116 +# For install paths:
117 +# CHOST = CTARGET - install into /
118 +# CHOST != CTARGET - install into /usr/CTARGET/
119 +
120 +export CBUILD=${CBUILD:-${CHOST}}
121 +export CTARGET=${CTARGET:-${CHOST}}
122 +if [[ ${CTARGET} == ${CHOST} ]] ; then
123 + if [[ ${CATEGORY} == cross-* ]] ; then
124 + export CTARGET=${CATEGORY#cross-}
125 + fi
126 +fi
127 +
128 +is_crosscompile() {
129 + [[ ${CHOST} != ${CTARGET} ]]
130 +}
131 +
132 +SLOT="2.2"
133 +
134 +# General: We need a new-enough binutils/gcc to match upstream baseline.
135 +# arch: we need to make sure our binutils/gcc supports TLS.
136 +COMMON_DEPEND="
137 + nscd? ( selinux? (
138 + audit? ( sys-process/audit )
139 + caps? ( sys-libs/libcap )
140 + ) )
141 + suid? ( caps? ( sys-libs/libcap ) )
142 + selinux? ( sys-libs/libselinux )
143 + systemtap? ( dev-util/systemtap )
144 +"
145 +DEPEND="${COMMON_DEPEND}
146 + >=app-misc/pax-utils-0.1.10
147 + !<sys-apps/sandbox-1.6
148 + !<sys-apps/portage-2.1.2
149 + doc? ( sys-apps/texinfo )
150 +"
151 +RDEPEND="${COMMON_DEPEND}
152 + !sys-kernel/ps3-sources
153 + sys-apps/gentoo-functions
154 + !sys-libs/nss-db
155 +"
156 +
157 +if [[ ${CATEGORY} == cross-* ]] ; then
158 + DEPEND+=" !headers-only? (
159 + >=${CATEGORY}/binutils-2.24
160 + >=${CATEGORY}/gcc-4.9
161 + )"
162 + [[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
163 +else
164 + DEPEND+="
165 + >=sys-devel/binutils-2.24
166 + >=sys-devel/gcc-4.9
167 + virtual/os-headers
168 + "
169 + RDEPEND+=" vanilla? ( !sys-libs/timezone-data )"
170 + PDEPEND+=" !vanilla? ( sys-libs/timezone-data )"
171 +fi
172 +
173 +#
174 +# the phases
175 +#
176 +
177 +pkg_pretend() {
178 + # Make sure devpts is mounted correctly for use w/out setuid pt_chown
179 + check_devpts
180 +
181 + # Prevent native builds from downgrading
182 + if [[ ${MERGE_TYPE} != "buildonly" ]] && \
183 + [[ ${ROOT} == "/" ]] && \
184 + [[ ${CBUILD} == ${CHOST} ]] && \
185 + [[ ${CHOST} == ${CTARGET} ]] ; then
186 + # The high rev # is to allow people to downgrade between -r# versions.
187 + # We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine.
188 + # Hopefully we never actually use a r# this high.
189 + if has_version ">${CATEGORY}/${P}-r10000" ; then
190 + eerror "Sanity check to keep you from breaking your system:"
191 + eerror " Downgrading glibc is not supported and a sure way to destruction"
192 + die "Aborting to save your system"
193 + fi
194 +
195 + if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
196 + then
197 + eerror "Your patched vendor kernel is broken. You need to get an"
198 + eerror "update from whoever is providing the kernel to you."
199 + eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227"
200 + eerror "https://bugs.gentoo.org/262698"
201 + die "Keeping your system alive, say thank you"
202 + fi
203 +
204 + if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
205 + then
206 + eerror "Your old kernel is broken. You need to update it to"
207 + eerror "a newer version as syscall(<bignum>) will break."
208 + eerror "https://bugs.gentoo.org/279260"
209 + die "Keeping your system alive, say thank you"
210 + fi
211 + fi
212 +
213 + # Users have had a chance to phase themselves, time to give em the boot
214 + if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
215 + eerror "You still haven't deleted ${EROOT}/etc/locales.build."
216 + eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
217 + die "Lazy upgrader detected"
218 + fi
219 +
220 + if [[ ${CTARGET} == i386-* ]] ; then
221 + eerror "i386 CHOSTs are no longer supported."
222 + eerror "Chances are you don't actually want/need i386."
223 + eerror "Please read https://www.gentoo.org/doc/en/change-chost.xml"
224 + die "Please fix your CHOST"
225 + fi
226 +
227 + if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
228 + ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
229 + ewarn "This will result in a 50% performance penalty when running with a 32bit"
230 + ewarn "hypervisor, which is probably not what you want."
231 + fi
232 +
233 + use hardened && ! tc-enables-pie && \
234 + ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
235 +
236 + # Make sure host system is up to date #394453
237 + if has_version '<sys-libs/glibc-2.13' && \
238 + [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]]
239 + then
240 + ebegin "Scanning system for __guard to see if you need to rebuild first ..."
241 + local files=$(
242 + scanelf -qys__guard -F'#s%F' \
243 + "${EROOT}"/*bin/ \
244 + "${EROOT}"/lib* \
245 + "${EROOT}"/usr/*bin/ \
246 + "${EROOT}"/usr/lib* | \
247 + egrep -v \
248 + -e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \
249 + -e "^${EROOT}/sbin/(ldconfig|sln)$"
250 + )
251 + [[ -z ${files} ]]
252 + if ! eend $? ; then
253 + eerror "Your system still has old SSP __guard symbols. You need to"
254 + eerror "rebuild all the packages that provide these files first:"
255 + eerror "${files}"
256 + die "old __guard detected"
257 + fi
258 + fi
259 +
260 + # Check for sanity of /etc/nsswitch.conf
261 + if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
262 + local entry
263 + for entry in passwd group shadow; do
264 + if ! egrep -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
265 + eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
266 + eerror "Please make sure you have 'files' entries for"
267 + eerror "'passwd:', 'group:' and 'shadow:' databases."
268 + eerror "For more details see:"
269 + eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
270 + die "nsswitch.conf has no 'files' provider in '${entry}'."
271 + fi
272 + done
273 + fi
274 +}
275 +
276 +src_unpack() {
277 + use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2
278 +
279 + setup_env
280 +
281 + # Check NPTL support _before_ we unpack things to save some time
282 + check_nptl_support
283 +
284 + if [[ -n ${EGIT_REPO_URI} ]] ; then
285 + git-r3_src_unpack
286 + else
287 + unpack ${P}.tar.xz
288 + fi
289 +
290 + cd "${S}"
291 + touch locale/C-translit.h #185476 #218003
292 +
293 + cd "${WORKDIR}"
294 + unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
295 +}
296 +
297 +src_prepare() {
298 + if ! use vanilla ; then
299 + elog "Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER}"
300 + eapply "${WORKDIR}"/patches
301 + einfo "Done."
302 + fi
303 +
304 + if just_headers ; then
305 + if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
306 + # mips peeps like to screw with us. if building headers,
307 + # we don't have a real compiler, so we can't let them
308 + # insert -mabi on us.
309 + sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
310 + find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
311 + fi
312 + fi
313 +
314 + default
315 +
316 + gnuconfig_update
317 +
318 + cd "${WORKDIR}"
319 + find . -name configure -exec touch {} +
320 +
321 + eprefixify extra/locale/locale-gen
322 +
323 + # Fix permissions on some of the scripts.
324 + chmod u+x "${S}"/scripts/*.sh
325 +
326 + cd "${S}"
327 +
328 + if use hardened ; then
329 + # We don't enable these for non-hardened as the output is very terse --
330 + # it only states that a crash happened. The default upstream behavior
331 + # includes backtraces and symbols.
332 + einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
333 + cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die
334 + cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die
335 +
336 + if use debug ; then
337 + # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested.
338 + sed -i \
339 + -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
340 + -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
341 + debug/Makefile || die
342 + fi
343 + fi
344 +}
345 +
346 +glibc_do_configure() {
347 + # Glibc does not work with gold (for various reasons) #269274.
348 + tc-ld-disable-gold
349 +
350 + # CXX isnt handled by the multilib system, so if we dont unset here
351 + # we accumulate crap across abis
352 + unset CXX
353 +
354 + einfo "Configuring glibc for $1"
355 +
356 + if use doc ; then
357 + export MAKEINFO=makeinfo
358 + else
359 + export MAKEINFO=/dev/null
360 + fi
361 +
362 + local v
363 + for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO ; do
364 + einfo " $(printf '%15s' ${v}:) ${!v}"
365 + done
366 +
367 + # The glibc configure script doesn't properly use LDFLAGS all the time.
368 + export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}"
369 + einfo " $(printf '%15s' 'Manual CC:') ${CC}"
370 +
371 + # Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
372 + export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS)"
373 + einfo " $(printf '%15s' 'Manual CXX:') ${CXX}"
374 +
375 + echo
376 +
377 + local myconf=()
378 +
379 + # set addons
380 + pushd "${S}" > /dev/null
381 + local addons=$(echo */configure | sed \
382 + -e 's:/configure::g' \
383 + -e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
384 + -e 's: \+$::' \
385 + -e 's! !,!g' \
386 + -e 's!^!,!' \
387 + -e '/^,\*$/d')
388 + [[ -d ports ]] && addons+=",ports"
389 + popd > /dev/null
390 +
391 + case ${CTARGET} in
392 + powerpc-*)
393 + # Currently gcc on powerpc32 generates invalid code for
394 + # __builtin_return_address(0) calls. Normally programs
395 + # don't do that but malloc hooks in glibc do:
396 + # https://gcc.gnu.org/PR81996
397 + # https://bugs.gentoo.org/629054
398 + myconf+=( --enable-stack-protector=no )
399 + ;;
400 + *)
401 + myconf+=( --enable-stack-protector=all )
402 + ;;
403 + esac
404 + myconf+=( --enable-stackguard-randomization )
405 +
406 + # Keep a whitelist of targets supporing IFUNC. glibc's ./configure
407 + # is not robust enough to detect proper support:
408 + # https://bugs.gentoo.org/641216
409 + # https://sourceware.org/PR22634#c0
410 + case $(tc-arch ${CTARGET}) in
411 + # Keep whitelist of targets where autodetection mostly works.
412 + amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
413 + # Blacklist everywhere else
414 + *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
415 + esac
416 +
417 + [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
418 +
419 + if [[ $1 == "nptl" ]] ; then
420 + myconf+=( --enable-kernel=${NPTL_KERN_VER} )
421 + else
422 + die "invalid pthread option"
423 + fi
424 + myconf+=( --enable-add-ons="${addons#,}" )
425 +
426 + # Since SELinux support is only required for nscd, only enable it if:
427 + # 1. USE selinux
428 + # 2. only for the primary ABI on multilib systems
429 + # 3. Not a crosscompile
430 + if ! is_crosscompile && use selinux ; then
431 + if use multilib ; then
432 + if is_final_abi ; then
433 + myconf+=( --with-selinux )
434 + else
435 + myconf+=( --without-selinux )
436 + fi
437 + else
438 + myconf+=( --with-selinux )
439 + fi
440 + else
441 + myconf+=( --without-selinux )
442 + fi
443 +
444 + # Force a few tests where we always know the answer but
445 + # configure is incapable of finding it.
446 + if is_crosscompile ; then
447 + export \
448 + libc_cv_c_cleanup=yes \
449 + libc_cv_forced_unwind=yes
450 + fi
451 +
452 + myconf+=(
453 + --without-cvs
454 + --disable-werror
455 + --enable-bind-now
456 + --build=${CBUILD_OPT:-${CBUILD}}
457 + --host=${CTARGET_OPT:-${CTARGET}}
458 + $(use_enable profile)
459 + $(use_with gd)
460 + --with-headers=$(alt_build_headers)
461 + --prefix="${EPREFIX}/usr"
462 + --sysconfdir="${EPREFIX}/etc"
463 + --localstatedir="${EPREFIX}/var"
464 + --libdir='$(prefix)'/$(get_libdir)
465 + --mandir='$(prefix)'/share/man
466 + --infodir='$(prefix)'/share/info
467 + --libexecdir='$(libdir)'/misc/glibc
468 + --with-bugurl=https://bugs.gentoo.org/
469 + --with-pkgversion="$(glibc_banner)"
470 + $(use_multiarch || echo --disable-multi-arch)
471 + $(in_iuse systemtap && use_enable systemtap)
472 + $(in_iuse nscd && use_enable nscd)
473 + ${EXTRA_ECONF}
474 + )
475 +
476 + # We rely on sys-libs/timezone-data for timezone tools normally.
477 + myconf+=( $(use_enable vanilla timezone-tools) )
478 +
479 + # These libs don't have configure flags.
480 + ac_cv_lib_audit_audit_log_user_avc_message=$(in_iuse audit && usex audit || echo no)
481 + ac_cv_lib_cap_cap_init=$(in_iuse caps && usex caps || echo no)
482 +
483 + # There is no configure option for this and we need to export it
484 + # since the glibc build will re-run configure on itself
485 + export libc_cv_rootsbindir="${EPREFIX}/sbin"
486 + export libc_cv_slibdir="${EPREFIX}/$(get_libdir)"
487 +
488 + # We take care of patching our binutils to use both hash styles,
489 + # and many people like to force gnu hash style only, so disable
490 + # this overriding check. #347761
491 + export libc_cv_hashstyle=no
492 +
493 + local builddir=$(builddir "$1")
494 + mkdir -p "${builddir}"
495 + cd "${builddir}"
496 + set -- "${S}"/configure "${myconf[@]}"
497 + echo "$@"
498 + "$@" || die "failed to configure glibc"
499 +
500 + # ia64 static cross-compilers are a pita in so much that they
501 + # can't produce static ELFs (as the libgcc.a is broken). so
502 + # disable building of the programs for those targets if it
503 + # doesn't work.
504 + # XXX: We could turn this into a compiler test, but ia64 is
505 + # the only one that matters, so this should be fine for now.
506 + if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
507 + sed -i '1i+link-static = touch $@' config.make
508 + fi
509 +
510 + # If we're trying to migrate between ABI sets, we need
511 + # to lie and use a local copy of gcc. Like if the system
512 + # is built with MULTILIB_ABIS="amd64 x86" but we want to
513 + # add x32 to it, gcc/glibc don't yet support x32.
514 + if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
515 + echo 'main(){}' > "${T}"/test.c
516 + if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
517 + sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
518 + fi
519 + fi
520 +}
521 +
522 +glibc_headers_configure() {
523 + export ABI=default
524 +
525 + local builddir=$(builddir "headers")
526 + mkdir -p "${builddir}"
527 + cd "${builddir}"
528 +
529 + # if we don't have a compiler yet, we can't really test it now ...
530 + # hopefully they don't affect header generation, so let's hope for
531 + # the best here ...
532 + local v vars=(
533 + ac_cv_header_cpuid_h=yes
534 + libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{,32,64},sh,x86_64}_tls=yes
535 + libc_cv_asm_cfi_directives=yes
536 + libc_cv_broken_visibility_attribute=no
537 + libc_cv_c_cleanup=yes
538 + libc_cv_forced_unwind=yes
539 + libc_cv_gcc___thread=yes
540 + libc_cv_mlong_double_128=yes
541 + libc_cv_mlong_double_128ibm=yes
542 + libc_cv_ppc_machine=yes
543 + libc_cv_ppc_rel16=yes
544 + libc_cv_predef_fortify_source=no
545 + libc_cv_visibility_attribute=yes
546 + libc_cv_z_combreloc=yes
547 + libc_cv_z_execstack=yes
548 + libc_cv_z_initfirst=yes
549 + libc_cv_z_nodelete=yes
550 + libc_cv_z_nodlopen=yes
551 + libc_cv_z_relro=yes
552 + libc_mips_abi=${ABI}
553 + libc_mips_float=$([[ $(tc-is-softfloat) == "yes" ]] && echo soft || echo hard)
554 + # These libs don't have configure flags.
555 + ac_cv_lib_audit_audit_log_user_avc_message=no
556 + ac_cv_lib_cap_cap_init=no
557 + )
558 +
559 + einfo "Forcing cached settings:"
560 + for v in "${vars[@]}" ; do
561 + einfo " ${v}"
562 + export ${v}
563 + done
564 +
565 + # Blow away some random CC settings that screw things up. #550192
566 + if [[ -d ${S}/sysdeps/mips ]]; then
567 + pushd "${S}"/sysdeps/mips >/dev/null
568 + sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die
569 + sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die
570 +
571 + # Force the mips ABI to the default. This is OK because the set of
572 + # installed headers in this phase is the same between the 3 ABIs.
573 + # If this ever changes, this hack will break, but that's unlikely
574 + # as glibc discourages that behavior.
575 + # https://crbug.com/647033
576 + sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die
577 +
578 + popd >/dev/null
579 + fi
580 +
581 + local myconf=()
582 + myconf+=(
583 + --disable-sanity-checks
584 + --enable-hacker-mode
585 + --without-cvs
586 + --disable-werror
587 + --enable-bind-now
588 + --build=${CBUILD_OPT:-${CBUILD}}
589 + --host=${CTARGET_OPT:-${CTARGET}}
590 + --with-headers=$(alt_build_headers)
591 + --prefix="${EPREFIX}/usr"
592 + ${EXTRA_ECONF}
593 + )
594 +
595 + local addons
596 + [[ -d ${S}/ports ]] && addons+=",ports"
597 + myconf+=( --enable-add-ons="${addons#,}" )
598 +
599 + # Nothing is compiled here which would affect the headers for the target.
600 + # So forcing CC/CFLAGS is sane.
601 + set -- "${S}"/configure "${myconf[@]}"
602 + echo "$@"
603 + CC="$(tc-getBUILD_CC)" \
604 + CFLAGS="-O1 -pipe" \
605 + CPPFLAGS="-U_FORTIFY_SOURCE" \
606 + LDFLAGS="" \
607 + "$@" || die "failed to configure glibc"
608 +}
609 +
610 +do_src_configure() {
611 + if just_headers ; then
612 + glibc_headers_configure
613 + else
614 + glibc_do_configure nptl
615 + fi
616 +}
617 +
618 +src_configure() {
619 + foreach_abi do_src_configure
620 +}
621 +
622 +do_src_compile() {
623 + emake -C "$(builddir nptl)" || die "make nptl for ${ABI} failed"
624 +}
625 +
626 +src_compile() {
627 + if just_headers ; then
628 + return
629 + fi
630 +
631 + foreach_abi do_src_compile
632 +}
633 +
634 +glibc_src_test() {
635 + cd "$(builddir $1)"
636 + emake -j1 check
637 +}
638 +
639 +do_src_test() {
640 + local ret=0
641 +
642 + glibc_src_test nptl
643 + : $(( ret |= $? ))
644 +
645 + return ${ret}
646 +}
647 +
648 +src_test() {
649 + # Give tests more time to complete.
650 + export TIMEOUTFACTOR=5
651 +
652 + foreach_abi do_src_test || die "tests failed"
653 +}
654 +
655 +glibc_do_src_install() {
656 + local builddir=$(builddir nptl)
657 + cd "${builddir}"
658 +
659 + emake install_root="${D}$(alt_prefix)" install || die
660 +
661 + # This version (2.26) provides some compatibility libraries for the NIS/NIS+ support
662 + # which come without headers etc. Only needed for binary packages since the
663 + # external net-libs/libnsl has increased soversion. Keep only versioned libraries.
664 + find "${D}" -name "libnsl.a" -delete
665 + find "${D}" -name "libnsl.so" -delete
666 +
667 + # Normally upstream_pv is ${PV}. Live ebuilds are exception, there we need
668 + # to infer upstream version:
669 + # '#define VERSION "2.26.90"' -> '2.26.90'
670 + local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h)
671 +
672 + if [[ -e ${ED}$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
673 + # Move versioned .a file out of libdir to evade portage QA checks
674 + # instead of using gen_usr_ldscript(). We fix ldscript as:
675 + # "GROUP ( /usr/lib64/libm-<pv>.a ..." -> "GROUP ( /usr/lib64/glibc-<pv>/libm-<pv>.a ..."
676 + sed -i "s@\(libm-${upstream_pv}.a\)@${P}/\1@" "${ED}"$(alt_usrlibdir)/libm.a || die
677 + dodir $(alt_usrlibdir)/${P}
678 + mv "${ED}"$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die
679 + fi
680 +
681 + # We'll take care of the cache ourselves
682 + rm -f "${ED}"/etc/ld.so.cache
683 +
684 + # Everything past this point just needs to be done once ...
685 + is_final_abi || return 0
686 +
687 + # Make sure the non-native interp can be found on multilib systems even
688 + # if the main library set isn't installed into the right place. Maybe
689 + # we should query the active gcc for info instead of hardcoding it ?
690 + local i ldso_abi ldso_name
691 + local ldso_abi_list=(
692 + # x86
693 + amd64 /lib64/ld-linux-x86-64.so.2
694 + x32 /libx32/ld-linux-x32.so.2
695 + x86 /lib/ld-linux.so.2
696 + # mips
697 + o32 /lib/ld.so.1
698 + n32 /lib32/ld.so.1
699 + n64 /lib64/ld.so.1
700 + # powerpc
701 + ppc /lib/ld.so.1
702 + ppc64 /lib64/ld64.so.1
703 + # s390
704 + s390 /lib/ld.so.1
705 + s390x /lib/ld64.so.1
706 + # sparc
707 + sparc32 /lib/ld-linux.so.2
708 + sparc64 /lib64/ld-linux.so.2
709 + )
710 + case $(tc-endian) in
711 + little)
712 + ldso_abi_list+=(
713 + # arm
714 + arm64 /lib/ld-linux-aarch64.so.1
715 + )
716 + ;;
717 + big)
718 + ldso_abi_list+=(
719 + # arm
720 + arm64 /lib/ld-linux-aarch64_be.so.1
721 + )
722 + ;;
723 + esac
724 + if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${ED}/$(alt_prefix)/lib ]] ; then
725 + dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
726 + fi
727 + for (( i = 0; i < ${#ldso_abi_list[@]}; i += 2 )) ; do
728 + ldso_abi=${ldso_abi_list[i]}
729 + has ${ldso_abi} $(get_install_abis) || continue
730 +
731 + ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
732 + if [[ ! -L ${ED}/${ldso_name} && ! -e ${ED}/${ldso_name} ]] ; then
733 + dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
734 + fi
735 + done
736 +
737 + # With devpts under Linux mounted properly, we do not need the pt_chown
738 + # binary to be setuid. This is because the default owners/perms will be
739 + # exactly what we want.
740 + if in_iuse suid && ! use suid ; then
741 + find "${ED}" -name pt_chown -exec chmod -s {} +
742 + fi
743 +
744 + #################################################################
745 + # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
746 + # Make sure we install some symlink hacks so that when we build
747 + # a 2nd stage cross-compiler, gcc finds the target system
748 + # headers correctly. See gcc/doc/gccinstall.info
749 + if is_crosscompile ; then
750 + # We need to make sure that /lib and /usr/lib always exists.
751 + # gcc likes to use relative paths to get to its multilibs like
752 + # /usr/lib/../lib64/. So while we don't install any files into
753 + # /usr/lib/, we do need it to exist.
754 + cd "${ED}"$(alt_libdir)/..
755 + [[ -e lib ]] || mkdir lib
756 + cd "${ED}"$(alt_usrlibdir)/..
757 + [[ -e lib ]] || mkdir lib
758 +
759 + dosym usr/include $(alt_prefix)/sys-include
760 + return 0
761 + fi
762 +
763 + # Files for Debian-style locale updating
764 + dodir /usr/share/i18n
765 + sed \
766 + -e "/^#/d" \
767 + -e "/SUPPORTED-LOCALES=/d" \
768 + -e "s: \\\\::g" -e "s:/: :g" \
769 + "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
770 + || die "generating /usr/share/i18n/SUPPORTED failed"
771 + cd "${WORKDIR}"/extra/locale
772 + dosbin locale-gen
773 + doman *.[0-8]
774 + insinto /etc
775 + doins locale.gen
776 +
777 + # Make sure all the ABI's can find the locales and so we only
778 + # have to generate one set
779 + local a
780 + keepdir /usr/$(get_libdir)/locale
781 + for a in $(get_install_abis) ; do
782 + if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
783 + dosym ../$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
784 + fi
785 + done
786 +
787 + cd "${S}"
788 +
789 + # Install misc network config files
790 + insinto /etc
791 + doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf
792 + doins "${WORKDIR}"/extra/etc/*.conf
793 +
794 + if use nscd ; then
795 + doinitd "$(prefixify_ro "${WORKDIR}"/extra/etc/nscd)"
796 +
797 + local nscd_args=(
798 + -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
799 + )
800 +
801 + sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
802 +
803 + systemd_dounit nscd/nscd.service
804 + systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf
805 + else
806 + # Do this since extra/etc/*.conf above might have nscd.conf.
807 + rm -f "${ED}"/etc/nscd.conf
808 + fi
809 +
810 + echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
811 + doenvd "${T}"/00glibc
812 +
813 + for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
814 + [[ -s ${d} ]] && dodoc ${d}
815 + done
816 +
817 + # Prevent overwriting of the /etc/localtime symlink. We'll handle the
818 + # creation of the "factory" symlink in pkg_postinst().
819 + rm -f "${ED}"/etc/localtime
820 +}
821 +
822 +glibc_headers_install() {
823 + local builddir=$(builddir "headers")
824 + cd "${builddir}"
825 + emake install_root="${D}$(alt_prefix)" install-headers
826 +
827 + insinto $(alt_headers)/gnu
828 + doins "${S}"/include/gnu/stubs.h
829 +
830 + # Make sure we install the sys-include symlink so that when
831 + # we build a 2nd stage cross-compiler, gcc finds the target
832 + # system headers correctly. See gcc/doc/gccinstall.info
833 + dosym usr/include $(alt_prefix)/sys-include
834 +}
835 +
836 +src_install() {
837 + if just_headers ; then
838 + export ABI=default
839 + glibc_headers_install
840 + return
841 + fi
842 +
843 + foreach_abi glibc_do_src_install
844 + src_strip
845 +}
846 +
847 +pkg_preinst() {
848 + # nothing to do if just installing headers
849 + just_headers && return
850 +
851 + # prepare /etc/ld.so.conf.d/ for files
852 + mkdir -p "${EROOT}"/etc/ld.so.conf.d
853 +
854 + # Default /etc/hosts.conf:multi to on for systems with small dbs.
855 + if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
856 + sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
857 + einfo "Defaulting /etc/host.conf:multi to on"
858 + fi
859 +
860 + [[ ${ROOT} != "/" ]] && return 0
861 + [[ -d ${ED}/$(get_libdir) ]] || return 0
862 + [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
863 +}
864 +
865 +pkg_postinst() {
866 + # nothing to do if just installing headers
867 + just_headers && return
868 +
869 + if ! tc-is-cross-compiler && [[ -x ${EROOT}/usr/sbin/iconvconfig ]] ; then
870 + # Generate fastloading iconv module configuration file.
871 + "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
872 + fi
873 +
874 + if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
875 + # Reload init ... if in a chroot or a diff init package, ignore
876 + # errors from this step #253697
877 + /sbin/telinit U 2>/dev/null
878 +
879 + # if the host locales.gen contains no entries, we'll install everything
880 + local locale_list="${EROOT}etc/locale.gen"
881 + if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
882 + ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
883 + locale_list="${EROOT}usr/share/i18n/SUPPORTED"
884 + fi
885 + locale-gen -j $(makeopts_jobs) --config "${locale_list}"
886 + fi
887 +
888 + # Check for sanity of /etc/nsswitch.conf, take 2
889 + if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then
890 + local entry
891 + for entry in passwd group shadow; do
892 + if egrep -q "^[ \t]*${entry}:.*nis" "${EROOT}"/etc/nsswitch.conf; then
893 + ewarn ""
894 + ewarn "Your ${EROOT}/etc/nsswitch.conf uses NIS. Support for that has been"
895 + ewarn "removed from glibc and is now provided by the package"
896 + ewarn " sys-auth/libnss-nis"
897 + ewarn "Install it now to keep your NIS setup working."
898 + ewarn ""
899 + fi
900 + done
901 + fi
902 +}