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