3 |
3 |
|
4 |
4 |
EAPI=7
|
5 |
5 |
|
|
6 |
# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
|
|
7 |
# Please read & adapt the page as necessary if obsolete.
|
|
8 |
|
6 |
9 |
PYTHON_COMPAT=( python3_{10..11} )
|
7 |
10 |
TMPFILES_OPTIONAL=1
|
8 |
11 |
|
9 |
|
inherit python-any-r1 prefix toolchain-funcs flag-o-matic gnuconfig \
|
|
12 |
inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \
|
10 |
13 |
multilib systemd multiprocessing tmpfiles
|
11 |
14 |
|
12 |
15 |
DESCRIPTION="GNU libc C library"
|
... | ... | |
17 |
20 |
EMULTILIB_PKG="true"
|
18 |
21 |
|
19 |
22 |
# Gentoo patchset (ignored for live ebuilds)
|
20 |
|
PATCH_VER=8
|
|
23 |
PATCH_VER=11
|
21 |
24 |
PATCH_DEV=dilfridge
|
22 |
25 |
|
23 |
26 |
if [[ ${PV} == 9999* ]]; then
|
... | ... | |
26 |
29 |
KEYWORDS="~alpha amd64 arm arm64 hppa ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
|
27 |
30 |
SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
|
28 |
31 |
SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
|
29 |
|
SRC_URI+=" riscv? ( https://dev.gentoo.org/~dilfridge/distfiles/backport-rv32.txz )"
|
30 |
32 |
fi
|
31 |
33 |
|
32 |
34 |
RELEASE_VER=${PV}
|
33 |
35 |
|
34 |
36 |
GCC_BOOTSTRAP_VER=20201208
|
35 |
37 |
|
36 |
|
LOCALE_GEN_VER=2.10
|
|
38 |
LOCALE_GEN_VER=2.22
|
|
39 |
|
|
40 |
GLIBC_SYSTEMD_VER=20210814
|
37 |
41 |
|
38 |
42 |
SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
|
39 |
|
SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
|
|
43 |
SRC_URI+=" multilib-bootstrap? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
|
|
44 |
SRC_URI+=" systemd? ( https://gitweb.gentoo.org/proj/toolchain/glibc-systemd.git/snapshot/glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz )"
|
40 |
45 |
|
41 |
|
IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib nscd profile selinux +ssp +static-libs static-pie suid systemtap test vanilla"
|
|
46 |
IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp +static-libs static-pie suid systemd systemtap test vanilla"
|
42 |
47 |
|
43 |
48 |
# Minimum kernel version that glibc requires
|
44 |
49 |
MIN_KERN_VER="3.2.0"
|
... | ... | |
95 |
100 |
|
96 |
101 |
BDEPEND="
|
97 |
102 |
${PYTHON_DEPS}
|
98 |
|
>=app-misc/pax-utils-0.1.10
|
|
103 |
>=app-misc/pax-utils-1.3.1
|
99 |
104 |
sys-devel/bison
|
100 |
105 |
doc? ( sys-apps/texinfo )
|
101 |
106 |
!compile-locales? (
|
... | ... | |
113 |
118 |
suid? ( caps? ( sys-libs/libcap ) )
|
114 |
119 |
selinux? ( sys-libs/libselinux )
|
115 |
120 |
systemtap? ( dev-debug/systemtap )
|
116 |
|
!<net-misc/openssh-8.1_p1-r2
|
117 |
121 |
"
|
118 |
122 |
DEPEND="${COMMON_DEPEND}
|
119 |
123 |
compile-locales? (
|
... | ... | |
128 |
132 |
sys-apps/grep
|
129 |
133 |
app-alternatives/awk
|
130 |
134 |
sys-apps/gentoo-functions
|
|
135 |
!<app-misc/pax-utils-1.3.1
|
|
136 |
!<net-misc/openssh-8.1_p1-r2
|
131 |
137 |
"
|
132 |
138 |
|
133 |
139 |
RESTRICT="!test? ( test )"
|
134 |
140 |
|
135 |
141 |
if [[ ${CATEGORY} == cross-* ]] ; then
|
136 |
142 |
BDEPEND+=" !headers-only? (
|
137 |
|
>=${CATEGORY}/binutils-2.24
|
|
143 |
>=${CATEGORY}/binutils-2.27
|
138 |
144 |
>=${CATEGORY}/gcc-6
|
139 |
145 |
)"
|
140 |
146 |
[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
|
141 |
147 |
else
|
142 |
148 |
BDEPEND+="
|
143 |
|
>=sys-devel/binutils-2.24
|
|
149 |
>=sys-devel/binutils-2.27
|
144 |
150 |
>=sys-devel/gcc-6
|
145 |
151 |
"
|
146 |
152 |
DEPEND+=" virtual/os-headers "
|
... | ... | |
169 |
175 |
# https://sourceware.org/PR19329
|
170 |
176 |
# https://bugs.gentoo.org/719674#c12
|
171 |
177 |
tst-stack4
|
|
178 |
|
|
179 |
# The following tests fail only inside portage
|
|
180 |
# https://bugs.gentoo.org/831267
|
|
181 |
tst-system
|
|
182 |
tst-strerror
|
|
183 |
tst-strsignal
|
172 |
184 |
)
|
173 |
185 |
|
174 |
186 |
#
|
... | ... | |
395 |
407 |
# glibc aborts if rpath is set by LDFLAGS
|
396 |
408 |
filter-ldflags '-Wl,-rpath=*'
|
397 |
409 |
|
|
410 |
# ld can't use -r & --relax at the same time, bug #788901
|
|
411 |
# https://sourceware.org/PR27837
|
|
412 |
filter-ldflags '-Wl,--relax'
|
|
413 |
|
398 |
414 |
# Fails to link (bug #940709) in some cases but even if it manages to,
|
399 |
415 |
# subtle runtime breakage will occur because the linker scripts need
|
400 |
416 |
# adaptation. Mentioned in PR21557#c0.
|
... | ... | |
403 |
419 |
# #492892
|
404 |
420 |
filter-flags -frecord-gcc-switches
|
405 |
421 |
|
|
422 |
# #829583
|
|
423 |
filter-lfs-flags
|
|
424 |
|
406 |
425 |
unset CBUILD_OPT CTARGET_OPT
|
407 |
426 |
if use multilib ; then
|
408 |
427 |
CTARGET_OPT=$(get_abi_CTARGET)
|
... | ... | |
422 |
441 |
filter-flags '-fstack-protector*'
|
423 |
442 |
}
|
424 |
443 |
|
425 |
|
want_tls() {
|
426 |
|
# Archs that can use TLS (Thread Local Storage)
|
427 |
|
case $(tc-arch) in
|
428 |
|
x86)
|
429 |
|
# requires i486 or better #106556
|
430 |
|
[[ ${CTARGET} == i[4567]86* ]] && return 0
|
431 |
|
return 1
|
432 |
|
;;
|
433 |
|
esac
|
434 |
|
return 0
|
435 |
|
}
|
436 |
|
|
437 |
|
want__thread() {
|
438 |
|
want_tls || return 1
|
439 |
|
|
440 |
|
# For some reason --with-tls --with__thread is causing segfaults on sparc32.
|
441 |
|
[[ ${PROFILE_ARCH} == "sparc" ]] && return 1
|
442 |
|
|
443 |
|
[[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD}
|
444 |
|
|
445 |
|
# only test gcc -- can't test linking yet
|
446 |
|
tc-has-tls -c ${CTARGET}
|
447 |
|
WANT__THREAD=$?
|
448 |
|
|
449 |
|
return ${WANT__THREAD}
|
450 |
|
}
|
451 |
|
|
452 |
444 |
use_multiarch() {
|
453 |
445 |
# Allow user to disable runtime arch detection in multilib.
|
454 |
446 |
use multiarch || return 1
|
... | ... | |
504 |
496 |
einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
|
505 |
497 |
return 0
|
506 |
498 |
fi
|
507 |
|
local VAR=CFLAGS_${ABI}
|
|
499 |
|
|
500 |
# glibc does not work with non-bfd (for various reasons):
|
|
501 |
# * gold (bug #269274)
|
|
502 |
# * mold (bug #860900)
|
|
503 |
tc-ld-force-bfd
|
|
504 |
|
|
505 |
if use doc ; then
|
|
506 |
export MAKEINFO=makeinfo
|
|
507 |
else
|
|
508 |
export MAKEINFO=/dev/null
|
|
509 |
fi
|
|
510 |
|
|
511 |
# Reset CC and CXX to the value at start of emerge
|
|
512 |
export CC=${__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
|
|
513 |
export CXX=${__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
|
|
514 |
|
|
515 |
# and make sure __ORIC_CC and __ORIG_CXX is defined now.
|
|
516 |
export __ORIG_CC=${CC}
|
|
517 |
export __ORIG_CXX=${CXX}
|
|
518 |
|
|
519 |
if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
|
|
520 |
|
|
521 |
# If we are running in an otherwise clang/llvm environment, we need to
|
|
522 |
# recover the proper gcc and binutils settings here, at least until glibc
|
|
523 |
# is finally building with clang. So let's override everything that is
|
|
524 |
# set in the clang profiles.
|
|
525 |
# Want to shoot yourself into the foot? Set USE=custom-cflags, that's always
|
|
526 |
# a good start into that direction.
|
|
527 |
# Also, if you're crosscompiling, let's assume you know what you are doing.
|
|
528 |
# Hopefully.
|
|
529 |
|
|
530 |
local current_binutils_path=$(binutils-config -B)
|
|
531 |
local current_gcc_path=$(gcc-config -B)
|
|
532 |
einfo "Overriding clang configuration, since it won't work here"
|
|
533 |
|
|
534 |
export CC="${current_gcc_path}/gcc"
|
|
535 |
export CXX="${current_gcc_path}/g++"
|
|
536 |
export LD="${current_binutils_path}/ld.bfd"
|
|
537 |
export AR="${current_binutils_path}/ar"
|
|
538 |
export AS="${current_binutils_path}/as"
|
|
539 |
export NM="${current_binutils_path}/nm"
|
|
540 |
export STRIP="${current_binutils_path}/strip"
|
|
541 |
export RANLIB="${current_binutils_path}/ranlib"
|
|
542 |
export OBJCOPY="${current_binutils_path}/objcopy"
|
|
543 |
export STRINGS="${current_binutils_path}/strings"
|
|
544 |
export OBJDUMP="${current_binutils_path}/objdump"
|
|
545 |
export READELF="${current_binutils_path}/readelf"
|
|
546 |
export ADDR2LINE="${current_binutils_path}/addr2line"
|
|
547 |
|
|
548 |
# do we need to also do flags munging here? yes! at least...
|
|
549 |
filter-flags '-fuse-ld=*'
|
|
550 |
filter-flags '-D_FORTIFY_SOURCE=*'
|
|
551 |
|
|
552 |
else
|
|
553 |
|
|
554 |
# this is the "normal" case
|
|
555 |
|
|
556 |
export CC="$(tc-getCC ${CTARGET})"
|
|
557 |
export CXX="$(tc-getCXX ${CTARGET})"
|
|
558 |
|
|
559 |
# Always use tuple-prefixed toolchain. For non-native ABI glibc's configure
|
|
560 |
# can't detect them automatically due to ${CHOST} mismatch and fallbacks
|
|
561 |
# to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup().
|
|
562 |
export NM="$(tc-getNM ${CTARGET})"
|
|
563 |
export READELF="$(tc-getREADELF ${CTARGET})"
|
|
564 |
|
|
565 |
fi
|
|
566 |
|
508 |
567 |
# We need to export CFLAGS with abi information in them because glibc's
|
509 |
568 |
# configure script checks CFLAGS for some targets (like mips). Keep
|
510 |
569 |
# around the original clean value to avoid appending multiple ABIs on
|
511 |
|
# top of each other.
|
512 |
|
: ${__GLIBC_CC:=$(tc-getCC ${CTARGET})}
|
513 |
|
export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
|
514 |
|
einfo " $(printf '%15s' 'Manual CC:') ${CC}"
|
|
570 |
# top of each other. (Why does the comment talk about CFLAGS if the code
|
|
571 |
# acts on CC?)
|
|
572 |
export __GLIBC_CC=${CC}
|
|
573 |
export __GLIBC_CXX=${CXX}
|
|
574 |
|
|
575 |
export __abi_CFLAGS="$(get_abi_CFLAGS)"
|
|
576 |
|
|
577 |
# CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
|
|
578 |
# To build .S (assembly) files with the same ABI-specific flags
|
|
579 |
# upstream currently recommends adding CFLAGS to CC/CXX:
|
|
580 |
# https://sourceware.org/PR23273
|
|
581 |
# Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
|
|
582 |
# and breaks multiarch support. See 659030#c3 for an example.
|
|
583 |
# The glibc configure script doesn't properly use LDFLAGS all the time.
|
|
584 |
export CC="${__GLIBC_CC} ${__abi_CFLAGS} ${CFLAGS} ${LDFLAGS}"
|
|
585 |
|
|
586 |
# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
|
|
587 |
export CXX="${__GLIBC_CXX} ${__abi_CFLAGS} ${CFLAGS}"
|
|
588 |
|
|
589 |
if is_crosscompile; then
|
|
590 |
# Assume worst-case bootstrap: glibc is buil first time
|
|
591 |
# when ${CTARGET}-g++ is not available yet. We avoid
|
|
592 |
# building auxiliary programs that require C++: bug #683074
|
|
593 |
# It should not affect final result.
|
|
594 |
export libc_cv_cxx_link_ok=no
|
|
595 |
# The line above has the same effect. We set CXX explicitly
|
|
596 |
# to make build logs less confusing.
|
|
597 |
export CXX=
|
|
598 |
fi
|
515 |
599 |
}
|
516 |
600 |
|
517 |
601 |
foreach_abi() {
|
... | ... | |
652 |
736 |
ewarn "hypervisor, which is probably not what you want."
|
653 |
737 |
fi
|
654 |
738 |
|
655 |
|
# Check for sanity of /etc/nsswitch.conf
|
656 |
|
if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
|
657 |
|
local entry
|
658 |
|
for entry in passwd group shadow; do
|
659 |
|
if ! grep -E -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
|
660 |
|
eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
|
661 |
|
eerror "Please make sure you have 'files' entries for"
|
662 |
|
eerror "'passwd:', 'group:' and 'shadow:' databases."
|
663 |
|
eerror "For more details see:"
|
664 |
|
eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
|
665 |
|
die "nsswitch.conf has no 'files' provider in '${entry}'."
|
666 |
|
fi
|
667 |
|
done
|
668 |
|
fi
|
669 |
|
|
670 |
739 |
# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
|
671 |
740 |
# we test for...
|
672 |
741 |
if ! is_crosscompile ; then
|
... | ... | |
695 |
764 |
fi
|
696 |
765 |
|
697 |
766 |
# When we actually have to compile something...
|
698 |
|
if ! just_headers ; then
|
699 |
|
ebegin "Checking gcc for __thread support"
|
700 |
|
if ! eend $(want__thread ; echo $?) ; then
|
701 |
|
echo
|
702 |
|
eerror "Could not find a gcc that supports the __thread directive!"
|
703 |
|
eerror "Please update your binutils/gcc and try again."
|
704 |
|
die "No __thread support in gcc!"
|
705 |
|
fi
|
706 |
|
|
|
767 |
if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
|
707 |
768 |
if [[ ${CTARGET} == *-linux* ]] ; then
|
708 |
769 |
local run_kv build_kv want_kv
|
709 |
770 |
|
... | ... | |
731 |
792 |
fi
|
732 |
793 |
}
|
733 |
794 |
|
|
795 |
upgrade_warning() {
|
|
796 |
if [[ ${MERGE_TYPE} != buildonly && -n ${REPLACING_VERSIONS} && -z ${ROOT} ]]; then
|
|
797 |
local oldv newv=$(ver_cut 1-2 ${PV})
|
|
798 |
for oldv in ${REPLACING_VERSIONS}; do
|
|
799 |
if ver_test ${oldv} -lt ${newv}; then
|
|
800 |
ewarn "After upgrading glibc, please restart all running processes."
|
|
801 |
ewarn "Be sure to include init (telinit u) or systemd (systemctl daemon-reexec)."
|
|
802 |
ewarn "Alternatively, reboot your system."
|
|
803 |
break
|
|
804 |
fi
|
|
805 |
done
|
|
806 |
fi
|
|
807 |
}
|
|
808 |
|
734 |
809 |
#
|
735 |
810 |
# the phases
|
736 |
811 |
#
|
... | ... | |
741 |
816 |
# All the checks...
|
742 |
817 |
einfo "Checking general environment sanity."
|
743 |
818 |
sanity_prechecks
|
|
819 |
upgrade_warning
|
744 |
820 |
}
|
745 |
821 |
|
746 |
822 |
pkg_setup() {
|
... | ... | |
754 |
830 |
# Consistency is not guaranteed between pkg_ and src_ ...
|
755 |
831 |
sanity_prechecks
|
756 |
832 |
|
757 |
|
use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
|
|
833 |
use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
|
758 |
834 |
|
759 |
835 |
setup_env
|
760 |
836 |
|
... | ... | |
776 |
852 |
|
777 |
853 |
cd "${WORKDIR}" || die
|
778 |
854 |
unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
|
779 |
|
use riscv && unpack backport-rv32.txz
|
|
855 |
use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
|
780 |
856 |
}
|
781 |
857 |
|
782 |
858 |
src_prepare() {
|
... | ... | |
787 |
863 |
else
|
788 |
864 |
patchsetname="${RELEASE_VER}-${PATCH_VER}"
|
789 |
865 |
fi
|
790 |
|
elog "Applying Gentoo Glibc Patchset ${patchsetname}"
|
|
866 |
einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
|
791 |
867 |
eapply "${WORKDIR}"/patches
|
792 |
868 |
einfo "Done."
|
793 |
|
|
794 |
|
if use riscv ; then
|
795 |
|
elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
|
796 |
|
eapply "${WORKDIR}"/backport-rv32
|
797 |
|
einfo "Done."
|
798 |
|
fi
|
799 |
869 |
fi
|
800 |
870 |
|
801 |
871 |
default
|
... | ... | |
818 |
888 |
}
|
819 |
889 |
|
820 |
890 |
glibc_do_configure() {
|
821 |
|
# glibc does not work with non-bfd (for various reasons):
|
822 |
|
# * gold (bug #269274)
|
823 |
|
# * mold (bug #860900)
|
824 |
|
tc-ld-force-bfd
|
825 |
|
|
826 |
|
# CXX isnt handled by the multilib system, so if we dont unset here
|
827 |
|
# we accumulate crap across abis
|
828 |
|
unset CXX
|
829 |
|
|
830 |
|
einfo "Configuring glibc for nptl"
|
831 |
|
|
832 |
|
if use doc ; then
|
833 |
|
export MAKEINFO=makeinfo
|
834 |
|
else
|
835 |
|
export MAKEINFO=/dev/null
|
836 |
|
fi
|
837 |
891 |
|
838 |
892 |
local v
|
839 |
|
for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM READELF; do
|
|
893 |
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
|
840 |
894 |
einfo " $(printf '%15s' ${v}:) ${!v}"
|
841 |
895 |
done
|
842 |
896 |
|
843 |
|
# CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
|
844 |
|
# To build .S (assembly) files with the same ABI-specific flags
|
845 |
|
# upstream currently recommends adding CFLAGS to CC/CXX:
|
846 |
|
# https://sourceware.org/PR23273
|
847 |
|
# Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
|
848 |
|
# and breaks multiarch support. See 659030#c3 for an example.
|
849 |
|
# The glibc configure script doesn't properly use LDFLAGS all the time.
|
850 |
|
export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}"
|
851 |
|
einfo " $(printf '%15s' 'Manual CC:') ${CC}"
|
852 |
|
|
853 |
|
# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
|
854 |
|
export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
|
855 |
|
|
856 |
|
if is_crosscompile; then
|
857 |
|
# Assume worst-case bootstrap: glibc is buil first time
|
858 |
|
# when ${CTARGET}-g++ is not available yet. We avoid
|
859 |
|
# building auxiliary programs that require C++: bug #683074
|
860 |
|
# It should not affect final result.
|
861 |
|
export libc_cv_cxx_link_ok=no
|
862 |
|
# The line above has the same effect. We set CXX explicitly
|
863 |
|
# to make build logs less confusing.
|
864 |
|
export CXX=
|
865 |
|
fi
|
866 |
|
einfo " $(printf '%15s' 'Manual CXX:') ${CXX}"
|
867 |
|
|
868 |
|
# Always use tuple-prefixed toolchain. For non-native ABI glibc's configure
|
869 |
|
# can't detect them automatically due to ${CHOST} mismatch and fallbacks
|
870 |
|
# to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup().
|
871 |
|
export NM="$(tc-getNM ${CTARGET})"
|
872 |
|
export READELF="$(tc-getREADELF ${CTARGET})"
|
873 |
|
einfo " $(printf '%15s' 'Manual NM:') ${NM}"
|
874 |
|
einfo " $(printf '%15s' 'Manual READELF:') ${READELF}"
|
875 |
|
|
876 |
897 |
echo
|
877 |
|
|
878 |
898 |
local myconf=()
|
879 |
899 |
|
880 |
900 |
case ${CTARGET} in
|
... | ... | |
883 |
903 |
# https://sourceware.org/PR24202
|
884 |
904 |
myconf+=( --enable-stack-protector=no )
|
885 |
905 |
;;
|
886 |
|
powerpc-*)
|
887 |
|
# Currently gcc on powerpc32 generates invalid code for
|
888 |
|
# __builtin_return_address(0) calls. Normally programs
|
889 |
|
# don't do that but malloc hooks in glibc do:
|
890 |
|
# https://gcc.gnu.org/PR81996
|
891 |
|
# https://bugs.gentoo.org/629054
|
892 |
|
myconf+=( --enable-stack-protector=no )
|
893 |
|
;;
|
894 |
906 |
*)
|
895 |
907 |
# Use '=strong' instead of '=all' to protect only functions
|
896 |
908 |
# worth protecting from stack smashes.
|
... | ... | |
976 |
988 |
# https://bugs.gentoo.org/753740
|
977 |
989 |
libc_cv_complocaledir='${exec_prefix}/lib/locale'
|
978 |
990 |
|
|
991 |
# -march= option tricks build system to infer too
|
|
992 |
# high ISA level: https://sourceware.org/PR27318
|
|
993 |
libc_cv_include_x86_isa_level=no
|
|
994 |
# Explicit override of https://sourceware.org/PR27991
|
|
995 |
# exposes a bug in glibc's configure:
|
|
996 |
# https://sourceware.org/PR27991
|
|
997 |
libc_cv_have_x86_lahf_sahf=no
|
|
998 |
libc_cv_have_x86_movbe=no
|
|
999 |
|
979 |
1000 |
${EXTRA_ECONF}
|
980 |
1001 |
)
|
981 |
1002 |
|
... | ... | |
1018 |
1039 |
# is built with MULTILIB_ABIS="amd64 x86" but we want to
|
1019 |
1040 |
# add x32 to it, gcc/glibc don't yet support x32.
|
1020 |
1041 |
#
|
1021 |
|
if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
|
|
1042 |
if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
|
1022 |
1043 |
echo 'int main(){}' > "${T}"/test.c
|
1023 |
1044 |
if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
|
1024 |
1045 |
sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
|
... | ... | |
1119 |
1140 |
--host=${CTARGET_OPT:-${CTARGET}}
|
1120 |
1141 |
--with-headers=$(build_eprefix)$(alt_build_headers)
|
1121 |
1142 |
--prefix="$(host_eprefix)/usr"
|
|
1143 |
$(use_enable crypt)
|
1122 |
1144 |
${EXTRA_ECONF}
|
1123 |
1145 |
)
|
1124 |
1146 |
|
... | ... | |
1212 |
1234 |
root="$2"
|
1213 |
1235 |
fi
|
1214 |
1236 |
|
1215 |
|
local locale_list="${root}/etc/locale.gen"
|
|
1237 |
local locale_list="${root%/}/etc/locale.gen"
|
1216 |
1238 |
|
1217 |
1239 |
pushd "${ED}"/$(get_libdir) >/dev/null
|
1218 |
1240 |
|
1219 |
1241 |
if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
|
1220 |
1242 |
[[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
|
1221 |
|
locale_list="${root}/usr/share/i18n/SUPPORTED"
|
|
1243 |
locale_list="${root%/}/usr/share/i18n/SUPPORTED"
|
1222 |
1244 |
fi
|
1223 |
1245 |
|
1224 |
1246 |
set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
|
... | ... | |
1326 |
1348 |
fi
|
1327 |
1349 |
done
|
1328 |
1350 |
|
|
1351 |
# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
|
|
1352 |
# the runtime loader name, see also https://xkcd.com/927/
|
|
1353 |
# Normally, in Gentoo one should never come across executables that require this.
|
|
1354 |
# However, binary commercial packages are known to adhere to weird practices.
|
|
1355 |
# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
|
|
1356 |
local lsb_ldso_name native_ldso_name lsb_ldso_abi
|
|
1357 |
local lsb_ldso_abi_list=(
|
|
1358 |
# x86
|
|
1359 |
amd64 ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3
|
|
1360 |
)
|
|
1361 |
for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
|
|
1362 |
lsb_ldso_abi=${lsb_ldso_abi_list[i]}
|
|
1363 |
native_ldso_name=${lsb_ldso_abi_list[i+1]}
|
|
1364 |
lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
|
|
1365 |
has ${lsb_ldso_abi} $(get_install_abis) || continue
|
|
1366 |
|
|
1367 |
if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
|
|
1368 |
dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
|
|
1369 |
fi
|
|
1370 |
done
|
|
1371 |
|
1329 |
1372 |
# With devpts under Linux mounted properly, we do not need the pt_chown
|
1330 |
1373 |
# binary to be setuid. This is because the default owners/perms will be
|
1331 |
1374 |
# exactly what we want.
|
... | ... | |
1370 |
1413 |
|
1371 |
1414 |
# Install misc network config files
|
1372 |
1415 |
insinto /etc
|
1373 |
|
doins posix/gai.conf nss/nsswitch.conf
|
|
1416 |
doins posix/gai.conf
|
|
1417 |
|
|
1418 |
if use systemd ; then
|
|
1419 |
doins "${WORKDIR}/glibc-systemd-${GLIBC_SYSTEMD_VER}/gentoo-config/nsswitch.conf"
|
|
1420 |
else
|
|
1421 |
doins nss/nsswitch.conf
|
|
1422 |
fi
|
1374 |
1423 |
|
1375 |
1424 |
# Gentoo-specific
|
1376 |
1425 |
newins "${FILESDIR}"/host.conf-1 host.conf
|
... | ... | |
1386 |
1435 |
|
1387 |
1436 |
sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
|
1388 |
1437 |
|
1389 |
|
systemd_dounit nscd/nscd.service
|
|
1438 |
use systemd && systemd_dounit nscd/nscd.service
|
1390 |
1439 |
newtmpfiles nscd/nscd.tmpfiles nscd.conf
|
1391 |
1440 |
fi
|
1392 |
1441 |
|
... | ... | |
1433 |
1482 |
foreach_abi glibc_do_src_install
|
1434 |
1483 |
|
1435 |
1484 |
if ! use static-libs ; then
|
1436 |
|
elog "Not installing static glibc libraries"
|
|
1485 |
einfo "Not installing static glibc libraries"
|
1437 |
1486 |
find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
|
1438 |
1487 |
fi
|
1439 |
1488 |
}
|
... | ... | |
1456 |
1505 |
# (e.g. /var/tmp/portage:${HOSTNAME})
|
1457 |
1506 |
pushd "${ED}"/$(get_libdir) >/dev/null
|
1458 |
1507 |
|
|
1508 |
# first let's find the actual dynamic linker here
|
|
1509 |
# symlinks may point to the wrong abi
|
|
1510 |
local newldso=$(find . -maxdepth 1 -name 'ld-*so' -type f -print -quit)
|
|
1511 |
|
|
1512 |
einfo Last-minute run tests with ${newldso} in /$(get_libdir) ...
|
|
1513 |
|
1459 |
1514 |
local x striptest
|
1460 |
1515 |
for x in cal date env free ls true uname uptime ; do
|
1461 |
1516 |
x=$(type -p ${x})
|
... | ... | |
1468 |
1523 |
# We need to clear the locale settings as the upgrade might want
|
1469 |
1524 |
# incompatible locale data. This test is not for verifying that.
|
1470 |
1525 |
LC_ALL=C \
|
1471 |
|
./ld-*.so --library-path . ${x} > /dev/null \
|
|
1526 |
${newldso} --library-path . ${x} > /dev/null \
|
1472 |
1527 |
|| die "simple run test (${x}) failed"
|
1473 |
1528 |
done
|
1474 |
1529 |
|
... | ... | |
1497 |
1552 |
# https://bugs.gentoo.org/753740
|
1498 |
1553 |
rm "${EROOT}"/usr/lib/locale || die
|
1499 |
1554 |
fi
|
|
1555 |
|
|
1556 |
# Keep around libcrypt so that Perl doesn't break when merging libxcrypt
|
|
1557 |
# (libxcrypt is the new provider for now of libcrypt.so.{1,2}).
|
|
1558 |
# bug #802207
|
|
1559 |
if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]" && ! has preserve-libs ${FEATURES}; then
|
|
1560 |
PRESERVED_OLD_LIBCRYPT=1
|
|
1561 |
cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" "${T}/libcrypt$(get_libname 1)" || die
|
|
1562 |
else
|
|
1563 |
PRESERVED_OLD_LIBCRYPT=0
|
|
1564 |
fi
|
1500 |
1565 |
}
|
1501 |
1566 |
|
1502 |
1567 |
pkg_postinst() {
|
... | ... | |
1512 |
1577 |
use compile-locales || run_locale_gen "${EROOT}/"
|
1513 |
1578 |
fi
|
1514 |
1579 |
|
|
1580 |
upgrade_warning
|
|
1581 |
|
1515 |
1582 |
# Check for sanity of /etc/nsswitch.conf, take 2
|
1516 |
1583 |
if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then
|
1517 |
1584 |
local entry
|
... | ... | |
1526 |
1593 |
fi
|
1527 |
1594 |
done
|
1528 |
1595 |
fi
|
|
1596 |
|
|
1597 |
if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
|
|
1598 |
cp -p "${T}/libcrypt$(get_libname 1)" "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" || die
|
|
1599 |
preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
|
|
1600 |
|
|
1601 |
elog "Please ignore a possible later error message about a file collision involving"
|
|
1602 |
elog "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1). We need to preserve this file for the moment to keep"
|
|
1603 |
elog "the upgrade working, but it also needs to be overwritten when"
|
|
1604 |
elog "sys-libs/libxcrypt is installed. See bug 802210 for more details."
|
|
1605 |
fi
|
1529 |
1606 |
}
|