# :- tags for glibc main package %define glibcversion 2.33_tmb_WIP_NO_release_or_selinux_allowed_yet %define __glibcrelease 2 %define glibcepoch 6 %define source_package glibc-%{glibcversion} %define source_dir glibc-%{glibcversion} %define _glibcrelease %{__glibcrelease} %define glibcrelease %mkrel %{_glibcrelease} # Define "cross" to an architecture to which glibc is to be # cross-compiled %define build_cross 0 %{expand: %{?cross: %%global build_cross 1}} %if %{build_cross} %define target_cpu %{cross} %define cross_prefix cross-%{target_cpu}- %define _prefix /usr/%{target_cpu}-%{_real_vendor}-linux%{gnuext} %define cross_program_prefix %{target_cpu}-%{_real_vendor}-linux%{gnuext}- %define _exec_prefix %{_prefix} # brain damage alert: should not be needed imho # overriding _prefix and _exec_prefix should be enough %define _bindir %{_exec_prefix}/bin %define _sbindir %{_exec_prefix}/sbin %define _libexecdir %{_exec_prefix}/libexec %define _datadir %{_prefix}/share %define _sharedstatedir %{_prefix}/com %define _localstatedir %{_prefix}/var %define _lib lib %define _libdir %{_exec_prefix}/%{_lib} %define _slibdir %{_exec_prefix}/%{_lib} %define _slibdir32 %{_exec_prefix}/lib %define _includedir %{_prefix}/include %else %define gnuext %{_gnu} %define target_cpu %{_target_cpu} %define cross_prefix %{nil} %define cross_program_prefix %{nil} %define _slibdir /%{_lib} %define _slibdir32 /lib %endif # Define target (base) architecture %define arch %(echo %{target_cpu}|sed -e "s/\\(i.86\\|athlon\\)/i386/" -e "s/amd64/x86_64/") %define isarch() %(case " %* " in (*" %{arch} "*) echo 1;; (*) echo 0;; esac) %if %{build_cross} %if %isarch %arm %define gnuext -gnueabi %else %define gnuext -gnu %endif %endif # Define Xen arches to build with -mno-tls-direct-direct-seg-refs %define xenarches %{ix86} x86_64 # arches which requires glibc-port %define ports_arch %arm # Define to build nscd with selinux support %define build_selinux 0 # Flag for build_pdf_doc: # 1 build glibc with PDF documentation # 0 don't build PDF glibc documentation (e.g. for bootstrap build) %define build_pdf_doc 0 # Enable checking by default for arches where we know tests all pass %define build_check 0 # Allow make check to fail only when running kernels where we know # tests must pass (no missing features or bugs in the kernel) %define check_min_kver 2.6.32 # Define to build a biarch package %define build_biarch 0 %if %isarch x86_64 %define build_biarch 1 %endif # build debug packages %define build_debug 1 # Define to bootstrap new glibc %define build_bootstrap 0 %{expand: %{!?build_cross_bootstrap: %global build_cross_bootstrap 0}} %define build_profile 1 %define build_nscd 1 %define build_doc 1 %define build_utils 1 %define build_i18ndata 1 %define build_timezone 0 # Disable a few defaults when cross-compiling a glibc %if %{build_cross} %define build_doc 0 %define build_pdf_doc 0 %define build_biarch 0 %define build_check 0 %define build_nscd 0 %define build_profile 0 %define build_utils 0 %define build_i18ndata 0 %define build_timezone 0 %endif # Allow --with[out] at rpm command line build %{expand: %{?_without_PDF: %%global build_pdf_doc 0}} %{expand: %{?_without_CHECK: %%global build_check 0}} %{expand: %{?_without_UTILS: %%global build_utils 0}} %{expand: %{?_without_BOOTSTRAP:%%global build_bootstrap 0}} %{expand: %{?_with_PDF: %%global build_pdf_doc 1}} %{expand: %{?_with_CHECK: %%global build_check 1}} %{expand: %{?_with_UTILS: %%global build_utils 1}} %{expand: %{?_with_BOOTSTRAP: %%global build_bootstrap 1}} Summary: The GNU libc libraries Name: %{cross_prefix}glibc Version: %{glibcversion} Release: %{glibcrelease} Epoch: %{glibcepoch} License: LGPL Group: System/Libraries Url: https://www.gnu.org/software/libc/ # FSF source Source0: https://ftpmirror.gnu.org/libc/%{source_package}.tar.xz Source1: https://ftpmirror.gnu.org/libc/%{source_package}.tar.xz.sig Source2: glibc-git.sh Source4: glibc-find-requires.sh Source5: glibc-check.sh Source6: nscd.service Source7: nscd.socket Source8: nsswitch.conf Source9: nscd.conf # wrapper to avoid rpm circular dependencies Source14: glibc-post-wrapper.c %if %{build_cross} Autoreq: false Autoprov: false %else Provides: should-restart = system %if %isarch %{xenarches} Obsoletes: %{name}-xen Provides: %{name}-xen %endif # The dynamic linker supports DT_GNU_HASH Provides: rtld(GNU_HASH) Autoreq: false %endif BuildRequires: bison >= 3.3.1-1 BuildRequires: patch BuildRequires: gettext BuildRequires: perl BuildRequires: kernel-userspace-headers BuildRequires: libstdc++-static-devel BuildRequires: hardlink %if %{build_selinux} BuildRequires: pkgconfig(libselinux) >= 1.17.10 BuildRequires: pkgconfig(libpcre) >= 8.44 %endif # (tmb) force new gcc 10.2 BuildRequires: %{cross_prefix}gcc >= 10.2.1-0.20210130.1 # (tmb) force latest binutils BuildRequires: %{cross_prefix}binutils >= 1:2.36.1-2 # we need the static dash %define ash_bin /usr/bin/dash.static Requires(post): dash-static Requires(post): grep Requires: filesystem >= 2.1.9-18 # ensure libxcrypt is installed as glibc crypt is disabled / being obsoleted Requires: %{_lib}xcrypt1 >= 4.1.1-1 BuildRequires: systemtap-sdt-devel BuildRequires: texinfo BuildRequires: texinfo-tex %if %{build_pdf_doc} BuildRequires: texlive %endif %if %{build_utils} BuildRequires: pkgconfig(gdlib) %endif BuildRequires: autoconf2.5 BuildRequires: pkgconfig(libcap) BuildRequires: rpm-mageia-setup-build >= 1.147 BuildRequires: spec-helper >= 0.31.2 ### ### upstream release/2.33/master branch ### git format-patch --start-number 200 glibc-2.33..origin/release/2.33/master ### Patch200: 0200-nsswitch-return-result-when-nss-database-is-locked-B.patch Patch201: 0201-tunables-Simplify-TUNABLE_SET-interface.patch Patch202: 0202-x86-Use-SIZE_MAX-instead-of-long-int-1-for-tunable-r.patch Patch203: 0203-tunables-Disallow-negative-values-for-some-tunables.patch Patch204: 0204-S390-Add-new-hwcap-values.patch Patch205: 0205-string-Work-around-GCC-PR-98512-in-rawmemchr.patch ### ### upstream master branch ### starts from number 300 ### Patch300: 0300-nscd-Fix-double-free-in-netgroupcache-BZ-27462.patch Patch301: 0301-nss-Re-enable-NSS-module-loading-after-chroot-BZ-273.patch ### ### Mageia patches ### # make "localedef --add-to-archive" to follow symlink # safe to send ustream, need to be kept for locales Patch00: glibc-2.17-localedef-archive-follow-symlinks.patch # various path fix, according to usrmove Patch01: glibc-2.17-fhs-usrmove.patch Patch06: glibc-2.26-share-locale.patch # use xvt instead of xterm in xtrace.sh # cannot be pushed upstream as xvt is Ma* specific Patch09: glibc-2.2.4-xterm-xvt.patch # add transliteration for "COLON SIGN" # ( used for the money of money of san salvador ) Patch11: glibc-2.19-compat-EUR-currencies.patch # fix the chkconfig header, should be sent upstream Patch13: glibc-2.3.3-nscd-enable.patch # disable cache for hosts on nscd, as this is seen as insecure # if the system relie on reverse dns for security Patch14: glibc-2.9-nscd-no-host-cache.patch # add some new timezone for various cities # Halifax, Montreal, Johannesburg # should be sent upstream ( I guess ) Patch23: glibc-2.3.4-timezone.patch Patch24: glibc-2.10.1-biarch-cpp-defines.patch Patch29: glibc-2.3.5-biarch-utils.patch # translation fixes, need to be checked with some i18n team member # should be safe to send upstream once checked Patch35: glibc-2.16.0-force-gb18030-for-zh_CN.patch # disable parallel testsuite of rt on powerpc with SMT Patch38: glibc-2.18-testsuite-rt-notparallel.patch # Add C.UTF-8 locale into /usr/lib/locale/ Patch59: glibc-c-utf8-locale.patch # check for libcap, even if selinux is disabled # should be sent upstream Patch44: glibc-2.26-dont-tie-libcap-with-selinux.patch # Determine minium kernel versions %define enablekernel 3.2 Conflicts: kernel < %{enablekernel} # People changed location of rpm scripts... %define rpmscripts /usr/lib/rpm/%{_real_vendor} # Don't try to explicitly provide GLIBC_PRIVATE versioned libraries %define __find_provides %{_builddir}/%{source_dir}/find_provides.sh %define __find_requires %{_builddir}/%{source_dir}/find_requires.sh %if !%{build_cross} Obsoletes: ld.so Provides: ld.so %endif Obsoletes: ldconfig Provides: ldconfig = %{glibcepoch}:%{glibcversion}-%{glibcrelease} /sbin/ldconfig # obsolete nss_db as it got merged again in 2.15 Obsoletes: nss_db <= 2.2.3-0.pre1.9 %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. The glibc package also contains national language (locale) support. This package now also provides ldconfig which was package seperately in the past. Ldconfig is a basic system program which determines run-time link bindings between ld.so and shared libraries. Ldconfig scans a running system and sets up the symbolic links that are used to load shared libraries properly. It also creates a cache (/etc/ld.so.cache) which speeds the loading of programs which use shared libraries. %package devel Summary: Header and object files for development using standard C libraries Group: Development/C Requires(post): coreutils Requires(postun): coreutils, awk # ensure libxcrypt is installed as glibc crypt is disabled / being obsoleted Requires: %{_lib}xcrypt-devel >= 4.1.1-1 # (tmb) filter out requires on self-provides %global __requires_exclude devel\\(libm.*\\) # (tmb) add virtual provides for old libm to ease builds... from glibc-2.22 libmvec is preferred %ifarch x86_64 Provides: devel(libm(64bit)) %endif Requires: %{name} = %{glibcepoch}:%{glibcversion}-%{glibcrelease} %if !%{build_cross} Requires: linux-userspace-headers %endif %if %{build_cross} Autoreq: false Autoprov: false %else Autoreq: true %endif %description devel The glibc-devel package contains the header and 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 header and object files available in order to create the executables. This package also includes the C header files for the Linux kernel. The header files define structures and constants that are needed for building most standard programs. The header files are also needed for rebuilding the kernel. Install glibc-devel if you are going to develop programs which will use the standard C libraries. %package static-devel Summary: Static libraries for GNU C library Group: Development/C Requires: %{name}-devel = %{glibcepoch}:%{glibcversion}-%{glibcrelease} # ensure libxcrypt is installed as glibc crypt is disabled / being obsoleted Requires: %{_lib}xcrypt-static-devel >= 4.1.1-1 %description static-devel The glibc-static-devel package contains the static libraries necessary for developing programs which use the standard C libraries. Install glibc-static-devel if you need to statically link your program or library. %package profile Summary: The GNU libc libraries, including support for gprof profiling Group: Development/C Obsoletes: libc-profile Provides: libc-profile = %{glibcversion}-%{glibcrelease} Autoreq: true %description profile The glibc-profile package includes the GNU libc libraries and support for profiling using the gprof program. Profiling is analyzing a program's functions to see how much CPU time they use and determining which functions are calling other functions during execution. To use gprof to profile a program, your program needs to use the GNU libc libraries included in glibc-profile (instead of the standard GNU libc libraries included in the glibc package). If you are going to use the gprof program to profile a program, you'll need to install the glibc-profile program. %package -n nscd Summary: A Name Service Caching Daemon (nscd) Group: System/Servers Requires(post): systemd >= %{systemd_required_version} Requires(post): rpm-helper >= 0.24.8-1 Requires(preun): rpm-helper >= 0.24.8-1 Autoreq: true %description -n nscd Nscd caches name service lookups and can dramatically improve performance with NIS+, and may help with DNS as well. Note that you can't use nscd with 2.0 kernels because of bugs in the kernel-side thread support. Unfortunately, nscd happens to hit these bugs particularly hard. Install nscd if you need a name service lookup caching daemon, and you're not using a version 2.0 kernel. %package utils Summary: Development utilities from GNU C library Group: Development/Other Requires: %{name} = %{glibcepoch}:%{glibcversion}-%{glibcrelease} %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 %{build_i18ndata} %package i18ndata Summary: Database sources for 'locale' Group: System/Libraries %description i18ndata This package contains the data needed to build the locale data files to use the internationalization features of the GNU libc. %endif %if %{build_timezone} %package -n timezone Summary: Time zone descriptions Group: System/Base %description -n timezone These are configuration files that describe possible time zones. %endif ### glibc core "debuginfo and debugsource" sub-packages %if %{build_debug} %define debug_package %{nil} %define __debug_install_post %{nil} %global __debug_package 1 # Disable thew new features that glibc packages don't use. %undefine _debugsource_packages %undefine _debuginfo_subpackages %undefine _unique_debug_names %undefine _unique_debug_srcs %package debuginfo Summary: Debug information for package %{name} Group: Development/Debug AutoReqProv: no %description debuginfo This package provides debug information for package %{name}. Debug information is useful when developing applications that use this package or when debugging this package. %package debugsource Summary: Debug source for package %{name} Group: Development/Debug AutoReqProv: no %description debugsource This package provides debug source for %{name} %endif %package doc Summary: GNU C library documentation Group: Development/Other BuildArch: noarch %description doc The glibc-doc package contains documentation for the GNU C library in info format. %if %{build_pdf_doc} %package doc-pdf Summary: GNU C library documentation Group: Development/Other BuildArch: noarch %description doc-pdf The glibc-doc-pdf package contains the printable documentation for the GNU C library in PDF format. %endif %prep %setup -q -n %{source_dir} %autopatch -p1 %if %{build_selinux} # XXX kludge to build nscd with selinux support as it added -nostdinc # so /usr/include/selinux is not found ln -s %{_includedir}/selinux selinux %endif find . -type f -size 0 -o -name "*.orig" -exec rm -f {} \; # \\(Anssi 03/2008\\) FIXME: use __provides_exclude cat > find_provides.sh << EOF #!/bin/sh %{rpmscripts}/find-provides | grep -v GLIBC_PRIVATE exit 0 EOF chmod +x find_provides.sh cat > find_requires.bootstrap.sh << EOF /bin/sh %{SOURCE4} %{buildroot} %{_target_cpu} | grep -v "\(GLIBC_PRIVATE\|linux-gate\|linux-vdso\)" exit 0 EOF chmod +x find_requires.bootstrap.sh # XXX: use better way later to avoid LD_LIBRARY_PATH issue cat %{rpmscripts}/find-requires | sed '/.*LD_LIBRARY_PATH.*/d;' > find_requires chmod +x find_requires # \\(Anssi 03/2008\\) FIXME: use __requires_exclude cat > find_requires.noprivate.sh << EOF %{_builddir}/%{source_dir}/find_requires %{buildroot} %{_target_cpu} | \ grep -v GLIBC_PRIVATE exit 0 EOF chmod +x find_requires.noprivate.sh # FIXME: fix system rpm find-requires to use the prefix cross version %if %{build_bootstrap} || "%{_target_cpu}" != "%{target_cpu}" ln -s find_requires.bootstrap.sh find_requires.sh %else ln -s find_requires.noprivate.sh find_requires.sh %endif # Remove patch backups from files we ship in glibc packages rm -fr ChangeLog.old rm -f localedata/locales/{???_??,??_??}.* rm -f localedata/locales/[a-z_]*.* %build # Prepare test matrix in the next function CheckList=$PWD/Check.list rm -f $CheckList touch $CheckList # # CompareKver # function to compare the desired kernel version with running kernel # version (package releases not taken into account in comparison). The # function returns: # -1 = is lesser than current running kernel # 0 = is equal to the current running kernel # 1 = is greater than current running kernel # function CompareKver() { v1=`echo $1 | sed 's/\.\?$/./'` v2=`uname -r | sed 's/[^.0-9].*//' | sed 's/\.\?$/./'` n=1 s=0 while true; do c1=`echo "$v1" | cut -d "." -f $n` c2=`echo "$v2" | cut -d "." -f $n` if [ -z "$c1" -a -z "$c2" ]; then break elif [ -z "$c1" ]; then s=-1 break elif [ -z "$c2" ]; then s=1 break elif [ "$c1" -gt "$c2" ]; then s=1 break elif [ "$c2" -gt "$c1" ]; then s=-1 break fi n=$((n + 1)) done echo $s } # # BuildGlibc [+] # function BuildGlibc() { arch="$1" shift 1 # PowerPC CPU add-on case $arch in cpu-addon,*) cpu=` echo "$arch" | sed -n "/.*,\([^,]*\),.*$/s//\1/p"` arch=`echo "$arch" | sed -n "/.*,.*,\([^,]*\)$/s//\1/p"` ;; *) cpu=$arch ;; esac # Select optimization flags and compiler to use BuildAltArch="no" BuildCompFlags="" BuildFlags="" case $arch in i[3456]86 | athlon) BuildFlags="-march=$arch -mtune=generic" if [[ "`uname -m`" = "x86_64" ]]; then BuildAltArch="yes" BuildCompFlags="-m32" fi ;; x86_64) BuildFlags="-mtune=generic" ;; armv4t*) BuildFlags="-march=armv4t" BuildCompFlags="-march=armv4t" ;; armv5t*) BuildFlags="-march=armv5t" BuildCompFlags="-march=armv5t" ;; # to check armv7h*) BuildFlags="-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16" BuildCompFlags="-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16" ;; esac # Choose multiarch support MultiArchFlags= case $arch in i686 | x86_64) MultiArchFlags="--enable-multi-arch" ;; esac # Determine C & C++ compilers BuildCC="%{__cc} $BuildCompFlags" BuildCXX="%{__cxx} $BuildCompFlags" # Are we supposed to cross-compile? if [[ "%{target_cpu}" != "%{_target_cpu}" ]]; then # Can't use BuildCC anymore with previous changes. BuildCC="%{cross_program_prefix}gcc $BuildCompFlags" BuildCXX="%{cross_program_prefix}g++ $BuildCompFlags" BuildCross="--build=%{_target_platform}" export libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes fi BuildFlags="$BuildFlags -DNDEBUG=1 -O2 -finline-functions -g" # Do not use direct references against %gs when accessing tls data # XXX make it the default in GCC? (for other non glibc specific usage) case $arch in i[3456]86 | x86_64) BuildFlags="$BuildFlags -mno-tls-direct-seg-refs" ;; esac # Arch specific compilation flags if [[ "$arch" = "ppc64" ]]; then BuildFlags="$BuildFlags -fno-inline-functions -mno-minimal-toc" fi # Extra configure flags ExtraFlags= if [[ "%{build_profile}" != "0" ]]; then ExtraFlags="$ExtraFlags --enable-profile" fi # NPTL+TLS are now the default # check for other arches %if %isarch %ports_arch Pthreads="ports nptl" %else Pthreads="nptl" %endif # Add-ons AddOns="libidn" if [[ "$cpu" != "$arch" ]]; then AddOns="$AddOns,powerpc-cpu" BuildFlags="$BuildFlags -mcpu=$cpu" ExtraFlags="$ExtraFlags --with-cpu=$cpu" fi # Build with selinux support? %if %{build_selinux} SElinuxFlags="--with-selinux" %else SElinuxFlags="--without-selinux" %endif # Kernel headers directory KernelHeaders=%{_includedir} # Determine library name glibc_cv_cc_64bit_output=no if echo ".text" | $BuildCC -c -o test.o -xassembler -; then case `/usr/bin/file test.o` in *"ELF 64"*) glibc_cv_cc_64bit_output=yes ;; esac fi rm -f test.o # Force a separate and clean object dir rm -rf build-$cpu-linux mkdir build-$cpu-linux pushd build-$cpu-linux [[ "$BuildAltArch" = "yes" ]] && touch ".alt" || touch ".main" CC="$BuildCC" CXX="$BuildCXX" CFLAGS="$BuildFlags -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -Wno-maybe-uninitialized" ../configure \ $arch-%{_real_vendor}-linux%{gnuext} $BuildCross \ --prefix=%{_prefix} \ --libexecdir=%{_prefix}/libexec \ --infodir=%{_infodir} \ --enable-add-ons="$AddOns" --without-cvs \ $ExtraFlags $MultiArchFlags $SElinuxFlags \ --enable-kernel=%{enablekernel} \ --with-headers=$KernelHeaders ${1+"$@"} \ --enable-systemtap \ --disable-crypt %make_build -r -s popd # All tests are expected to pass on certain platforms, depending also # on the version of the kernel running case $arch in athlon | ia64 | ppc | ppc64) if [ "`CompareKver %{check_min_kver}`" -lt 0 ]; then check_flags="" else check_flags="-k" fi ;; *) check_flags="-k" ;; esac # Generate test matrix [[ -d "build-$arch-linux" ]] || { echo "ERROR: PrepareGlibcTest: build-$arch-linux does not exist!" return 1 } local BuildJobs="-j`getconf _NPROCESSORS_ONLN`" echo "$BuildJobs -d build-$arch-linux $check_flags" >> $CheckList case $cpu in i686|athlon) base_arch=i586;; power*) base_arch=$arch;; *) base_arch=none;; esac [[ -d "build-$base_arch-linux" ]] && { check_flags="$check_flags -l build-$base_arch-linux/elf/ld.so" echo "$BuildJobs -d build-$arch-linux $check_flags" >> $CheckList } return 0 } # Build main glibc BuildGlibc %{target_cpu} %if %{build_biarch} %if %isarch x86_64 BuildGlibc i686 %endif %endif # Build i686 libraries if not already building for i686/athlon case %{target_cpu} in i686 | athlon) ;; i[3-6]86) # BuildGlibc i686 --disable-profile ;; esac %if %{build_check} export TMPDIR=/tmp export TIMEOUTFACTOR=16 Check="$PWD/glibc-check.sh" cat %{SOURCE5} > $Check chmod +x $Check while read arglist; do $Check $arglist || exit 1 done < $CheckList %endif %install # force use of _NPROCESSORS_ONLN jobs since RPM_BUILD_NCPUS could be # greater for icecream BuildJobs="-j`getconf _NPROCESSORS_ONLN`" make install_root=%{buildroot} install -C build-%{target_cpu}-linux %if %{build_i18ndata} (cd build-%{target_cpu}-linux; make $BuildJobs -C ../localedata objdir=`pwd` \ install_root=%{buildroot} \ install-locales ) install -m 0644 localedata/SUPPORTED %{buildroot}/%{_datadir}/i18n/ %endif # Empty filelist for non i686/athlon targets > extralibs.filelist # Install biarch libraries %if %{build_biarch} %if %isarch x86_64 ALT_ARCHES=i686-linux %endif for ALT_ARCH in $ALT_ARCHES; do mkdir -p %{buildroot}/$ALT_ARCH make install_root=%{buildroot}/$ALT_ARCH install -C build-$ALT_ARCH # Dispatch */lib only LIB=/lib %if !%{build_cross} mv %{buildroot}/$ALT_ARCH/$LIB %{buildroot}/$LIB mv %{buildroot}/$ALT_ARCH%{_prefix}/libexec/getconf/* \ %{buildroot}%{_prefix}/libexec/getconf/ [ ! -d %{buildroot}/%{_prefix}/$LIB/ ] && mkdir -p %{buildroot}/%{_prefix}/$LIB/ mv %{buildroot}/$ALT_ARCH/%{_prefix}/$LIB/* %{buildroot}/%{_prefix}/$LIB/ %else mv %{buildroot}/$ALT_ARCH/%{_prefix}/lib %{buildroot}/$LIB sed -i %{buildroot}/$LIB/libc.so -e "s!%{_slibdir}!$LIB!g" %endif rm -rf %{buildroot}/$ALT_ARCH # XXX Dispatch 32-bit stubs (sed '/^@/d' include/stubs-prologue.h; LC_ALL=C sort $(find build-$ALT_ARCH -name stubs)) \ > %{buildroot}%{_includedir}/gnu/stubs-32.h done %endif # Install extra glibc libraries function InstallGlibc() { local BuildDir="$1" local SubDir="$2" local LibDir="$3" case $BuildDir in *) Pthreads=nptl ;; esac [[ -z "$LibDir" ]] && LibDir="%{_slibdir}" pushd $BuildDir mkdir -p %{buildroot}$LibDir/$SubDir/ install -m755 libc.so %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/libc-*.so` ln -sf `basename %{buildroot}$LibDir/libc-*.so` %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/libc.so.*` install -m755 math/libm.so %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/libm-*.so` ln -sf `basename %{buildroot}$LibDir/libm-*.so` %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/libm.so.*` install -m755 $Pthreads/libpthread.so %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/libpthread-*.so` ln -sf `basename %{buildroot}$LibDir/libpthread-*.so` %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/libpthread.so.*` install -m755 ${Pthreads}_db/libthread_db.so %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/libthread_db-*.so` ln -sf `basename %{buildroot}$LibDir/libthread_db-*.so` %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/libthread_db.so.*` install -m755 rt/librt.so %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/librt-*.so` ln -sf `basename %{buildroot}$LibDir/librt-*.so` %{buildroot}$LibDir/$SubDir/`basename %{buildroot}$LibDir/librt.so.*` echo "%dir $LibDir/$SubDir" >> ../extralibs.filelist find %{buildroot}$LibDir/$SubDir -maxdepth 1 -type f -o -type l | sed -e "s|%{buildroot}||" >> ../extralibs.filelist popd } # Install arch-specific optimized libraries %if %isarch %{ix86} case %{target_cpu} in i[3-5]86) # InstallGlibc build-i686-linux i686 ;; esac %endif # Remove the files we don't want to distribute rm -f %{buildroot}%{_libdir}/libNoVersion* rm -f %{buildroot}%{_slibdir}/libNoVersion* %if "%{name}" == "glibc" install -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/nsswitch.conf %endif # This is for ncsd - in glibc 2.2 %if %{build_nscd} install -m 644 nscd/nscd.conf %{buildroot}%{_sysconfdir} install -d -m 755 %{buildroot}%{_unitdir} install -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/nscd.service install -m 644 %{SOURCE7} %{buildroot}%{_unitdir}/nscd.socket install -D -m 644 %{SOURCE9} %{buildroot}%{_tmpfilesdir}/nscd.conf install -d -m 755 %{buildroot}%{_var}/db/nscd %endif # Useless and takes place rm -rf %buildroot/%{_datadir}/zoneinfo/{posix,right} # Include ld.so.conf %if "%{name}" == "glibc" echo "include /etc/ld.so.conf.d/*.conf" > %{buildroot}%{_sysconfdir}/ld.so.conf chmod 644 %{buildroot}%{_sysconfdir}/ld.so.conf mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d # ldconfig cache mkdir -p %{buildroot}%{_var}/cache/ldconfig touch %{buildroot}%{_var}/cache/ldconfig/aux-cache %endif # Include %{_libdir}/gconv/gconv-modules.cache > %{buildroot}%{_libdir}/gconv/gconv-modules.cache chmod 644 %{buildroot}%{_libdir}/gconv/gconv-modules.cache %if "%{name}" == "glibc" touch %{buildroot}%{_sysconfdir}/ld.so.cache %endif # Are we cross-compiling? Strip="strip" if [[ "%{_target_cpu}" != "%{target_cpu}" ]]; then Strip="%{cross_program_prefix}$Strip" fi # Strip debugging info from all static libraries pushd %{buildroot}%{_slibdir} for i in *.a; do if [ -f "$i" ]; then case "$i" in *_p.a) ;; *) $Strip -g -R .comment $i ;; esac fi done popd pushd %{buildroot}%{_libdir} for i in libc_nonshared.a; do if [ -f "$i" ]; then $Strip -g -R .comment $i fi done popd # post install wrapper %__cc -Os -g %{SOURCE14} -static \ -o "%{buildroot}%{_sbindir}/glibc-post-wrapper" \ -L "%{buildroot}%{_libdir}/" \ '-DSLIBDIR="%{_slibdir}"' \ '-DGCONV_DIR="%{_libdir}/gconv"' chmod 700 %{buildroot}%{_sbindir}/glibc-post-wrapper # rquota.x and rquota.h are now provided by quota rm -f %{buildroot}%{_includedir}/rpcsvc/rquota.[hx] # Hardlink identical locale files together %if %{build_i18ndata} %{_bindir}/hardlink -vc %{buildroot}%{_datadir}/locale %endif rm -rf %{buildroot}%{_includedir}/netatalk/ # Build file list for devel package find %{buildroot}%{_includedir} -type f -or -type l > devel.filelist find %{buildroot}%{_includedir} -type d | sed "s/^/%dir /" | \ grep -v "%{_libdir}/libnss1.*.so$" | \ grep -v "%{_includedir}$" | >> devel.filelist find %{buildroot}%{_libdir} -maxdepth 1 -name "*.so" -o -name "*.o" | egrep -v "(libmemusage.so|libpcprofile.so)" >> devel.filelist # biarch libs %if %{build_biarch} find %{buildroot}%{_prefix}/lib -maxdepth 1 -name "*.so" -o -name "*.o" | egrep -v "(libmemusage.so|libpcprofile.so)" >> devel.filelist %endif perl -pi -e "s|%{buildroot}||" devel.filelist # /etc/localtime - we're proud of our timezone #Well we may put Paris %if %{build_timezone} rm -f %{buildroot}%{_sysconfdir}/localtime cp -f %{buildroot}%{_datadir}/zoneinfo/US/Eastern %{buildroot}%{_sysconfdir}/localtime #ln -sf ..%{_datadir}/zoneinfo/US/Eastern %{buildroot}%{_sysconfdir}/localtime %endif # [gg] build PDF documentation %if %{build_pdf_doc} (cd manual; texi2dvi -p -t @afourpaper -t @finalout libc.texinfo) %endif # Leave a compatibility symlink for the dynamic loader on armhfp targets, # at least until the world gets rebuilt %ifarch armv7hl ln -sf %{_slibdir}/ld-linux-armhf.so.3 %{buildroot}%{_slibdir}/ld-linux.so.3 %endif # Generate final rpm filelist, with localized libc.mo files rm -f rpm.filelist %if "%{name}" == "glibc" %find_lang libc perl -ne '/^\s*$/ or print' libc.lang > rpm.filelist %endif cat extralibs.filelist >> rpm.filelist # Remove unpackaged files rm -f %{buildroot}%{_infodir}/dir.old* rm -rf %{buildroot}%{_includedir}/asm-*/mach-*/ rm -f %{buildroot}%{_datadir}/locale/locale-archive* rm -f %{buildroot}%{_var}/db/Makefile %if !%{build_utils} %if %{build_biarch} rm -f %{buildroot}%{_slibdir32}/libmemusage.so rm -f %{buildroot}%{_slibdir32}/libpcprofile.so %endif rm -f %{buildroot}%{_slibdir}/libmemusage.so rm -f %{buildroot}%{_slibdir}/libpcprofile.so rm -f %{buildroot}%{_bindir}/memusage rm -f %{buildroot}%{_bindir}/memusagestat rm -f %{buildroot}%{_bindir}/mtrace rm -f %{buildroot}%{_bindir}/pcprofiledump rm -f %{buildroot}%{_bindir}/xtrace %endif %if !%{build_timezone} rm -f %{buildroot}%{_sysconfdir}/localtime rm -f %{buildroot}%{_bindir}/zdump rm -f %{buildroot}%{_sbindir}/zic rm -rf %{buildroot}%{_datadir}/zoneinfo %endif %if !%{build_i18ndata} rm -rf %{buildroot}%{_datadir}/i18n %endif %if "%{name}" != "glibc" rm -rf %{buildroot}/boot rm -rf %{buildroot}/sbin rm -rf %{buildroot}/usr/share rm -rf %{buildroot}%{_bindir} rm -rf %{buildroot}%{_sbindir} rm -rf %{buildroot}%{_datadir} rm -rf %{buildroot}%{_infodir} rm -rf %{buildroot}%{_prefix}/etc rm -rf %{buildroot}%{_libdir}/gconv %endif # In case we are cross-compiling, don't bother to remake symlinks and # fool spec-helper when stripping files %if "%{name}" != "glibc" export DONT_SYMLINK_LIBS=1 export PATH=%{_bindir}:$PATH %endif # This will make the '-g' argument to be passed to eu-strip for these # libraries, so that only debug symbols are stripped and gdb/valgrind continue # to work without needing glibc-debug package to be installed. export EXCLUDE_FROM_FULL_STRIP="ld-%{glibcversion}.so libpthread libc-%{glibcversion}.so" # If we are building a debug package then copy all of the static archives # into the debug directory to keep them as unstripped copies. %if %{build_debug} mkdir -p %{buildroot}%{_prefix}/lib/debug%{_libdir} cp -a %{buildroot}%{_libdir}/*.a \ %{buildroot}%{_prefix}/lib/debug%{_libdir}/ rm -f %{buildroot}%{_prefix}/lib/debug%{_libdir}/*_p.a %endif # Strip all of the installed object files. strip -g %{buildroot}%{_libdir}/*.o find_debuginfo_args='--strict-build-id -g -i' /usr/lib/rpm/find-debuginfo.sh $find_debuginfo_args -o debuginfo.filelist # List all of the *.a archives in the debug directory. list_debug_archives() { local dir=%{_prefix}/lib/debug%{_libdir} find %{buildroot}$dir -name "*.a" -printf "$dir/%%P\n" } # Remove some common directories from the common package debuginfo so that we # don't end up owning them. exclude_common_dirs() { exclude_dirs="%{_prefix}/src/debug" exclude_dirs="$exclude_dirs $(echo %{_prefix}/lib/debug{,/%{_lib},/bin,/sbin})" exclude_dirs="$exclude_dirs $(echo %{_prefix}/lib/debug%{_prefix}{,/%{_lib},/libexec,/bin,/sbin})" for d in $(echo $exclude_dirs | sed 's/ /\n/g'); do sed -i "\|^%%dir $d/\?$|d" $1 done } exclude_common_dirs debuginfo.filelist # remove debug source dir sed -i 's/\%{_prefix}\/src\/debug\/%{name}-%{version}//' debuginfo.filelist %if "%{name}" == "glibc" %post -p %{_sbindir}/glibc-post-wrapper # automatic ldconfig cache update on rpm installs/removals # (see http://www.rpm.org/wiki/FileTriggers) # FIXME: port to lua to remove circular dependency with grep %transfiletriggerin -p %{ash_bin} -P 2000000 -- /lib/ /lib64/ grep -F '.so.' | ldconfig -X %transfiletriggerin -p %{ash_bin} -P 2000000 -- /etc/ld.so.conf.d/ ldconfig -X %endif %if %{build_nscd} %pre -n nscd %_pre_useradd nscd / /bin/false %post -n nscd %_tmpfilescreate nscd %_post_service nscd %preun -n nscd %_preun_service nscd %postun -n nscd %_postun_userdel nscd if [ "$1" -ge "1" ]; then /sbin/service nscd condrestart > /dev/null 2>&1 || : fi %endif # # glibc # %files -f rpm.filelist %if "%{name}" == "glibc" %if %{build_timezone} %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/localtime %endif %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/nsswitch.conf %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/ld.so.conf %dir %{_sysconfdir}/ld.so.conf.d %config(noreplace) %{_sysconfdir}/rpc #doc nis/nss %doc posix/gai.conf %{_datadir}/locale/locale.alias /sbin/sln %dir %{_prefix}/libexec/getconf %{_prefix}/libexec/getconf/* %endif %{_slibdir}/ld-%{glibcversion}.so %if %isarch i386 %{_slibdir}/ld-linux.so.2 %endif %if %isarch %arm %if %isarch armv7hl %{_slibdir}/ld-linux-armhf.so.3 %endif %{_slibdir}/ld-linux.so.3 %endif %if %isarch x86_64 %{_slibdir}/ld-linux-x86-64.so.2 %endif %if %isarch aarch64 %{_slibdir}/ld-linux-aarch64.so.1 %endif %{_slibdir}/lib*-[.0-9]*.so %{_slibdir}/lib*.so.[0-9]* %{_slibdir}/libSegFault.so %if "%{name}" == "glibc" %dir %{_libdir}/audit %{_libdir}/audit/sotruss-lib.so %dir %{_libdir}/gconv %{_libdir}/gconv/*.so %{_libdir}/gconv/gconv-modules %ghost %{_libdir}/gconv/gconv-modules.cache %{_bindir}/catchsegv %{_bindir}/gencat %{_bindir}/getconf %{_bindir}/getent %{_bindir}/iconv %{_bindir}/ldd %if %isarch i386 %{_bindir}/lddlibc4 %endif %{_bindir}/locale %{_bindir}/localedef %{_bindir}/makedb %{_bindir}/pldd %{_bindir}/sotruss %{_bindir}/sprof %{_bindir}/tzselect %{_sbindir}/iconvconfig %{_sbindir}/glibc-post-wrapper %endif %if %isarch aarch64 %{_slibdir32}/ld-linux-aarch64.so.1 %endif %if %{build_biarch} %{_slibdir32}/ld-%{glibcversion}.so %{_slibdir32}/ld-linux*.so.2 %{_slibdir32}/lib*-[.0-9]*.so %{_slibdir32}/lib*.so.[0-9]* %{_slibdir32}/libSegFault.so %dir %{_prefix}/lib/audit %{_prefix}/lib/audit/sotruss-lib.so %dir %{_prefix}/lib/gconv %{_prefix}/lib/gconv/* %endif # # ldconfig # %if "%{name}" == "glibc" /sbin/ldconfig %ghost %{_sysconfdir}/ld.so.cache %dir %{_var}/cache/ldconfig %ghost %{_var}/cache/ldconfig/aux-cache %endif # # glibc-devel # %files devel -f devel.filelist %doc README NEWS INSTALL # (tmb) FIXME, figure out rpm doc breakage/change #doc COPYING COPYING.LIB #doc documentation/* #doc hesiod/README.hesiod #doc crypt/README.ufc-crypt %{_libdir}/libc_nonshared.a %{_libdir}/libg.a %{_libdir}/libmcheck.a %if %isarch x86_64 %{_libdir}/libm-%{glibcversion}.a %{_libdir}/libmvec.a %endif %if %{build_biarch} %{_prefix}/lib/libc_nonshared.a %{_prefix}/lib/libg.a %{_prefix}/lib/libmcheck.a %endif # # glibc-static-devel # %files static-devel %doc COPYING COPYING.LIB %{_libdir}/libBrokenLocale.a %{_libdir}/libanl.a %{_libdir}/libc.a %{_libdir}/libdl.a %{_libdir}/libm.a %{_libdir}/libpthread.a %{_libdir}/libresolv.a %{_libdir}/librt.a %{_libdir}/libutil.a %if %{build_biarch} %{_prefix}/lib/libBrokenLocale.a %{_prefix}/lib/libanl.a %{_prefix}/lib/libc.a %{_prefix}/lib/libdl.a %{_prefix}/lib/libm.a %{_prefix}/lib/libpthread.a %{_prefix}/lib/libresolv.a %{_prefix}/lib/librt.a %{_prefix}/lib/libutil.a %endif # # glibc-doc # %if %{build_doc} %files doc %{_infodir}/libc.info* %endif # # glibc-doc-pdf # %if %{build_pdf_doc} %files doc-pdf %doc manual/libc.pdf %endif # # glibc-profile # %if %{build_profile} %files profile %{_libdir}/lib*_p.a %if %{build_biarch} %{_prefix}/lib/lib*_p.a %endif %endif # # glibc-utils # %if %{build_utils} %files utils %if %{build_biarch} %{_slibdir32}/libmemusage.so %{_slibdir32}/libpcprofile.so %endif %{_slibdir}/libmemusage.so %{_slibdir}/libpcprofile.so %{_bindir}/memusage %{_bindir}/memusagestat %{_bindir}/mtrace %{_bindir}/pcprofiledump %{_bindir}/xtrace %endif # # nscd # %if %{build_nscd} %files -n nscd %config(noreplace) %{_sysconfdir}/nscd.conf %{_sbindir}/nscd %{_unitdir}/nscd.service %{_unitdir}/nscd.socket %{_tmpfilesdir}/nscd.conf %dir %{_var}/db/nscd %endif # # timezone # %if %{build_timezone} %files -n timezone %{_sbindir}/zdump %{_sbindir}/zic %dir %{_datadir}/zoneinfo %{_datadir}/zoneinfo/* %endif # # glibc-i18ndata # %if %{build_i18ndata} %files i18ndata %dir %{_datadir}/i18n %dir %{_datadir}/i18n/charmaps %{_datadir}/i18n/charmaps/* %dir %{_datadir}/i18n/locales %{_datadir}/i18n/locales/* %{_datadir}/i18n/SUPPORTED %endif %if %{build_debug} %files debuginfo -f debuginfo.filelist %files debugsource %dir %{_prefix}/src/debug/%{name}-%{version} %{_prefix}/src/debug/%{name}-%{version}/* %endif