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