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 <fweimer@redhat.com>
This commit is contained in:
Arjun Shankar 2022-02-15 00:40:57 +01:00
parent cf979ff812
commit a0bdca4f3f

View File

@ -152,7 +152,7 @@ end \
Summary: The GNU libc libraries Summary: The GNU libc libraries
Name: glibc Name: glibc
Version: %{glibcversion} Version: %{glibcversion}
Release: 2%{?dist} Release: 3%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for # In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries. # libraries.
@ -1223,6 +1223,20 @@ popd
# via hardlinks, so we must group them ourselves. # via hardlinks, so we must group them ourselves.
hardlink -c %{glibc_sysroot}/usr/lib/locale 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_different:
# Install all core libraries into DESTDIR/SUBDIR. Either the file is # 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 # 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 %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog %changelog
* Tue Feb 15 2022 Arjun Shankar <arjun@redhat.com> - 2.35.9000-3
- Reduce installed size of some langpacks by de-duplicating LC_CTYPE
* Thu Feb 10 2022 Arjun Shankar <arjun@redhat.com> - 2.35.9000-2 * Thu Feb 10 2022 Arjun Shankar <arjun@redhat.com> - 2.35.9000-2
- Drop glibc-fedora-localedef.patch and adjust locale installation - Drop glibc-fedora-localedef.patch and adjust locale installation
accordingly so that installed content remains unchanged. accordingly so that installed content remains unchanged.