sys-libs/glibc: Apply Flatcar modifications

- take care of nscd.conf via tmpfiles, add files/nscd-conf.tmpfiles.
  - comment out 'dostrip -x' to force the OS image binaries to be stripped
  - remove everything glibc wants to put under /etc since we use
    baselayout to provide that
  - replace virtual/awk with app-alternatives/awk
This commit is contained in:
Krzesimir Nowak 2021-12-15 20:48:57 +01:00
parent 43ccab8e9d
commit 4bd509277a
3 changed files with 34 additions and 5 deletions

View File

@ -0,0 +1,9 @@
# 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: ...`.

View File

@ -0,0 +1,2 @@
L /etc/nscd.conf - - - - ../usr/share/baselayout/nscd.conf
d /var/db/nscd - - - - -

View File

@ -110,7 +110,7 @@ BDEPEND="
!compile-locales? (
app-arch/gzip
sys-apps/grep
virtual/awk
app-alternatives/awk
)
"
COMMON_DEPEND="
@ -127,14 +127,14 @@ DEPEND="${COMMON_DEPEND}
compile-locales? (
app-arch/gzip
sys-apps/grep
virtual/awk
app-alternatives/awk
)
test? ( >=net-dns/libidn2-2.3.0 )
"
RDEPEND="${COMMON_DEPEND}
app-arch/gzip
sys-apps/grep
virtual/awk
app-alternatives/awk
sys-apps/gentoo-functions
!<app-misc/pax-utils-${MIN_PAX_UTILS_VER}
!<net-misc/openssh-8.1_p1-r2
@ -1274,12 +1274,13 @@ glibc_do_src_install() {
# '#define VERSION "2.26.90"' -> '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 /
# is_crosscompile && dostrip -x /
# gdb thread introspection relies on local libpthreas 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
@ -1462,6 +1463,23 @@ glibc_do_src_install() {
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() {