%define anolis_release 13 %bcond_without testsuite %bcond_without benchtests %bcond_with bootstrap %bcond_without werror %bcond_without docs %ifarch x86_64 aarch64 %bcond_without valgrind %else %bcond_with valgrind %endif %global __filter_GLIBC_PRIVATE 1 %global __provides_exclude ^libc_malloc_debug\\.so.*$ %global locale_rx eo syr *_* %if %{with bootstrap} %undefine with_benchtests %undefine with_werror %undefine with_docs %undefine with_valgrind %endif %undefine _auto_set_build_flags %undefine _unique_build_ids %undefine __brp_ldconfig %define _no_recompute_build_ids 1 %define enablekernel 3.2 %define target %{_target_cpu}-anolis-linux %define glibc_make_flags_as ASFLAGS="-g -Wa,--generate-missing-build-notes=yes" %define glibc_make_flags %{glibc_make_flags_as} %define glibc_post_funcs() \ function post_exec (program, ...) \ local pid = posix.fork () \ if pid == 0 then \ posix.exec (program, ...) \ assert (nil) \ elseif pid > 0 then \ posix.wait (pid) \ end \ end \ \ function update_gconv_modules_cache () \ local iconv_dir = "%{_libdir}/gconv" \ local iconv_cache = iconv_dir .. "/gconv-modules.cache" \ local iconv_modules = iconv_dir .. "/gconv-modules" \ if (posix.utime (iconv_modules) == 0) then \ 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 \ end \ end \ %{nil} Summary: The GNU libc libraries Name: glibc Version: 2.36 Release: %{anolis_release}%{?dist} 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: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz Source1: bench.mk Source2: glibc-bench-compare Source10: wrap-find-debuginfo.sh Source20: langpacklist %{lua: local wrapper = rpm.expand("%{SOURCE10}") local sysroot = rpm.expand("%{buildroot}") 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 .. " " .. sysroot .. " " .. original) } Patch1: glibc-no-archive-for-localedef.patch Patch2: glibc-place-info-into-Libraries-category.patch Patch3: glibc-nscd-add-syslog-target-dependency.patch Patch4: glibc-fix-newlocale-error-return.patch Patch5: glibc-cs-path.patch Patch6: glibc-python3.patch Patch7: glibc-deprecated-selinux-makedb.patch # https://sourceware.org/bugzilla/show_bug.cgi?id=30243 Patch8: glibc-gb18030-2022-bug30243.patch # patches sync from 2.36 release branch Patch0101: 0001-stdlib-Suppress-gcc-diagnostic-that-char8_t-is-a-key.patch Patch0102: 0002-wcsmbs-Add-missing-test-c8rtomb-test-mbrtoc8-depende.patch Patch0103: 0003-dlfcn-Pass-caller-pointer-to-static-dlopen-implement.patch Patch0104: 0004-Update-syscall-lists-for-Linux-5.19.patch Patch0105: 0005-elf-Replace-strcpy-call-with-memcpy-BZ-29454.patch Patch0106: 0006-Linux-Terminate-subprocess-on-late-failure-in-tst-pi.patch Patch0107: 0007-alpha-Fix-generic-brk-system-call-emulation-in-__brk.patch Patch0108: 0008-socket-Check-lengths-before-advancing-pointer-in-CMS.patch Patch0109: 0009-NEWS-Add-entry-for-bug-28846.patch Patch0110: 0010-glibcextract.py-Add-compile_c_snippet.patch Patch0111: 0011-linux-Use-compile_c_snippet-to-check-linux-pidfd.h-a.patch Patch0112: 0012-linux-Mimic-kernel-defition-for-BLOCK_SIZE.patch Patch0113: 0013-linux-Use-compile_c_snippet-to-check-linux-mount.h-a.patch Patch0114: 0014-linux-Fix-sys-mount.h-usage-with-kernel-headers.patch Patch0115: 0015-Linux-Fix-enum-fsconfig_command-detection-in-sys-mou.patch Patch0116: 0016-syslog-Fix-large-messages-BZ-29536.patch Patch0117: 0017-elf-Call-__libc_early_init-for-reused-namespaces-bug.patch Patch0118: 0018-Apply-asm-redirections-in-wchar.h-before-first-use.patch Patch0119: 0019-elf-Restore-how-vDSO-dependency-is-printed-with-LD_T.patch Patch0120: 0020-syslog-Remove-extra-whitespace-between-timestamp-and.patch Patch0121: 0021-Add-NEWS-entry-for-CVE-2022-39046.patch Patch0122: 0022-nscd-Fix-netlink-cache-invalidation-if-epoll-is-used.patch Patch0123: 0023-resolv-Add-tst-resolv-byaddr-for-testing-reverse-loo.patch Patch0124: 0024-resolv-Add-tst-resolv-aliases.patch Patch0125: 0025-resolv-Add-internal-__res_binary_hnok-function.patch Patch0126: 0026-resolv-Add-the-__ns_samebinaryname-function.patch Patch0127: 0027-resolv-Add-internal-__ns_name_length_uncompressed-fu.patch Patch0128: 0028-resolv-Add-DNS-packet-parsing-helpers-geared-towards.patch Patch0129: 0029-nss_dns-Split-getanswer_ptr-from-getanswer_r.patch Patch0130: 0030-nss_dns-Rewrite-_nss_dns_gethostbyaddr2_r-and-getans.patch Patch0131: 0031-nss_dns-Remove-remnants-of-IPv6-address-mapping.patch Patch0132: 0032-nss_dns-Rewrite-getanswer_r-to-match-getanswer_ptr-b.patch Patch0133: 0033-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases.patch Patch0134: 0034-resolv-Add-new-tst-resolv-invalid-cname.patch Patch0135: 0035-nss_dns-Rewrite-_nss_dns_gethostbyname4_r-using-curr.patch Patch0136: 0036-resolv-Fix-building-tst-resolv-invalid-cname-for-ear.patch Patch0137: 0037-NEWS-Note-bug-12154-and-bug-29305-as-fixed.patch Patch0138: 0038-elf-Run-tst-audit-tlsdesc-tst-audit-tlsdesc-dlopen-e.patch Patch0139: 0039-elf-Fix-hwcaps-string-size-overestimation.patch Patch0140: 0040-scripts-dso-ordering-test.py-Generate-program-run-ti.patch Patch0141: 0041-elf-Rename-_dl_sort_maps-parameter-from-skip-to-forc.patch Patch0142: 0042-elf-Implement-force_first-handling-in-_dl_sort_maps_.patch Patch0143: 0043-gconv-Use-64-bit-interfaces-in-gconv_parseconfdir-bu.patch Patch0144: 0044-m68k-Enforce-4-byte-alignment-on-internal-locks-BZ-2.patch Patch0145: 0045-get_nscd_addresses-Fix-subscript-typos-BZ-29605.patch Patch0146: 0046-stdlib-Fix-__getrandom_nocancel-type-and-arc4random-.patch Patch0147: 0047-hppa-Fix-initialization-of-dp-register-BZ-29635.patch Patch0148: 0048-hppa-undef-__ASSUME_SET_ROBUST_LIST.patch Patch0149: 0049-x86-include-BMI1-and-BMI2-in-x86-64-v3-level.patch Patch0150: 0050-x86-64-Require-BMI2-for-AVX2-str-n-casecmp-implement.patch Patch0151: 0051-x86-64-Require-BMI2-for-AVX2-strcmp-implementation.patch Patch0152: 0052-x86-64-Require-BMI2-for-AVX2-strncmp-implementation.patch Patch0153: 0053-x86-64-Require-BMI2-for-AVX2-wcs-n-cmp-implementatio.patch Patch0154: 0054-x86-64-Require-BMI2-for-AVX2-raw-w-memchr-implementa.patch Patch0155: 0055-x86-64-Require-BMI2-and-LZCNT-for-AVX2-memrchr-imple.patch Patch0156: 0056-x86-64-Require-BMI1-BMI2-for-AVX2-strrchr-and-wcsrch.patch Patch0157: 0057-nscd-Drop-local-address-tuple-variable-BZ-29607.patch Patch0158: 0058-Ensure-calculations-happen-with-desired-rounding-mod.patch Patch0159: 0059-nss-Implement-no-addrconfig-option-for-getent.patch Patch0160: 0060-nss-Fix-tst-nss-files-hosts-long-on-single-stack-hos.patch Patch0161: 0061-nss-Use-shared-prefix-in-IPv4-address-in-tst-reload1.patch Patch0162: 0062-elf-Do-not-completely-clear-reused-namespace-in-dlmo.patch Patch0163: 0063-Fix-BZ-29463-in-the-ibm128-implementation-of-y1l-too.patch Patch0164: 0064-Avoid-undefined-behaviour-in-ibm128-implementation-o.patch Patch0165: 0065-linux-Fix-generic-struct_stat-for-64-bit-time-BZ-296.patch Patch0166: 0066-elf-Reinstate-on-DL_DEBUG_BINDINGS-_dl_lookup_symbol.patch Patch0167: 0067-longlong.h-update-from-GCC-for-LoongArch-clz-ctz-sup.patch Patch0168: 0068-linux-Fix-fstatat-on-MIPSn64-BZ-29730.patch Patch0169: 0069-LoongArch-Fix-ABI-related-macros-in-elf.h-to-keep-co.patch Patch0170: 0070-Makerules-fix-MAKEFLAGS-assignment-for-upcoming-make.patch Patch0171: 0071-mktime-improve-heuristic-for-ca-1986-Indiana-DST.patch Patch0172: 0072-Linux-Support-__IPC_64-in-sysvctl-ctl-command-argume.patch Patch0173: 0073-elf-Fix-rtld-audit-trampoline-for-aarch64.patch Patch0174: 0074-x86-Fix-wcsnlen-avx2-page-cross-length-comparison-BZ.patch Patch0175: 0075-Apply-asm-redirections-in-syslog.h-before-first-use-.patch Patch0176: 0076-nis-Build-libnsl-with-64-bit-time_t.patch Patch0177: 0077-nscd-Use-64-bit-time_t-on-libc-nscd-routines-BZ-2940.patch Patch0178: 0078-time-Use-64-bit-time-on-tzfile.patch Patch0179: 0079-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch Patch0180: 0080-sunrpc-Suppress-GCC-Os-warning-on-user2netname.patch Patch0181: 0081-x86-Fix-Os-build-BZ-29576.patch Patch0182: 0082-LoongArch-add-new-relocs-and-fix-from-upstream.patch Patch0183: 0083-CVE-2023-4527.patch Patch0184: 0084-CVE-2023-4806.patch Patch0185: 0085-CVE-2023-5156.patch Patch0186: 0086-CVE-2023-4911.patch BuildRequires: audit-libs-devel >= 1.1.3 libcap-devel systemtap-sdt-devel BuildRequires: procps-ng util-linux gawk sed >= 3.95 gettext BuildRequires: python3 python3-devel BuildRequires: gcc >= 7.2.1 BuildRequires: make >= 4.0 bison >= 2.7 binutils >= 2.30 %if %{with valgrind} BuildRequires: valgrind %endif %if %{without bootstrap} BuildRequires: gd-devel libpng-devel zlib-devel libselinux-devel >= 1.33.4 %if %{with testsuite} BuildRequires: gcc-c++ libstdc++-static glibc-static libidn2 perl-interpreter %endif %endif Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) Requires: glibc-common = %{EVR} Requires: basesystem libgcc Requires: glibc-langpack = %{EVR} Requires: (glibc-gconv-extra = %{EVR} if system-rpm-config) Requires(pre): basesystem Suggests: glibc-minimal-langpack = %{EVR} Recommends: glibc-gconv-extra = %{EVR} Obsoletes: glibc-profile < 2.4 Obsoletes: nscd < 2.35 Conflicts: kernel < %{enablekernel} Conflicts: prelink < 0.4.2 %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. %ifnarch loongarch64 %package -n libnsl Summary: Legacy support library for NIS Requires: %{name} = %{EVR} %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. %endif %package devel Summary: Object files for development using standard C libraries. BuildRequires: kernel-headers >= 3.2 Requires: %{name} = %{EVR} Requires: libxcrypt-devel >= 4.0.0 kernel-headers >= 3.2 Provides: glibc-headers = %{EVR} Provides: glibc-headers(%{_target_cpu}) Obsoletes: glibc-headers < %{EVR} %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. %package static Summary: C library static libraries for -static linking. Requires: %{name}-devel = %{EVR} Requires: libxcrypt-static >= 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. %package common Summary: Common binaries and locale data for glibc Requires: %{name} = %{EVR} Requires: tzdata >= 2003a %description common The glibc-common package includes common binaries for the GNU libc libraries, as well as national language (locale) support. %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 %package locale-source Summary: The sources for the locales Requires: %{name} = %{EVR} Requires: %{name}-common = %{EVR} %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. %package all-langpacks Summary: All language packs for glibc. Provides: glibc-langpack = %{EVR} Requires: %{name} = %{EVR} Requires: %{name}-common = %{EVR} %{lua: -- List the langpacks provided by all-langpacks lang_provides = {} for line in io.lines(rpm.expand("%{SOURCE20}")) do print(rpm.expand([[ Provides: %{name}-langpack-]]..line..[[ = %{EVR} Obsoletes: %{name}-langpack-]]..line..[[ <= %{EVR} ]])) end } %description all-langpacks This package includes all the basic infomation required to support all language. Exclude en and zh langpack. %package langpack-en Summary: Locale data for English Provides: glibc-langpack = %{EVR} Requires: %{name} = %{EVR} Requires: %{name}-common = %{EVR} %description langpack-en The glibc-langpack-en package includes the basic information required to support the English language in your applications. %package langpack-zh Summary: Locale data for Chinese Provides: glibc-langpack = %{EVR} Requires: %{name} = %{EVR} Requires: %{name}-common = %{EVR} Obsoletes: %{name}-langpack-cmn < %{EVR} Provides: %{name}-langpack-cmn = %{EVR} %description langpack-zh The glibc-langpack-zh package includes the basic information required to support the Chinese language in your applications. %package minimal-langpack Summary: Minimal language packs for glibc. Provides: glibc-langpack = %{EVR} Requires: %{name} = %{EVR} Requires: %{name}-common = %{EVR} %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. %package gconv-extra Summary: All iconv converter modules for glibc. Requires: %{name} = %{EVR} Requires: %{name}-common = %{EVR} %description gconv-extra This package contains all iconv converter modules built in glibc. %package -n nss_db Summary: Name Service Switch (NSS) module using hash-indexed files Requires: %{name} = %{EVR} %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} = %{EVR} %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} = %{EVR} Requires: nss_db = %{EVR} Requires: nss_hesiod = %{EVR} %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. %package utils Summary: Development utilities from GNU C library Requires: %{name} = %{EVR} %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 glibc %description benchtests This package provides built benchmark binaries and scripts to run microbenchmark tests on the system. %endif %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. %if %{with docs} %package doc Summary: Documentation for GNU libc BuildArch: noarch BuildRequires: texinfo >= 5.0 Requires: %{name} = %{EVR} %description doc The glibc-doc package contains The GNU C Library Reference Manual in info format. Additional package documentation is also provided. %endif %prep %autosetup -p1 chmod +x benchtests/scripts/*.py scripts/pylint find . -type f -size 0 -o -name "*.orig" -exec rm -f {} \; touch `find . -name configure` touch locale/programs/*-kw.h # Ignore kernel version check errors. %ifarch loongarch64 sed -i "s@5.19.0@4.15.0@g" sysdeps/unix/sysv/linux/loongarch/configure{,.ac} %endif %build uname -a LD_SHOW_AUXV=1 /bin/true cat /proc/cpuinfo cat /proc/sysinfo 2>/dev/null || true cat /proc/meminfo df GCC=gcc GXX=g++ rpm_append_flag () { BuildFlags="$BuildFlags $*" } 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 } 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=armv9-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/anolis/anolis-annobin-cc1" \ %if 0%{?_annotated_build} > 0 BuildFlagsNonshared="-fplugin=annobin -fplugin-arg-annobin-disable -Wa,--generate-missing-build-notes=yes" %endif echo "$GCC" > Gcc 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} \ --build=%{target} \ --with-headers=%{_prefix}/include \ --enable-kernel=%{enablekernel} \ --with-nonshared-cflags="$BuildFlagsNonshared" \ --enable-bind-now \ --enable-stack-protector=strong \ --enable-tunables \ --enable-systemtap \ ${core_with_options} \ %ifarch x86_64 --enable-cet \ %endif %if %{without werror} --disable-werror \ %endif %if %{with bootstrap} --without-selinux \ %endif %ifarch aarch64 --enable-memory-tagging \ %endif --disable-profile \ --disable-crypt \ --disable-build-nscd \ --disable-nscd || { cat config.log; false; } %make_build -r %{glibc_make_flags} popd } build %install GCC=`cat Gcc` %ifarch riscv64 for d in %{buildroot}%{_libdir} %{buildroot}/%{_lib}; do mkdir -p $d (cd $d && ln -sf . lp64d) done %endif pushd build-%{target} %make_build install_root=%{buildroot} install %make_build install_root=%{buildroot} install-locales -C ../localedata objdir=`pwd` popd hardlink %{buildroot}/usr/lib/locale rm -f %{buildroot}/%{_libdir}/libNoVersion* rm -f %{buildroot}/%{_lib}/libNoVersion* rm -f %{buildroot}/%{_lib}/libnss1-* rm -f %{buildroot}/%{_lib}/libnss-*.so.1 rm -f %{buildroot}/{usr/,}sbin/sln mkdir -p %{buildroot}/var/cache/ldconfig truncate -s 0 %{buildroot}/var/cache/ldconfig/aux-cache %{buildroot}/sbin/ldconfig -N -r %{buildroot} %if %{with docs} if [ -d %{buildroot}%{_prefix}/info -a "%{_infodir}" != "%{_prefix}/info" ]; then mkdir -p %{buildroot}%{_infodir} mv -f %{buildroot}%{_prefix}/info/* %{buildroot}%{_infodir} rm -rf %{buildroot}%{_prefix}/info fi gzip -9nvf %{buildroot}%{_infodir}/libc* mkdir -p %{buildroot}%{_docdir}/glibc cp elf/rtld-debugger-interface.txt %{buildroot}%{_docdir}/glibc %else rm -f %{buildroot}%{_infodir}/dir rm -f %{buildroot}%{_infodir}/libc.info* %endif olddir=`pwd` pushd %{buildroot}%{_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 %{buildroot} --add-to-archive \ %locale_rx ln locale-archive locale-archive.real popd echo 'include ld.so.conf.d/*.conf' > %{buildroot}/etc/ld.so.conf truncate -s 0 %{buildroot}/etc/ld.so.cache chmod 644 %{buildroot}/etc/ld.so.conf mkdir -p %{buildroot}/etc/ld.so.conf.d truncate -s 0 %{buildroot}/etc/gai.conf truncate -s 0 %{buildroot}%{_libdir}/gconv/gconv-modules.cache chmod 644 %{buildroot}%{_libdir}/gconv/gconv-modules.cache rm -rf %{buildroot}%{_prefix}/share/zoneinfo touch -r %{SOURCE0} %{buildroot}/etc/ld.so.conf touch -r inet/etc.rpc %{buildroot}/etc/rpc %if %{with benchtests} pushd build-%{target} make BENCH_DURATION=1 bench-build popd mkdir -p %{buildroot}%{_prefix}/libexec/glibc-benchtests cp $(find build-%{target}/benchtests -type f -executable) %{buildroot}%{_prefix}/libexec/glibc-benchtests/ for b in %{SOURCE1} %{SOURCE2}; do cp $b %{buildroot}%{_prefix}/libexec/glibc-benchtests/ done cp benchtests/scripts/benchout.schema.json %{buildroot}%{_prefix}/libexec/glibc-benchtests/ cp benchtests/scripts/compare_bench.py %{buildroot}%{_prefix}/libexec/glibc-benchtests/ cp benchtests/scripts/import_bench.py %{buildroot}%{_prefix}/libexec/glibc-benchtests/ cp benchtests/scripts/validate_benchout.py %{buildroot}%{_prefix}/libexec/glibc-benchtests/ %endif pushd locale ln -s programs/*.gperf . popd pushd iconv ln -s ../locale/programs/charmap-kw.gperf . popd %if %{with docs} rm -f %{buildroot}%{_infodir}/dir %endif mkdir -p %{buildroot}%{_libdir} mv -f %{buildroot}/%{_lib}/lib{pcprofile,memusage}.so %{buildroot}%{_libdir} rm %{buildroot}%{_libdir}/libc_malloc_debug.so strip -g %{buildroot}%{_libdir}/*.o for i in %{buildroot}%{_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 ar cr %{buildroot}%{_prefix}/%{_lib}/libpthread_nonshared.a %check %if %{with testsuite} run_tests () { %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 &2 cat misc/tst-syscall-list.out >&2 set -x } export TIMEOUTFACTOR=16 parent=$$ echo ====================TESTING========================= 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 %{buildroot}/%{_lib}/ld-*.so | sed -n -e "$PLTCMD" echo ====================PLT RELOCS LIBC.SO============== readelf -Wr %{buildroot}/%{_lib}/libc-*.so | sed -n -e "$PLTCMD" echo ====================PLT RELOCS END================== ldso_path="$(find %{buildroot}/ -regextype posix-extended \ -regex '.*/ld(-.*|64|)\.so\.[0-9]+$' -type f | LC_ALL=C sort | head -n1)" run_ldso="$ldso_path --library-path %{buildroot}/%{_lib}" LD_SHOW_AUXV=1 $run_ldso /bin/true %if 0%{?_enable_debug_packages} %if %{with valgrind} $run_ldso /usr/bin/valgrind --error-exitcode=1 $run_ldso /usr/bin/true $run_ldso /usr/bin/valgrind --error-exitcode=1 $run_ldso /usr/bin/true --help >/dev/null %endif %endif %endif %pre -p required = '%{enablekernel}' rel = posix.uname("%r") if rpm.vercmp(rel, required) < 0 then error("FATAL: kernel too old", 0) end %post -p %glibc_post_funcs -- (1) Remove multilib libraries from previous installs. 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" } remove_regexps = {} for i = 1, #install_libs do remove_regexps[#remove_regexps + 1] = ("lib" .. install_libs[i] .. "%%-[2-9]%%.[0-9]+%%.so$") remove_regexps[#remove_regexps + 1] = ("lib" .. install_libs[i] .. "%%.so%%.[0-9]+$") end remove_regexps[#install_libs + 1] = "libthread_db%%-1%%.0%%.so" remove_regexps[#install_libs + 2] = "libSegFault%%.so" local remove_dirs = { "%{_libdir}/i686", "%{_libdir}/i686/nosegneg", "%{_libdir}/power6", "%{_libdir}/power7", "%{_libdir}/power8", "%{_libdir}/power9", } repeat local iter = posix.files("%{_libdir}/glibc-hwcaps") if iter ~= nil then for entry in iter do if entry ~= "." and entry ~= ".." then local path = "%{_libdir}/glibc-hwcaps/" .. entry if posix.access(path .. "/.", "x") then remove_dirs[#remove_dirs + 1] = path end end end end until true 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 local ldsoconf = "/etc/ld.so.conf" local ldsoconf_tmp = "/etc/glibc_post_upgrade.ld.so.conf" if posix.access (ldsoconf) then local have_include = false for line in io.lines (ldsoconf) do if string.match (line, "^include ld.so.conf.d/%%*%%.conf$") ~= nil then have_include = true end end if not have_include then 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. post_exec ("%{_prefix}/sbin/ldconfig") -- (4) Update gconv modules cache. update_gconv_modules_cache() -- (5) On upgrades, restart systemd if installed. if tonumber(arg[2]) >= 2 and posix.access("%{_prefix}/bin/systemctl", "x") then local pid = posix.fork() if pid == 0 then posix.redirect2null(2) assert(posix.exec("%{_prefix}/bin/systemctl", "daemon-reexec")) elseif pid > 0 then posix.wait(pid) end end %posttrans all-langpacks -e -p 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 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 stat_archive == nil then posix.link(real_path, archive_path) end local save_path = archive_path .. ".rpmsave" if posix.access(save_path) then posix.unlink(save_path) end %post gconv-extra -p %glibc_post_funcs update_gconv_modules_cache () %postun gconv-extra -p %glibc_post_funcs update_gconv_modules_cache () %files %ifarch x86_64 /lib64/ld-linux-x86-64.so.2 /lib64/libmvec.so.1 %endif %ifarch aarch64 /lib/ld-linux-aarch64.so.1 %endif %ifarch loongarch64 /lib64/ld-linux-loongarch-lp64d.so.1 %endif %ifarch riscv64 /lib/ld-linux-riscv64-lp64d.so.1 /lib64/lp64d %endif /lib64/libBrokenLocale.so.1 %ifnarch loongarch64 /lib64/libanl.so.1 /lib64/libutil.so.1 %endif /lib64/libc.so.6 /lib64/libc_malloc_debug.so.0 /lib64/libdl.so.2 /lib64/libm.so.6 /lib64/libpthread.so.0 /lib64/libresolv.so.2 /lib64/librt.so.1 /lib64/libthread_db.so.1 /lib64/libnss_compat.so.2 /lib64/libnss_files.so.2 /lib64/libnss_dns.so.2 /usr/lib64/libmemusage.so /usr/lib64/libpcprofile.so /usr/lib64/gconv/ANSI_X3.110.so /usr/lib64/gconv/CP1252.so /usr/lib64/gconv/ISO8859-1.so /usr/lib64/gconv/ISO8859-15.so /usr/lib64/gconv/UNICODE.so /usr/lib64/gconv/UTF-16.so /usr/lib64/gconv/UTF-32.so /usr/lib64/gconv/UTF-7.so /usr/lib64/audit/sotruss-lib.so /sbin/ldconfig /usr/sbin/iconvconfig %dir %{_prefix}/libexec/getconf %{_prefix}/libexec/getconf/POSIX_V6_LP64_OFF64 %{_prefix}/libexec/getconf/POSIX_V7_LP64_OFF64 %{_prefix}/libexec/getconf/XBS5_LP64_OFF64 %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 %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 %dir %{_libdir}/gconv %dir %{_libdir}/gconv/gconv-modules.d %verify(not md5 size mtime) %config(noreplace) /usr/lib64/gconv/gconv-modules %verify(not md5 size mtime) /usr/lib64/gconv/gconv-modules.cache %dir %{_prefix}/%{_lib}/audit %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 %license COPYING COPYING.LIB LICENSES %files common %{_bindir}/gencat %{_bindir}/getconf %{_bindir}/getent %{_bindir}/iconv %{_bindir}/ld.so %{_bindir}/ldd %{_bindir}/locale %{_bindir}/localedef %{_bindir}/pldd %{_bindir}/sotruss %{_bindir}/sprof %{_bindir}/tzselect %{_bindir}/zdump %{_sbindir}/zic %dir /usr/share/i18n %dir /usr/share/i18n/charmaps %dir /usr/share/i18n/locales /usr/share/locale/locale.alias %dir %{_prefix}/lib/locale %dir %{_prefix}/lib/locale/C.utf8 %{_prefix}/lib/locale/C.utf8/* %files all-langpacks %{_prefix}/lib/locale %{_prefix}/lib/locale/locale-archive %{_prefix}/lib/locale/locale-archive.real %{_prefix}/share/locale/*/LC_MESSAGES/libc.mo %exclude %{_prefix}/lib/locale/C.utf8 %exclude %{_prefix}/lib/locale/zh* %exclude %{_prefix}/lib/locale/en* %exclude %{_prefix}/share/locale/zh* %exclude %{_prefix}/share/locale/en* %files minimal-langpack %files langpack-en %dir %{_prefix}/lib/locale %{_prefix}/lib/locale/en* %{_prefix}/share/locale/en_*/LC_MESSAGES/libc.mo %files langpack-zh %dir %{_prefix}/lib/locale %{_prefix}/lib/locale/zh* %{_prefix}/share/locale/zh_*/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 devel %ifnarch loongarch64 /usr/lib64/libanl.a %endif /usr/lib64/libc_nonshared.a /usr/lib64/libdl.a /usr/lib64/libg.a /usr/lib64/libmcheck.a /usr/lib64/libpthread.a /usr/lib64/librt.a /usr/lib64/libutil.a /usr/lib64/Mcrt1.o /usr/lib64/Scrt1.o /usr/lib64/crt1.o /usr/lib64/crti.o /usr/lib64/crtn.o /usr/lib64/gcrt1.o %ifnarch riscv64 /usr/lib64/grcrt1.o /usr/lib64/rcrt1.o %endif /usr/lib64/libBrokenLocale.so %ifnarch loongarch64 /usr/lib64/libanl.so %endif /usr/lib64/libc.so /usr/lib64/libm.so /usr/lib64/libresolv.so /usr/lib64/libthread_db.so /usr/include/*.h %dir /usr/include/arpa /usr/include/arpa/*.h %dir /usr/include/bits /usr/include/bits/*.h /usr/include/bits/stab.def %dir /usr/include/bits/types /usr/include/bits/types/*.h %dir /usr/include/finclude /usr/include/finclude/math-vector-fortran.h %dir /usr/include/gnu /usr/include/gnu/*.h %dir /usr/include/net /usr/include/net/*.h %dir /usr/include/netash /usr/include/netash/ash.h %dir /usr/include/netatalk /usr/include/netatalk/at.h %dir /usr/include/netax25 /usr/include/netax25/ax25.h %dir /usr/include/neteconet /usr/include/neteconet/ec.h %dir /usr/include/netinet /usr/include/netinet/*.h %dir /usr/include/netipx /usr/include/netipx/ipx.h %dir /usr/include/netiucv /usr/include/netiucv/iucv.h %dir /usr/include/netpacket /usr/include/netpacket/packet.h %dir /usr/include/netrom /usr/include/netrom/netrom.h %dir /usr/include/netrose /usr/include/netrose/rose.h %dir /usr/include/nfs /usr/include/nfs/nfs.h %dir /usr/include/protocols /usr/include/protocols/routed.h /usr/include/protocols/rwhod.h /usr/include/protocols/talkd.h /usr/include/protocols/timed.h %dir /usr/include/rpc /usr/include/rpc/netdb.h %dir /usr/include/scsi /usr/include/scsi/scsi.h /usr/include/scsi/scsi_ioctl.h /usr/include/scsi/sg.h %dir /usr/include/sys /usr/include/sys/*.h %ifarch x86_64 /usr/lib64/libmvec.so %dir /usr/include/sys/platform /usr/include/sys/platform/*.h %dir /usr/include/bits/platform /usr/include/bits/platform/*.h %endif %if %{with docs} %files doc /usr/share/info/libc.info-* /usr/share/info/libc.info.* %dir /usr/share/doc %dir /usr/share/doc/glibc /usr/share/doc/glibc/rtld-debugger-interface.txt %endif %files static %{_libdir}/libBrokenLocale.a %{_libdir}/libc.a %{_libdir}/libm.a %{_libdir}/libresolv.a %ifarch x86_64 %{_libdir}/libm-%{version}.a %{_libdir}/libmvec.a %endif %files utils %if %{without bootstrap} %{_bindir}/memusage %{_bindir}/memusagestat %endif %{_bindir}/mtrace %{_bindir}/pcprofiledump %{_bindir}/xtrace %files gconv-extra %verify(not md5 size mtime) %config(noreplace) /usr/lib64/gconv/gconv-modules.d/gconv-modules-extra.conf /usr/lib64/gconv/*.so %exclude /usr/lib64/gconv/{ANSI_X3.110,CP1252,ISO8859-1,ISO8859-15,UNICODE,UTF-16,UTF-32,UTF-7}.so %files -n nss_db /var/db/Makefile /lib64/libnss_db.so.2 %{_bindir}/makedb %files -n nss_hesiod /lib64/libnss_hesiod.so.2 %doc hesiod/README.hesiod %files nss-devel %{_libdir}/libnss_compat.so %{_libdir}/libnss_db.so %{_libdir}/libnss_hesiod.so %ifnarch loongarch64 %files -n libnsl /lib64/libnsl.so.1 %endif %if %{with benchtests} %files benchtests /usr/libexec/glibc-benchtests/* %endif %files -n compat-libpthread-nonshared %{_libdir}/libpthread_nonshared.a %changelog * Wed Nov 08 2023 U2FsdGVkX1 - 2.36-13 - Add riscv64 support * Tue Oct 24 2023 Peng Fan - 2.36-12 - LoongArch: Not provided libanl, libnsl and libutil by LoongArch. * Thu Oct 11 2023 Peng Fan - 2.36-11 - LoongArch: Ignore kernel version checks. - Temporarily not pack libanl.so and libutil.so in LoongArch. * Wed Oct 04 2023 Funda Wang - 2.36-10 - fix CVE-2023-4527, CVE-2023-4806, CVE-2023-5156, CVE-2023-4911 * Tue Aug 15 2023 Funda Wang - 2.36-9 - Add patch for gb18030-2022 from upstream bug#30243 - Correctly move langpack-cmn into langpack-zh * Tue Aug 8 2023 Peng Fan - 2.36-8 - LoongArch: backport from upstream. - upstream commit: eaa5b1cce87d34c945955360b1e519c6994308a1 * Fri Apr 14 2023 Chunmei Xu - 2.36-7 - optimise spec file * Tue Mar 28 2023 mgb01105731 - 2.36-6 - Del Specific Fields * Wed Feb 22 2023 Chunmei Xu - 2.36-5 - recover to provide glibc-minimal-langpack * Wed Feb 22 2023 Chunmei Xu - 2.36-4 - remove glibc-minimal-langpack - add glibc-langpack-en/zh as suggests for glibc * Thu Jan 5 2023 Chunmei Xu - 2.36-3 - sync patches from 2.36 release branch, upstream commit 4f4d7a13edfd2fdc57c9d76e1fd6d017fb47550c - move glibc-langpack-xxx subpackage to glibc-all-langpacks except glibc-langpack-en/zh * Thu Sep 1 2022 Chunmei Xu - 2.36-2 - sync patches from 2.36 release branch - upstream commit: b3736d1a3c60a3ec9959bf3b38794958546bf6a2 * Thu Aug 04 2022 Chunmei Xu - 2.36-1 - rebase to 2.36 * Mon Jul 11 2022 Weisson - 2.35-2 - Add support for 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. * Tue Feb 22 2022 Chunmei Xu - 2.35-1 - upstream 2.35 release tarball and add patches from release/2.35/master