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