1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
# Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc
|
7 |
7 |
# Please read & adapt the page as necessary if obsolete.
|
... | ... | |
20 |
20 |
EMULTILIB_PKG="true"
|
21 |
21 |
|
22 |
22 |
# Gentoo patchset (ignored for live ebuilds)
|
23 |
|
PATCH_VER=10
|
|
23 |
PATCH_VER=5
|
24 |
24 |
PATCH_DEV=dilfridge
|
25 |
25 |
|
|
26 |
# gcc mulitilib bootstrap files version
|
|
27 |
GCC_BOOTSTRAP_VER=20201208
|
|
28 |
|
|
29 |
# systemd integration version
|
|
30 |
GLIBC_SYSTEMD_VER=20210729
|
|
31 |
|
|
32 |
# Minimum kernel version that glibc requires
|
|
33 |
MIN_KERN_VER="3.2.0"
|
|
34 |
|
|
35 |
# Minimum pax-utils version needed (which contains any new syscall changes for
|
|
36 |
# its seccomp filter!). Please double check this!
|
|
37 |
MIN_PAX_UTILS_VER="1.3.3"
|
|
38 |
|
26 |
39 |
if [[ ${PV} == 9999* ]]; then
|
27 |
40 |
inherit git-r3
|
28 |
41 |
else
|
... | ... | |
31 |
44 |
SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz"
|
32 |
45 |
fi
|
33 |
46 |
|
34 |
|
RELEASE_VER=${PV}
|
35 |
|
|
36 |
|
GCC_BOOTSTRAP_VER=20201208
|
37 |
|
|
38 |
|
LOCALE_GEN_VER=2.23
|
39 |
|
|
40 |
|
GLIBC_SYSTEMD_VER=20210729
|
41 |
|
|
42 |
|
SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz"
|
43 |
47 |
SRC_URI+=" multilib-bootstrap? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )"
|
44 |
48 |
SRC_URI+=" systemd? ( https://gitweb.gentoo.org/proj/toolchain/glibc-systemd.git/snapshot/glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz )"
|
45 |
49 |
|
46 |
50 |
IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd perl profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla"
|
47 |
51 |
|
48 |
|
# Minimum kernel version that glibc requires
|
49 |
|
MIN_KERN_VER="3.2.0"
|
50 |
|
# Minimum pax-utils version needed (which contains any new syscall changes for
|
51 |
|
# its seccomp filter!). Please double check this!
|
52 |
|
MIN_PAX_UTILS_VER="1.3.3"
|
53 |
|
|
54 |
52 |
# Here's how the cross-compile logic breaks down ...
|
55 |
53 |
# CTARGET - machine that will target the binaries
|
56 |
54 |
# CHOST - machine that will host the binaries
|
... | ... | |
99 |
97 |
# Lastly, let's avoid some openssh nastiness, bug 708224, as
|
100 |
98 |
# convenience to our users.
|
101 |
99 |
|
102 |
|
# gzip, grep, awk are needed by locale-gen, bug 740750
|
103 |
|
|
|
100 |
IDEPEND="
|
|
101 |
!compile-locales? ( sys-apps/locale-gen )
|
|
102 |
"
|
104 |
103 |
BDEPEND="
|
105 |
104 |
${PYTHON_DEPS}
|
106 |
105 |
>=app-misc/pax-utils-${MIN_PAX_UTILS_VER}
|
107 |
106 |
sys-devel/bison
|
108 |
|
doc? ( sys-apps/texinfo )
|
109 |
|
!compile-locales? (
|
110 |
|
app-arch/gzip
|
111 |
|
sys-apps/grep
|
112 |
|
app-alternatives/awk
|
|
107 |
compile-locales? ( sys-apps/locale-gen )
|
|
108 |
doc? (
|
|
109 |
dev-lang/perl
|
|
110 |
sys-apps/texinfo
|
|
111 |
)
|
|
112 |
test? (
|
|
113 |
dev-lang/perl
|
|
114 |
>=net-dns/libidn2-2.3.0
|
113 |
115 |
)
|
114 |
|
test? ( dev-lang/perl )
|
115 |
116 |
"
|
116 |
117 |
COMMON_DEPEND="
|
117 |
118 |
gd? ( media-libs/gd:2= )
|
... | ... | |
119 |
120 |
audit? ( sys-process/audit )
|
120 |
121 |
caps? ( sys-libs/libcap )
|
121 |
122 |
) )
|
122 |
|
perl? ( dev-lang/perl )
|
123 |
|
test? ( dev-lang/perl )
|
124 |
123 |
suid? ( caps? ( sys-libs/libcap ) )
|
125 |
124 |
selinux? ( sys-libs/libselinux )
|
126 |
125 |
systemtap? ( dev-util/systemtap )
|
127 |
126 |
"
|
128 |
127 |
DEPEND="${COMMON_DEPEND}
|
129 |
|
compile-locales? (
|
130 |
|
app-arch/gzip
|
131 |
|
sys-apps/grep
|
132 |
|
app-alternatives/awk
|
133 |
|
)
|
134 |
|
test? ( >=net-dns/libidn2-2.3.0 )
|
135 |
128 |
"
|
136 |
129 |
RDEPEND="${COMMON_DEPEND}
|
137 |
|
app-arch/gzip
|
138 |
|
sys-apps/grep
|
139 |
|
app-alternatives/awk
|
140 |
|
sys-apps/gentoo-functions
|
141 |
130 |
!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
|
142 |
|
!<net-misc/openssh-8.1_p1-r2
|
|
131 |
perl? ( dev-lang/perl )
|
143 |
132 |
"
|
144 |
133 |
|
145 |
134 |
RESTRICT="!test? ( test )"
|
... | ... | |
463 |
452 |
|
464 |
453 |
# glibc's headers disallow -O0 and fail at build time:
|
465 |
454 |
# include/libc-symbols.h:75:3: #error "glibc cannot be compiled without optimization"
|
|
455 |
# https://sourceware.org/glibc/wiki/FAQ#Why_do_I_get:.60.23error_.22glibc_cannot_be_compiled_without_optimization.22.27.2C_when_trying_to_compile_GNU_libc_with_GNU_CC.3F
|
466 |
456 |
replace-flags -O0 -O1
|
467 |
457 |
|
468 |
458 |
# glibc handles this internally already where it's appropriate;
|
... | ... | |
672 |
662 |
|
673 |
663 |
glibc_banner() {
|
674 |
664 |
local b="Gentoo ${PVR}"
|
675 |
|
[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}"
|
|
665 |
[[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" (patchset ${PATCH_VER})"
|
676 |
666 |
echo "${b}"
|
677 |
667 |
}
|
678 |
668 |
|
... | ... | |
768 |
758 |
fi
|
769 |
759 |
fi
|
770 |
760 |
|
771 |
|
# Users have had a chance to phase themselves, time to give em the boot
|
772 |
|
if [[ -e ${EROOT}/etc/locale.gen ]] && [[ -e ${EROOT}/etc/locales.build ]] ; then
|
773 |
|
eerror "You still haven't deleted ${EROOT}/etc/locales.build."
|
774 |
|
eerror "Do so now after making sure ${EROOT}/etc/locale.gen is kosher."
|
775 |
|
die "Lazy upgrader detected"
|
776 |
|
fi
|
777 |
|
|
778 |
761 |
if [[ ${CTARGET} == i386-* ]] ; then
|
779 |
762 |
eerror "i386 CHOSTs are no longer supported."
|
780 |
763 |
eerror "Chances are you don't actually want/need i386."
|
... | ... | |
881 |
864 |
upgrade_warning
|
882 |
865 |
}
|
883 |
866 |
|
|
867 |
# pkg_setup
|
|
868 |
|
884 |
869 |
pkg_setup() {
|
885 |
870 |
# see bug 682570
|
886 |
871 |
[[ -z ${BOOTSTRAP_RAP} ]] && python-any-r1_pkg_setup
|
... | ... | |
909 |
894 |
unpack ${P}.tar.xz
|
910 |
895 |
|
911 |
896 |
cd "${WORKDIR}" || die
|
912 |
|
unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.xz
|
|
897 |
unpack glibc-${PV}-patches-${PATCH_VER}.tar.xz
|
913 |
898 |
fi
|
914 |
899 |
|
915 |
900 |
cd "${WORKDIR}" || die
|
916 |
|
unpack locale-gen-${LOCALE_GEN_VER}.tar.gz
|
917 |
901 |
use systemd && unpack glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz
|
918 |
902 |
}
|
919 |
903 |
|
|
904 |
# src_prepare
|
|
905 |
|
920 |
906 |
src_prepare() {
|
921 |
907 |
local patchsetname
|
922 |
908 |
if ! use vanilla ; then
|
923 |
909 |
if [[ ${PV} == 9999* ]] ; then
|
924 |
910 |
patchsetname="from git master"
|
925 |
911 |
else
|
926 |
|
patchsetname="${RELEASE_VER}-${PATCH_VER}"
|
|
912 |
patchsetname="${PV}-${PATCH_VER}"
|
927 |
913 |
fi
|
928 |
|
einfo "Applying Gentoo Glibc Patchset ${patchsetname}"
|
|
914 |
einfo "Applying Gentoo Glibc patchset ${patchsetname}"
|
929 |
915 |
eapply "${WORKDIR}"/patches
|
930 |
916 |
einfo "Done."
|
931 |
917 |
fi
|
... | ... | |
934 |
920 |
|
935 |
921 |
gnuconfig_update
|
936 |
922 |
|
937 |
|
cd "${WORKDIR}"
|
|
923 |
cd "${WORKDIR}" || die
|
938 |
924 |
find . -name configure -exec touch {} +
|
939 |
925 |
|
940 |
|
# move the external locale-gen to its old place
|
941 |
|
mkdir extra || die
|
942 |
|
mv locale-gen-${LOCALE_GEN_VER} extra/locale || die
|
943 |
|
|
944 |
|
eprefixify extra/locale/locale-gen
|
945 |
|
|
946 |
926 |
# Fix permissions on some of the scripts.
|
947 |
927 |
chmod u+x "${S}"/scripts/*.sh
|
948 |
928 |
|
949 |
|
cd "${S}"
|
|
929 |
cd "${S}" || die
|
950 |
930 |
}
|
951 |
931 |
|
|
932 |
# src_configure
|
|
933 |
|
952 |
934 |
glibc_do_configure() {
|
953 |
935 |
dump_build_environment
|
954 |
936 |
|
... | ... | |
964 |
946 |
# https://sourceware.org/PR22634#c0
|
965 |
947 |
case $(tc-arch ${CTARGET}) in
|
966 |
948 |
# Keep whitelist of targets where autodetection mostly works.
|
967 |
|
amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
|
|
949 |
amd64|x86|sparc|ppc|ppc64|arm|arm64|s390|riscv|loong) ;;
|
968 |
950 |
# Blacklist everywhere else
|
969 |
951 |
*) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
|
970 |
952 |
esac
|
... | ... | |
1033 |
1015 |
# execute Perl during configure if we're cross-compiling a prefix, but
|
1034 |
1016 |
# it will just disable mtrace in that case.
|
1035 |
1017 |
# Note: mtrace is needed by the test suite.
|
1036 |
|
ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl no))"
|
|
1018 |
ac_cv_path_PERL="$(usex perl "${EPREFIX}"/usr/bin/perl $(usex test "${EPREFIX}"/usr/bin/perl $(usex doc "${EPREFIX}"/usr/bin/perl no)))"
|
1037 |
1019 |
|
1038 |
1020 |
# locale data is arch-independent
|
1039 |
1021 |
# https://bugs.gentoo.org/753740
|
... | ... | |
1042 |
1024 |
# -march= option tricks build system to infer too
|
1043 |
1025 |
# high ISA level: https://sourceware.org/PR27318
|
1044 |
1026 |
libc_cv_include_x86_isa_level=no
|
|
1027 |
|
1045 |
1028 |
# Explicit override of https://sourceware.org/PR27991
|
1046 |
1029 |
# exposes a bug in glibc's configure:
|
1047 |
1030 |
# https://sourceware.org/PR27991
|
... | ... | |
1221 |
1204 |
foreach_abi do_src_configure
|
1222 |
1205 |
}
|
1223 |
1206 |
|
|
1207 |
# src_compile
|
|
1208 |
|
1224 |
1209 |
do_src_compile() {
|
1225 |
1210 |
emake -C "$(builddir nptl)"
|
1226 |
1211 |
}
|
... | ... | |
1233 |
1218 |
foreach_abi do_src_compile
|
1234 |
1219 |
}
|
1235 |
1220 |
|
|
1221 |
# src_test
|
|
1222 |
|
1236 |
1223 |
glibc_src_test() {
|
1237 |
1224 |
cd "$(builddir nptl)"
|
1238 |
1225 |
|
... | ... | |
1252 |
1239 |
SANDBOX_ON=0 LD_PRELOAD= TIMEOUTFACTOR=16 emake ${myxfailparams} check
|
1253 |
1240 |
}
|
1254 |
1241 |
|
1255 |
|
do_src_test() {
|
1256 |
|
local ret=0
|
1257 |
|
|
1258 |
|
glibc_src_test
|
1259 |
|
: $(( ret |= $? ))
|
1260 |
|
|
1261 |
|
return ${ret}
|
1262 |
|
}
|
1263 |
|
|
1264 |
1242 |
src_test() {
|
1265 |
1243 |
if just_headers ; then
|
1266 |
1244 |
return
|
1267 |
1245 |
fi
|
1268 |
1246 |
|
1269 |
|
# Give tests more time to complete.
|
1270 |
|
export TIMEOUTFACTOR=5
|
1271 |
|
|
1272 |
|
foreach_abi do_src_test || die "tests failed"
|
|
1247 |
foreach_abi glibc_src_test || die "tests failed"
|
1273 |
1248 |
}
|
1274 |
1249 |
|
|
1250 |
# src_install
|
|
1251 |
|
1275 |
1252 |
run_locale_gen() {
|
1276 |
1253 |
# if the host locales.gen contains no entries, we'll install everything
|
1277 |
1254 |
local root="$1"
|
... | ... | |
1291 |
1268 |
locale_list="${root%/}/usr/share/i18n/SUPPORTED"
|
1292 |
1269 |
fi
|
1293 |
1270 |
|
1294 |
|
set -- locale-gen ${inplace} --jobs $(makeopts_jobs) --config "${locale_list}" \
|
|
1271 |
# bug 736794: we need to be careful with the parallelization... the number of
|
|
1272 |
# processors saved in the environment of a binary package may differ strongly
|
|
1273 |
# from the number of processes available during postinst
|
|
1274 |
local mygenjobs="$(makeopts_jobs)"
|
|
1275 |
if [[ "${EMERGE_FROM}" == "binary" ]] ; then
|
|
1276 |
mygenjobs="$(nproc)"
|
|
1277 |
fi
|
|
1278 |
|
|
1279 |
set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config "${locale_list}" \
|
1295 |
1280 |
--destdir "${root}"
|
1296 |
1281 |
echo "$@"
|
1297 |
1282 |
"$@"
|
... | ... | |
1319 |
1304 |
# Avoid stripping binaries not targeted by ${CHOST}. Or else
|
1320 |
1305 |
# ${CHOST}-strip would break binaries build for ${CTARGET}.
|
1321 |
1306 |
is_crosscompile && dostrip -x /
|
1322 |
|
# gdb thread introspection relies on local libpthreas symbols. stripping breaks it
|
|
1307 |
|
|
1308 |
# gdb thread introspection relies on local libpthreads symbols. stripping breaks it
|
1323 |
1309 |
# See Note [Disable automatic stripping]
|
1324 |
1310 |
dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
|
1325 |
1311 |
|
... | ... | |
1437 |
1423 |
|
1438 |
1424 |
#################################################################
|
1439 |
1425 |
# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
|
|
1426 |
#################################################################
|
|
1427 |
|
1440 |
1428 |
# Make sure we install some symlink hacks so that when we build
|
1441 |
1429 |
# a 2nd stage cross-compiler, gcc finds the target system
|
1442 |
1430 |
# headers correctly. See gcc/doc/gccinstall.info
|
... | ... | |
1460 |
1448 |
-e "s: \\\\::g" -e "s:/: :g" \
|
1461 |
1449 |
"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
|
1462 |
1450 |
|| die "generating /usr/share/i18n/SUPPORTED failed"
|
1463 |
|
cd "${WORKDIR}"/extra/locale
|
1464 |
|
dosbin locale-gen
|
1465 |
|
doman *.[0-8]
|
1466 |
|
insinto /etc
|
1467 |
|
doins locale.gen
|
1468 |
|
|
1469 |
|
keepdir /usr/lib/locale
|
1470 |
1451 |
|
1471 |
|
cd "${S}"
|
|
1452 |
cd "${S}" || die
|
1472 |
1453 |
|
1473 |
1454 |
# Install misc network config files
|
1474 |
1455 |
insinto /etc
|
... | ... | |
1513 |
1494 |
# Generate all locales if this is a native build as locale generation
|
1514 |
1495 |
if use compile-locales && ! is_crosscompile ; then
|
1515 |
1496 |
run_locale_gen --inplace-glibc "${ED}/"
|
1516 |
|
sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die
|
1517 |
1497 |
fi
|
1518 |
1498 |
}
|
1519 |
1499 |
|
... | ... | |
1593 |
1573 |
# nothing to do if just installing headers
|
1594 |
1574 |
just_headers && return
|
1595 |
1575 |
|
|
1576 |
einfo "Checking general environment sanity."
|
|
1577 |
sanity_prechecks
|
|
1578 |
|
1596 |
1579 |
# prepare /etc/ld.so.conf.d/ for files
|
1597 |
1580 |
mkdir -p "${EROOT}"/etc/ld.so.conf.d
|
1598 |
1581 |
|