From 164934cc94c212084e70e030b177fb871f8f55a9 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 11 Sep 2023 12:13:52 +0200 Subject: [PATCH] sys-libs/glibc: Sync with Gentoo It's from Gentoo commit e0bfeb250d886e096fd861a5d280e798c1e16e9c. --- .../coreos-overlay/sys-libs/glibc/Manifest | 5 +- .../coreos-overlay/sys-libs/glibc/README.md | 9 - .../sys-libs/glibc/files/nscd-conf.tmpfiles | 2 - .../sys-libs/glibc/files/nscd.service | 15 -- .../sys-libs/glibc/files/nscd.tmpfilesd | 4 - ...bc-2.36-r5.ebuild => glibc-2.37-r3.ebuild} | 203 +++++++++--------- .../sys-libs/glibc/metadata.xml | 1 + 7 files changed, 100 insertions(+), 139 deletions(-) delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/README.md delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd-conf.tmpfiles delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd.service delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd.tmpfilesd rename sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/{glibc-2.36-r5.ebuild => glibc-2.37-r3.ebuild} (94%) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest index 7404e43b95..d757f9fa38 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest @@ -1,5 +1,4 @@ DIST gcc-multilib-bootstrap-20201208.tar.xz 5528452 BLAKE2B 16699a6e4df5b2f28a21776ae9e3728b26a9ea251f5580aa5349545ad7c9f6145b9cb6a12ca8f5f96b9cb2a3c70b7e66ca702e4c6f083ac00408e0a20a69e613 SHA512 a243f505e17d0a7e144e8713c077582412f61d6cf7f79baa846de4fb77f5e0f27e11c9a785e14624e04ac52287b32164e7995323aa11caef59113ac438254347 -DIST glibc-2.36-patches-5.tar.xz 81348 BLAKE2B 003a59a992302c21132474bcdc994d10b5d50a94368e949ce28cbe389cefd104f66c48cb61a63d24e2f6db94d010e4220bda3fb5291d088cda88069b928c92e0 SHA512 6d6a16114df2223bf04729a79d12a52e41c9b8e756863c1acbb909dc34696958073604ced1b691579271218738511191ddf517e03a700d3948752c455201bcc4 -DIST glibc-2.36.tar.xz 18610836 BLAKE2B f8375e084043f032609e66fd98c234249df57a595c59672acb1bb8c69aed64d339d526611553449492b097cda900ad1d9bae8873d7f5932b10a9a0d8c9210c55 SHA512 9ea0bbda32f83a85b7da0c34f169607fb8a102f0a11a914e6bf531be47d1bef4f5307128286cffa1e2dc5879f0e6ccaef527dd353486883fa332a0b44bde8b3e +DIST glibc-2.37-patches-5.tar.xz 37640 BLAKE2B a87fb239208eb6d65c96bf7687570d8d0919277410fe1e28c293fa7749ffa862417bc1fe6d0819e47a806b20e52d14de84b843fa879fe15b884b2742719caf87 SHA512 344276606b7330322df72ee964d3447d02907df92b5a1d20b9aa427e93727be907f915ecd62db45e994c46451bd09d5da95ef7bf1a27d247a57589c568e6cb20 +DIST glibc-2.37.tar.xz 18674604 BLAKE2B 8139cd977b2ed3bfdbde5ffb1cda8f759763dbb83071167272fef798cfbdc0d17cfd1ec893d126c52c91511b7961f3ad12eed34534b99412dfa04a1cdd5b4ea3 SHA512 4fc5932f206bb1b8b54828a28af1a681616b838bbab60c81c82155f3629cbfe1301d271af65511ed917f4c6949a025429221fe6035753282f15346919f15b90c DIST glibc-systemd-20210729.tar.gz 1480 BLAKE2B 37722c7579df782d890e44dbab99c3de52ab466eb9de80d82405e9bb5620bf39ffc8c5f466a435bdb86ef6d36dd7019c0736573916bda6c67d02a2581e0ec979 SHA512 efd75af58b50522c28cdac7abd1fc56555bc1bb042512c90d8340c1ec09c5791b3872a305bf83723252bbde5855b75d958c041083457765c4cfd170732d09238 -DIST locale-gen-2.22.tar.gz 7971 BLAKE2B 2dc66fa69bf51799d0c34459b654fba6998b80a7e322e9b670036c967e269ad921f50195e6e34c4a83c1f0bad191fd5aa3f37defb82271b73acbca07b7e49d08 SHA512 9798b10dbbc792345a7b7a121dec5f4bba9839a8aec010f01a09f3402fd5bf2376f79e03a6a19bc357010db780037a8811c381136ce19be1f1370374906dff38 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/README.md b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/README.md deleted file mode 100644 index 0bcb9dd9ee..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# GLibc - -The system's C library, sometimes referred to as "service pack for the C -language". The build recipe has a single modification over the one Gentoo -upstream uses: in the installation callback `glibc_do_src_install`, we remove -all of glibc's `/etc` files right after the stock glibc build diligently -installed them, since we ship our own `/etc` stuff via the `baseimage` recipe. -The addition sits at the end of the `glibc_do_src_install` function and is duly -labelled `## Flatcar Container Linux: ...`. diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd-conf.tmpfiles b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd-conf.tmpfiles deleted file mode 100644 index 0cf43dcb7a..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd-conf.tmpfiles +++ /dev/null @@ -1,2 +0,0 @@ -L /etc/nscd.conf - - - - ../usr/share/baselayout/nscd.conf -d /var/db/nscd - - - - - diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd.service b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd.service deleted file mode 100644 index 25a3b1d9be..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Name Service Cache Daemon -After=network.target - -[Service] -ExecStart=/usr/sbin/nscd -F -ExecStop=/usr/sbin/nscd --shutdown -ExecReload=/usr/sbin/nscd -i passwd -ExecReload=/usr/sbin/nscd -i group -ExecReload=/usr/sbin/nscd -i hosts -ExecReload=/usr/sbin/nscd -i services -Restart=always - -[Install] -WantedBy=multi-user.target diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd.tmpfilesd b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd.tmpfilesd deleted file mode 100644 index 52edbba673..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/nscd.tmpfilesd +++ /dev/null @@ -1,4 +0,0 @@ -# Configuration to create /run/nscd directory -# Used as part of systemd's tmpfiles - -d /run/nscd 0755 root root diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.36-r5.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.37-r3.ebuild similarity index 94% rename from sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.36-r5.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.37-r3.ebuild index 05c1d5837f..c3c9ca521d 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.36-r5.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.37-r3.ebuild @@ -1,12 +1,12 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 # Bumping notes: https://wiki.gentoo.org/wiki/Project:Toolchain/sys-libs/glibc # Please read & adapt the page as necessary if obsolete. -PYTHON_COMPAT=( python3_{8..11} ) +PYTHON_COMPAT=( python3_{9..11} ) TMPFILES_OPTIONAL=1 inherit python-any-r1 prefix preserve-libs toolchain-funcs flag-o-matic gnuconfig \ @@ -23,6 +23,19 @@ EMULTILIB_PKG="true" PATCH_VER=5 PATCH_DEV=dilfridge +# gcc mulitilib bootstrap files version +GCC_BOOTSTRAP_VER=20201208 + +# systemd integration version +GLIBC_SYSTEMD_VER=20210729 + +# Minimum kernel version that glibc requires +MIN_KERN_VER="3.2.0" + +# Minimum pax-utils version needed (which contains any new syscall changes for +# its seccomp filter!). Please double check this! +MIN_PAX_UTILS_VER="1.3.3" + if [[ ${PV} == 9999* ]]; then inherit git-r3 else @@ -31,25 +44,10 @@ else SRC_URI+=" https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz" fi -RELEASE_VER=${PV} - -GCC_BOOTSTRAP_VER=20201208 - -LOCALE_GEN_VER=2.22 - -GLIBC_SYSTEMD_VER=20210729 - -SRC_URI+=" https://gitweb.gentoo.org/proj/locale-gen.git/snapshot/locale-gen-${LOCALE_GEN_VER}.tar.gz" SRC_URI+=" multilib-bootstrap? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" SRC_URI+=" systemd? ( https://gitweb.gentoo.org/proj/toolchain/glibc-systemd.git/snapshot/glibc-systemd-${GLIBC_SYSTEMD_VER}.tar.gz )" -IUSE="audit caps cet compile-locales +crypt custom-cflags doc gd hash-sysv-compat headers-only +multiarch multilib multilib-bootstrap nscd profile selinux +ssp stack-realign +static-libs suid systemd systemtap test vanilla" - -# Minimum kernel version that glibc requires -MIN_KERN_VER="3.2.0" -# Minimum pax-utils version needed (which contains any new syscall changes for -# its seccomp filter!). Please double check this! -MIN_PAX_UTILS_VER="1.3.3" +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" # Here's how the cross-compile logic breaks down ... # CTARGET - machine that will target the binaries @@ -99,17 +97,21 @@ fi # Lastly, let's avoid some openssh nastiness, bug 708224, as # convenience to our users. -# gzip, grep, awk are needed by locale-gen, bug 740750 - +IDEPEND=" + !compile-locales? ( sys-apps/locale-gen ) +" BDEPEND=" ${PYTHON_DEPS} >=app-misc/pax-utils-${MIN_PAX_UTILS_VER} sys-devel/bison - doc? ( sys-apps/texinfo ) - !compile-locales? ( - app-arch/gzip - sys-apps/grep - app-alternatives/awk + compile-locales? ( sys-apps/locale-gen ) + doc? ( + dev-lang/perl + sys-apps/texinfo + ) + test? ( + dev-lang/perl + >=net-dns/libidn2-2.3.0 ) " COMMON_DEPEND=" @@ -123,20 +125,10 @@ COMMON_DEPEND=" systemtap? ( dev-util/systemtap ) " DEPEND="${COMMON_DEPEND} - compile-locales? ( - app-arch/gzip - sys-apps/grep - app-alternatives/awk - ) - test? ( >=net-dns/libidn2-2.3.0 ) " RDEPEND="${COMMON_DEPEND} - app-arch/gzip - sys-apps/grep - app-alternatives/awk - sys-apps/gentoo-functions ! '2.26.90' local upstream_pv=$(sed -n -r 's/#define VERSION "(.*)"/\1/p' "${S}"/version.h) - # Flatcar: override this and strip everything to keep image size at bay # Avoid stripping binaries not targeted by ${CHOST}. Or else # ${CHOST}-strip would break binaries build for ${CTARGET}. - # is_crosscompile && dostrip -x / - # gdb thread introspection relies on local libpthreas symbols. stripping breaks it + is_crosscompile && dostrip -x / + + # gdb thread introspection relies on local libpthreads symbols. stripping breaks it # See Note [Disable automatic stripping] - # dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so + dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then # Move versioned .a file out of libdir to evade portage QA checks @@ -1318,6 +1318,17 @@ glibc_do_src_install() { mv "${ED}"/$(alt_usrlibdir)/libm-${upstream_pv}.a "${ED}"/$(alt_usrlibdir)/${P}/libm-${upstream_pv}.a || die fi + # We configure toolchains for standalone prefix systems with a sysroot, + # which is prepended to paths in ld scripts, so strip the prefix from these. + # Before: GROUP ( /foo/lib64/libc.so.6 /foo/usr/lib64/libc_nonshared.a AS_NEEDED ( /foo/lib64/ld-linux-x86-64.so.2 ) ) + # After: GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ) + if [[ -n $(host_eprefix) ]] ; then + local file + grep -lZIF "ld script" "${ED}/$(alt_usrlibdir)"/lib*.{a,so} 2>/dev/null | while read -rd '' file ; do + sed -i "s|$(host_eprefix)/|/|g" "${file}" || die + done + fi + # We'll take care of the cache ourselves rm -f "${ED}"/etc/ld.so.cache @@ -1412,6 +1423,8 @@ glibc_do_src_install() { ################################################################# # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY # + ################################################################# + # Make sure we install some symlink hacks so that when we build # a 2nd stage cross-compiler, gcc finds the target system # headers correctly. See gcc/doc/gccinstall.info @@ -1435,15 +1448,8 @@ glibc_do_src_install() { -e "s: \\\\::g" -e "s:/: :g" \ "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ || die "generating /usr/share/i18n/SUPPORTED failed" - cd "${WORKDIR}"/extra/locale - dosbin locale-gen - doman *.[0-8] - insinto /etc - doins locale.gen - keepdir /usr/lib/locale - - cd "${S}" + cd "${S}" || die # Install misc network config files insinto /etc @@ -1488,25 +1494,7 @@ glibc_do_src_install() { # Generate all locales if this is a native build as locale generation if use compile-locales && ! is_crosscompile ; then run_locale_gen --inplace-glibc "${ED}/" - sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i "${ED}"/usr/sbin/locale-gen || die fi - - ## Flatcar Container Linux: Add some local changes: - # - Config files are installed by baselayout, not glibc. - # - Install nscd/systemd stuff in /usr. - - # Use tmpfiles to put nscd.conf in /etc and create directories. - insinto /usr/share/baselayout - if ! in_iuse nscd || use nscd ; then - doins "${S}"/nscd/nscd.conf || die - newtmpfiles "${FILESDIR}"/nscd-conf.tmpfiles nscd-conf.conf || die - fi - - # Clean out any default configs. - rm -rf "${ED}"/etc - - # Restore this one for the SDK. - test ! -e "${T}"/00glibc || doenvd "${T}"/00glibc } glibc_headers_install() { @@ -1585,6 +1573,9 @@ pkg_preinst() { # nothing to do if just installing headers just_headers && return + einfo "Checking general environment sanity." + sanity_prechecks + # prepare /etc/ld.so.conf.d/ for files mkdir -p "${EROOT}"/etc/ld.so.conf.d diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/metadata.xml b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/metadata.xml index 69c29b299a..846d01d34e 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/metadata.xml +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/metadata.xml @@ -17,6 +17,7 @@ enable optimizations for multiple CPU architectures (detected at runtime) Provide prebuilt libgcc.a and crt files if missing. Only needed for ABI switch. Build, and enable support for, the Name Service Cache Daemon + Install additional scripts written in Perl protect stack of glibc internals Realign the stack in the 32-bit build for compatibility with older binaries at some performance cost Enable static PIE support (runtime files for -static-pie gcc option).