From f5aee5328c712e661f029d5ea6363314ecd8d160 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 6 Mar 2024 08:46:43 -0500 Subject: [PATCH 1/2] glibc: clean up install, add C.UTF-8 locale by default --- srcpkgs/glibc/template | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/srcpkgs/glibc/template b/srcpkgs/glibc/template index abd2ad846c9de1..1da9d03b626988 100644 --- a/srcpkgs/glibc/template +++ b/srcpkgs/glibc/template @@ -1,7 +1,7 @@ # Template file for 'glibc' pkgname=glibc version=2.38 -revision=5 +revision=6 bootstrap=yes short_desc="GNU C library" maintainer="Enno Boland " @@ -123,23 +123,28 @@ do_build() { env LDFLAGS.so="-Wl,--hash-style=both" LDFLAGS-rtld="-Wl,--hash-style=both" \ make ${makejobs} } + do_install() { vlicense LICENSES # Create DESTDIR/etc/ld.so.conf mkdir -p ${DESTDIR}/etc echo "include /etc/ld.so.conf.d/*.conf" > ${DESTDIR}/etc/ld.so.conf - cd build - make install_root=${DESTDIR} install + ( cd build && make install_root=${DESTDIR} install ) + + # The C.UTF-8 locale should always be available + vmkdir usr/lib/locale + I18NPATH=./localedata localedef --prefix="${DESTDIR}" \ + -i C -f UTF-8 --no-archive C.utf8 # create /etc/default/libc-locales vinstall ${FILESDIR}/libc-locales 644 etc/default - cp ${wrksrc}/localedata/SUPPORTED ${wrksrc}/build - sed -i -e "s|/| |g" \ + sed -e "s|/| |g" \ -e 's|\\| |g' \ -e "s|SUPPORTED-LOCALES=||" \ - -e "s|^|#|g" ${wrksrc}/build/SUPPORTED - cat ${wrksrc}/build/SUPPORTED >> ${DESTDIR}/etc/default/libc-locales + -e "s|^|#|g" \ + -e "/#C\.UTF-8 /d" localedata/SUPPORTED \ + >> "${DESTDIR}/etc/default/libc-locales" # ldd is a bash script, so make it run as such. replace_interpreter bash ${DESTDIR}/usr/bin/ldd @@ -162,7 +167,7 @@ do_install() { armv?l) ln -sfr ${DESTDIR}/usr/lib/ld-linux-armhf.so.3 ${DESTDIR}/usr/lib/ld-linux.so.3;; esac - vinstall ${wrksrc}/posix/gai.conf 644 etc + vinstall posix/gai.conf 644 etc rm -rf ${DESTDIR}/var/db # Remove tzselect and z{dump,ic}, provided by tzutils. rm -f ${DESTDIR}/usr/bin/tzselect @@ -185,6 +190,7 @@ glibc-devel_package() { fi } } + glibc-locales_package() { conf_files="/etc/default/libc-locales" short_desc+=" - locale data files" @@ -194,6 +200,7 @@ glibc-locales_package() { vmove usr/share/locale } } + nscd_package() { conf_files="/etc/nscd.conf" short_desc+=" - Name Service Cache Daemon" From 1b0e9252a3aeaa74b275495d0c6b0063b5f47a6f Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 6 Mar 2024 10:05:46 -0500 Subject: [PATCH 2/2] common/hooks/pre-pkg/99-pkglint.sh: allow C.utf8 locale in glibc package --- common/hooks/pre-pkg/99-pkglint.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh index 30d97fcda40d46..90cb07da3f4aff 100644 --- a/common/hooks/pre-pkg/99-pkglint.sh +++ b/common/hooks/pre-pkg/99-pkglint.sh @@ -79,8 +79,22 @@ hook() { # Check for l10n files in usr/lib/locale if [ -d ${PKGDESTDIR}/usr/lib/locale ]; then - msg_red "${pkgver}: /usr/lib/locale is forbidden, use /usr/share/locale!\n" - error=1 + local locale_allow=0 ldir + local lroot="${PKGDESTDIR}/usr/lib/locale" + + if [ "${pkgname}" = "glibc" ]; then + # glibc gets an exception for its included C.utf8 locale + locale_allow=1 + for ldir in "${lroot}"/*; do + [ "${ldir}" = "${lroot}/C.utf8" ] && continue + locale_allow=0 + done + fi + + if [ "${locale_allow}" -ne 1 ]; then + msg_red "${pkgver}: /usr/lib/locale is forbidden, use /usr/share/locale!\n" + error=1 + fi fi # Check for bash completions in etc/bash_completion.d