glibc/glibc.spec

2260 lines
85 KiB
RPMSpec

%define glibcsrcdir glibc-2.33
%define glibcversion 2.33
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
# git archive HEAD --format=tar --prefix=$(git describe --match 'glibc-*')/ \
# > $(git describe --match 'glibc-*').tar
# gzip -9 $(git describe --match 'glibc-*').tar
#
# glibc_release_url is only defined when we have a release tarball.
%{lua: if string.match(rpm.expand("%glibcsrcdir"), "^glibc%-[0-9.]+$") then
rpm.define("glibc_release_url https://ftp.gnu.org/gnu/glibc/") end}
##############################################################################
# We support the following options:
# --with/--without,
# * testsuite - Running the testsuite.
# * benchtests - Running and building benchmark subpackage.
# * bootstrap - Bootstrapping the package.
# * werror - Build with -Werror
# * docs - Build with documentation and the required dependencies.
# * valgrind - Run smoke tests with valgrind to verify dynamic loader.
#
# You must always run the testsuite for production builds.
# Default: Always run the testsuite.
%bcond_without testsuite
# Default: Always build the benchtests.
%bcond_without benchtests
# Default: Not bootstrapping.
%bcond_with bootstrap
# Default: Treat warnings as errors.
%bcond_without werror
# Default: Always build documentation.
%bcond_without docs
# Default: Always run valgrind tests if there is architecture support.
%ifarch %{valgrind_arches}
%bcond_without valgrind
%else
%bcond_with valgrind
%endif
# Restrict %%{valgrind_arches} further in case there are problems with
# the smoke test.
%if %{with valgrind}
%ifarch ppc64 ppc64p7
# The valgrind smoke test does not work on ppc64, ppc64p7 (bug 1273103).
%undefine with_valgrind
%endif
%endif
%if %{with bootstrap}
# Disable benchtests, -Werror, docs, and valgrind if we're bootstrapping
%undefine with_benchtests
%undefine with_werror
%undefine with_docs
%undefine with_valgrind
%endif
# Only some architectures have static PIE support.
%define pie_arches %{ix86} x86_64
##############################################################################
# Any architecture/kernel combination that supports running 32-bit and 64-bit
# code in userspace is considered a biarch arch.
%define biarcharches %{ix86} x86_64 s390 s390x
# Avoid generating a glibc-headers package on architectures which are
# not biarch.
%ifarch %{biarcharches}
%define need_headers_package 1
%if 0%{?rhel} > 0
%define headers_package_name glibc-headers
%else
%ifarch %{ix86} x86_64
%define headers_package_name glibc-headers-x86
%endif
%ifarch s390 s390x
%define headers_package_name glibc-headers-s390
%endif
%dnl !rhel
%endif
%else
%define need_headers_package 0
%dnl !biarcharches
%endif
##############################################################################
# %%package glibc - The GNU C Library (glibc) core package.
##############################################################################
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 14%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
#
# LGPLv2+ with exceptions is used for things that are linked directly
# into dynamically linked programs and shared libraries (e.g. crt
# files, lib*_nonshared.a). Historically, this exception also applies
# to parts of libio.
#
# GPLv2+ with exceptions is used for parts of the Arm unwinder.
#
# GFDL is used for the documentation.
#
# Some other licenses are used in various places (BSD, Inner-Net,
# ISC, Public Domain).
#
# HSRL and FSFAP are only used in test cases, which currently do not
# ship in binary RPMs, so they are not listed here. MIT is used for
# scripts/install-sh, which does not ship, either.
#
# GPLv3+ is used by manual/texinfo.tex, which we do not use.
#
# LGPLv3+ is used by some Hurd code, which we do not build.
#
# LGPLv2 is used in one place (time/timespec_get.c, by mistake), but
# it is not actually compiled, so it does not matter for libraries.
License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL
URL: http://www.gnu.org/software/glibc/
Source0: %{?glibc_release_url}%{glibcsrcdir}.tar.xz
Source1: nscd.conf
Source2: bench.mk
Source3: glibc-bench-compare
Source10: wrap-find-debuginfo.sh
Source11: parse-SUPPORTED.py
# Include in the source RPM for reference.
Source12: ChangeLog.old
######################################################################
# Activate the wrapper script for debuginfo generation, by rewriting
# the definition of __debug_install_post.
%{lua:
local wrapper = rpm.expand("%{SOURCE10}")
local ldso = rpm.expand("%{glibc_sysroot}/%{_lib}/ld-%{VERSION}.so")
local original = rpm.expand("%{macrobody:__debug_install_post}")
-- Strip leading newline. It confuses the macro redefinition.
-- Avoid embedded newlines that confuse the macro definition.
original = original:match("^%s*(.-)%s*$"):gsub("\\\n", "")
rpm.define("__debug_install_post bash " .. wrapper
.. " " .. ldso .. " " .. original)
}
##############################################################################
# Patches:
# - See each individual patch file for origin and upstream status.
# - For new patches follow template.patch format.
##############################################################################
Patch1: glibc-fedora-nscd.patch
Patch3: glibc-rh697421.patch
Patch4: glibc-fedora-linux-tcsetattr.patch
Patch6: glibc-fedora-localedef.patch
Patch8: glibc-fedora-manual-dircategory.patch
Patch9: glibc-rh827510.patch
Patch12: glibc-rh819430.patch
Patch13: glibc-fedora-localedata-rh61908.patch
Patch15: glibc-rh1070416.patch
Patch16: glibc-nscd-sysconfig.patch
Patch17: glibc-cs-path.patch
Patch18: glibc-c-utf8-locale.patch
Patch23: glibc-python3.patch
Patch29: glibc-fedora-nsswitch.patch
Patch30: glibc-deprecated-selinux-makedb.patch
Patch31: glibc-deprecated-selinux-nscd.patch
Patch32: glibc-upstream-2.33-1.patch
Patch33: glibc-upstream-2.33-2.patch
Patch34: glibc-upstream-2.33-3.patch
Patch35: glibc-upstream-2.33-4.patch
Patch36: glibc-upstream-2.33-5.patch
Patch37: glibc-upstream-2.33-6.patch
Patch38: glibc-upstream-2.33-7.patch
Patch39: glibc-upstream-2.33-8.patch
Patch40: glibc-upstream-2.33-9.patch
Patch41: glibc-upstream-2.33-10.patch
Patch42: glibc-upstream-2.33-11.patch
Patch43: glibc-upstream-2.33-12.patch
Patch44: glibc-upstream-2.33-13.patch
Patch45: glibc-upstream-2.33-14.patch
Patch46: glibc-upstream-2.33-15.patch
Patch47: glibc-upstream-2.33-16.patch
Patch48: glibc-upstream-2.33-17.patch
Patch49: glibc-upstream-2.33-18.patch
Patch50: glibc-upstream-2.33-19.patch
Patch51: glibc-upstream-2.33-20.patch
Patch52: glibc-upstream-2.33-21.patch
Patch53: glibc-upstream-2.33-22.patch
Patch54: glibc-upstream-2.33-23.patch
Patch55: glibc-upstream-2.33-24.patch
Patch56: glibc-upstream-2.33-25.patch
Patch57: glibc-upstream-2.33-26.patch
Patch58: glibc-upstream-2.33-27.patch
Patch59: glibc-upstream-2.33-28.patch
Patch60: glibc-upstream-2.33-29.patch
Patch61: glibc-upstream-2.33-30.patch
Patch62: glibc-upstream-2.33-31.patch
Patch63: glibc-upstream-2.33-32.patch
Patch64: glibc-upstream-2.33-33.patch
Patch65: glibc-upstream-2.33-34.patch
Patch66: glibc-upstream-2.33-35.patch
Patch67: glibc-upstream-2.33-36.patch
Patch68: glibc-upstream-2.33-37.patch
Patch69: glibc-upstream-2.33-38.patch
Patch70: glibc-upstream-2.33-39.patch
Patch71: glibc-upstream-2.33-40.patch
Patch72: glibc-cpu-check-1.patch
Patch73: glibc-cpu-check-2.patch
Patch74: glibc-cpu-check-3.patch
Patch75: glibc-upstream-2.33-41.patch
##############################################################################
# Continued list of core "glibc" package information:
##############################################################################
Obsoletes: glibc-profile < 2.4
Provides: ldconfig
# The dynamic linker supports DT_GNU_HASH
Provides: rtld(GNU_HASH)
# We need libgcc for cancellation support in POSIX threads.
Requires: libgcc%{_isa}
Requires: glibc-common = %{version}-%{release}
# Various components (regex, glob) have been imported from gnulib.
Provides: bundled(gnulib)
Requires(pre): basesystem
Requires: basesystem
%ifarch %{ix86}
# Automatically install the 32-bit variant if the 64-bit variant has
# been installed. This covers the case when glibc.i686 is installed
# after nss_*.x86_64. (See below for the other ordering.)
Recommends: (nss_db(x86-32) if nss_db(x86-64))
Recommends: (nss_hesiod(x86-32) if nss_hesiod(x86-64))
%endif
# This is for building auxiliary programs like memusage, nscd
# For initial glibc bootstraps it can be commented out
%if %{without bootstrap}
BuildRequires: gd-devel libpng-devel zlib-devel
%endif
%if %{with docs}
%endif
%if %{without bootstrap}
BuildRequires: libselinux-devel >= 1.33.4-3
%endif
BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext
# We need procps-ng (/bin/ps), util-linux (/bin/kill), and gawk (/bin/awk),
# but it is more flexible to require the actual programs and let rpm infer
# the packages. However, until bug 1259054 is widely fixed we avoid the
# following:
# BuildRequires: /bin/ps, /bin/kill, /bin/awk
# And use instead (which should be reverted some time in the future):
BuildRequires: procps-ng, util-linux, gawk
BuildRequires: systemtap-sdt-devel
%if %{with valgrind}
# Require valgrind for smoke testing the dynamic loader to make sure we
# have not broken valgrind.
BuildRequires: valgrind
%endif
# We use systemd rpm macros for nscd
BuildRequires: systemd
# We use python for the microbenchmarks and locale data regeneration
# from unicode sources (carried out manually). We choose python3
# explicitly because it supports both use cases. On some
# distributions, python3 does not actually install /usr/bin/python3,
# so we also depend on python3-devel.
BuildRequires: python3 python3-devel
# This GCC version is needed for -fstack-clash-protection support.
BuildRequires: gcc >= 7.2.1-6
%define enablekernel 3.2
Conflicts: kernel < %{enablekernel}
%define target %{_target_cpu}-redhat-linux
%ifarch %{arm}
%define target %{_target_cpu}-redhat-linuxeabi
%endif
%ifarch ppc64le
%define target ppc64le-redhat-linux
%endif
# GNU make 4.0 introduced the -O option.
BuildRequires: make >= 4.0
# The intl subsystem generates a parser using bison.
BuildRequires: bison >= 2.7
# binutils 2.30-17 is needed for --generate-missing-build-notes.
BuildRequires: binutils >= 2.30-17
# Earlier releases have broken support for IRELATIVE relocations
Conflicts: prelink < 0.4.2
%if %{without bootstrap}
%if %{with testsuite}
# The testsuite builds static C++ binaries that require a C++ compiler,
# static C++ runtime from libstdc++-static, and lastly static glibc.
BuildRequires: gcc-c++
BuildRequires: libstdc++-static
# A configure check tests for the ability to create static C++ binaries
# before glibc is built and therefore we need a glibc-static for that
# check to pass even if we aren't going to use any of those objects to
# build the tests.
BuildRequires: glibc-static
# libidn2 (but not libidn2-devel) is needed for testing AI_IDN/NI_IDN.
BuildRequires: libidn2
# The testsuite runs mtrace, which is a perl script
BuildRequires: perl-interpreter
%endif
%endif
# Filter out all GLIBC_PRIVATE symbols since they are internal to
# the package and should not be examined by any other tool.
%global __filter_GLIBC_PRIVATE 1
# For language packs we have glibc require a virtual dependency
# "glibc-langpack" wich gives us at least one installed langpack.
# If no langpack providing 'glibc-langpack' was installed you'd
# get language-neutral support e.g. C, POSIX, and C.UTF-8 locales.
# In the past we used to install the glibc-all-langpacks by default
# but we no longer do this to minimize container and VM sizes.
# Today you must actively use the language packs infrastructure to
# install language support.
Requires: glibc-langpack = %{version}-%{release}
Suggests: glibc-minimal-langpack = %{version}-%{release}
%description
The glibc package contains standard libraries which are used by
multiple programs on the system. In order to save disk space and
memory, as well as to make upgrading easier, common system code is
kept in one place and shared between programs. This particular package
contains the most important sets of shared libraries: the standard C
library and the standard math library. Without these two libraries, a
Linux system will not function.
######################################################################
# libnsl subpackage
######################################################################
%package -n libnsl
Summary: Legacy support library for NIS
Requires: %{name}%{_isa} = %{version}-%{release}
%description -n libnsl
This package provides the legacy version of libnsl library, for
accessing NIS services.
This library is provided for backwards compatibility only;
applications should use libnsl2 instead to gain IPv6 support.
##############################################################################
# glibc "devel" sub-package
##############################################################################
%package devel
Summary: Object files for development using standard C libraries.
Requires: %{name} = %{version}-%{release}
Requires: libxcrypt-devel%{_isa} >= 4.0.0
Requires: kernel-headers >= 3.2
BuildRequires: kernel-headers >= 3.2
%if %{need_headers_package}
Requires: %{headers_package_name} = %{version}-%{release}
%endif
%if !(0%{?rhel} > 0 && %{need_headers_package})
# For backwards compatibility, when the glibc-headers package existed.
Provides: glibc-headers = %{version}-%{release}
Provides: glibc-headers(%{_target_cpu})
Obsoletes: glibc-headers < %{version}-%{release}
%endif
%description devel
The glibc-devel package contains the object files necessary
for developing programs which use the standard C libraries (which are
used by nearly all programs). If you are developing programs which
will use the standard C libraries, your system needs to have these
standard object files available in order to create the
executables.
Install glibc-devel if you are going to develop programs which will
use the standard C libraries.
##############################################################################
# glibc "doc" sub-package
##############################################################################
%if %{with docs}
%package doc
Summary: Documentation for GNU libc
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
# Removing texinfo will cause check-safety.sh test to fail because it seems to
# trigger documentation generation based on dependencies. We need to fix this
# upstream in some way that doesn't depend on generating docs to validate the
# texinfo. I expect it's simply the wrong dependency for that target.
BuildRequires: texinfo >= 5.0
%description doc
The glibc-doc package contains The GNU C Library Reference Manual in info
format. Additional package documentation is also provided.
%endif
##############################################################################
# glibc "static" sub-package
##############################################################################
%package static
Summary: C library static libraries for -static linking.
Requires: %{name}-devel = %{version}-%{release}
Requires: libxcrypt-static%{?_isa} >= 4.0.0
%description static
The glibc-static package contains the C library static libraries
for -static linking. You don't need these, unless you link statically,
which is highly discouraged.
##############################################################################
# glibc "headers" sub-package
# - The headers package includes all common headers that are shared amongst
# the multilib builds. It avoids file conflicts between the architecture-
# specific glibc-devel variants.
# Files like gnu/stubs.h which have gnu/stubs-32.h (i686) and gnu/stubs-64.h
# are included in glibc-headers, but the -32 and -64 files are in their
# respective i686 and x86_64 devel packages.
##############################################################################
%if %{need_headers_package}
%package -n %{headers_package_name}
Summary: Additional internal header files for glibc-devel.
Requires: %{name} = %{version}-%{release}
%if 0%{?rhel} > 0
Provides: %{name}-headers(%{_target_cpu})
Obsoletes: glibc-headers-x86 < %{version}-%{release}
Obsoletes: glibc-headers-s390 < %{version}-%{release}
%else
BuildArch: noarch
%endif
%description -n %{headers_package_name}
The %{headers_package_name} package contains the architecture-specific
header files which cannot be included in glibc-devel package.
%endif
##############################################################################
# glibc "common" sub-package
##############################################################################
%package common
Summary: Common binaries and locale data for glibc
Requires: %{name} = %{version}-%{release}
Requires: tzdata >= 2003a
%description common
The glibc-common package includes common binaries for the GNU libc
libraries, as well as national language (locale) support.
######################################################################
# File triggers to do ldconfig calls automatically (see rhbz#1380878)
######################################################################
# File triggers for when libraries are added or removed in standard
# paths.
%transfiletriggerin common -P 2000000 -- /lib /usr/lib /lib64 /usr/lib64
/sbin/ldconfig
%end
%transfiletriggerpostun common -P 2000000 -- /lib /usr/lib /lib64 /usr/lib64
/sbin/ldconfig
%end
# We need to run ldconfig manually because __brp_ldconfig assumes that
# glibc itself is always installed in $RPM_BUILD_ROOT, but with sysroots
# we may be installed into a subdirectory of that path. Therefore we
# unset __brp_ldconfig and run ldconfig by hand with the sysroots path
# passed to -r.
%undefine __brp_ldconfig
######################################################################
%package locale-source
Summary: The sources for the locales
Requires: %{name} = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
%description locale-source
The sources for all locales provided in the language packs.
If you are building custom locales you will most likely use
these sources as the basis for your new locale.
%{lua:
-- To make lua-mode happy: '
-- List of supported locales. This is used to generate the langpack
-- subpackages below. This table needs adjustments if the set of
-- glibc locales changes. "code" is the glibc code for the language
-- (before the "_". "name" is the English translation of the language
-- name (for use in subpackage descriptions). "regions" is a table of
-- variant specifiers (after the "_", excluding "@" and "."
-- variants/charset specifiers). The table must be sorted by the code
-- field, and the regions table must be sorted as well.
--
-- English translations of language names can be obtained using (for
-- the "aa" language in this example):
--
-- python3 -c 'import langtable; print(langtable.language_name("aa", languageIdQuery="en"))'
local locales = {
{ code="aa", name="Afar", regions={ "DJ", "ER", "ET" } },
{ code="af", name="Afrikaans", regions={ "ZA" } },
{ code="agr", name="Aguaruna", regions={ "PE" } },
{ code="ak", name="Akan", regions={ "GH" } },
{ code="am", name="Amharic", regions={ "ET" } },
{ code="an", name="Aragonese", regions={ "ES" } },
{ code="anp", name="Angika", regions={ "IN" } },
{
code="ar",
name="Arabic",
regions={
"AE",
"BH",
"DZ",
"EG",
"IN",
"IQ",
"JO",
"KW",
"LB",
"LY",
"MA",
"OM",
"QA",
"SA",
"SD",
"SS",
"SY",
"TN",
"YE"
}
},
{ code="as", name="Assamese", regions={ "IN" } },
{ code="ast", name="Asturian", regions={ "ES" } },
{ code="ayc", name="Southern Aymara", regions={ "PE" } },
{ code="az", name="Azerbaijani", regions={ "AZ", "IR" } },
{ code="be", name="Belarusian", regions={ "BY" } },
{ code="bem", name="Bemba", regions={ "ZM" } },
{ code="ber", name="Berber", regions={ "DZ", "MA" } },
{ code="bg", name="Bulgarian", regions={ "BG" } },
{ code="bhb", name="Bhili", regions={ "IN" } },
{ code="bho", name="Bhojpuri", regions={ "IN", "NP" } },
{ code="bi", name="Bislama", regions={ "VU" } },
{ code="bn", name="Bangla", regions={ "BD", "IN" } },
{ code="bo", name="Tibetan", regions={ "CN", "IN" } },
{ code="br", name="Breton", regions={ "FR" } },
{ code="brx", name="Bodo", regions={ "IN" } },
{ code="bs", name="Bosnian", regions={ "BA" } },
{ code="byn", name="Blin", regions={ "ER" } },
{ code="ca", name="Catalan", regions={ "AD", "ES", "FR", "IT" } },
{ code="ce", name="Chechen", regions={ "RU" } },
{ code="chr", name="Cherokee", regions={ "US" } },
{ code="ckb", name="Central Kurdish", regions={ "IQ" } },
{ code="cmn", name="Mandarin Chinese", regions={ "TW" } },
{ code="crh", name="Crimean Turkish", regions={ "UA" } },
{ code="cs", name="Czech", regions={ "CZ" } },
{ code="csb", name="Kashubian", regions={ "PL" } },
{ code="cv", name="Chuvash", regions={ "RU" } },
{ code="cy", name="Welsh", regions={ "GB" } },
{ code="da", name="Danish", regions={ "DK" } },
{
code="de",
name="German",
regions={ "AT", "BE", "CH", "DE", "IT", "LI", "LU" }
},
{ code="doi", name="Dogri", regions={ "IN" } },
{ code="dsb", name="Lower Sorbian", regions={ "DE" } },
{ code="dv", name="Divehi", regions={ "MV" } },
{ code="dz", name="Dzongkha", regions={ "BT" } },
{ code="el", name="Greek", regions={ "CY", "GR" } },
{
code="en",
name="English",
regions={
"AG",
"AU",
"BW",
"CA",
"DK",
"GB",
"HK",
"IE",
"IL",
"IN",
"NG",
"NZ",
"PH",
"SC",
"SG",
"US",
"ZA",
"ZM",
"ZW"
}
},
{ code="eo", name="Esperanto", regions={} },
{
code="es",
name="Spanish",
regions={
"AR",
"BO",
"CL",
"CO",
"CR",
"CU",
"DO",
"EC",
"ES",
"GT",
"HN",
"MX",
"NI",
"PA",
"PE",
"PR",
"PY",
"SV",
"US",
"UY",
"VE"
}
},
{ code="et", name="Estonian", regions={ "EE" } },
{ code="eu", name="Basque", regions={ "ES" } },
{ code="fa", name="Persian", regions={ "IR" } },
{ code="ff", name="Fulah", regions={ "SN" } },
{ code="fi", name="Finnish", regions={ "FI" } },
{ code="fil", name="Filipino", regions={ "PH" } },
{ code="fo", name="Faroese", regions={ "FO" } },
{ code="fr", name="French", regions={ "BE", "CA", "CH", "FR", "LU" } },
{ code="fur", name="Friulian", regions={ "IT" } },
{ code="fy", name="Western Frisian", regions={ "DE", "NL" } },
{ code="ga", name="Irish", regions={ "IE" } },
{ code="gd", name="Scottish Gaelic", regions={ "GB" } },
{ code="gez", name="Geez", regions={ "ER", "ET" } },
{ code="gl", name="Galician", regions={ "ES" } },
{ code="gu", name="Gujarati", regions={ "IN" } },
{ code="gv", name="Manx", regions={ "GB" } },
{ code="ha", name="Hausa", regions={ "NG" } },
{ code="hak", name="Hakka Chinese", regions={ "TW" } },
{ code="he", name="Hebrew", regions={ "IL" } },
{ code="hi", name="Hindi", regions={ "IN" } },
{ code="hif", name="Fiji Hindi", regions={ "FJ" } },
{ code="hne", name="Chhattisgarhi", regions={ "IN" } },
{ code="hr", name="Croatian", regions={ "HR" } },
{ code="hsb", name="Upper Sorbian", regions={ "DE" } },
{ code="ht", name="Haitian Creole", regions={ "HT" } },
{ code="hu", name="Hungarian", regions={ "HU" } },
{ code="hy", name="Armenian", regions={ "AM" } },
{ code="ia", name="Interlingua", regions={ "FR" } },
{ code="id", name="Indonesian", regions={ "ID" } },
{ code="ig", name="Igbo", regions={ "NG" } },
{ code="ik", name="Inupiaq", regions={ "CA" } },
{ code="is", name="Icelandic", regions={ "IS" } },
{ code="it", name="Italian", regions={ "CH", "IT" } },
{ code="iu", name="Inuktitut", regions={ "CA" } },
{ code="ja", name="Japanese", regions={ "JP" } },
{ code="ka", name="Georgian", regions={ "GE" } },
{ code="kab", name="Kabyle", regions={ "DZ" } },
{ code="kk", name="Kazakh", regions={ "KZ" } },
{ code="kl", name="Kalaallisut", regions={ "GL" } },
{ code="km", name="Khmer", regions={ "KH" } },
{ code="kn", name="Kannada", regions={ "IN" } },
{ code="ko", name="Korean", regions={ "KR" } },
{ code="kok", name="Konkani", regions={ "IN" } },
{ code="ks", name="Kashmiri", regions={ "IN" } },
{ code="ku", name="Kurdish", regions={ "TR" } },
{ code="kw", name="Cornish", regions={ "GB" } },
{ code="ky", name="Kyrgyz", regions={ "KG" } },
{ code="lb", name="Luxembourgish", regions={ "LU" } },
{ code="lg", name="Ganda", regions={ "UG" } },
{ code="li", name="Limburgish", regions={ "BE", "NL" } },
{ code="lij", name="Ligurian", regions={ "IT" } },
{ code="ln", name="Lingala", regions={ "CD" } },
{ code="lo", name="Lao", regions={ "LA" } },
{ code="lt", name="Lithuanian", regions={ "LT" } },
{ code="lv", name="Latvian", regions={ "LV" } },
{ code="lzh", name="Literary Chinese", regions={ "TW" } },
{ code="mag", name="Magahi", regions={ "IN" } },
{ code="mai", name="Maithili", regions={ "IN", "NP" } },
{ code="mfe", name="Morisyen", regions={ "MU" } },
{ code="mg", name="Malagasy", regions={ "MG" } },
{ code="mhr", name="Meadow Mari", regions={ "RU" } },
{ code="mi", name="Maori", regions={ "NZ" } },
{ code="miq", name="Miskito", regions={ "NI" } },
{ code="mjw", name="Karbi", regions={ "IN" } },
{ code="mk", name="Macedonian", regions={ "MK" } },
{ code="ml", name="Malayalam", regions={ "IN" } },
{ code="mn", name="Mongolian", regions={ "MN" } },
{ code="mni", name="Manipuri", regions={ "IN" } },
{ code="mnw", name="Mon", regions={ "MM" } },
{ code="mr", name="Marathi", regions={ "IN" } },
{ code="ms", name="Malay", regions={ "MY" } },
{ code="mt", name="Maltese", regions={ "MT" } },
{ code="my", name="Burmese", regions={ "MM" } },
{ code="nan", name="Min Nan Chinese", regions={ "TW" } },
{ code="nb", name="Norwegian Bokmål", regions={ "NO" } },
{ code="nds", name="Low German", regions={ "DE", "NL" } },
{ code="ne", name="Nepali", regions={ "NP" } },
{ code="nhn", name="Tlaxcala-Puebla Nahuatl", regions={ "MX" } },
{ code="niu", name="Niuean", regions={ "NU", "NZ" } },
{ code="nl", name="Dutch", regions={ "AW", "BE", "NL" } },
{ code="nn", name="Norwegian Nynorsk", regions={ "NO" } },
{ code="nr", name="South Ndebele", regions={ "ZA" } },
{ code="nso", name="Northern Sotho", regions={ "ZA" } },
{ code="oc", name="Occitan", regions={ "FR" } },
{ code="om", name="Oromo", regions={ "ET", "KE" } },
{ code="or", name="Odia", regions={ "IN" } },
{ code="os", name="Ossetic", regions={ "RU" } },
{ code="pa", name="Punjabi", regions={ "IN", "PK" } },
{ code="pap", name="Papiamento", regions={ "AW", "CW" } },
{ code="pl", name="Polish", regions={ "PL" } },
{ code="ps", name="Pashto", regions={ "AF" } },
{ code="pt", name="Portuguese", regions={ "BR", "PT" } },
{ code="quz", name="Cusco Quechua", regions={ "PE" } },
{ code="raj", name="Rajasthani", regions={ "IN" } },
{ code="ro", name="Romanian", regions={ "RO" } },
{ code="ru", name="Russian", regions={ "RU", "UA" } },
{ code="rw", name="Kinyarwanda", regions={ "RW" } },
{ code="sa", name="Sanskrit", regions={ "IN" } },
{ code="sah", name="Sakha", regions={ "RU" } },
{ code="sat", name="Santali", regions={ "IN" } },
{ code="sc", name="Sardinian", regions={ "IT" } },
{ code="sd", name="Sindhi", regions={ "IN" } },
{ code="se", name="Northern Sami", regions={ "NO" } },
{ code="sgs", name="Samogitian", regions={ "LT" } },
{ code="shn", name="Shan", regions={ "MM" } },
{ code="shs", name="Shuswap", regions={ "CA" } },
{ code="si", name="Sinhala", regions={ "LK" } },
{ code="sid", name="Sidamo", regions={ "ET" } },
{ code="sk", name="Slovak", regions={ "SK" } },
{ code="sl", name="Slovenian", regions={ "SI" } },
{ code="sm", name="Samoan", regions={ "WS" } },
{ code="so", name="Somali", regions={ "DJ", "ET", "KE", "SO" } },
{ code="sq", name="Albanian", regions={ "AL", "MK" } },
{ code="sr", name="Serbian", regions={ "ME", "RS" } },
{ code="ss", name="Swati", regions={ "ZA" } },
{ code="st", name="Southern Sotho", regions={ "ZA" } },
{ code="sv", name="Swedish", regions={ "FI", "SE" } },
{ code="sw", name="Swahili", regions={ "KE", "TZ" } },
{ code="szl", name="Silesian", regions={ "PL" } },
{ code="ta", name="Tamil", regions={ "IN", "LK" } },
{ code="tcy", name="Tulu", regions={ "IN" } },
{ code="te", name="Telugu", regions={ "IN" } },
{ code="tg", name="Tajik", regions={ "TJ" } },
{ code="th", name="Thai", regions={ "TH" } },
{ code="the", name="Chitwania Tharu", regions={ "NP" } },
{ code="ti", name="Tigrinya", regions={ "ER", "ET" } },
{ code="tig", name="Tigre", regions={ "ER" } },
{ code="tk", name="Turkmen", regions={ "TM" } },
{ code="tl", name="Tagalog", regions={ "PH" } },
{ code="tn", name="Tswana", regions={ "ZA" } },
{ code="to", name="Tongan", regions={ "TO" } },
{ code="tpi", name="Tok Pisin", regions={ "PG" } },
{ code="tr", name="Turkish", regions={ "CY", "TR" } },
{ code="ts", name="Tsonga", regions={ "ZA" } },
{ code="tt", name="Tatar", regions={ "RU" } },
{ code="ug", name="Uyghur", regions={ "CN" } },
{ code="uk", name="Ukrainian", regions={ "UA" } },
{ code="unm", name="Unami language", regions={ "US" } },
{ code="ur", name="Urdu", regions={ "IN", "PK" } },
{ code="uz", name="Uzbek", regions={ "UZ" } },
{ code="ve", name="Venda", regions={ "ZA" } },
{ code="vi", name="Vietnamese", regions={ "VN" } },
{ code="wa", name="Walloon", regions={ "BE" } },
{ code="wae", name="Walser", regions={ "CH" } },
{ code="wal", name="Wolaytta", regions={ "ET" } },
{ code="wo", name="Wolof", regions={ "SN" } },
{ code="xh", name="Xhosa", regions={ "ZA" } },
{ code="yi", name="Yiddish", regions={ "US" } },
{ code="yo", name="Yoruba", regions={ "NG" } },
{ code="yue", name="Cantonese", regions={ "HK" } },
{ code="yuw", name="Yau", regions={ "PG" } },
{ code="zh", name="Mandarin Chinese", regions={ "CN", "HK", "SG", "TW" } },
{ code="zu", name="Zulu", regions={ "ZA" } }
}
-- Prints a list of LANGUAGE "_" REGION pairs. The output is expected
-- to be identical to parse-SUPPORTED.py. Called from the %%prep section.
function print_locale_pairs()
for i = 1, #locales do
local locale = locales[i]
if #locale.regions == 0 then
print(locale.code .. "\n")
else
for j = 1, #locale.regions do
print(locale.code .. "_" .. locale.regions[j] .. "\n")
end
end
end
end
local function compute_supplements(locale)
local lang = locale.code
local regions = locale.regions
result = "langpacks-core-" .. lang
for i = 1, #regions do
result = result .. " or langpacks-core-" .. lang .. "_" .. regions[i]
end
return result
end
-- Emit the definition of a language pack package.
local function lang_package(locale)
local lang = locale.code
local langname = locale.name
local suppl = compute_supplements(locale)
print(rpm.expand([[
%package langpack-]]..lang..[[
Summary: Locale data for ]]..langname..[[
Provides: glibc-langpack = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
Supplements: (glibc and (]]..suppl..[[))
%description langpack-]]..lang..[[
The glibc-langpack-]]..lang..[[ package includes the basic information required
to support the ]]..langname..[[ language in your applications.
%files -f langpack-]]..lang..[[.filelist langpack-]]..lang..[[
]]))
end
for i = 1, #locales do
lang_package(locales[i])
end
}
# The glibc-all-langpacks provides the virtual glibc-langpack,
# and thus satisfies glibc's requirement for installed locales.
# Users can add one more other langauge packs and then eventually
# uninstall all-langpacks to save space.
%package all-langpacks
Summary: All language packs for %{name}.
Requires: %{name} = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
Provides: %{name}-langpack = %{version}-%{release}
%description all-langpacks
# No %files, this is an empty package. The C/POSIX and
# C.UTF-8 files are already installed by glibc. We create
# minimal-langpack because the virtual provide of
# glibc-langpack needs at least one package installed
# to satisfy it. Given that no-locales installed is a valid
# use case we support it here with this package.
%package minimal-langpack
Summary: Minimal language packs for %{name}.
Provides: glibc-langpack = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
%description minimal-langpack
This is a Meta package that is used to install minimal language packs.
This package ensures you can use C, POSIX, or C.UTF-8 locales, but
nothing else. It is designed for assembling a minimal system.
%files minimal-langpack
##############################################################################
# glibc "nscd" sub-package
#
# Deprecated in Fedora 34 and planned for removal in Fedora 35.
#
# systemd-resolved is now enabled by default for DNS caching in Fedora, and
# sssd is capable of caching the remaining named services that nscd handles.
# It is therefore time to retire nscd in Fedora and move to more modern named
# services caches.
#
# For details, see:
# bug 1905135: https://fedoraproject.org/wiki/Changes/DeprecateNSCD
# bug 1905142: https://fedoraproject.org/wiki/Changes/RemoveNSCD
##############################################################################
%package -n nscd
Summary: A Name Service Caching Daemon (nscd).
# Fedora 35 is planned for release on Oct 26 2021, with nscd removed
Provides: deprecated() = 20211026
Requires: %{name} = %{version}-%{release}
%if %{without bootstrap}
Requires: libselinux >= 1.17.10-1
%endif
Requires: audit-libs >= 1.1.3
Requires(pre): /usr/sbin/useradd, coreutils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd, /usr/sbin/userdel
%description -n nscd
The nscd daemon caches name service lookups and can improve
performance with LDAP, and may help with DNS as well.
##############################################################################
# Subpackages for NSS modules except nss_files, nss_compat, nss_dns
##############################################################################
# This should remain it's own subpackage or "Provides: nss_db" to allow easy
# migration from old systems that previously had the old nss_db package
# installed. Note that this doesn't make the migration that smooth, the
# databases still need rebuilding because the formats were different.
# The nss_db package was deprecated in F16 and onwards:
# https://lists.fedoraproject.org/pipermail/devel/2011-July/153665.html
# The different database format does cause some issues for users:
# https://lists.fedoraproject.org/pipermail/devel/2011-December/160497.html
%package -n nss_db
Summary: Name Service Switch (NSS) module using hash-indexed files
Requires: %{name}%{_isa} = %{version}-%{release}
%ifarch x86_64
# Automatically install the 32-bit variant if the 64-bit variant has
# been installed. This covers the case when glibc.i686 is installed
# before nss_db.x86_64. (See above for the other ordering.)
Recommends: (nss_db(x86-32) if glibc(x86-32))
%endif
%description -n nss_db
The nss_db Name Service Switch module uses hash-indexed files in /var/db
to speed up user, group, service, host name, and other NSS-based lookups.
%package -n nss_hesiod
Summary: Name Service Switch (NSS) module using Hesiod
Requires: %{name}%{_isa} = %{version}-%{release}
%ifarch x86_64
# Automatically install the 32-bit variant if the 64-bit variant has
# been installed. This covers the case when glibc.i686 is installed
# before nss_hesiod.x86_64. (See above for the other ordering.)
Recommends: (nss_hesiod(x86-32) if glibc(x86-32))
%endif
%description -n nss_hesiod
The nss_hesiod Name Service Switch module uses the Domain Name System
(DNS) as a source for user, group, and service information, following
the Hesiod convention of Project Athena.
%package nss-devel
Summary: Development files for directly linking NSS service modules
Requires: %{name}%{_isa} = %{version}-%{release}
Requires: nss_db%{_isa} = %{version}-%{release}
Requires: nss_hesiod%{_isa} = %{version}-%{release}
%description nss-devel
The glibc-nss-devel package contains the object files necessary to
compile applications and libraries which directly link against NSS
modules supplied by glibc.
This is a rare and special use case; regular development has to use
the glibc-devel package instead.
##############################################################################
# glibc "utils" sub-package
##############################################################################
%package utils
Summary: Development utilities from GNU C library
Requires: %{name} = %{version}-%{release}
%description utils
The glibc-utils package contains memusage, a memory usage profiler,
mtrace, a memory leak tracer and xtrace, a function call tracer
which can be helpful during program debugging.
If unsure if you need this, don't install this package.
%if %{with benchtests}
%package benchtests
Summary: Benchmarking binaries and scripts for %{name}
%description benchtests
This package provides built benchmark binaries and scripts to run
microbenchmark tests on the system.
%endif
##############################################################################
# compat-libpthread-nonshared
# See: https://sourceware.org/bugzilla/show_bug.cgi?id=23500
##############################################################################
%package -n compat-libpthread-nonshared
Summary: Compatibility support for linking against libpthread_nonshared.a.
%description -n compat-libpthread-nonshared
This package provides compatibility support for applications that expect
libpthread_nonshared.a to exist. The support provided is in the form of
an empty libpthread_nonshared.a that allows dynamic links to succeed.
Such applications should be adjusted to avoid linking against
libpthread_nonshared.a which is no longer used. The static library
libpthread_nonshared.a is an internal implementation detail of the C
runtime and should not be expected to exist.
##############################################################################
# Prepare for the build.
##############################################################################
%prep
%autosetup -n %{glibcsrcdir} -p1
##############################################################################
# %%prep - Additional prep required...
##############################################################################
# Make benchmark scripts executable
chmod +x benchtests/scripts/*.py scripts/pylint
# Remove all files generated from patching.
find . -type f -size 0 -o -name "*.orig" -exec rm -f {} \;
# Ensure timestamps on configure files are current to prevent
# regenerating them.
touch `find . -name configure`
# Ensure *-kw.h files are current to prevent regenerating them.
touch locale/programs/*-kw.h
# Verify that our locales table is compatible with the locales table
# in the spec file.
set +x
echo '%{lua: print_locale_pairs()}' > localedata/SUPPORTED.spec
set -x
python3 %{SOURCE11} localedata/SUPPORTED > localedata/SUPPORTED.glibc
diff -u \
--label "spec file" localedata/SUPPORTED.spec \
--label "glibc localedata/SUPPORTED" localedata/SUPPORTED.glibc
rm localedata/SUPPORTED.spec localedata/SUPPORTED.glibc
##############################################################################
# Build glibc...
##############################################################################
%build
# Log osystem information
uname -a
LD_SHOW_AUXV=1 /bin/true
cat /proc/cpuinfo
cat /proc/sysinfo 2>/dev/null || true
cat /proc/meminfo
df
# We build using the native system compilers.
GCC=gcc
GXX=g++
# Part of rpm_inherit_flags. Is overridden below.
rpm_append_flag ()
{
BuildFlags="$BuildFlags $*"
}
# Propagates the listed flags to rpm_append_flag if supplied by
# redhat-rpm-config.
BuildFlags="-O2 -g"
rpm_inherit_flags ()
{
local reference=" $* "
local flag
for flag in $RPM_OPT_FLAGS $RPM_LD_FLAGS ; do
if echo "$reference" | grep -q -F " $flag " ; then
rpm_append_flag "$flag"
fi
done
}
# Propgate select compiler flags from redhat-rpm-config. These flags
# are target-dependent, so we use only those which are specified in
# redhat-rpm-config. We keep the -m32/-m32/-m64 flags to support
# multilib builds.
#
# Note: For building alternative run-times, care is required to avoid
# overriding the architecture flags which go into CC/CXX. The flags
# below are passed in CFLAGS.
rpm_inherit_flags \
"-Wp,-D_GLIBCXX_ASSERTIONS" \
"-fasynchronous-unwind-tables" \
"-fstack-clash-protection" \
"-funwind-tables" \
"-m31" \
"-m32" \
"-m64" \
"-march=armv8-a+lse" \
"-march=armv8.1-a" \
"-march=haswell" \
"-march=i686" \
"-march=x86-64" \
"-march=x86-64-v2" \
"-march=x86-64-v3" \
"-march=x86-64-v4" \
"-march=z13" \
"-march=z14" \
"-march=z15" \
"-march=zEC12" \
"-mbranch-protection=standard" \
"-mcpu=power10" \
"-mcpu=power8" \
"-mcpu=power9" \
"-mfpmath=sse" \
"-msse2" \
"-mstackrealign" \
"-mtune=generic" \
"-mtune=power10" \
"-mtune=power8" \
"-mtune=power9" \
"-mtune=z13" \
"-mtune=z14" \
"-mtune=z15" \
"-mtune=zEC12" \
"-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" \
# libc_nonshared.a cannot be built with the default hardening flags
# because the glibc build system is incompatible with
# -D_FORTIFY_SOURCE. The object files need to be marked as to be
# skipped in annobin annotations. (The -specs= variant of activating
# annobin does not work here because of flag ordering issues.)
# See <https://bugzilla.redhat.com/show_bug.cgi?id=1668822>.
BuildFlagsNonshared="-fplugin=annobin -fplugin-arg-annobin-disable -Wa,--generate-missing-build-notes=yes"
# Special flag to enable annobin annotations for statically linked
# assembler code. Needs to be passed to make; not preserved by
# configure.
%define glibc_make_flags_as ASFLAGS="-g -Wa,--generate-missing-build-notes=yes"
%define glibc_make_flags %{glibc_make_flags_as}
##############################################################################
# %%build - Generic options.
##############################################################################
EnableKernel="--enable-kernel=%{enablekernel}"
# Save the used compiler and options into the file "Gcc" for use later
# by %%install.
echo "$GCC" > Gcc
##############################################################################
# build()
# Build glibc in `build-%{target}$1', passing the rest of the arguments
# as CFLAGS to the build (not the same as configure CFLAGS). Several
# global values are used to determine build flags, kernel version,
# system tap support, etc.
##############################################################################
build()
{
local builddir=build-%{target}${1:+-$1}
${1+shift}
rm -rf $builddir
mkdir $builddir
pushd $builddir
../configure CC="$GCC" CXX="$GXX" CFLAGS="$BuildFlags $*" \
--prefix=%{_prefix} \
--with-headers=%{_prefix}/include $EnableKernel \
--with-nonshared-cflags="$BuildFlagsNonshared" \
--enable-bind-now \
--build=%{target} \
--enable-stack-protector=strong \
%ifarch %{pie_arches}
--enable-static-pie \
%endif
--enable-tunables \
--enable-systemtap \
${core_with_options} \
%ifarch x86_64 %{ix86}
--enable-cet \
%endif
%ifarch %{ix86}
--disable-multi-arch \
%endif
%if %{without werror}
--disable-werror \
%endif
--disable-profile \
%if %{with bootstrap}
--without-selinux \
%endif
%ifarch aarch64
%if 0%{?rhel} > 0
--enable-memory-tagging \
%endif
%endif
--disable-crypt ||
{ cat config.log; false; }
%make_build -r %{glibc_make_flags}
popd
}
# Default set of compiler options.
build
##############################################################################
# Install glibc...
##############################################################################
%install
# The built glibc is installed into a subdirectory of $RPM_BUILD_ROOT.
# For a system glibc that subdirectory is "/" (the root of the filesystem).
# This is called a sysroot (system root) and can be changed if we have a
# distribution that supports multiple installed glibc versions.
%define glibc_sysroot $RPM_BUILD_ROOT
# Remove existing file lists.
find . -type f -name '*.filelist' -exec rm -rf {} \;
# Reload compiler and build options that were used during %%build.
GCC=`cat Gcc`
%ifarch riscv64
# RISC-V ABI wants to install everything in /lib64/lp64d or /usr/lib64/lp64d.
# Make these be symlinks to /lib64 or /usr/lib64 respectively. See:
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/DRHT5YTPK4WWVGL3GIN5BF2IKX2ODHZ3/
for d in %{glibc_sysroot}%{_libdir} %{glibc_sysroot}/%{_lib}; do
mkdir -p $d
(cd $d && ln -sf . lp64d)
done
%endif
# Build and install:
pushd build-%{target}
%make_build install_root=%{glibc_sysroot} install
%make_build install_root=%{glibc_sysroot} \
install-locales -C ../localedata objdir=`pwd`
popd
# Locale creation may produce different groups of hardlinks in an
# unpredictable manner. Re-grouping makes those differences go away.
hardlink %{glibc_sysroot}/usr/lib/locale
# 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
# same). The path SUBDIR_UP is the prefix used to go from
# DESTDIR/SUBDIR to the default installed libraries e.g.
# ln -s SUBDIR_UP/foo.so DESTDIR/SUBDIR/foo.so.
# When you call this function it is expected that you are in the root
# of the build directory, and that the default build directory is:
# "../build-%{target}" (relatively).
# The primary use of this function is to install alternate runtimes
# into the build directory and avoid duplicating this code for each
# runtime.
install_different()
{
local lib libbase libbaseso dlib
local destdir="$1"
local subdir="$2"
local subdir_up="$3"
local libdestdir="$destdir/$subdir"
# All three arguments must be non-zero paths.
if ! [ "$destdir" \
-a "$subdir" \
-a "$subdir_up" ]; then
echo "One of the arguments to install_different was emtpy."
exit 1
fi
# Create the destination directory and the multilib directory.
mkdir -p "$destdir"
mkdir -p "$libdestdir"
# Walk all of the libraries we installed...
for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db
do
libbase=${lib#*/}
# Take care that `libbaseso' has a * that needs expanding so
# take care with quoting.
libbaseso=$(basename %{glibc_sysroot}/%{_lib}/${libbase}-*.so)
# Only install if different from default build library.
if cmp -s ${lib}.so ../build-%{target}/${lib}.so; then
ln -sf "$subdir_up"/$libbaseso $libdestdir/$libbaseso
else
cp -a ${lib}.so $libdestdir/$libbaseso
fi
dlib=$libdestdir/$(basename %{glibc_sysroot}/%{_lib}/${libbase}.so.*)
ln -sf $libbaseso $dlib
done
}
##############################################################################
# Remove the files we don't want to distribute
##############################################################################
# Remove the libNoVersion files.
# XXX: This looks like a bug in glibc that accidentally installed these
# wrong files. We probably don't need this today.
rm -f %{glibc_sysroot}/%{_libdir}/libNoVersion*
rm -f %{glibc_sysroot}/%{_lib}/libNoVersion*
# Remove the old nss modules.
rm -f %{glibc_sysroot}/%{_lib}/libnss1-*
rm -f %{glibc_sysroot}/%{_lib}/libnss-*.so.1
# This statically linked binary is no longer necessary in a world where
# the default Fedora install uses an initramfs, and further we have rpm-ostree
# which captures the whole userspace FS tree.
# Further, see https://github.com/projectatomic/rpm-ostree/pull/1173#issuecomment-355014583
rm -f %{glibc_sysroot}/{usr/,}sbin/sln
######################################################################
# Run ldconfig to create all the symbolic links we need
######################################################################
# Note: This has to happen before creating /etc/ld.so.conf.
mkdir -p %{glibc_sysroot}/var/cache/ldconfig
truncate -s 0 %{glibc_sysroot}/var/cache/ldconfig/aux-cache
# ldconfig is statically linked, so we can use the new version.
%{glibc_sysroot}/sbin/ldconfig -N -r %{glibc_sysroot}
##############################################################################
# Install info files
##############################################################################
%if %{with docs}
# Move the info files if glibc installed them into the wrong location.
if [ -d %{glibc_sysroot}%{_prefix}/info -a "%{_infodir}" != "%{_prefix}/info" ]; then
mkdir -p %{glibc_sysroot}%{_infodir}
mv -f %{glibc_sysroot}%{_prefix}/info/* %{glibc_sysroot}%{_infodir}
rm -rf %{glibc_sysroot}%{_prefix}/info
fi
# Compress all of the info files.
gzip -9nvf %{glibc_sysroot}%{_infodir}/libc*
# Copy the debugger interface documentation over to the right location
mkdir -p %{glibc_sysroot}%{_docdir}/glibc
cp elf/rtld-debugger-interface.txt %{glibc_sysroot}%{_docdir}/glibc
%else
rm -f %{glibc_sysroot}%{_infodir}/dir
rm -f %{glibc_sysroot}%{_infodir}/libc.info*
%endif
##############################################################################
# Create locale sub-package file lists
##############################################################################
olddir=`pwd`
pushd %{glibc_sysroot}%{_prefix}/lib/locale
rm -f locale-archive
$olddir/build-%{target}/elf/ld.so \
--library-path $olddir/build-%{target}/ \
$olddir/build-%{target}/locale/localedef \
--alias-file=$olddir/intl/locale.alias \
--prefix %{glibc_sysroot} --add-to-archive \
eo *_*
# Historically, glibc-all-langpacks deleted the file on updates (sic),
# so we need to restore it in the posttrans scriptlet (like the old
# glibc-all-langpacks versions)
ln locale-archive locale-archive.real
# Create the file lists for the language specific sub-packages:
for i in eo *_*
do
lang=${i%%_*}
if [ ! -e langpack-${lang}.filelist ]; then
echo "%dir %{_prefix}/lib/locale" >> langpack-${lang}.filelist
fi
echo "%dir %{_prefix}/lib/locale/$i" >> langpack-${lang}.filelist
echo "%{_prefix}/lib/locale/$i/*" >> langpack-${lang}.filelist
done
popd
pushd %{glibc_sysroot}%{_prefix}/share/locale
for i in */LC_MESSAGES/libc.mo
do
locale=${i%%%%/*}
lang=${locale%%%%_*}
echo "%lang($lang) %{_prefix}/share/locale/${i}" \
>> %{glibc_sysroot}%{_prefix}/lib/locale/langpack-${lang}.filelist
done
popd
mv %{glibc_sysroot}%{_prefix}/lib/locale/*.filelist .
##############################################################################
# Install configuration files for services
##############################################################################
install -p -m 644 nss/nsswitch.conf %{glibc_sysroot}/etc/nsswitch.conf
# This is for ncsd - in glibc 2.2
install -m 644 nscd/nscd.conf %{glibc_sysroot}/etc
mkdir -p %{glibc_sysroot}%{_tmpfilesdir}
install -m 644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}
mkdir -p %{glibc_sysroot}/lib/systemd/system
install -m 644 nscd/nscd.service nscd/nscd.socket %{glibc_sysroot}/lib/systemd/system
# Include ld.so.conf
echo 'include ld.so.conf.d/*.conf' > %{glibc_sysroot}/etc/ld.so.conf
truncate -s 0 %{glibc_sysroot}/etc/ld.so.cache
chmod 644 %{glibc_sysroot}/etc/ld.so.conf
mkdir -p %{glibc_sysroot}/etc/ld.so.conf.d
mkdir -p %{glibc_sysroot}/etc/sysconfig
truncate -s 0 %{glibc_sysroot}/etc/sysconfig/nscd
truncate -s 0 %{glibc_sysroot}/etc/gai.conf
# Include %{_libdir}/gconv/gconv-modules.cache
truncate -s 0 %{glibc_sysroot}%{_libdir}/gconv/gconv-modules.cache
chmod 644 %{glibc_sysroot}%{_libdir}/gconv/gconv-modules.cache
# Remove any zoneinfo files; they are maintained by tzdata.
rm -rf %{glibc_sysroot}%{_prefix}/share/zoneinfo
# Make sure %config files have the same timestamp across multilib packages.
#
# XXX: Ideally ld.so.conf should have the timestamp of the spec file, but there
# doesn't seem to be any macro to give us that. So we do the next best thing,
# which is to at least keep the timestamp consistent. The choice of using
# SOURCE0 is arbitrary.
touch -r %{SOURCE0} %{glibc_sysroot}/etc/ld.so.conf
touch -r inet/etc.rpc %{glibc_sysroot}/etc/rpc
%if %{with benchtests}
# Build benchmark binaries. Ignore the output of the benchmark runs.
pushd build-%{target}
make BENCH_DURATION=1 bench-build
popd
# Copy over benchmark binaries.
mkdir -p %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests
cp $(find build-%{target}/benchtests -type f -executable) %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
# ... and the makefile.
for b in %{SOURCE2} %{SOURCE3}; do
cp $b %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
done
# .. and finally, the comparison scripts.
cp benchtests/scripts/benchout.schema.json %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
cp benchtests/scripts/compare_bench.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
cp benchtests/scripts/import_bench.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
cp benchtests/scripts/validate_benchout.py %{glibc_sysroot}%{_prefix}/libexec/glibc-benchtests/
%endif
# The #line directives gperf generates do not give the proper
# file name relative to the build directory.
pushd locale
ln -s programs/*.gperf .
popd
pushd iconv
ln -s ../locale/programs/charmap-kw.gperf .
popd
%if %{with docs}
# Remove the `dir' info-heirarchy file which will be maintained
# by the system as it adds info files to the install.
rm -f %{glibc_sysroot}%{_infodir}/dir
%endif
mkdir -p %{glibc_sysroot}/var/{db,run}/nscd
touch %{glibc_sysroot}/var/{db,run}/nscd/{passwd,group,hosts,services}
touch %{glibc_sysroot}/var/run/nscd/{socket,nscd.pid}
# Move libpcprofile.so and libmemusage.so into the proper library directory.
# They can be moved without any real consequences because users would not use
# them directly.
mkdir -p %{glibc_sysroot}%{_libdir}
mv -f %{glibc_sysroot}/%{_lib}/lib{pcprofile,memusage}.so \
%{glibc_sysroot}%{_libdir}
# Strip all of the installed object files.
strip -g %{glibc_sysroot}%{_libdir}/*.o
###############################################################################
# Rebuild libpthread.a using --whole-archive to ensure all of libpthread
# is included in a static link. This prevents any problems when linking
# statically, using parts of libpthread, and other necessary parts not
# being included. Upstream has decided that this is the wrong approach to
# this problem and that the full set of dependencies should be resolved
# such that static linking works and produces the most minimally sized
# static application possible.
###############################################################################
pushd %{glibc_sysroot}%{_prefix}/%{_lib}/
$GCC -r -nostdlib -o libpthread.o -Wl,--whole-archive ./libpthread.a
rm libpthread.a
ar rcs libpthread.a libpthread.o
rm libpthread.o
popd
# The xtrace and memusage scripts have hard-coded paths that need to be
# translated to a correct set of paths using the $LIB token which is
# dynamically translated by ld.so as the default lib directory.
for i in %{glibc_sysroot}%{_prefix}/bin/{xtrace,memusage}; do
%if %{with bootstrap}
test -w $i || continue
%endif
sed -e 's~=/%{_lib}/libpcprofile.so~=%{_libdir}/libpcprofile.so~' \
-e 's~=/%{_lib}/libmemusage.so~=%{_libdir}/libmemusage.so~' \
-e 's~='\''/\\\$LIB/libpcprofile.so~='\''%{_prefix}/\\$LIB/libpcprofile.so~' \
-e 's~='\''/\\\$LIB/libmemusage.so~='\''%{_prefix}/\\$LIB/libmemusage.so~' \
-i $i
done
##############################################################################
# Build an empty libpthread_nonshared.a for compatiliby with applications
# that have old linker scripts that reference this file. We ship this only
# in compat-libpthread-nonshared sub-package.
##############################################################################
ar cr %{glibc_sysroot}%{_prefix}/%{_lib}/libpthread_nonshared.a
##############################################################################
# Beyond this point in the install process we no longer modify the set of
# installed files.
##############################################################################
##############################################################################
# Build the file lists used for describing the package and subpackages.
##############################################################################
# There are several main file lists (and many more for
# the langpack sub-packages (langpack-${lang}.filelist)):
# * master.filelist
# - Master file list from which all other lists are built.
# * glibc.filelist
# - Files for the glibc packages.
# * common.filelist
# - Flies for the common subpackage.
# * utils.filelist
# - Files for the utils subpackage.
# * nscd.filelist
# - Files for the nscd subpackage.
# * devel.filelist
# - Files for the devel subpackage.
# * doc.filelist
# - Files for the documentation subpackage.
# * headers.filelist
# - Files for the headers subpackage.
# * static.filelist
# - Files for the static subpackage.
# * libnsl.filelist
# - Files for the libnsl subpackage
# * nss_db.filelist
# * nss_hesiod.filelist
# - File lists for nss_* NSS module subpackages.
# * nss-devel.filelist
# - File list with the .so symbolic links for NSS packages.
# * compat-libpthread-nonshared.filelist.
# - File list for compat-libpthread-nonshared subpackage.
# Create the main file lists. This way we can append to any one of them later
# wihtout having to create it. Note these are removed at the start of the
# install phase.
touch master.filelist
touch glibc.filelist
touch common.filelist
touch utils.filelist
touch nscd.filelist
touch devel.filelist
touch doc.filelist
touch headers.filelist
touch static.filelist
touch libnsl.filelist
touch nss_db.filelist
touch nss_hesiod.filelist
touch nss-devel.filelist
touch compat-libpthread-nonshared.filelist
###############################################################################
# Master file list, excluding a few things.
###############################################################################
{
# List all files or links that we have created during install.
# Files with 'etc' are configuration files, likewise 'gconv-modules'
# and 'gconv-modules.cache' are caches, and we exclude them.
find %{glibc_sysroot} \( -type f -o -type l \) \
\( \
-name etc -printf "%%%%config " -o \
-name gconv-modules \
-printf "%%%%verify(not md5 size mtime) %%%%config(noreplace) " -o \
-name gconv-modules.cache \
-printf "%%%%verify(not md5 size mtime) " \
, \
! -path "*/lib/debug/*" -printf "/%%P\n" \)
# List all directories with a %%dir prefix. We omit the info directory and
# all directories in (and including) /usr/share/locale.
find %{glibc_sysroot} -type d \
\( -path '*%{_prefix}/share/locale' -prune -o \
\( -path '*%{_prefix}/share/*' \
%if %{with docs}
! -path '*%{_infodir}' -o \
%endif
-path "*%{_prefix}/include/*" \
\) -printf "%%%%dir /%%P\n" \)
} | {
# Also remove the *.mo entries. We will add them to the
# language specific sub-packages.
# libnss_ files go into subpackages related to NSS modules.
# and .*/share/i18n/charmaps/.*), they go into the sub-package
# "locale-source":
sed -e '\,.*/share/locale/\([^/_]\+\).*/LC_MESSAGES/.*\.mo,d' \
-e '\,.*/share/i18n/locales/.*,d' \
-e '\,.*/share/i18n/charmaps/.*,d' \
-e '\,.*/etc/\(localtime\|nsswitch.conf\|ld\.so\.conf\|ld\.so\.cache\|default\|rpc\|gai\.conf\),d' \
-e '\,.*/%{_libdir}/lib\(pcprofile\|memusage\)\.so,d' \
-e '\,.*/bin/\(memusage\|mtrace\|xtrace\|pcprofiledump\),d'
} | sort > master.filelist
# The master file list is now used by each subpackage to list their own
# files. We go through each package and subpackage now and create their lists.
# Each subpackage picks the files from the master list that they need.
# The order of the subpackage list generation does not matter.
# Make the master file list read-only after this point to avoid accidental
# modification.
chmod 0444 master.filelist
###############################################################################
# glibc
###############################################################################
# Add all files with the following exceptions:
# - The info files '%{_infodir}/dir'
# - The partial (lib*_p.a) static libraries, include files.
# - The static files, objects, unversioned DSOs, and nscd.
# - The bin, locale, some sbin, and share.
# - We want iconvconfig in the main package and we do this by using
# a double negation of -v and [^i] so it removes all files in
# sbin *but* iconvconfig.
# - All the libnss files (we add back the ones we want later).
# - All bench test binaries.
# - The aux-cache, since it's handled specially in the files section.
cat master.filelist \
| grep -v \
-e '%{_infodir}' \
-e '%{_libdir}/lib.*_p.a' \
-e '%{_prefix}/include' \
-e '%{_libdir}/lib.*\.a' \
-e '%{_libdir}/.*\.o' \
-e '%{_libdir}/lib.*\.so' \
-e 'nscd' \
-e '%{_prefix}/bin' \
-e '%{_prefix}/lib/locale' \
-e '%{_prefix}/sbin/[^i]' \
-e '%{_prefix}/share' \
-e '/var/db/Makefile' \
-e '/libnss_.*\.so[0-9.]*$' \
-e '/libnsl' \
-e 'glibc-benchtests' \
-e 'aux-cache' \
> glibc.filelist
# Add specific files:
# - The nss_files, nss_compat, and nss_db files.
# - The libmemusage.so and libpcprofile.so used by utils.
for module in compat files dns; do
cat master.filelist \
| grep -E \
-e "/libnss_$module(\.so\.[0-9.]+|-[0-9.]+\.so)$" \
>> glibc.filelist
done
grep -e "libmemusage.so" -e "libpcprofile.so" master.filelist >> glibc.filelist
###############################################################################
# glibc-devel
###############################################################################
# Put some static files into the devel package.
grep '%{_libdir}/lib.*\.a' master.filelist \
| grep '/lib\(\(c\|pthread\|nldbl\|mvec\)_nonshared\|g\|ieee\|mcheck\)\.a$' \
> devel.filelist
# Put all of the object files and *.so (not the versioned ones) into the
# devel package.
grep '%{_libdir}/.*\.o' < master.filelist >> devel.filelist
grep '%{_libdir}/lib.*\.so' < master.filelist >> devel.filelist
# The exceptions are:
# - libmemusage.so and libpcprofile.so in glibc used by utils.
# - libnss_*.so which are in nss-devel.
sed -i -e '\,libmemusage.so,d' \
-e '\,libpcprofile.so,d' \
-e '\,/libnss_[a-z]*\.so$,d' \
devel.filelist
###############################################################################
# glibc-doc
###############################################################################
%if %{with docs}
# Put the info files into the doc file list, but exclude the generated dir.
grep '%{_infodir}' master.filelist | grep -v '%{_infodir}/dir' > doc.filelist
grep '%{_docdir}' master.filelist >> doc.filelist
%endif
###############################################################################
# glibc-headers
###############################################################################
%if %{need_headers_package}
# The glibc-headers package includes only common files which are identical
# across all multilib packages. We must keep gnu/stubs.h and gnu/lib-names.h
# in the glibc-headers package, but the -32, -64, -64-v1, and -64-v2 versions
# go into glibc-devel.
grep '%{_prefix}/include/gnu/stubs-.*\.h$' < master.filelist >> devel.filelist || :
grep '%{_prefix}/include/gnu/lib-names-.*\.h$' < master.filelist >> devel.filelist || :
# Put the include files into headers file list.
grep '%{_prefix}/include' < master.filelist \
| egrep -v '%{_prefix}/include/gnu/stubs-.*\.h$' \
| egrep -v '%{_prefix}/include/gnu/lib-names-.*\.h$' \
> headers.filelist
%else
# If there is no glibc-headers package, all header files go into the
# glibc-devel package.
grep '%{_prefix}/include' < master.filelist >> devel.filelist
%endif
###############################################################################
# glibc-static
###############################################################################
# Put the rest of the static files into the static package.
grep '%{_libdir}/lib.*\.a' < master.filelist \
| grep -v '/lib\(\(c\|pthread\|nldbl\|mvec\)_nonshared\|g\|ieee\|mcheck\)\.a$' \
> static.filelist
###############################################################################
# glibc-common
###############################################################################
# All of the bin and certain sbin files go into the common package except
# iconvconfig which needs to go in glibc. Likewise nscd is excluded because
# it goes in nscd. The iconvconfig binary is kept in the main glibc package
# because we use it in the post-install scriptlet to rebuild the
# gconv-modules.cache. The makedb binary is in nss_db.
grep '%{_prefix}/bin' master.filelist \
| grep -v '%{_prefix}/bin/makedb' \
>> common.filelist
grep '%{_prefix}/sbin' master.filelist \
| grep -v '%{_prefix}/sbin/iconvconfig' \
| grep -v 'nscd' >> common.filelist
# All of the files under share go into the common package since they should be
# multilib-independent.
# Exceptions:
# - The actual share directory, not owned by us.
# - The info files which go into doc, and the info directory.
# - All documentation files, which go into doc.
grep '%{_prefix}/share' master.filelist \
| grep -v \
-e '%{_prefix}/share/info/libc.info.*' \
-e '%%dir %{prefix}/share/info' \
-e '%%dir %{prefix}/share' \
-e '%{_docdir}' \
>> common.filelist
###############################################################################
# nscd
###############################################################################
# The nscd binary must go into the nscd subpackage.
echo '%{_prefix}/sbin/nscd' > nscd.filelist
###############################################################################
# glibc-utils
###############################################################################
# Add the utils scripts and programs to the utils subpackage.
cat > utils.filelist <<EOF
%if %{without bootstrap}
%{_prefix}/bin/memusage
%{_prefix}/bin/memusagestat
%endif
%{_prefix}/bin/mtrace
%{_prefix}/bin/pcprofiledump
%{_prefix}/bin/xtrace
EOF
###############################################################################
# nss_db, nss_hesiod
###############################################################################
# Move the NSS-related files to the NSS subpackages. Be careful not
# to pick up .debug files, and the -devel symbolic links.
for module in db hesiod; do
grep -E "/libnss_$module(\.so\.[0-9.]+|-[0-9.]+\.so)$" \
master.filelist > nss_$module.filelist
done
grep -E "%{_prefix}/bin/makedb$" master.filelist >> nss_db.filelist
###############################################################################
# nss-devel
###############################################################################
# Symlinks go into the nss-devel package (instead of the main devel
# package).
grep '/libnss_[a-z]*\.so$' master.filelist > nss-devel.filelist
###############################################################################
# libnsl
###############################################################################
# Prepare the libnsl-related file lists.
grep '/libnsl-[0-9.]*.so$' master.filelist > libnsl.filelist
test $(wc -l < libnsl.filelist) -eq 1
%if %{with benchtests}
###############################################################################
# glibc-benchtests
###############################################################################
# List of benchmarks.
find build-%{target}/benchtests -type f -executable | while read b; do
echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)"
done >> benchtests.filelist
# ... and the makefile.
for b in %{SOURCE2} %{SOURCE3}; do
echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)" >> benchtests.filelist
done
# ... and finally, the comparison scripts.
echo "%{_prefix}/libexec/glibc-benchtests/benchout.schema.json" >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/compare_bench.py*" >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/import_bench.py*" >> benchtests.filelist
echo "%{_prefix}/libexec/glibc-benchtests/validate_benchout.py*" >> benchtests.filelist
%endif
###############################################################################
# compat-libpthread-nonshared
###############################################################################
echo "%{_libdir}/libpthread_nonshared.a" >> compat-libpthread-nonshared.filelist
##############################################################################
# Run the glibc testsuite
##############################################################################
%check
%if %{with testsuite}
# Run the glibc tests. If any tests fail to build we exit %check with
# an error, otherwise we print the test failure list and the failed
# test output and continue. Write to standard error to avoid
# synchronization issues with make and shell tracing output if
# standard output and standard error are different pipes.
run_tests () {
# This hides a test suite build failure, which should be fatal. We
# check "Summary of test results:" below to verify that all tests
# were built and run.
%make_build check |& tee rpmbuild.check.log >&2
test -n tests.sum
if ! grep -q '^Summary of test results:$' rpmbuild.check.log ; then
echo "FAIL: test suite build of target: $(basename "$(pwd)")" >& 2
exit 1
fi
set +x
grep -v ^PASS: tests.sum > rpmbuild.tests.sum.not-passing || true
if test -n rpmbuild.tests.sum.not-passing ; then
echo ===================FAILED TESTS===================== >&2
echo "Target: $(basename "$(pwd)")" >& 2
cat rpmbuild.tests.sum.not-passing >&2
while read failed_code failed_test ; do
for suffix in out test-result ; do
if test -e "$failed_test.$suffix"; then
echo >&2
echo "=====$failed_code $failed_test.$suffix=====" >&2
cat -- "$failed_test.$suffix" >&2
echo >&2
fi
done
done <rpmbuild.tests.sum.not-passing
fi
# Unconditonally dump differences in the system call list.
echo "* System call consistency checks:" >&2
cat misc/tst-syscall-list.out >&2
set -x
}
# Increase timeouts
export TIMEOUTFACTOR=16
parent=$$
echo ====================TESTING=========================
# Default libraries.
pushd build-%{target}
run_tests
popd
echo ====================TESTING END=====================
PLTCMD='/^Relocation section .*\(\.rela\?\.plt\|\.rela\.IA_64\.pltoff\)/,/^$/p'
echo ====================PLT RELOCS LD.SO================
readelf -Wr %{glibc_sysroot}/%{_lib}/ld-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS LIBC.SO==============
readelf -Wr %{glibc_sysroot}/%{_lib}/libc-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS END==================
# Obtain a way to run the dynamic loader. Avoid matching the symbolic
# link and then pick the first loader (although there should be only
# one).
run_ldso="$(find %{glibc_sysroot}/%{_lib}/ld-*.so -type f | LC_ALL=C sort | head -n1) --library-path %{glibc_sysroot}/%{_lib}"
# Show the auxiliary vector as seen by the new library
# (even if we do not perform the valgrind test).
LD_SHOW_AUXV=1 $run_ldso /bin/true
%if 0%{?_enable_debug_packages}
# Finally, check if valgrind runs with the new glibc.
# We want to fail building if valgrind is not able to run with this glibc so
# that we can then coordinate with valgrind to get it fixed before we update
# glibc.
%if %{with valgrind}
$run_ldso /usr/bin/valgrind --error-exitcode=1 \
$run_ldso /usr/bin/true
# true --help performs some memory allocations.
$run_ldso /usr/bin/valgrind --error-exitcode=1 \
$run_ldso /usr/bin/true --help >/dev/null
%endif
%endif
%endif
%pre -p <lua>
-- Check that the running kernel is new enough
required = '%{enablekernel}'
rel = posix.uname("%r")
if rpm.vercmp(rel, required) < 0 then
error("FATAL: kernel too old", 0)
end
%post -p <lua>
-- We use lua's posix.exec because there may be no shell that we can
-- run during glibc upgrade. We used to implement much of %%post as a
-- C program, but from an overall maintenance perspective the lua in
-- the spec file was simpler and safer given the operations required.
-- All lua code will be ignored by rpm-ostree; see:
-- https://github.com/projectatomic/rpm-ostree/pull/1869
-- If we add new lua actions to the %%post code we should coordinate
-- with rpm-ostree and ensure that their glibc install is functional.
function post_exec (program, ...)
local pid = posix.fork ()
if pid == 0 then
assert (posix.exec (program, ...))
elseif pid > 0 then
posix.wait (pid)
end
end
-- (1) Remove multilib libraries from previous installs.
-- In order to support in-place upgrades, we must immediately remove
-- obsolete platform directories after installing a new glibc
-- version. RPM only deletes files removed by updates near the end
-- of the transaction. If we did not remove the obsolete platform
-- directories here, they may be preferred by the dynamic linker
-- during the execution of subsequent RPM scriptlets, likely
-- resulting in process startup failures.
-- Full set of libraries glibc may install.
install_libs = { "anl", "BrokenLocale", "c", "dl", "m", "mvec",
"nss_compat", "nss_db", "nss_dns", "nss_files",
"nss_hesiod", "pthread", "resolv", "rt", "SegFault",
"thread_db", "util" }
-- We are going to remove these libraries. Generally speaking we remove
-- all core libraries in the multilib directory.
-- We employ a tight match where X.Y is in [2.0,9.9*], so we would
-- match "libc-2.0.so" and so on up to "libc-9.9*".
remove_regexps = {}
for i = 1, #install_libs do
remove_regexps[i] = ("lib" .. install_libs[i]
.. "%%-[2-9]%%.[0-9]+%%.so$")
end
-- Two exceptions:
remove_regexps[#install_libs + 1] = "libthread_db%%-1%%.0%%.so"
remove_regexps[#install_libs + 2] = "libSegFault%%.so"
-- We are going to search these directories.
local remove_dirs = { "%{_libdir}/i686",
"%{_libdir}/i686/nosegneg",
"%{_libdir}/power6",
"%{_libdir}/power7",
"%{_libdir}/power8",
"%{_libdir}/power9",
}
-- Walk all the directories with files we need to remove...
for _, rdir in ipairs (remove_dirs) do
if posix.access (rdir) then
-- If the directory exists we look at all the files...
local remove_files = posix.files (rdir)
for rfile in remove_files do
for _, rregexp in ipairs (remove_regexps) do
-- Does it match the regexp?
local dso = string.match (rfile, rregexp)
if (dso ~= nil) then
-- Removing file...
os.remove (rdir .. '/' .. rfile)
end
end
end
end
end
-- (2) Update /etc/ld.so.conf
-- Next we update /etc/ld.so.conf to ensure that it starts with
-- a literal "include ld.so.conf.d/*.conf".
local ldsoconf = "/etc/ld.so.conf"
local ldsoconf_tmp = "/etc/glibc_post_upgrade.ld.so.conf"
if posix.access (ldsoconf) then
-- We must have a "include ld.so.conf.d/*.conf" line.
local have_include = false
for line in io.lines (ldsoconf) do
-- This must match, and we don't ignore whitespace.
if string.match (line, "^include ld.so.conf.d/%%*%%.conf$") ~= nil then
have_include = true
end
end
if not have_include then
-- Insert "include ld.so.conf.d/*.conf" line at the start of the
-- file. We only support one of these post upgrades running at
-- a time (temporary file name is fixed).
local tmp_fd = io.open (ldsoconf_tmp, "w")
if tmp_fd ~= nil then
tmp_fd:write ("include ld.so.conf.d/*.conf\n")
for line in io.lines (ldsoconf) do
tmp_fd:write (line .. "\n")
end
tmp_fd:close ()
local res = os.rename (ldsoconf_tmp, ldsoconf)
if res == nil then
io.stdout:write ("Error: Unable to update configuration file (rename).\n")
end
else
io.stdout:write ("Error: Unable to update configuration file (open).\n")
end
end
end
-- (3) Rebuild ld.so.cache early.
-- If the format of the cache changes then we need to rebuild
-- the cache early to avoid any problems running binaries with
-- the new glibc.
-- Note: We use _prefix because Fedora's UsrMove says so.
post_exec ("%{_prefix}/sbin/ldconfig")
-- (4) Update gconv modules cache.
-- If the /usr/lib/gconv/gconv-modules.cache exists, then update it
-- with the latest set of modules that were just installed.
-- We assume that the cache is in _libdir/gconv and called
-- "gconv-modules.cache".
local iconv_dir = "%{_libdir}/gconv"
local iconv_cache = iconv_dir .. "/gconv-modules.cache"
if (posix.utime (iconv_cache) == 0) then
post_exec ("%{_prefix}/sbin/iconvconfig",
"-o", iconv_cache,
"--nostdlib",
iconv_dir)
else
io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
end
%posttrans all-langpacks -e -p <lua>
-- The old glibc-all-langpacks postun scriptlet deleted the locale-archive
-- file, so we may have to resurrect it on upgrades.
local archive_path = "%{_prefix}/lib/locale/locale-archive"
local real_path = "%{_prefix}/lib/locale/locale-archive.real"
local stat_archive = posix.stat(archive_path)
local stat_real = posix.stat(real_path)
-- If the hard link was removed, restore it.
if stat_archive ~= nil and stat_real ~= nil
and (stat_archive.ino ~= stat_real.ino
or stat_archive.dev ~= stat_real.dev) then
posix.unlink(archive_path)
stat_archive = nil
end
-- If the file is gone, restore it.
if stat_archive == nil then
posix.link(real_path, archive_path)
end
-- Remove .rpmsave file potentially created due to config file change.
local save_path = archive_path .. ".rpmsave"
if posix.access(save_path) then
posix.unlink(save_path)
end
%pre -n nscd
getent group nscd >/dev/null || /usr/sbin/groupadd -g 28 -r nscd
getent passwd nscd >/dev/null ||
/usr/sbin/useradd -M -o -r -d / -s /sbin/nologin \
-c "NSCD Daemon" -u 28 -g nscd nscd
%post -n nscd
%systemd_post nscd.service
%preun -n nscd
%systemd_preun nscd.service
%postun -n nscd
if test $1 = 0; then
/usr/sbin/userdel nscd > /dev/null 2>&1 || :
fi
%systemd_postun_with_restart nscd.service
%files -f glibc.filelist
%dir %{_prefix}/%{_lib}/audit
%verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf
%verify(not md5 size mtime) %config(noreplace) /etc/ld.so.conf
%verify(not md5 size mtime) %config(noreplace) /etc/rpc
%dir /etc/ld.so.conf.d
%dir %{_prefix}/libexec/getconf
%dir %{_libdir}/gconv
%dir %attr(0700,root,root) /var/cache/ldconfig
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/cache/ldconfig/aux-cache
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/gai.conf
# If rpm doesn't support %license, then use %doc instead.
%{!?_licensedir:%global license %%doc}
%license COPYING COPYING.LIB LICENSES
%files -f common.filelist common
%dir %{_prefix}/lib/locale
%dir %{_prefix}/lib/locale/C.utf8
%{_prefix}/lib/locale/C.utf8/*
%files all-langpacks
%{_prefix}/lib/locale/locale-archive
%{_prefix}/lib/locale/locale-archive.real
%{_prefix}/share/locale/*/LC_MESSAGES/libc.mo
%files locale-source
%dir %{_prefix}/share/i18n/locales
%{_prefix}/share/i18n/locales/*
%dir %{_prefix}/share/i18n/charmaps
%{_prefix}/share/i18n/charmaps/*
%files -f devel.filelist devel
%if %{with docs}
%files -f doc.filelist doc
%endif
%files -f static.filelist static
%if %{need_headers_package}
%files -f headers.filelist -n %{headers_package_name}
%endif
%files -f utils.filelist utils
%files -f nscd.filelist -n nscd
%config(noreplace) /etc/nscd.conf
%dir %attr(0755,root,root) /var/run/nscd
%dir %attr(0755,root,root) /var/db/nscd
/lib/systemd/system/nscd.service
/lib/systemd/system/nscd.socket
%{_tmpfilesdir}/nscd.conf
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid
%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/passwd
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/group
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/hosts
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/services
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/passwd
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/group
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/hosts
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/services
%ghost %config(missingok,noreplace) /etc/sysconfig/nscd
%files -f nss_db.filelist -n nss_db
/var/db/Makefile
%files -f nss_hesiod.filelist -n nss_hesiod
%doc hesiod/README.hesiod
%files -f nss-devel.filelist nss-devel
%files -f libnsl.filelist -n libnsl
/%{_lib}/libnsl.so.1
%if %{with benchtests}
%files benchtests -f benchtests.filelist
%endif
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Tue May 25 2021 Florian Weimer <fweimer@redhat.com> - 2.33-14
- Import commit 0ef0e6de7fdfa18328b09ba2afb4f0112d4bdab4 from the
glibc 2.33 branch:
- ppc64le: scv ABI error handling fails to check IS_ERR_VALUE (#1963901)
* Fri May 21 2021 Florian Weimer <fweimer@redhat.com> - 2.33-13
- Switch back to a unified glibc-headers package (#1940686)
* Fri May 21 2021 Florian Weimer <fweimer@redhat.com> - 2.33-12
- aarch64: Enable optional memory tagging support (#1948645)
* Fri May 7 2021 Florian Weimer <fweimer@redhat.com> - 2.33-11
- Sync with Fedora f34 branch, commit 4f55bd2df5c705c99f21.
- This removes the forced setting of the z14/POWER9 baselines,
switching back to redhat-rpm-config flags.
- s390x: Adjust z14 check to proposed upstream approach (#1945473)
- ppc64le: Implement preliminary check for POWER9 support (#1945472)
- Use distribution mechanism for debuginfo (#1915330)
- Switch back to parallel locale generation during build
- Upstream patches from the 2.33 stable release branch, up to commit
3f5080aedd164c1f92a53552dd3e0b82ac6d2bd3:
- S390: Also check vector support in memmove ifunc-selector [BZ #27511]
- malloc: Fix a realloc crash with heap tagging [BZ 27468]
- Update Nios II libm-test-ulps.
- tst: Provide test for select
- misc: Fix tst-select timeout handling (BZ#27648)
- libsupport: Add support_select_modifies_timeout
- libsupport: Add support_select_normalizes_timeout
- linux: Normalize and return timeout on select (BZ #27651)
- linux: always update select timeout (BZ #27706)
- tunables: Fix comparison of tunable values
- support: Typo and formatting fixes
- support: Pass environ to child process
- support: Add capability to fork an sgid child
- tst-env-setuid: Use support_capture_subprogram_self_sgid
- Enhance setuid-tunables test
- Fix SXID_ERASE behavior in setuid programs (BZ #27471)
- Remove PR_TAGGED_ADDR_ENABLE from sys/prctl.h
- x86: tst-cpu-features-supports.c: Update AMX check
- nptl_db: Support different libpthread/ld.so load orders (bug 27744)
- nptl: Check for compatible GDB in nptl/tst-pthread-gdb-attach
- nptl: Do not build nptl/tst-pthread-gdb-attach as PIE
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 2.33-10
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Fri Apr 9 2021 Florian Weimer <fweimer@redhat.com> - 2.33-9
- ppc64le, s390x: Enforce POWER9 and z14 baseline (#1876584, #1876479)
* Fri Apr 9 2021 Florian Weimer <fweimer@redhat.com> - 2.33-8
- s390x: Implement preliminary check for z14 support (#1945473)
* Fri Apr 9 2021 Florian Weimer <fweimer@redhat.com> - 2.33-7
- Inherit additional build flags from redhat-rpm-config (#1947895)
* Wed Apr 7 2021 Florian Weimer <fweimer@redhat.com> - 2.33-6
- Remove power9 multilib (#1889978)
* Tue Mar 16 2021 Florian Weimer <fweimer@redhat.com> - 2.33-5
- Import patches from the upstream glibc 2.33 branch, up to commit
db32fc27e7bdfb5468200a94e9152bcc1c971d25:
- test-container: Always copy test-specific support files [BZ #27537]
- nptl: Remove private futex optimization [BZ #27304]
- pthread_once hangs when init routine throws an exception [BZ #18435]
- elf: ld.so --help calls _dl_init_paths without a main map (#1609351)
- elf: Always set l in _dl_init_paths (bug 23462)
- x86: Handle _SC_LEVEL1_ICACHE_LINESIZE [BZ #27444]
- io: Return EBAFD for negative file descriptor on fstat (BZ #27559)
- nscd: Fix double free in netgroupcache [BZ #27462]
- x86: Set minimum x86-64 level marker [BZ #27318]
* Thu Mar 4 2021 Florian Weimer <fweimer@redhat.com> - 2.33-4
- Import patch from the upstream glibc 2.33 branch, up to commit
3e880d733753183696d1a81c34caef3a9add2b0c.
- nss: Re-enable NSS module loading after chroot [BZ #27389]
* Tue Mar 2 2021 Florian Weimer <fweimer@redhat.com> - 2.33-3
- Import patches from the upstream glibc 2.33 branch, up to commit
71b2463f6178a6097532dcfe8948bffbe2376dfb.
- x86: Add CPU-specific diagnostics to ld.so --list-diagnostics
- x86: Automate generation of PREFERRED_FEATURE_INDEX_1 bitfield
- ld.so: Implement the --list-diagnostics option
* Fri Feb 19 2021 Florian Weimer <fweimer@redhat.com> - 2.33-2
- Re-enable -Werror; GCC PR 98512 workaround applied upstream
- Import patches from the upstream glibc 2.33 branch, up to commit
8d4241b8976273513e72cc1c5f6b1af3e11f0792.
- string: Work around GCC PR 98512 in rawmemchr
- S390: Add new hwcap values.
- tunables: Disallow negative values for some tunables
- x86: Use SIZE_MAX instead of (long int)-1 for tunable range value
- tunables: Simplify TUNABLE_SET interface
- nsswitch: return result when nss database is locked [BZ #27343]
* Mon Feb 15 2021 Florian Weimer <fweimer@redhat.com> - 2.33-1
- Switch to glibc 2.33 upstream release tarball