From a0bdca4f3f0b5d8fa83b94baa29aee593a6185d7 Mon Sep 17 00:00:00 2001 From: Arjun Shankar Date: Tue, 15 Feb 2022 00:40:57 +0100 Subject: [PATCH] locale: symlink identical langpack LC_CTYPEs to the C.utf8 version Almost half the LC_CTYPE files in langpacks are identical to the C.utf8 variant which is installed by default. This commit converts these to symbolic links instead, saving ~350K of installed size per langpack. Reviewed-by: Florian Weimer --- glibc.spec | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/glibc.spec b/glibc.spec index c581cf7..3ac699e 100644 --- a/glibc.spec +++ b/glibc.spec @@ -152,7 +152,7 @@ end \ Summary: The GNU libc libraries Name: glibc Version: %{glibcversion} -Release: 2%{?dist} +Release: 3%{?dist} # In general, GPLv2+ is used by programs, LGPLv2+ is used for # libraries. @@ -1223,6 +1223,20 @@ popd # via hardlinks, so we must group them ourselves. hardlink -c %{glibc_sysroot}/usr/lib/locale +# Almost half the LC_CTYPE files in langpacks are identical to the C.utf8 +# variant which is installed by default. When we keep them as hardlinks, +# each langpack ends up retaining a copy. If we convert these to symbolic +# links instead, we save ~350K each when they get installed that way. +# +# LC_MEASUREMENT and LC_PAPER also have several duplicates but we don't +# bother with these because they are only ~30 bytes each. +pushd %{glibc_sysroot}/usr/lib/locale +for f in $(find eo *_* -samefile C.utf8/LC_CTYPE); do + rm $f && ln -s '../C.utf8/LC_CTYPE' $f +done +popd + + # install_different: # Install all core libraries into DESTDIR/SUBDIR. Either the file is # installed as a copy or a symlink to the default install (if it is the @@ -2160,6 +2174,9 @@ update_gconv_modules_cache () %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared %changelog +* Tue Feb 15 2022 Arjun Shankar - 2.35.9000-3 +- Reduce installed size of some langpacks by de-duplicating LC_CTYPE + * Thu Feb 10 2022 Arjun Shankar - 2.35.9000-2 - Drop glibc-fedora-localedef.patch and adjust locale installation accordingly so that installed content remains unchanged.