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_{9..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 ~ia64 ~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-util/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 |
# #492892
|
399 |
415 |
filter-flags -frecord-gcc-switches
|
400 |
416 |
|
|
417 |
# #829583
|
|
418 |
filter-lfs-flags
|
|
419 |
|
401 |
420 |
unset CBUILD_OPT CTARGET_OPT
|
402 |
421 |
if use multilib ; then
|
403 |
422 |
CTARGET_OPT=$(get_abi_CTARGET)
|
... | ... | |
417 |
436 |
filter-flags '-fstack-protector*'
|
418 |
437 |
}
|
419 |
438 |
|
420 |
|
want_tls() {
|
421 |
|
# Archs that can use TLS (Thread Local Storage)
|
422 |
|
case $(tc-arch) in
|
423 |
|
x86)
|
424 |
|
# requires i486 or better #106556
|
425 |
|
[[ ${CTARGET} == i[4567]86* ]] && return 0
|
426 |
|
return 1
|
427 |
|
;;
|
428 |
|
esac
|
429 |
|
return 0
|
430 |
|
}
|
431 |
|
|
432 |
|
want__thread() {
|
433 |
|
want_tls || return 1
|
434 |
|
|
435 |
|
# For some reason --with-tls --with__thread is causing segfaults on sparc32.
|
436 |
|
[[ ${PROFILE_ARCH} == "sparc" ]] && return 1
|
437 |
|
|
438 |
|
[[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD}
|
439 |
|
|
440 |
|
# only test gcc -- can't test linking yet
|
441 |
|
tc-has-tls -c ${CTARGET}
|
442 |
|
WANT__THREAD=$?
|
443 |
|
|
444 |
|
return ${WANT__THREAD}
|
445 |
|
}
|
446 |
|
|
447 |
439 |
use_multiarch() {
|
448 |
440 |
# Allow user to disable runtime arch detection in multilib.
|
449 |
441 |
use multiarch || return 1
|
... | ... | |
499 |
491 |
einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
|
500 |
492 |
return 0
|
501 |
493 |
fi
|
502 |
|
local VAR=CFLAGS_${ABI}
|
|
494 |
|
|
495 |
# Glibc does not work with gold (for various reasons) #269274.
|
|
496 |
tc-ld-disable-gold
|
|
497 |
|
|
498 |
if use doc ; then
|
|
499 |
export MAKEINFO=makeinfo
|
|
500 |
else
|
|
501 |
export MAKEINFO=/dev/null
|
|
502 |
fi
|
|
503 |
|
|
504 |
# Reset CC and CXX to the value at start of emerge
|
|
505 |
export CC=${__ORIG_CC:-${CC:-$(tc-getCC ${CTARGET})}}
|
|
506 |
export CXX=${__ORIG_CXX:-${CXX:-$(tc-getCXX ${CTARGET})}}
|
|
507 |
|
|
508 |
# and make sure __ORIC_CC and __ORIG_CXX is defined now.
|
|
509 |
export __ORIG_CC=${CC}
|
|
510 |
export __ORIG_CXX=${CXX}
|
|
511 |
|
|
512 |
if tc-is-clang && ! use custom-cflags && ! is_crosscompile ; then
|
|
513 |
|
|
514 |
# If we are running in an otherwise clang/llvm environment, we need to
|
|
515 |
# recover the proper gcc and binutils settings here, at least until glibc
|
|
516 |
# is finally building with clang. So let's override everything that is
|
|
517 |
# set in the clang profiles.
|
|
518 |
# Want to shoot yourself into the foot? Set USE=custom-cflags, that's always
|
|
519 |
# a good start into that direction.
|
|
520 |
# Also, if you're crosscompiling, let's assume you know what you are doing.
|
|
521 |
# Hopefully.
|
|
522 |
|
|
523 |
local current_binutils_path=$(binutils-config -B)
|
|
524 |
local current_gcc_path=$(gcc-config -B)
|
|
525 |
einfo "Overriding clang configuration, since it won't work here"
|
|
526 |
|
|
527 |
export CC="${current_gcc_path}/gcc"
|
|
528 |
export CXX="${current_gcc_path}/g++"
|
|
529 |
export LD="${current_binutils_path}/ld.bfd"
|
|
530 |
export AR="${current_binutils_path}/ar"
|
|
531 |
export AS="${current_binutils_path}/as"
|
|
532 |
export NM="${current_binutils_path}/nm"
|
|
533 |
export STRIP="${current_binutils_path}/strip"
|
|
534 |
export RANLIB="${current_binutils_path}/ranlib"
|
|
535 |
export OBJCOPY="${current_binutils_path}/objcopy"
|
|
536 |
export STRINGS="${current_binutils_path}/strings"
|
|
537 |
export OBJDUMP="${current_binutils_path}/objdump"
|
|
538 |
export READELF="${current_binutils_path}/readelf"
|
|
539 |
export ADDR2LINE="${current_binutils_path}/addr2line"
|
|
540 |
|
|
541 |
# do we need to also do flags munging here? yes! at least...
|
|
542 |
filter-flags '-fuse-ld=*'
|
|
543 |
filter-flags '-D_FORTIFY_SOURCE=*'
|
|
544 |
|
|
545 |
else
|
|
546 |
|
|
547 |
# this is the "normal" case
|
|
548 |
|
|
549 |
export CC="$(tc-getCC ${CTARGET})"
|
|
550 |
export CXX="$(tc-getCXX ${CTARGET})"
|
|
551 |
|
|
552 |
# Always use tuple-prefixed toolchain. For non-native ABI glibc's configure
|
|
553 |
# can't detect them automatically due to ${CHOST} mismatch and fallbacks
|
|
554 |
# to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup().
|
|
555 |
export NM="$(tc-getNM ${CTARGET})"
|
|
556 |
export READELF="$(tc-getREADELF ${CTARGET})"
|
|
557 |
|
|
558 |
fi
|
|
559 |
|
503 |
560 |
# We need to export CFLAGS with abi information in them because glibc's
|
504 |
561 |
# configure script checks CFLAGS for some targets (like mips). Keep
|
505 |
562 |
# around the original clean value to avoid appending multiple ABIs on
|
506 |
|
# top of each other.
|
507 |
|
: ${__GLIBC_CC:=$(tc-getCC ${CTARGET})}
|
508 |
|
export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
|
509 |
|
einfo " $(printf '%15s' 'Manual CC:') ${CC}"
|
|
563 |
# top of each other. (Why does the comment talk about CFLAGS if the code
|
|
564 |
# acts on CC?)
|
|
565 |
export __GLIBC_CC=${CC}
|
|
566 |
export __GLIBC_CXX=${CXX}
|
|
567 |
|
|
568 |
export __abi_CFLAGS="$(get_abi_CFLAGS)"
|
|
569 |
|
|
570 |
# CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
|
|
571 |
# To build .S (assembly) files with the same ABI-specific flags
|
|
572 |
# upstream currently recommends adding CFLAGS to CC/CXX:
|
|
573 |
# https://sourceware.org/PR23273
|
|
574 |
# Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
|
|
575 |
# and breaks multiarch support. See 659030#c3 for an example.
|
|
576 |
# The glibc configure script doesn't properly use LDFLAGS all the time.
|
|
577 |
export CC="${__GLIBC_CC} ${__abi_CFLAGS} ${CFLAGS} ${LDFLAGS}"
|
|
578 |
|
|
579 |
# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
|
|
580 |
export CXX="${__GLIBC_CXX} ${__abi_CFLAGS} ${CFLAGS}"
|
|
581 |
|
|
582 |
if is_crosscompile; then
|
|
583 |
# Assume worst-case bootstrap: glibc is buil first time
|
|
584 |
# when ${CTARGET}-g++ is not available yet. We avoid
|
|
585 |
# building auxiliary programs that require C++: bug #683074
|
|
586 |
# It should not affect final result.
|
|
587 |
export libc_cv_cxx_link_ok=no
|
|
588 |
# The line above has the same effect. We set CXX explicitly
|
|
589 |
# to make build logs less confusing.
|
|
590 |
export CXX=
|
|
591 |
fi
|
510 |
592 |
}
|
511 |
593 |
|
512 |
594 |
foreach_abi() {
|
... | ... | |
647 |
729 |
ewarn "hypervisor, which is probably not what you want."
|
648 |
730 |
fi
|
649 |
731 |
|
650 |
|
# Check for sanity of /etc/nsswitch.conf
|
651 |
|
if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then
|
652 |
|
local entry
|
653 |
|
for entry in passwd group shadow; do
|
654 |
|
if ! grep -E -q "^[ \t]*${entry}:.*files" "${EROOT}"/etc/nsswitch.conf; then
|
655 |
|
eerror "Your ${EROOT}/etc/nsswitch.conf is out of date."
|
656 |
|
eerror "Please make sure you have 'files' entries for"
|
657 |
|
eerror "'passwd:', 'group:' and 'shadow:' databases."
|
658 |
|
eerror "For more details see:"
|
659 |
|
eerror " https://wiki.gentoo.org/wiki/Project:Toolchain/nsswitch.conf_in_glibc-2.26"
|
660 |
|
die "nsswitch.conf has no 'files' provider in '${entry}'."
|
661 |
|
fi
|
662 |
|
done
|
663 |
|
fi
|
664 |
|
|
665 |
732 |
# ABI-specific checks follow here. Hey, we have a lot more specific conditions that
|
666 |
733 |
# we test for...
|
667 |
734 |
if ! is_crosscompile ; then
|
... | ... | |
686 |
753 |
fi
|
687 |
754 |
|
688 |
755 |
# When we actually have to compile something...
|
689 |
|
if ! just_headers ; then
|
690 |
|
ebegin "Checking gcc for __thread support"
|
691 |
|
if ! eend $(want__thread ; echo $?) ; then
|
692 |
|
echo
|
693 |
|
eerror "Could not find a gcc that supports the __thread directive!"
|
694 |
|
eerror "Please update your binutils/gcc and try again."
|
695 |
|
die "No __thread support in gcc!"
|
696 |
|
fi
|
697 |
|
|
|
756 |
if ! just_headers && [[ ${MERGE_TYPE} != "binary" ]] ; then
|
698 |
757 |
if [[ ${CTARGET} == *-linux* ]] ; then
|
699 |
758 |
local run_kv build_kv want_kv
|
700 |
759 |
|
... | ... | |
722 |
781 |
fi
|
723 |
782 |
}
|
724 |
783 |
|
|
784 |
upgrade_warning() {
|
|
785 |
if [[ ${MERGE_TYPE} != buildonly && -n ${REPLACING_VERSIONS} && -z ${ROOT} ]]; then
|
|
786 |
local oldv newv=$(ver_cut 1-2 ${PV})
|
|
787 |
for oldv in ${REPLACING_VERSIONS}; do
|
|
788 |
if ver_test ${oldv} -lt ${newv}; then
|
|
789 |
ewarn "After upgrading glibc, please restart all running processes."
|
|
790 |
ewarn "Be sure to include init (telinit u) or systemd (systemctl daemon-reexec)."
|
|
791 |
ewarn "Alternatively, reboot your system."
|
|
792 |
break
|
|
793 |
fi
|
|
794 |
done
|
|
795 |
fi
|
|
796 |
}
|
|
797 |
|
725 |
798 |
#
|
726 |
799 |
# the phases
|
727 |
800 |
#
|
... | ... | |
732 |
805 |
# All the checks...
|
733 |
806 |
einfo "Checking general environment sanity."
|
734 |
807 |
sanity_prechecks
|
|
808 |
upgrade_warning
|
735 |
809 |
}
|
736 |
810 |
|
737 |
811 |
pkg_setup() {
|
... | ... | |
745 |
819 |
# Consistency is not guaranteed between pkg_ and src_ ...
|
746 |
820 |
sanity_prechecks
|
747 |
821 |
|
748 |
|
use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
|
|
822 |
use multilib-bootstrap && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
|
749 |
823 |
|
750 |
824 |
setup_env
|
751 |
825 |
|
... | ... | |
767 |
841 |
|
768 |
842 |
cd "${WORKDIR}" || die
|
769 |
843 |
unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
|
770 |
|
use riscv && unpack backport-rv32.txz
|
|
844 |
use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
|
771 |
845 |
}
|
772 |
846 |
|
773 |
847 |
src_prepare() {
|
... | ... | |
778 |
852 |
else
|
779 |
853 |
patchsetname="${RELEASE_VER}-${PATCH_VER}"
|
780 |
854 |
fi
|
781 |
|
elog "Applying Gentoo Glibc Patchset ${patchsetname}"
|
|
855 |
einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
|
782 |
856 |
eapply "${WORKDIR}"/patches
|
783 |
857 |
einfo "Done."
|
784 |
|
|
785 |
|
if use riscv ; then
|
786 |
|
elog "Adding rv32 backport patchset for glibc-2.32 (experimental)"
|
787 |
|
eapply "${WORKDIR}"/backport-rv32
|
788 |
|
einfo "Done."
|
789 |
|
fi
|
790 |
858 |
fi
|
791 |
859 |
|
792 |
860 |
default
|
... | ... | |
809 |
877 |
}
|
810 |
878 |
|
811 |
879 |
glibc_do_configure() {
|
812 |
|
# Glibc does not work with gold (for various reasons) #269274.
|
813 |
|
tc-ld-disable-gold
|
814 |
|
|
815 |
|
# CXX isnt handled by the multilib system, so if we dont unset here
|
816 |
|
# we accumulate crap across abis
|
817 |
|
unset CXX
|
818 |
|
|
819 |
|
einfo "Configuring glibc for nptl"
|
820 |
|
|
821 |
|
if use doc ; then
|
822 |
|
export MAKEINFO=makeinfo
|
823 |
|
else
|
824 |
|
export MAKEINFO=/dev/null
|
825 |
|
fi
|
826 |
880 |
|
827 |
881 |
local v
|
828 |
|
for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CXX LD {AS,C,CPP,CXX,LD}FLAGS MAKEINFO NM READELF; do
|
|
882 |
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
|
829 |
883 |
einfo " $(printf '%15s' ${v}:) ${!v}"
|
830 |
884 |
done
|
831 |
885 |
|
832 |
|
# CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
|
833 |
|
# To build .S (assembly) files with the same ABI-specific flags
|
834 |
|
# upstream currently recommends adding CFLAGS to CC/CXX:
|
835 |
|
# https://sourceware.org/PR23273
|
836 |
|
# Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific CFLAGS
|
837 |
|
# and breaks multiarch support. See 659030#c3 for an example.
|
838 |
|
# The glibc configure script doesn't properly use LDFLAGS all the time.
|
839 |
|
export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}"
|
840 |
|
einfo " $(printf '%15s' 'Manual CC:') ${CC}"
|
841 |
|
|
842 |
|
# Some of the tests are written in C++, so we need to force our multlib abis in, bug 623548
|
843 |
|
export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
|
844 |
|
|
845 |
|
if is_crosscompile; then
|
846 |
|
# Assume worst-case bootstrap: glibc is buil first time
|
847 |
|
# when ${CTARGET}-g++ is not available yet. We avoid
|
848 |
|
# building auxiliary programs that require C++: bug #683074
|
849 |
|
# It should not affect final result.
|
850 |
|
export libc_cv_cxx_link_ok=no
|
851 |
|
# The line above has the same effect. We set CXX explicitly
|
852 |
|
# to make build logs less confusing.
|
853 |
|
export CXX=
|
854 |
|
fi
|
855 |
|
einfo " $(printf '%15s' 'Manual CXX:') ${CXX}"
|
856 |
|
|
857 |
|
# Always use tuple-prefixed toolchain. For non-native ABI glibc's configure
|
858 |
|
# can't detect them automatically due to ${CHOST} mismatch and fallbacks
|
859 |
|
# to unprefixed tools. Similar to multilib.eclass:multilib_toolchain_setup().
|
860 |
|
export NM="$(tc-getNM ${CTARGET})"
|
861 |
|
export READELF="$(tc-getREADELF ${CTARGET})"
|
862 |
|
einfo " $(printf '%15s' 'Manual NM:') ${NM}"
|
863 |
|
einfo " $(printf '%15s' 'Manual READELF:') ${READELF}"
|
864 |
|
|
865 |
886 |
echo
|
866 |
|
|
867 |
887 |
local myconf=()
|
868 |
888 |
|
869 |
889 |
case ${CTARGET} in
|
... | ... | |
872 |
892 |
# https://sourceware.org/PR24202
|
873 |
893 |
myconf+=( --enable-stack-protector=no )
|
874 |
894 |
;;
|
875 |
|
powerpc-*)
|
876 |
|
# Currently gcc on powerpc32 generates invalid code for
|
877 |
|
# __builtin_return_address(0) calls. Normally programs
|
878 |
|
# don't do that but malloc hooks in glibc do:
|
879 |
|
# https://gcc.gnu.org/PR81996
|
880 |
|
# https://bugs.gentoo.org/629054
|
881 |
|
myconf+=( --enable-stack-protector=no )
|
882 |
|
;;
|
883 |
895 |
*)
|
884 |
896 |
# Use '=strong' instead of '=all' to protect only functions
|
885 |
897 |
# worth protecting from stack smashes.
|
... | ... | |
965 |
977 |
# https://bugs.gentoo.org/753740
|
966 |
978 |
libc_cv_complocaledir='${exec_prefix}/lib/locale'
|
967 |
979 |
|
|
980 |
# -march= option tricks build system to infer too
|
|
981 |
# high ISA level: https://sourceware.org/PR27318
|
|
982 |
libc_cv_include_x86_isa_level=no
|
|
983 |
# Explicit override of https://sourceware.org/PR27991
|
|
984 |
# exposes a bug in glibc's configure:
|
|
985 |
# https://sourceware.org/PR27991
|
|
986 |
libc_cv_have_x86_lahf_sahf=no
|
|
987 |
libc_cv_have_x86_movbe=no
|
|
988 |
|
968 |
989 |
${EXTRA_ECONF}
|
969 |
990 |
)
|
970 |
991 |
|
... | ... | |
1007 |
1028 |
# is built with MULTILIB_ABIS="amd64 x86" but we want to
|
1008 |
1029 |
# add x32 to it, gcc/glibc don't yet support x32.
|
1009 |
1030 |
#
|
1010 |
|
if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then
|
|
1031 |
if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib-bootstrap ; then
|
1011 |
1032 |
echo 'main(){}' > "${T}"/test.c
|
1012 |
1033 |
if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then
|
1013 |
1034 |
sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die
|
... | ... | |
1108 |
1129 |
--host=${CTARGET_OPT:-${CTARGET}}
|
1109 |
1130 |
--with-headers=$(build_eprefix)$(alt_build_headers)
|
1110 |
1131 |
--prefix="$(host_eprefix)/usr"
|
|
1132 |
$(use_enable crypt)
|
1111 |
1133 |
${EXTRA_ECONF}
|
1112 |
1134 |
)
|
1113 |
1135 |
|
... | ... | |
1201 |
1223 |
root="$2"
|
1202 |
1224 |
fi
|
1203 |
1225 |
|
1204 |
|
local locale_list="${root}/etc/locale.gen"
|
|
1226 |
local locale_list="${root%/}/etc/locale.gen"
|
1205 |
1227 |
|
1206 |
1228 |
pushd "${ED}"/$(get_libdir) >/dev/null
|
1207 |
1229 |
|
1208 |
1230 |
if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
|
1209 |
1231 |
[[ -z ${inplace} ]] && ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
|
1210 |
|
locale_list="${root}/usr/share/i18n/SUPPORTED"
|
|
1232 |
locale_list="${root%/}/usr/share/i18n/SUPPORTED"
|
1211 |
1233 |
fi
|
1212 |
1234 |
|
1213 |
1235 |
set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
|
... | ... | |
1315 |
1337 |
fi
|
1316 |
1338 |
done
|
1317 |
1339 |
|
|
1340 |
# In the LSB 5.0 definition, someone had the excellent idea to "standardize"
|
|
1341 |
# the runtime loader name, see also https://xkcd.com/927/
|
|
1342 |
# Normally, in Gentoo one should never come across executables that require this.
|
|
1343 |
# However, binary commercial packages are known to adhere to weird practices.
|
|
1344 |
# https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD64/LSB-Core-AMD64.html#BASELIB
|
|
1345 |
local lsb_ldso_name native_ldso_name lsb_ldso_abi
|
|
1346 |
local lsb_ldso_abi_list=(
|
|
1347 |
# x86
|
|
1348 |
amd64 ld-linux-x86-64.so.2 ld-lsb-x86-64.so.3
|
|
1349 |
)
|
|
1350 |
for (( i = 0; i < ${#lsb_ldso_abi_list[@]}; i += 3 )) ; do
|
|
1351 |
lsb_ldso_abi=${lsb_ldso_abi_list[i]}
|
|
1352 |
native_ldso_name=${lsb_ldso_abi_list[i+1]}
|
|
1353 |
lsb_ldso_name=${lsb_ldso_abi_list[i+2]}
|
|
1354 |
has ${lsb_ldso_abi} $(get_install_abis) || continue
|
|
1355 |
|
|
1356 |
if [[ ! -L ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} && ! -e ${ED}/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name} ]] ; then
|
|
1357 |
dosym ${native_ldso_name} "$(alt_prefix)/$(get_abi_LIBDIR ${lsb_ldso_abi})/${lsb_ldso_name}"
|
|
1358 |
fi
|
|
1359 |
done
|
|
1360 |
|
1318 |
1361 |
# With devpts under Linux mounted properly, we do not need the pt_chown
|
1319 |
1362 |
# binary to be setuid. This is because the default owners/perms will be
|
1320 |
1363 |
# exactly what we want.
|
... | ... | |
1359 |
1402 |
|
1360 |
1403 |
# Install misc network config files
|
1361 |
1404 |
insinto /etc
|
1362 |
|
doins posix/gai.conf nss/nsswitch.conf
|
|
1405 |
doins posix/gai.conf
|
|
1406 |
|
|
1407 |
if use systemd ; then
|
|
1408 |
doins "${WORKDIR}/glibc-systemd-${GLIBC_SYSTEMD_VER}/gentoo-config/nsswitch.conf"
|
|
1409 |
else
|
|
1410 |
doins nss/nsswitch.conf
|
|
1411 |
fi
|
1363 |
1412 |
|
1364 |
1413 |
# Gentoo-specific
|
1365 |
1414 |
newins "${FILESDIR}"/host.conf-1 host.conf
|
... | ... | |
1375 |
1424 |
|
1376 |
1425 |
sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd
|
1377 |
1426 |
|
1378 |
|
systemd_dounit nscd/nscd.service
|
|
1427 |
use systemd && systemd_dounit nscd/nscd.service
|
1379 |
1428 |
newtmpfiles nscd/nscd.tmpfiles nscd.conf
|
1380 |
1429 |
fi
|
1381 |
1430 |
|
... | ... | |
1422 |
1471 |
foreach_abi glibc_do_src_install
|
1423 |
1472 |
|
1424 |
1473 |
if ! use static-libs ; then
|
1425 |
|
elog "Not installing static glibc libraries"
|
|
1474 |
einfo "Not installing static glibc libraries"
|
1426 |
1475 |
find "${ED}" -name "*.a" -and -not -name "*_nonshared.a" -delete
|
1427 |
1476 |
fi
|
1428 |
1477 |
}
|
... | ... | |
1445 |
1494 |
# (e.g. /var/tmp/portage:${HOSTNAME})
|
1446 |
1495 |
pushd "${ED}"/$(get_libdir) >/dev/null
|
1447 |
1496 |
|
|
1497 |
# first let's find the actual dynamic linker here
|
|
1498 |
# symlinks may point to the wrong abi
|
|
1499 |
local newldso=$(find . -maxdepth 1 -name 'ld-*so' -type f -print -quit)
|
|
1500 |
|
|
1501 |
einfo Last-minute run tests with ${newldso} in /$(get_libdir) ...
|
|
1502 |
|
1448 |
1503 |
local x striptest
|
1449 |
1504 |
for x in cal date env free ls true uname uptime ; do
|
1450 |
1505 |
x=$(type -p ${x})
|
... | ... | |
1457 |
1512 |
# We need to clear the locale settings as the upgrade might want
|
1458 |
1513 |
# incompatible locale data. This test is not for verifying that.
|
1459 |
1514 |
LC_ALL=C \
|
1460 |
|
./ld-*.so --library-path . ${x} > /dev/null \
|
|
1515 |
${newldso} --library-path . ${x} > /dev/null \
|
1461 |
1516 |
|| die "simple run test (${x}) failed"
|
1462 |
1517 |
done
|
1463 |
1518 |
|
... | ... | |
1486 |
1541 |
# https://bugs.gentoo.org/753740
|
1487 |
1542 |
rm "${EROOT}"/usr/lib/locale || die
|
1488 |
1543 |
fi
|
|
1544 |
|
|
1545 |
# Keep around libcrypt so that Perl doesn't break when merging libxcrypt
|
|
1546 |
# (libxcrypt is the new provider for now of libcrypt.so.{1,2}).
|
|
1547 |
# bug #802207
|
|
1548 |
if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]" && ! has preserve-libs ${FEATURES}; then
|
|
1549 |
PRESERVED_OLD_LIBCRYPT=1
|
|
1550 |
cp -p "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" "${T}/libcrypt$(get_libname 1)" || die
|
|
1551 |
else
|
|
1552 |
PRESERVED_OLD_LIBCRYPT=0
|
|
1553 |
fi
|
1489 |
1554 |
}
|
1490 |
1555 |
|
1491 |
1556 |
pkg_postinst() {
|
... | ... | |
1501 |
1566 |
use compile-locales || run_locale_gen "${EROOT}/"
|
1502 |
1567 |
fi
|
1503 |
1568 |
|
|
1569 |
upgrade_warning
|
|
1570 |
|
1504 |
1571 |
# Check for sanity of /etc/nsswitch.conf, take 2
|
1505 |
1572 |
if [[ -e ${EROOT}/etc/nsswitch.conf ]] && ! has_version sys-auth/libnss-nis ; then
|
1506 |
1573 |
local entry
|
... | ... | |
1515 |
1582 |
fi
|
1516 |
1583 |
done
|
1517 |
1584 |
fi
|
|
1585 |
|
|
1586 |
if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
|
|
1587 |
cp -p "${T}/libcrypt$(get_libname 1)" "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1)" || die
|
|
1588 |
preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
|
|
1589 |
|
|
1590 |
elog "Please ignore a possible later error message about a file collision involving"
|
|
1591 |
elog "${EROOT}/$(get_libdir)/libcrypt$(get_libname 1). We need to preserve this file for the moment to keep"
|
|
1592 |
elog "the upgrade working, but it also needs to be overwritten when"
|
|
1593 |
elog "sys-libs/libxcrypt is installed. See bug 802210 for more details."
|
|
1594 |
fi
|
1518 |
1595 |
}
|