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