From 1482b988442bb1cc3439645d3e4368447f301d9a98850883e02e26556d2ddd4b Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 17 Jul 2017 07:44:06 +0000 Subject: [PATCH] Accepting request 510863 from home:Andreas_Schwab:Factory Reorganize specfile OBS-URL: https://build.opensuse.org/request/show/510863 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=460 --- _multibuild | 5 - glibc-testsuite.spec | 1436 ++++++++++++++++++++++++++++++++++++++++++ glibc-utils.spec | 1436 ++++++++++++++++++++++++++++++++++++++++++ glibc.i686.spec | 1436 ++++++++++++++++++++++++++++++++++++++++++ glibc.spec | 8 +- pre_checkin.sh | 4 + 6 files changed, 4317 insertions(+), 8 deletions(-) delete mode 100644 _multibuild create mode 100644 glibc-testsuite.spec create mode 100644 glibc-utils.spec create mode 100644 glibc.i686.spec create mode 100644 pre_checkin.sh diff --git a/_multibuild b/_multibuild deleted file mode 100644 index e14556e..0000000 --- a/_multibuild +++ /dev/null @@ -1,5 +0,0 @@ - - i686 - utils - testsuite - diff --git a/glibc-testsuite.spec b/glibc-testsuite.spec new file mode 100644 index 0000000..3eb3a23 --- /dev/null +++ b/glibc-testsuite.spec @@ -0,0 +1,1436 @@ +# +# spec file for package glibc +# +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +# Run with osc --with=fast_build to have a shorter turnaround +# It will avoid building some parts of glibc +%bcond_with fast_build + +%define crypt_bf_version 1.3 +%define build_snapshot 0 + +%define flavor testsuite + +%bcond_with all +%define build_main 1 +%define build_utils %{with all} +%define build_testsuite %{with all} +%if "%flavor" == "utils" +%define build_main 0 +%define build_utils 1 +%define build_testsuite 0 +%endif +%if "%flavor" == "testsuite" +%define build_main 0 +%define build_utils 0 +%define build_testsuite 1 +%endif + +Name: glibc +Summary: Standard Shared Libraries (from the GNU C Library) +License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: System/Libraries +BuildRequires: audit-devel +BuildRequires: fdupes +BuildRequires: libcap-devel +BuildRequires: libselinux-devel +BuildRequires: makeinfo +BuildRequires: pwdutils +BuildRequires: systemd-rpm-macros +BuildRequires: xz +%if %{build_testsuite} +BuildRequires: gcc-c++ +BuildRequires: gdb +BuildRequires: glibc-devel-static +BuildRequires: libstdc++-devel +BuildRequires: python-pexpect +%endif +%if %{build_utils} +BuildRequires: gd-devel +%endif +%if "%flavor" == "i686" +ExclusiveArch: i586 i686 +BuildArch: i686 +%global optflags %(echo "%optflags"|sed -e s/i586/i686/) -march=i686 -mtune=generic +%endif + +%define __filter_GLIBC_PRIVATE 1 +%ifarch i686 +# For i686 let's only build what's different from i586, so +# no need to build documentation +%define build_profile 1 +%define build_locales 1 +%define build_html 0 +%else +%if %{with fast_build} || %{build_utils} && %{without all} +%define build_profile 0 +%define build_locales 0 +%define build_html 0 +%else +# Default: +%define build_profile 1 +%define build_locales 1 +%define build_html 1 +%endif +%endif + +%define build_variants %{build_main} + +%define disable_assert 0 +%define enable_stackguard_randomization 1 +%ifarch ppc ppc64 + %define optimize_power 1 + %ifarch ppc + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_tune power3 + %define powerpc_optimize_cpu_power4 1 + %else + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_tune power5 + %define powerpc_optimize_cpu_power4 0 + %endif + # We are not building Power CPU specific optimizations for openSUSE. + %define powerpc_optimize_cpu_power6 0 + %define powerpc_optimize_cpu_power7 0 + %define powerpc_optimize_cpu_cell 0 +%else + %define optimize_power 0 + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_cpu_power4 0 + %define powerpc_optimize_cpu_power6 0 + %define powerpc_optimize_cpu_power7 0 + %define powerpc_optimize_cpu_cell 0 +%endif # ppc, ppc64 +# 3.0 is the SLES 11 SP3 kernel +# 3.1 is the openSUSE 12.1 kernel +%define enablekernel 3.0 + +Version: 2.25 +Release: 0 +%if !%{build_snapshot} +%define git_id db0242e30234 +%define libversion %version +%else +%define git_id %(echo %version | sed 's/.*\.g//') +%define libversion %(echo %version | sed 's/\.[^.]*\.g.*//') +%endif +Url: http://www.gnu.org/software/libc/libc.html +BuildRoot: %{_tmppath}/%{name}-%{version}-build +Source: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz +%if !%{build_snapshot} +Source1: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz.sig +%endif +Source2: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=libc&download=1#/glibc.keyring +Source3: noversion.tar.bz2 +Source4: manpages.tar.bz2 +Source5: nsswitch.conf +Source7: bindresvport.blacklist +Source8: glibc_post_upgrade.c +Source9: glibc.rpmlintrc +Source10: baselibs.conf +# For systemd +Source20: nscd.conf +Source21: nscd.service +# crypt_blowfish +Source50: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz +# The sign key uses MD5 which is no longer accepted by gpg +#Source51: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz.sign + +# ngpt was used in 8.1 and SLES8 +Obsoletes: ngpt < 2.2.2 +Obsoletes: ngpt-devel < 2.2.2 +Provides: ngpt = 2.2.2 +Provides: ngpt-devel = 2.2.2 +Conflicts: kernel < %{enablekernel} +# bug437293 - handle update from SLES10 on PowerPC +%ifarch ppc64 +Obsoletes: glibc-64bit +%endif +%ifarch ppc +Obsoletes: glibc-32bit +%endif +%ifarch armv6hl armv7hl +# The old runtime linker link gets not provided by rpm find.provides, but it exists +Provides: ld-linux.so.3 +Provides: ld-linux.so.3(GLIBC_2.4) +%endif +Requires(pre): filesystem +Recommends: glibc-extra +Provides: rtld(GNU_HASH) +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%ifarch i686 +# We need to avoid to have only the src rpm from i686 on the media, +# since it does not work on other architectures. +NoSource: 0 +%endif +# + +### +# Patches are ordered in the following groups: +# Patches that we will never upstream or which have not been looked at: 0-999 +# Patches taken from upstream: 1000-2000 +# Patches that are going upstream, waiting approval: 2000-3000 +### + +### +# Patches that upstream will not accept +### + +### +# openSUSE specific patches - won't go upstream +### +### openSUSE extensions, configuration +# PATCH-FEATURE-OPENSUSE -- add crypt_blowfish support - bnc#700876 +Patch1: glibc-2.14-crypt.diff +# PATCH-FEATURE-OPENSUSE constify crypt_blowfish +Patch2: crypt_blowfish-const.patch +# PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de +Patch3: crypt_blowfish-1.2-sha.diff +# PATCH-FEATURE-OPENSUSE Move crypt_gensalt_rn to separate library +Patch4: crypt_blowfish-gensalt.patch +# PATCH-FEATURE-OPENSUSE Avoid build failure on noexecstack marker on ARM dmueller@suse.de +Patch5: crypt_blowfish-1.2-hack_around_arm.diff +# PATCH-FIX-OPENSUSE Fix path for nscd databases +Patch6: glibc-2.3.3-nscd-db-path.diff +# PATCH-FIX-OPENSUSE Fix path for nss_db (bnc#753657) - aj@suse.de +Patch7: nss-db-path.patch +# PATCH-FIX-OPENSUSE adjust nscd.conf +Patch8: glibc-nscd.conf.patch +# PATCH-FIX-OPENSUSE do not use compile time in binaries +Patch9: glibc-nodate.patch +# PATCH-FIX-OPENSUSE -- add some extra information to version output - kukuk@suse.de +Patch10: glibc-version.diff +# PATCH-FIX-OPENSUSE handle old glibc binaries +Patch12: glibc-2.3.90-noversion.diff +# PATCH-FIX-OPENSUSE -- Make --no-archive default for localedef - kukuk@suse.de +Patch13: glibc-2.3.2.no_archive.diff +# PATCH-FIX-OPENSUSE -- add blacklist for bindresvport +Patch14: glibc-bindresvport-blacklist.diff +# PATCH-FIX-OPENSUSE prefer -lang rpm packages +Patch15: glibc-2.3.90-langpackdir.diff +# PATCH-FEATURE-SLE Use nscd user for nscd +Patch19: nscd-server-user.patch +# PATCH-FEATURE-SLE powerpc: enable TLE only if GLIBC_ELISION_ENABLE=yes is defined +Patch21: powerpc-elision-enable-envvar.patch + +### Locale related patches +# PATCH-FIX-OPENSUSE Add additional locales +Patch100: add-locales.patch +# PATCH-FIX-OPENSUSE -- Add no_NO back (XXX: Still needed?) +Patch102: glibc-2.4.90-no_NO.diff +# PATCH-FIX-OPENSUSE -- Renames for China +Patch103: glibc-2.4-china.diff +# PATCH-FIX-OPENSUSE -- Add C.UTF-8 locale +Patch104: glibc-c-utf8-locale.patch +# PATCH-FIX-OPENSUSE -- Disable gettext for C.UTF-8 locale +Patch105: glibc-disable-gettext-for-c-utf8.patch + +### Broken patches in glibc that we revert for now: + +### Network related patches +# PATCH-FIX-OPENSUSE reload /etc/resolv.conf on change +Patch300: glibc-resolv-reload.diff +# PATCH-FIX-OPENSUSE Fix hangs in UDP RPC calls bso#5379 bnc#257745 aj@suse.de +Patch301: glibc-2.2-sunrpc.diff +# PATCH-FIX-OPENSUSE Warn about usage of mdns in resolv.conv +Patch304: glibc-resolv-mdnshint.diff +# PATCH-FIX-OPENSUSE disable rewriting ::1 to 127.0.0.1 for /etc/hosts bnc#684534, bnc#706719 +Patch306: glibc-fix-double-loopback.diff + +### +# Patches from upstream +### +# PATCH-FIX-UPSTREAM Fix getting tunable values on big-endian (BZ #21109) +Patch1000: tunables-bigendian.patch +# PATCH-FIX-UPSTREAM Fix i686 memchr overflow calculation (BZ #21182) +Patch1001: i686-memchr-sse.patch +# PATCH-FIX-UPSTREAM Avoid use-after-free read access in clntudp_call (BZ #21115) +Patch1002: sunrpc-use-after-free.patch +# PATCH-FIX-UPSTREAM Fix test-math-vector-sincos.h aliasing +Patch1003: test-math-vector-sincos-aliasing.patch +# PATCH-FIX-UPSTREAM Fix symbol redirect for fts_set (BZ #21289) +Patch1004: fts-symbol-redirect.patch +# PATCH-FIX-UPSTREAM Ignore and remove LD_HWCAP_MASK for AT_SECURE programs (BZ #21209) +Patch1005: ld-hwcap-mask-suid.patch +# PATCH-FIX-UPSTREAM rtld: Completely ignore LD_LIBRARY_PATH for AT_SECURE=1 programs (CVE-2017-1000366, BZ #21624) +Patch1006: ld-library-path-suid.patch + +### +# Patches awaiting upstream approval +### +# PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142) +Patch2000: fix-locking-in-_IO_cleanup.patch +# PATCH-FIX-UPSTREAM Never try to execute the file in ldd (BZ #16750) +Patch2001: ldd-system-interp.patch +# PATCH-FIX-UPSTREAM Don't close or flush stdio streams on abort (BZ #15436) +Patch2002: abort-no-flush.patch +# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976) +Patch2004: fnmatch-collating-elements.patch +# PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991) +Patch2005: nss-files-long-lines-2.patch +# PATCH-FIX-UPSTREAM Fix iconv buffer handling with IGNORE error handler (BZ #18830) +Patch2006: iconv-reset-input-buffer.patch +# PATCH-FIX-UPSTREAM Reinitialize dl_load_write_lock on fork (BZ #19282) +Patch2008: reinitialize-dl_load_write_lock.patch + +# Non-glibc patches +# PATCH-FIX-OPENSUSE Remove debianisms from manpages +Patch3000: manpages.patch + +%description +The GNU C Library provides the most important standard libraries used +by nearly all programs: the standard C library, the standard math +library, and the POSIX thread library. A system is not functional +without these libraries. + +%package utils +Summary: Development utilities from the GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ +Requires: glibc = %{version} + +%description utils +The glibc-utils package contains mtrace, a memory leak tracer and +xtrace, a function call tracer which can be helpful during program +debugging. + +If you are unsure if you need this, do not install this package. + +%package testsuite +Summary: Testsuite results from the GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ + +%description testsuite +This package contains the testsuite results from the GNU C Library. + +%package info +Summary: Info Files for the GNU C Library +License: GFDL-1.1 +Group: Documentation/Other +Requires(post): %{install_info_prereq} +Requires(preun): %{install_info_prereq} +BuildArch: noarch + +%description info +This package contains the documentation for the GNU C library stored as +info files. Due to a lack of resources, this documentation is not +complete and is partially out of date. + +%package html +Summary: HTML Documentation for the GNU C Library +License: GFDL-1.1 +Group: Documentation/HTML +BuildArch: noarch + +%description html +This package contains the HTML documentation for the GNU C library. Due +to a lack of resources, this documentation is not complete and is +partially out of date. + +%package i18ndata +Summary: Database Sources for 'locale' +License: GPL-2.0+ and MIT +Group: System/Libraries +BuildArch: noarch + +%description i18ndata +This package contains the data needed to build the locale data files to +use the internationalization features of the GNU libc. It is normally +not necessary to install this packages, the data files are already +created. + +%package locale +Summary: Locale Data for Localized Programs +License: GPL-2.0+ and MIT and LGPL-2.1+ +Group: System/Libraries +Requires(post): /bin/cat +Requires: glibc = %{version} +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-locale-64bit +%endif +%ifarch ppc +Obsoletes: glibc-locale-32bit +%endif + +%description locale +Locale data for the internationalisation features of the GNU C library. + +%package -n nscd +Summary: Name Service Caching Daemon +License: GPL-2.0+ +Group: System/Daemons +Provides: glibc:/usr/sbin/nscd +Requires: glibc = %{version} +Obsoletes: unscd <= 0.48 +Requires(pre): pwdutils +%{?systemd_requires} + +%description -n nscd +Nscd caches name service lookups and can dramatically improve +performance with NIS, NIS+, and LDAP. + +%package profile +Summary: Libc Profiling and Debugging Versions +License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: glibc = %{version} +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-profile-64bit +%endif +%ifarch ppc +Obsoletes: glibc-profile-32bit +%endif + +%description profile +This package contains special versions of the GNU C library which are +necessary for profiling and debugging. + +%package devel +Summary: Include Files and Libraries Mandatory for Development +License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Obsoletes: epoll = 1.0 +Provides: epoll < 1.0 +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-devel-64bit +%endif +%ifarch ppc +Obsoletes: glibc-devel-32bit +%endif +Requires: glibc = %{version} +Requires: linux-kernel-headers + +%description devel +These libraries are needed to develop programs which use the standard C +library. + +%package devel-static +Summary: C library static libraries for -static linking +License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: %{name}-devel = %{version} +# Provide Fedora name for package to make packaging easier +Provides: %{name}-static = %{version} + +%description devel-static +The glibc-devel-static package contains the C library static libraries +for -static linking. You don't need these, unless you link statically, +which is highly discouraged. + +# makedb requires libselinux. We add this program in a separate +# package so that glibc does not require libselinux. +%package extra +Summary: Extra binaries from GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ +Requires: glibc = %{version} + +%description extra +The glibc-extra package contains some extra binaries for glibc that +are not essential but recommend to use. + +makedb: A program to create a database for nss + +%package obsolete +Summary: Obsolete Shared Libraries from the GNU C Library +License: LGPL-2.0+ +Group: System/Libraries +Requires: glibc = %{version} + +%description obsolete +This package provides some old libraries from the GNU C Library which +are no longer supported. Additional it provides a compatibility library +for old binaries linked against glibc 2.0. + +Install this package if you need one of this libraries to get old +binaries working, but since this libraries are not supported and there +is no gurantee that they work for you, you should try to get newer +versions of your software. + +%prep +%setup -n glibc-%{version} -q -a 3 -a 4 +# Owl crypt_blowfish +tar -xzf %SOURCE50 +pushd crypt_blowfish-%{crypt_bf_version} +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 +popd +mv crypt/{crypt.h,gnu-crypt.h} +mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/ +# +%patch1 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +# avoid changing nscd_stat.c mtime to avoid code generation +# differences on each rebuild +touch -r nscd/nscd_stat.c nscd/s-stamp +%patch9 -p1 +touch -r nscd/s-stamp nscd/nscd_stat.c +rm nscd/s-stamp +%patch10 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch19 -p1 +%patch21 -p1 + +%patch100 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 +%patch105 -p1 + +%patch300 -p1 +%patch301 -p1 +%patch304 -p1 +%patch306 -p1 + +%patch1000 -p1 +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 +%patch1006 -p1 + +%patch2000 -p1 +%patch2001 -p1 +%patch2002 -p1 +%patch2004 -p1 +%patch2005 -p1 +%patch2006 -p1 +%patch2008 -p1 + +%patch3000 + +# +# Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed! +# +# Glibc 2.8 introduced the HP_TIMING element to the rtld_global_ro struct # definition. +# If the base is built without power4 the loader won't have this element in +# the struct whereas the power4/5/6/... libc will, so there will be a disconnect +# between the size of the rtld_global_ro struct between the two and dl_close +# ends up getting called incorrectly when it's actually attempting to call a +# resolver function. This is because the GLRO() macro simply attempts to +# compute an offset and gets the wrong one. +# Building the base glibc with --with-cpu=power4 solves this problem. +# But: ppc32 can not default to -mcpu=power4 because it would emit instructions +# which are not available on G3, G4 etc. +# +# We simply remove the power4 files, and build the base glibc for a generic powerpc cpu +# Additional cputuned libs can now be used on powerpc32 +# +rm -fv sysdeps/powerpc/powerpc32/power4/hp-timing.c sysdeps/powerpc/powerpc32/power4/hp-timing.h +find . -name configure | xargs touch + +####################################################################### +### +### BUILD +### +####################################################################### + +%build +if [ -x /bin/uname.bin ]; then + /bin/uname.bin -a +else + uname -a +fi +uptime || : +ulimit -a +nice +# We do not want configure to figure out the system its building one +# to support a common ground and thus set build and host to the +# target_cpu. +%ifarch %arm +%define target %{_target_cpu}-suse-linux-gnueabi +%else +%define target %{_target_cpu}-suse-linux +%endif +# Don't use as-needed, it breaks glibc assumptions +# Before enabling it, run the testsuite and verify that it +# passes completely +export SUSE_ASNEEDED=0 +# Adjust glibc version.h +echo "#define CONFHOST \"%{target}\"" >> version.h +echo "#define GITID \"%{git_id}\"" >> version.h +# +# Default CFLAGS and Compiler +# +BuildFlags="%{optflags} -U_FORTIFY_SOURCE" +enable_stack_protector= +for opt in $BuildFlags; do + case $opt in + -fstack-protector-strong) enable_stack_protector=strong ;; + -fstack-protector-all) enable_stack_protector=all ;; + -fstack-protector) enable_stack_protector=yes ;; + esac +done +BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector[^ ]*##' -e 's#-ffortify=[0-9]*##') +BuildCC="%__cc" +BuildCCplus="%__cxx" +add_ons=libidn +# +#now overwrite for some architectures +# +%ifarch sparc64 + BuildFlags="-O2 -mcpu=ultrasparc -mvis -fcall-used-g6" + BuildCC="gcc -m64" + BuildCCplus="$BuildCCplus -m64" +%endif +%ifarch sparc + BuildFlags="$BuildFlags -fcall-used-g6" + BuildCC="gcc -m32" + BuildCCplus="$BuildCCplus -m32" +%endif +%ifarch sparcv9 + BuildFlags="$BuildFlags -mcpu=ultrasparc -fcall-used-g6" + BuildCC="gcc -m32" + BuildCCplus="$BuildCCplus -m32" +%endif +%ifarch alphaev6 + BuildFlags="-mcpu=ev6" +%endif +%ifarch ppc ppc64 + BuildFlags="$(echo $BuildFlags | sed 's#-mminimal-toc##')" +%endif +%ifarch ppc64 + BuildCC="$BuildCC -m64" + BuildCCplus="$BuildCCplus -m64" +%endif +%ifarch hppa + BuildFlags="$BuildFlags -mpa-risc-1-1 -fstrict-aliasing" +%endif +# Add flags for all plattforms except AXP +%ifnarch alpha + BuildFlags="$BuildFlags -g" +%endif +%if %{disable_assert} + BuildFlags="$BuildFlags -DNDEBUG=1" +%endif +%ifarch %ix86 + add_ons=$add_ons,noversion +%endif +%ifarch mipsel + # fails to build otherwise - need to recheck and fix + %define enable_stackguard_randomization 0 +%endif + +configure_and_build_glibc() { + local dirname="$1"; shift + local cflags="$1"; shift + mkdir "cc-$dirname" + cd "cc-$dirname" +%ifarch %arm aarch64 + # remove asynchronous-unwind-tables during configure as it causes + # some checks to fail spuriously on arm + conf_cflags="${cflags/-fasynchronous-unwind-tables/}" + conf_cflags="${conf_cflags/-funwind-tables/}" +%else + conf_cflags="$cflags" +%endif + + profile="--disable-profile" +%if %{build_profile} + if [ "$dirname" = "base" ] ; then + profile="--enable-profile" + fi +%endif + elision=--enable-lock-elision + if [ "$dirname" = "noelision" ]; then + elision=--disable-lock-elision + fi + ../configure \ + CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ + CC="$BuildCC" CXX="$BuildCCplus" \ + --prefix=%{_prefix} \ + --libexecdir=%{_libexecdir} --infodir=%{_infodir} \ + --enable-add-ons=$add_ons \ + $profile $elision \ + "$@" \ + --build=%{target} --host=%{target} \ +%ifarch armv7hl ppc ppc64 ppc64le i686 x86_64 sparc sparc64 s390 s390x + --enable-multi-arch \ +%endif +%ifarch mipsel + --without-fp \ +%endif +%ifarch ppc64p7 + --with-cpu=power7 \ +%endif +%if %{enable_stackguard_randomization} + --enable-stackguard-randomization \ +%endif + ${enable_stack_protector:+--enable-stack-protector=$enable_stack_protector} \ + --enable-tunables \ + --enable-kernel=%{enablekernel} \ + --with-bugurl=http://bugs.opensuse.org \ + --enable-bind-now --enable-obsolete-rpc \ + --disable-timezone-tools +# Should we enable --enable-systemtap? +# Should we enable --enable-nss-crypt to build use freebl3 hash functions? + # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) + make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags" + cd .. +} + +%if !%{optimize_power} + # + # Build base glibc + # + configure_and_build_glibc base "$BuildFlags" +%else + # + # Build POWER-optimized glibc + # + # First, base build: + pBuildFlags="$BuildFlags -mtune=%{powerpc_optimize_tune}" + %if "%{powerpc_optimize_base}" != "" + pBuildFlags+=" -mcpu=%{powerpc_optimize_base}" + %endif + %if "%{powerpc_optimize_base}" != "" + configure_and_build_glibc base "$pBuildFlags" --with-cpu=%{powerpc_optimize_base} + %else + # Use no default CPU + configure_and_build_glibc base "$pBuildFlags" + %endif + %if %{build_variants} + # Then other power variants: + for pcpu in \ + %if %{powerpc_optimize_cpu_power4} + power4 \ + %endif + %if %{powerpc_optimize_cpu_power6} + power6 \ + %endif + %if %{powerpc_optimize_cpu_power7} + power7 \ + %endif + ; do + configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" \ + --with-cpu=$pcpu + done + # Eventually, special Cell variant: + %if %{powerpc_optimize_cpu_cell} + configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell" + %endif + %endif # %{build_variants} +%endif # optimize_power + +%if %{build_variants} +%ifarch i686 x86_64 +configure_and_build_glibc noelision "$BuildFlags" +%endif +%endif + +# +# Build html documentation +# +%if %{build_html} +make -C cc-base html +%endif + +# +# Build glibc_post_upgrade binary +# +$BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \ + -Lcc-base -Bcc-base/csu \ + '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \ +%ifarch ppc ppc64 + %if !%{powerpc_optimize_cpu_power4} + '-DREMOVE_PPC_OPTIMIZE_POWER4' \ + %endif + %if !%{powerpc_optimize_cpu_power6} + '-DREMOVE_PPC_OPTIMIZE_POWER6' \ + %endif + %if !%{powerpc_optimize_cpu_power7} + '-DREMOVE_PPC_OPTIMIZE_POWER7' \ + %endif + %if !%{powerpc_optimize_cpu_cell} + '-DREMOVE_PPC_OPTIMIZE_CELL' \ + %endif +%endif + '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"' + +# crypt_blowfish man pages +pushd crypt_blowfish-%{crypt_bf_version} +make man +popd + +####################################################################### +### +### CHECK +### +####################################################################### + +%check +%if %{build_testsuite} +# The testsuite will fail if asneeded is used +export SUSE_ASNEEDED=0 +# Increase timeout +export TIMEOUTFACTOR=16 +# The testsuite does its own malloc checking +unset MALLOC_CHECK_ +make -C cc-base -k check || { + cd cc-base + o=$- + set +x + for sum in subdir-tests.sum */subdir-tests.sum; do + while read s t; do + case $s in + XPASS:|PASS:) + echo ++++++ $s $t ++++++ + ;; + *) # X?FAIL: + echo ------ $s $t ------ + test ! -f $t.out || cat $t.out + ;; + esac + done < $sum + done + set -$o + # Fail build if there where compilation errors during testsuite run + test -f tests.sum +} +%else +# This has to pass on all platforms! +# Exceptions: +# None! +make %{?_smp_mflags} -C cc-base check-abi +%endif + +####################################################################### +### +### INSTALL +### +####################################################################### + +%install +%if %{build_main} +# We don't want to strip the .symtab from our libraries in find-debuginfo.sh, +# certainly not from libpthread.so.* because it is used by libthread_db to find +# some non-exported symbols in order to detect if threading support +# should be enabled. These symbols are _not_ exported, and we can't easily +# export them retroactively without changing the ABI. So we have to +# continue to "export" them via .symtab, instead of .dynsym :-( +# But we also want to keep .symtab and .strtab of other libraries since some +# debugging tools currently require these sections directly inside the main +# files - specifically valgrind and PurifyPlus. +export STRIP_KEEP_SYMTAB=*.so* + +# Make sure we will create the gconv-modules.cache +mkdir -p %{buildroot}%{_libdir}/gconv +touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache + +# Install base glibc +make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base + +install_optimized_variant() { + local dirname="$1"; shift + local subdir="$1"; shift + local subdir_up="$1"; shift + +cd "cc-$dirname" +destdir=$RPM_BUILD_ROOT/%{_lib}/$subdir +mkdir -p $destdir +# Don't run a complete make install, we know which libraries +# we want +for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db +do + libbase=${lib#*/} + libbaseso=$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}-*.so) + # Only install if different from base lib + if cmp -s ${lib}.so ../cc-base/${lib}.so; then + ln -sf $subdir_up/$libbaseso $destdir/$libbaseso + else + cp -a ${lib}.so $destdir/$libbaseso + fi +done +cd .. +cc-base/elf/ldconfig -vn $destdir +} + +# Install power-optimized glibc +%if %{optimize_power} + %if %{powerpc_optimize_cpu_power4} + install_optimized_variant power4 power4 ".." + %endif + %if %{powerpc_optimize_cpu_power6} + install_optimized_variant power6 power6 ".." + %endif + %if %{powerpc_optimize_cpu_power7} + install_optimized_variant power7 power7 ".." + %endif + %if %{powerpc_optimize_cpu_cell} + install_optimized_variant ppc-cell-be ppc-cell-be ".." + %endif + %if %{powerpc_optimize_cpu_power6} + # power6 is compatible with power6x + # doing a directory symlink doesnt work, ldconfig follows them and accepts only the first real dir + if test -d %{buildroot}/%{_lib}/power6; then + mkdir -p %{buildroot}/%{_lib}/power6x + for i in %{buildroot}/%{_lib}/power6/*.so; do + b=$(basename $i) + ln -vs ../power6/$b %{buildroot}/%{_lib}/power6x/$b + done + cc-base/elf/ldconfig -vn %{buildroot}/%{_lib}/power6x + fi + %endif +%endif # optimize_power + +%ifarch i686 x86_64 +cd cc-noelision +destdir=$RPM_BUILD_ROOT/%{_lib}/noelision +mkdir -p $destdir +install -m 755 nptl/libpthread.so $destdir/libpthread-%{libversion}.so +cd .. +cc-base/elf/ldconfig -vn $destdir +%endif + +# Install locales +%if %{build_locales} + # XXX Do not install locales in parallel! + cd cc-base + # localedef creates hardlinks to other locales if possible + # this will not work if we generate them in parallel. + # thus we need to run fdupes on /usr/lib/locale/ + # Still, on my system this is a speed advantage: + # non-parallel build for install-locales: 9:34mins + # parallel build with fdupes: 7:08mins + make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales + %fdupes %{buildroot}/usr/lib/locale + cd .. +%endif +# Create file list for glibc-locale package +%{find_lang} libc + +# Prepare obsolete/, used only on some architectures: +export RPM_BUILD_ROOT +%ifarch i586 +mkdir -p %{buildroot}/%{_lib}/obsolete +%endif + +# Miscelanna: + +install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} + +install -m 644 %{SOURCE7} %{buildroot}/etc +install -m 644 %{SOURCE5} %{buildroot}/etc +install -m 644 posix/gai.conf %{buildroot}/etc + +mkdir -p %{buildroot}/etc/default +install -m 644 nis/nss %{buildroot}/etc/default/ + +mkdir -p %{buildroot}%{_includedir}/resolv +install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/ +install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/ + +%if %{build_html} +mkdir -p %{buildroot}%{_datadir}/doc/glibc +cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc +%endif + +cd manpages; make install_root=%{buildroot} install; cd .. + +# crypt_blowfish man pages +pushd crypt_blowfish-%{crypt_bf_version} +install -m755 -d %{buildroot}%{_mandir}/man3 +install -m644 *.3 %{buildroot}%{_mandir}/man3 +popd + +# nscd tools: + +%ifnarch i686 +cp nscd/nscd.conf %{buildroot}/etc +mkdir -p %{buildroot}/etc/init.d +ln -sf /sbin/service %{buildroot}/usr/sbin/rcnscd +mkdir -p %{buildroot}/run/nscd +mkdir -p %{buildroot}/var/lib/nscd +%endif + +# +# Create ld.so.conf +# +cat > %{buildroot}/etc/ld.so.conf <>"$l" + cat "$l.d"/* >>"$l" +done +/usr/sbin/iconvconfig + +%post info +%install_info --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%preun info +%install_info_delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%pre -n nscd +getent group nscd >/dev/null || %{_sbindir}/groupadd -r nscd +getent passwd nscd >/dev/null || %{_sbindir}/useradd -r -g nscd -c "User for nscd" -s /sbin/nologin -d /run/nscd nscd +%service_add_pre nscd.service + +%preun -n nscd +%service_del_preun nscd.service + +%post -n nscd +%service_add_post nscd.service +%tmpfiles_create /usr/lib/tmpfiles.d/nscd.conf +# Previously we had nscd.socket, remove it +test -x /usr/bin/systemctl && /usr/bin/systemctl stop nscd.socket 2>/dev/null || : +test -x /usr/bin/systemctl && /usr/bin/systemctl disable nscd.socket 2>/dev/null || : +# Hard removal in case the above did not work +rm -f /etc/systemd/system/sockets.target.wants/nscd.socket +exit 0 + +%postun -n nscd +%service_del_postun nscd.service +exit 0 + +%if %{build_main} +%files +####################################################################### +### +### FILES +### +####################################################################### + +# glibc +%defattr(-,root,root) +%doc LICENSES +%config(noreplace) /etc/bindresvport.blacklist +%config /etc/ld.so.conf +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache +%config(noreplace) /etc/rpc +%verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf +%verify(not md5 size mtime) %config(noreplace) /etc/gai.conf +%config(noreplace) /etc/default/nss +%doc %{_mandir}/man1/gencat.1.gz +%doc %{_mandir}/man1/getconf.1.gz +%doc %{_mandir}/man5/* +/%{_lib}/ld-%{libversion}.so + +# Each architecture has a different name for the dynamic linker: +%ifarch %arm +%ifarch armv6hl armv7hl +/%{_lib}/ld-linux-armhf.so.3 +# Keep compatibility link +/%{_lib}/ld-linux.so.3 +%else +/%{_lib}/ld-linux.so.3 +%endif +%endif +%ifarch ia64 +/%{_lib}/ld-linux-ia64.so.2 +%endif +%ifarch ppc s390 mips hppa m68k +/%{_lib}/ld.so.1 +%endif +%ifarch ppc64 +/%{_lib}/ld64.so.1 +%endif +%ifarch ppc64le +/%{_lib}/ld64.so.2 +%endif +%ifarch s390x +/lib/ld64.so.1 +/%{_lib}/ld64.so.1 +%endif +%ifarch x86_64 +/%{_lib}/ld-linux-x86-64.so.2 +%endif +%ifarch %ix86 %sparc +/%{_lib}/ld-linux.so.2 +%endif +%ifarch aarch64 +/lib/ld-linux-aarch64.so.1 +/%{_lib}/ld-linux-aarch64.so.1 +%endif +%ifarch %ix86 x86_64 ppc ppc64 s390 s390x +# LSB +/%{_lib}/*-lsb*.so.3 +%endif + +/%{_lib}/libBrokenLocale-%{libversion}.so +/%{_lib}/libBrokenLocale.so.1 +/%{_lib}/libSegFault.so +/%{_lib}/libanl-%{libversion}.so +/%{_lib}/libanl.so.1 +/%{_lib}/libc-%{libversion}.so +/%{_lib}/libc.so.6* +/%{_lib}/libcidn-%{libversion}.so +/%{_lib}/libcidn.so.1 +/%{_lib}/libcrypt-%{libversion}.so +/%{_lib}/libcrypt.so.1 +/%{_lib}/libowcrypt-%{libversion}.so +/%{_lib}/libowcrypt.so.1 +/%{_lib}/libdl-%{libversion}.so +/%{_lib}/libdl.so.2* +/%{_lib}/libm-%{libversion}.so +/%{_lib}/libm.so.6* +%ifarch x86_64 +/%{_lib}/libmvec-%{libversion}.so +/%{_lib}/libmvec.so.1 +%endif +/%{_lib}/libnsl-%{libversion}.so +/%{_lib}/libnsl.so.1 +/%{_lib}/libnss_compat-%{libversion}.so +/%{_lib}/libnss_compat.so.2 +/%{_lib}/libnss_db-%{libversion}.so +/%{_lib}/libnss_db.so.2 +/%{_lib}/libnss_dns-%{libversion}.so +/%{_lib}/libnss_dns.so.2 +/%{_lib}/libnss_files-%{libversion}.so +/%{_lib}/libnss_files.so.2 +/%{_lib}/libnss_hesiod-%{libversion}.so +/%{_lib}/libnss_hesiod.so.2 +/%{_lib}/libnss_nis-%{libversion}.so +/%{_lib}/libnss_nis.so.2 +/%{_lib}/libnss_nisplus-%{libversion}.so +/%{_lib}/libnss_nisplus.so.2 +/%{_lib}/libpthread-%{libversion}.so +/%{_lib}/libpthread.so.0 +/%{_lib}/libresolv-%{libversion}.so +/%{_lib}/libresolv.so.2 +/%{_lib}/librt-%{libversion}.so +/%{_lib}/librt.so.1 +/%{_lib}/libthread_db-1.0.so +/%{_lib}/libthread_db.so.1 +/%{_lib}/libutil-%{libversion}.so +/%{_lib}/libutil.so.1 +%define optimized_libs() \ + %dir %attr(0755,root,root) /%{_lib}/%1\ + /%{_lib}/%1/libc-%{libversion}.so\ + /%{_lib}/%1/libc.so.6*\ + /%{_lib}/%1/libm-%{libversion}.so\ + /%{_lib}/%1/libm.so.6*\ + /%{_lib}/%1/libpthread-%{libversion}.so\ + /%{_lib}/%1/libpthread.so.0\ + /%{_lib}/%1/librt-%{libversion}.so\ + /%{_lib}/%1/librt.so.1\ + /%{_lib}/%1/libthread_db-1.0.so\ + /%{_lib}/%1/libthread_db.so.1 + +%if %{optimize_power} + %if %{powerpc_optimize_cpu_power4} + %{optimized_libs power4} + %endif + %if %{powerpc_optimize_cpu_power6} + %{optimized_libs power6} + %{optimized_libs power6x} + %endif + %if %{powerpc_optimize_cpu_power7} + %{optimized_libs power7} + %endif + %if %{powerpc_optimize_cpu_cell} + %{optimized_libs ppc-cell-be} + %endif +%endif # optimize_power +%ifarch i686 x86_64 +/%{_lib}/noelision +%endif +%dir %attr(0700,root,root) /var/cache/ldconfig +/sbin/ldconfig +%{_bindir}/gencat +%{_bindir}/getconf +%{_bindir}/getent +%{_bindir}/iconv +%attr(755,root,root) %{_bindir}/ldd +%ifarch %ix86 sparc sparcv9 m68k + %{_bindir}/lddlibc4 +%endif +%{_bindir}/locale +%{_bindir}/localedef +%dir %attr(0755,root,root) %{_libexecdir}/getconf +%{_libexecdir}/getconf/* +%{_sbindir}/glibc_post_upgrade +%{_sbindir}/iconvconfig + +%ifarch i586 +%files obsolete +%defattr (755,root,root,755) +/%{_lib}/obsolete +%endif + +%files locale -f libc.lang +%defattr(-,root,root) +%{_datadir}/locale/locale.alias +%if %{build_locales} + /usr/lib/locale +%endif +%{_libdir}/gconv + +%files devel +%defattr(-,root,root) +%doc COPYING COPYING.LIB NEWS README BUGS CONFORMANCE +%doc %{_mandir}/man1/catchsegv.1.gz +%doc %{_mandir}/man1/rpcgen.1.gz +%doc %{_mandir}/man3/* +%{_bindir}/catchsegv +%{_bindir}/rpcgen +%{_bindir}/sprof +%{_includedir}/* +%{_libdir}/*.o +%{_libdir}/*.so +# These static libraries are needed even for shared builds +%{_libdir}/libc_nonshared.a +%{_libdir}/libg.a +%{_libdir}/libieee.a +%ifarch ppc ppc64 ppc64le s390 s390x sparc sparcv8 sparcv9 sparcv9v +# This is not built on sparc64. + %{_libdir}/libnldbl_nonshared.a +%endif +%{_libdir}/libmcheck.a +%ifarch x86_64 +%{_libdir}/libmvec_nonshared.a +%endif +%{_libdir}/libpthread_nonshared.a +%{_libdir}/librpcsvc.a + +%files devel-static +%defattr(-,root,root) +%{_libdir}/libBrokenLocale.a +%{_libdir}/libanl.a +%{_libdir}/libc.a +%{_libdir}/libcrypt.a +%{_libdir}/libowcrypt.a +%{_libdir}/libdl.a +%{_libdir}/libm.a +%ifarch x86_64 +%{_libdir}/libm-%{libversion}.a +%{_libdir}/libmvec.a +%endif +%{_libdir}/libnsl.a +%{_libdir}/libpthread.a +%{_libdir}/libresolv.a +%{_libdir}/librt.a +%{_libdir}/libutil.a + +%ifnarch i686 +%files info +%defattr(-,root,root) +%doc %{_infodir}/libc.info.gz +%doc %{_infodir}/libc.info-?.gz +%doc %{_infodir}/libc.info-??.gz + +%if %{build_html} +%files html +%defattr(-,root,root) +%doc %{_prefix}/share/doc/glibc +%endif + +%files i18ndata +%defattr(-,root,root) +%{_prefix}/share/i18n + +%files -n nscd +%defattr(-,root,root) +%config(noreplace) /etc/nscd.conf +%{_sbindir}/nscd +%{_sbindir}/rcnscd +/usr/lib/systemd/system/nscd.service +%dir /usr/lib/tmpfiles.d +/usr/lib/tmpfiles.d/nscd.conf +%dir %attr(0755,root,root) %ghost /run/nscd +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /run/nscd/nscd.pid +%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /run/nscd/socket +%dir %attr(0755,root,root) /var/lib/nscd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/passwd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/group +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/hosts +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/services +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/netgroup +%endif # !i686 + +%if %{build_profile} +%files profile +%defattr(-,root,root) +%{_libdir}/libc_p.a +%{_libdir}/libBrokenLocale_p.a +%{_libdir}/libanl_p.a +%{_libdir}/libm_p.a +%ifarch x86_64 +%{_libdir}/libmvec_p.a +%endif +%{_libdir}/libcrypt_p.a +%{_libdir}/libowcrypt_p.a +%{_libdir}/libpthread_p.a +%{_libdir}/libresolv_p.a +%{_libdir}/libnsl_p.a +%{_libdir}/librt_p.a +%{_libdir}/librpcsvc_p.a +%{_libdir}/libutil_p.a +%{_libdir}/libdl_p.a +%endif + +%ifnarch i686 +%files extra +%defattr(-,root,root) +%{_bindir}/makedb +/var/lib/misc/Makefile +%endif # !i686 + +%endif # main + +%if %{build_utils} +%files utils +%defattr(-,root,root) +/%{_lib}/libmemusage.so +/%{_lib}/libpcprofile.so +%dir %{_libdir}/audit +%{_libdir}/audit/sotruss-lib.so +%{_bindir}/memusage +%{_bindir}/memusagestat +%{_bindir}/mtrace +%{_bindir}/pcprofiledump +%{_bindir}/sotruss +%{_bindir}/xtrace +%{_bindir}/pldd +%endif # utils + +%changelog diff --git a/glibc-utils.spec b/glibc-utils.spec new file mode 100644 index 0000000..7776716 --- /dev/null +++ b/glibc-utils.spec @@ -0,0 +1,1436 @@ +# +# spec file for package glibc +# +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +# Run with osc --with=fast_build to have a shorter turnaround +# It will avoid building some parts of glibc +%bcond_with fast_build + +%define crypt_bf_version 1.3 +%define build_snapshot 0 + +%define flavor utils + +%bcond_with all +%define build_main 1 +%define build_utils %{with all} +%define build_testsuite %{with all} +%if "%flavor" == "utils" +%define build_main 0 +%define build_utils 1 +%define build_testsuite 0 +%endif +%if "%flavor" == "testsuite" +%define build_main 0 +%define build_utils 0 +%define build_testsuite 1 +%endif + +Name: glibc +Summary: Standard Shared Libraries (from the GNU C Library) +License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: System/Libraries +BuildRequires: audit-devel +BuildRequires: fdupes +BuildRequires: libcap-devel +BuildRequires: libselinux-devel +BuildRequires: makeinfo +BuildRequires: pwdutils +BuildRequires: systemd-rpm-macros +BuildRequires: xz +%if %{build_testsuite} +BuildRequires: gcc-c++ +BuildRequires: gdb +BuildRequires: glibc-devel-static +BuildRequires: libstdc++-devel +BuildRequires: python-pexpect +%endif +%if %{build_utils} +BuildRequires: gd-devel +%endif +%if "%flavor" == "i686" +ExclusiveArch: i586 i686 +BuildArch: i686 +%global optflags %(echo "%optflags"|sed -e s/i586/i686/) -march=i686 -mtune=generic +%endif + +%define __filter_GLIBC_PRIVATE 1 +%ifarch i686 +# For i686 let's only build what's different from i586, so +# no need to build documentation +%define build_profile 1 +%define build_locales 1 +%define build_html 0 +%else +%if %{with fast_build} || %{build_utils} && %{without all} +%define build_profile 0 +%define build_locales 0 +%define build_html 0 +%else +# Default: +%define build_profile 1 +%define build_locales 1 +%define build_html 1 +%endif +%endif + +%define build_variants %{build_main} + +%define disable_assert 0 +%define enable_stackguard_randomization 1 +%ifarch ppc ppc64 + %define optimize_power 1 + %ifarch ppc + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_tune power3 + %define powerpc_optimize_cpu_power4 1 + %else + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_tune power5 + %define powerpc_optimize_cpu_power4 0 + %endif + # We are not building Power CPU specific optimizations for openSUSE. + %define powerpc_optimize_cpu_power6 0 + %define powerpc_optimize_cpu_power7 0 + %define powerpc_optimize_cpu_cell 0 +%else + %define optimize_power 0 + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_cpu_power4 0 + %define powerpc_optimize_cpu_power6 0 + %define powerpc_optimize_cpu_power7 0 + %define powerpc_optimize_cpu_cell 0 +%endif # ppc, ppc64 +# 3.0 is the SLES 11 SP3 kernel +# 3.1 is the openSUSE 12.1 kernel +%define enablekernel 3.0 + +Version: 2.25 +Release: 0 +%if !%{build_snapshot} +%define git_id db0242e30234 +%define libversion %version +%else +%define git_id %(echo %version | sed 's/.*\.g//') +%define libversion %(echo %version | sed 's/\.[^.]*\.g.*//') +%endif +Url: http://www.gnu.org/software/libc/libc.html +BuildRoot: %{_tmppath}/%{name}-%{version}-build +Source: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz +%if !%{build_snapshot} +Source1: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz.sig +%endif +Source2: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=libc&download=1#/glibc.keyring +Source3: noversion.tar.bz2 +Source4: manpages.tar.bz2 +Source5: nsswitch.conf +Source7: bindresvport.blacklist +Source8: glibc_post_upgrade.c +Source9: glibc.rpmlintrc +Source10: baselibs.conf +# For systemd +Source20: nscd.conf +Source21: nscd.service +# crypt_blowfish +Source50: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz +# The sign key uses MD5 which is no longer accepted by gpg +#Source51: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz.sign + +# ngpt was used in 8.1 and SLES8 +Obsoletes: ngpt < 2.2.2 +Obsoletes: ngpt-devel < 2.2.2 +Provides: ngpt = 2.2.2 +Provides: ngpt-devel = 2.2.2 +Conflicts: kernel < %{enablekernel} +# bug437293 - handle update from SLES10 on PowerPC +%ifarch ppc64 +Obsoletes: glibc-64bit +%endif +%ifarch ppc +Obsoletes: glibc-32bit +%endif +%ifarch armv6hl armv7hl +# The old runtime linker link gets not provided by rpm find.provides, but it exists +Provides: ld-linux.so.3 +Provides: ld-linux.so.3(GLIBC_2.4) +%endif +Requires(pre): filesystem +Recommends: glibc-extra +Provides: rtld(GNU_HASH) +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%ifarch i686 +# We need to avoid to have only the src rpm from i686 on the media, +# since it does not work on other architectures. +NoSource: 0 +%endif +# + +### +# Patches are ordered in the following groups: +# Patches that we will never upstream or which have not been looked at: 0-999 +# Patches taken from upstream: 1000-2000 +# Patches that are going upstream, waiting approval: 2000-3000 +### + +### +# Patches that upstream will not accept +### + +### +# openSUSE specific patches - won't go upstream +### +### openSUSE extensions, configuration +# PATCH-FEATURE-OPENSUSE -- add crypt_blowfish support - bnc#700876 +Patch1: glibc-2.14-crypt.diff +# PATCH-FEATURE-OPENSUSE constify crypt_blowfish +Patch2: crypt_blowfish-const.patch +# PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de +Patch3: crypt_blowfish-1.2-sha.diff +# PATCH-FEATURE-OPENSUSE Move crypt_gensalt_rn to separate library +Patch4: crypt_blowfish-gensalt.patch +# PATCH-FEATURE-OPENSUSE Avoid build failure on noexecstack marker on ARM dmueller@suse.de +Patch5: crypt_blowfish-1.2-hack_around_arm.diff +# PATCH-FIX-OPENSUSE Fix path for nscd databases +Patch6: glibc-2.3.3-nscd-db-path.diff +# PATCH-FIX-OPENSUSE Fix path for nss_db (bnc#753657) - aj@suse.de +Patch7: nss-db-path.patch +# PATCH-FIX-OPENSUSE adjust nscd.conf +Patch8: glibc-nscd.conf.patch +# PATCH-FIX-OPENSUSE do not use compile time in binaries +Patch9: glibc-nodate.patch +# PATCH-FIX-OPENSUSE -- add some extra information to version output - kukuk@suse.de +Patch10: glibc-version.diff +# PATCH-FIX-OPENSUSE handle old glibc binaries +Patch12: glibc-2.3.90-noversion.diff +# PATCH-FIX-OPENSUSE -- Make --no-archive default for localedef - kukuk@suse.de +Patch13: glibc-2.3.2.no_archive.diff +# PATCH-FIX-OPENSUSE -- add blacklist for bindresvport +Patch14: glibc-bindresvport-blacklist.diff +# PATCH-FIX-OPENSUSE prefer -lang rpm packages +Patch15: glibc-2.3.90-langpackdir.diff +# PATCH-FEATURE-SLE Use nscd user for nscd +Patch19: nscd-server-user.patch +# PATCH-FEATURE-SLE powerpc: enable TLE only if GLIBC_ELISION_ENABLE=yes is defined +Patch21: powerpc-elision-enable-envvar.patch + +### Locale related patches +# PATCH-FIX-OPENSUSE Add additional locales +Patch100: add-locales.patch +# PATCH-FIX-OPENSUSE -- Add no_NO back (XXX: Still needed?) +Patch102: glibc-2.4.90-no_NO.diff +# PATCH-FIX-OPENSUSE -- Renames for China +Patch103: glibc-2.4-china.diff +# PATCH-FIX-OPENSUSE -- Add C.UTF-8 locale +Patch104: glibc-c-utf8-locale.patch +# PATCH-FIX-OPENSUSE -- Disable gettext for C.UTF-8 locale +Patch105: glibc-disable-gettext-for-c-utf8.patch + +### Broken patches in glibc that we revert for now: + +### Network related patches +# PATCH-FIX-OPENSUSE reload /etc/resolv.conf on change +Patch300: glibc-resolv-reload.diff +# PATCH-FIX-OPENSUSE Fix hangs in UDP RPC calls bso#5379 bnc#257745 aj@suse.de +Patch301: glibc-2.2-sunrpc.diff +# PATCH-FIX-OPENSUSE Warn about usage of mdns in resolv.conv +Patch304: glibc-resolv-mdnshint.diff +# PATCH-FIX-OPENSUSE disable rewriting ::1 to 127.0.0.1 for /etc/hosts bnc#684534, bnc#706719 +Patch306: glibc-fix-double-loopback.diff + +### +# Patches from upstream +### +# PATCH-FIX-UPSTREAM Fix getting tunable values on big-endian (BZ #21109) +Patch1000: tunables-bigendian.patch +# PATCH-FIX-UPSTREAM Fix i686 memchr overflow calculation (BZ #21182) +Patch1001: i686-memchr-sse.patch +# PATCH-FIX-UPSTREAM Avoid use-after-free read access in clntudp_call (BZ #21115) +Patch1002: sunrpc-use-after-free.patch +# PATCH-FIX-UPSTREAM Fix test-math-vector-sincos.h aliasing +Patch1003: test-math-vector-sincos-aliasing.patch +# PATCH-FIX-UPSTREAM Fix symbol redirect for fts_set (BZ #21289) +Patch1004: fts-symbol-redirect.patch +# PATCH-FIX-UPSTREAM Ignore and remove LD_HWCAP_MASK for AT_SECURE programs (BZ #21209) +Patch1005: ld-hwcap-mask-suid.patch +# PATCH-FIX-UPSTREAM rtld: Completely ignore LD_LIBRARY_PATH for AT_SECURE=1 programs (CVE-2017-1000366, BZ #21624) +Patch1006: ld-library-path-suid.patch + +### +# Patches awaiting upstream approval +### +# PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142) +Patch2000: fix-locking-in-_IO_cleanup.patch +# PATCH-FIX-UPSTREAM Never try to execute the file in ldd (BZ #16750) +Patch2001: ldd-system-interp.patch +# PATCH-FIX-UPSTREAM Don't close or flush stdio streams on abort (BZ #15436) +Patch2002: abort-no-flush.patch +# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976) +Patch2004: fnmatch-collating-elements.patch +# PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991) +Patch2005: nss-files-long-lines-2.patch +# PATCH-FIX-UPSTREAM Fix iconv buffer handling with IGNORE error handler (BZ #18830) +Patch2006: iconv-reset-input-buffer.patch +# PATCH-FIX-UPSTREAM Reinitialize dl_load_write_lock on fork (BZ #19282) +Patch2008: reinitialize-dl_load_write_lock.patch + +# Non-glibc patches +# PATCH-FIX-OPENSUSE Remove debianisms from manpages +Patch3000: manpages.patch + +%description +The GNU C Library provides the most important standard libraries used +by nearly all programs: the standard C library, the standard math +library, and the POSIX thread library. A system is not functional +without these libraries. + +%package utils +Summary: Development utilities from the GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ +Requires: glibc = %{version} + +%description utils +The glibc-utils package contains mtrace, a memory leak tracer and +xtrace, a function call tracer which can be helpful during program +debugging. + +If you are unsure if you need this, do not install this package. + +%package testsuite +Summary: Testsuite results from the GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ + +%description testsuite +This package contains the testsuite results from the GNU C Library. + +%package info +Summary: Info Files for the GNU C Library +License: GFDL-1.1 +Group: Documentation/Other +Requires(post): %{install_info_prereq} +Requires(preun): %{install_info_prereq} +BuildArch: noarch + +%description info +This package contains the documentation for the GNU C library stored as +info files. Due to a lack of resources, this documentation is not +complete and is partially out of date. + +%package html +Summary: HTML Documentation for the GNU C Library +License: GFDL-1.1 +Group: Documentation/HTML +BuildArch: noarch + +%description html +This package contains the HTML documentation for the GNU C library. Due +to a lack of resources, this documentation is not complete and is +partially out of date. + +%package i18ndata +Summary: Database Sources for 'locale' +License: GPL-2.0+ and MIT +Group: System/Libraries +BuildArch: noarch + +%description i18ndata +This package contains the data needed to build the locale data files to +use the internationalization features of the GNU libc. It is normally +not necessary to install this packages, the data files are already +created. + +%package locale +Summary: Locale Data for Localized Programs +License: GPL-2.0+ and MIT and LGPL-2.1+ +Group: System/Libraries +Requires(post): /bin/cat +Requires: glibc = %{version} +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-locale-64bit +%endif +%ifarch ppc +Obsoletes: glibc-locale-32bit +%endif + +%description locale +Locale data for the internationalisation features of the GNU C library. + +%package -n nscd +Summary: Name Service Caching Daemon +License: GPL-2.0+ +Group: System/Daemons +Provides: glibc:/usr/sbin/nscd +Requires: glibc = %{version} +Obsoletes: unscd <= 0.48 +Requires(pre): pwdutils +%{?systemd_requires} + +%description -n nscd +Nscd caches name service lookups and can dramatically improve +performance with NIS, NIS+, and LDAP. + +%package profile +Summary: Libc Profiling and Debugging Versions +License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: glibc = %{version} +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-profile-64bit +%endif +%ifarch ppc +Obsoletes: glibc-profile-32bit +%endif + +%description profile +This package contains special versions of the GNU C library which are +necessary for profiling and debugging. + +%package devel +Summary: Include Files and Libraries Mandatory for Development +License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Obsoletes: epoll = 1.0 +Provides: epoll < 1.0 +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-devel-64bit +%endif +%ifarch ppc +Obsoletes: glibc-devel-32bit +%endif +Requires: glibc = %{version} +Requires: linux-kernel-headers + +%description devel +These libraries are needed to develop programs which use the standard C +library. + +%package devel-static +Summary: C library static libraries for -static linking +License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: %{name}-devel = %{version} +# Provide Fedora name for package to make packaging easier +Provides: %{name}-static = %{version} + +%description devel-static +The glibc-devel-static package contains the C library static libraries +for -static linking. You don't need these, unless you link statically, +which is highly discouraged. + +# makedb requires libselinux. We add this program in a separate +# package so that glibc does not require libselinux. +%package extra +Summary: Extra binaries from GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ +Requires: glibc = %{version} + +%description extra +The glibc-extra package contains some extra binaries for glibc that +are not essential but recommend to use. + +makedb: A program to create a database for nss + +%package obsolete +Summary: Obsolete Shared Libraries from the GNU C Library +License: LGPL-2.0+ +Group: System/Libraries +Requires: glibc = %{version} + +%description obsolete +This package provides some old libraries from the GNU C Library which +are no longer supported. Additional it provides a compatibility library +for old binaries linked against glibc 2.0. + +Install this package if you need one of this libraries to get old +binaries working, but since this libraries are not supported and there +is no gurantee that they work for you, you should try to get newer +versions of your software. + +%prep +%setup -n glibc-%{version} -q -a 3 -a 4 +# Owl crypt_blowfish +tar -xzf %SOURCE50 +pushd crypt_blowfish-%{crypt_bf_version} +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 +popd +mv crypt/{crypt.h,gnu-crypt.h} +mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/ +# +%patch1 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +# avoid changing nscd_stat.c mtime to avoid code generation +# differences on each rebuild +touch -r nscd/nscd_stat.c nscd/s-stamp +%patch9 -p1 +touch -r nscd/s-stamp nscd/nscd_stat.c +rm nscd/s-stamp +%patch10 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch19 -p1 +%patch21 -p1 + +%patch100 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 +%patch105 -p1 + +%patch300 -p1 +%patch301 -p1 +%patch304 -p1 +%patch306 -p1 + +%patch1000 -p1 +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 +%patch1006 -p1 + +%patch2000 -p1 +%patch2001 -p1 +%patch2002 -p1 +%patch2004 -p1 +%patch2005 -p1 +%patch2006 -p1 +%patch2008 -p1 + +%patch3000 + +# +# Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed! +# +# Glibc 2.8 introduced the HP_TIMING element to the rtld_global_ro struct # definition. +# If the base is built without power4 the loader won't have this element in +# the struct whereas the power4/5/6/... libc will, so there will be a disconnect +# between the size of the rtld_global_ro struct between the two and dl_close +# ends up getting called incorrectly when it's actually attempting to call a +# resolver function. This is because the GLRO() macro simply attempts to +# compute an offset and gets the wrong one. +# Building the base glibc with --with-cpu=power4 solves this problem. +# But: ppc32 can not default to -mcpu=power4 because it would emit instructions +# which are not available on G3, G4 etc. +# +# We simply remove the power4 files, and build the base glibc for a generic powerpc cpu +# Additional cputuned libs can now be used on powerpc32 +# +rm -fv sysdeps/powerpc/powerpc32/power4/hp-timing.c sysdeps/powerpc/powerpc32/power4/hp-timing.h +find . -name configure | xargs touch + +####################################################################### +### +### BUILD +### +####################################################################### + +%build +if [ -x /bin/uname.bin ]; then + /bin/uname.bin -a +else + uname -a +fi +uptime || : +ulimit -a +nice +# We do not want configure to figure out the system its building one +# to support a common ground and thus set build and host to the +# target_cpu. +%ifarch %arm +%define target %{_target_cpu}-suse-linux-gnueabi +%else +%define target %{_target_cpu}-suse-linux +%endif +# Don't use as-needed, it breaks glibc assumptions +# Before enabling it, run the testsuite and verify that it +# passes completely +export SUSE_ASNEEDED=0 +# Adjust glibc version.h +echo "#define CONFHOST \"%{target}\"" >> version.h +echo "#define GITID \"%{git_id}\"" >> version.h +# +# Default CFLAGS and Compiler +# +BuildFlags="%{optflags} -U_FORTIFY_SOURCE" +enable_stack_protector= +for opt in $BuildFlags; do + case $opt in + -fstack-protector-strong) enable_stack_protector=strong ;; + -fstack-protector-all) enable_stack_protector=all ;; + -fstack-protector) enable_stack_protector=yes ;; + esac +done +BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector[^ ]*##' -e 's#-ffortify=[0-9]*##') +BuildCC="%__cc" +BuildCCplus="%__cxx" +add_ons=libidn +# +#now overwrite for some architectures +# +%ifarch sparc64 + BuildFlags="-O2 -mcpu=ultrasparc -mvis -fcall-used-g6" + BuildCC="gcc -m64" + BuildCCplus="$BuildCCplus -m64" +%endif +%ifarch sparc + BuildFlags="$BuildFlags -fcall-used-g6" + BuildCC="gcc -m32" + BuildCCplus="$BuildCCplus -m32" +%endif +%ifarch sparcv9 + BuildFlags="$BuildFlags -mcpu=ultrasparc -fcall-used-g6" + BuildCC="gcc -m32" + BuildCCplus="$BuildCCplus -m32" +%endif +%ifarch alphaev6 + BuildFlags="-mcpu=ev6" +%endif +%ifarch ppc ppc64 + BuildFlags="$(echo $BuildFlags | sed 's#-mminimal-toc##')" +%endif +%ifarch ppc64 + BuildCC="$BuildCC -m64" + BuildCCplus="$BuildCCplus -m64" +%endif +%ifarch hppa + BuildFlags="$BuildFlags -mpa-risc-1-1 -fstrict-aliasing" +%endif +# Add flags for all plattforms except AXP +%ifnarch alpha + BuildFlags="$BuildFlags -g" +%endif +%if %{disable_assert} + BuildFlags="$BuildFlags -DNDEBUG=1" +%endif +%ifarch %ix86 + add_ons=$add_ons,noversion +%endif +%ifarch mipsel + # fails to build otherwise - need to recheck and fix + %define enable_stackguard_randomization 0 +%endif + +configure_and_build_glibc() { + local dirname="$1"; shift + local cflags="$1"; shift + mkdir "cc-$dirname" + cd "cc-$dirname" +%ifarch %arm aarch64 + # remove asynchronous-unwind-tables during configure as it causes + # some checks to fail spuriously on arm + conf_cflags="${cflags/-fasynchronous-unwind-tables/}" + conf_cflags="${conf_cflags/-funwind-tables/}" +%else + conf_cflags="$cflags" +%endif + + profile="--disable-profile" +%if %{build_profile} + if [ "$dirname" = "base" ] ; then + profile="--enable-profile" + fi +%endif + elision=--enable-lock-elision + if [ "$dirname" = "noelision" ]; then + elision=--disable-lock-elision + fi + ../configure \ + CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ + CC="$BuildCC" CXX="$BuildCCplus" \ + --prefix=%{_prefix} \ + --libexecdir=%{_libexecdir} --infodir=%{_infodir} \ + --enable-add-ons=$add_ons \ + $profile $elision \ + "$@" \ + --build=%{target} --host=%{target} \ +%ifarch armv7hl ppc ppc64 ppc64le i686 x86_64 sparc sparc64 s390 s390x + --enable-multi-arch \ +%endif +%ifarch mipsel + --without-fp \ +%endif +%ifarch ppc64p7 + --with-cpu=power7 \ +%endif +%if %{enable_stackguard_randomization} + --enable-stackguard-randomization \ +%endif + ${enable_stack_protector:+--enable-stack-protector=$enable_stack_protector} \ + --enable-tunables \ + --enable-kernel=%{enablekernel} \ + --with-bugurl=http://bugs.opensuse.org \ + --enable-bind-now --enable-obsolete-rpc \ + --disable-timezone-tools +# Should we enable --enable-systemtap? +# Should we enable --enable-nss-crypt to build use freebl3 hash functions? + # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) + make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags" + cd .. +} + +%if !%{optimize_power} + # + # Build base glibc + # + configure_and_build_glibc base "$BuildFlags" +%else + # + # Build POWER-optimized glibc + # + # First, base build: + pBuildFlags="$BuildFlags -mtune=%{powerpc_optimize_tune}" + %if "%{powerpc_optimize_base}" != "" + pBuildFlags+=" -mcpu=%{powerpc_optimize_base}" + %endif + %if "%{powerpc_optimize_base}" != "" + configure_and_build_glibc base "$pBuildFlags" --with-cpu=%{powerpc_optimize_base} + %else + # Use no default CPU + configure_and_build_glibc base "$pBuildFlags" + %endif + %if %{build_variants} + # Then other power variants: + for pcpu in \ + %if %{powerpc_optimize_cpu_power4} + power4 \ + %endif + %if %{powerpc_optimize_cpu_power6} + power6 \ + %endif + %if %{powerpc_optimize_cpu_power7} + power7 \ + %endif + ; do + configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" \ + --with-cpu=$pcpu + done + # Eventually, special Cell variant: + %if %{powerpc_optimize_cpu_cell} + configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell" + %endif + %endif # %{build_variants} +%endif # optimize_power + +%if %{build_variants} +%ifarch i686 x86_64 +configure_and_build_glibc noelision "$BuildFlags" +%endif +%endif + +# +# Build html documentation +# +%if %{build_html} +make -C cc-base html +%endif + +# +# Build glibc_post_upgrade binary +# +$BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \ + -Lcc-base -Bcc-base/csu \ + '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \ +%ifarch ppc ppc64 + %if !%{powerpc_optimize_cpu_power4} + '-DREMOVE_PPC_OPTIMIZE_POWER4' \ + %endif + %if !%{powerpc_optimize_cpu_power6} + '-DREMOVE_PPC_OPTIMIZE_POWER6' \ + %endif + %if !%{powerpc_optimize_cpu_power7} + '-DREMOVE_PPC_OPTIMIZE_POWER7' \ + %endif + %if !%{powerpc_optimize_cpu_cell} + '-DREMOVE_PPC_OPTIMIZE_CELL' \ + %endif +%endif + '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"' + +# crypt_blowfish man pages +pushd crypt_blowfish-%{crypt_bf_version} +make man +popd + +####################################################################### +### +### CHECK +### +####################################################################### + +%check +%if %{build_testsuite} +# The testsuite will fail if asneeded is used +export SUSE_ASNEEDED=0 +# Increase timeout +export TIMEOUTFACTOR=16 +# The testsuite does its own malloc checking +unset MALLOC_CHECK_ +make -C cc-base -k check || { + cd cc-base + o=$- + set +x + for sum in subdir-tests.sum */subdir-tests.sum; do + while read s t; do + case $s in + XPASS:|PASS:) + echo ++++++ $s $t ++++++ + ;; + *) # X?FAIL: + echo ------ $s $t ------ + test ! -f $t.out || cat $t.out + ;; + esac + done < $sum + done + set -$o + # Fail build if there where compilation errors during testsuite run + test -f tests.sum +} +%else +# This has to pass on all platforms! +# Exceptions: +# None! +make %{?_smp_mflags} -C cc-base check-abi +%endif + +####################################################################### +### +### INSTALL +### +####################################################################### + +%install +%if %{build_main} +# We don't want to strip the .symtab from our libraries in find-debuginfo.sh, +# certainly not from libpthread.so.* because it is used by libthread_db to find +# some non-exported symbols in order to detect if threading support +# should be enabled. These symbols are _not_ exported, and we can't easily +# export them retroactively without changing the ABI. So we have to +# continue to "export" them via .symtab, instead of .dynsym :-( +# But we also want to keep .symtab and .strtab of other libraries since some +# debugging tools currently require these sections directly inside the main +# files - specifically valgrind and PurifyPlus. +export STRIP_KEEP_SYMTAB=*.so* + +# Make sure we will create the gconv-modules.cache +mkdir -p %{buildroot}%{_libdir}/gconv +touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache + +# Install base glibc +make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base + +install_optimized_variant() { + local dirname="$1"; shift + local subdir="$1"; shift + local subdir_up="$1"; shift + +cd "cc-$dirname" +destdir=$RPM_BUILD_ROOT/%{_lib}/$subdir +mkdir -p $destdir +# Don't run a complete make install, we know which libraries +# we want +for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db +do + libbase=${lib#*/} + libbaseso=$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}-*.so) + # Only install if different from base lib + if cmp -s ${lib}.so ../cc-base/${lib}.so; then + ln -sf $subdir_up/$libbaseso $destdir/$libbaseso + else + cp -a ${lib}.so $destdir/$libbaseso + fi +done +cd .. +cc-base/elf/ldconfig -vn $destdir +} + +# Install power-optimized glibc +%if %{optimize_power} + %if %{powerpc_optimize_cpu_power4} + install_optimized_variant power4 power4 ".." + %endif + %if %{powerpc_optimize_cpu_power6} + install_optimized_variant power6 power6 ".." + %endif + %if %{powerpc_optimize_cpu_power7} + install_optimized_variant power7 power7 ".." + %endif + %if %{powerpc_optimize_cpu_cell} + install_optimized_variant ppc-cell-be ppc-cell-be ".." + %endif + %if %{powerpc_optimize_cpu_power6} + # power6 is compatible with power6x + # doing a directory symlink doesnt work, ldconfig follows them and accepts only the first real dir + if test -d %{buildroot}/%{_lib}/power6; then + mkdir -p %{buildroot}/%{_lib}/power6x + for i in %{buildroot}/%{_lib}/power6/*.so; do + b=$(basename $i) + ln -vs ../power6/$b %{buildroot}/%{_lib}/power6x/$b + done + cc-base/elf/ldconfig -vn %{buildroot}/%{_lib}/power6x + fi + %endif +%endif # optimize_power + +%ifarch i686 x86_64 +cd cc-noelision +destdir=$RPM_BUILD_ROOT/%{_lib}/noelision +mkdir -p $destdir +install -m 755 nptl/libpthread.so $destdir/libpthread-%{libversion}.so +cd .. +cc-base/elf/ldconfig -vn $destdir +%endif + +# Install locales +%if %{build_locales} + # XXX Do not install locales in parallel! + cd cc-base + # localedef creates hardlinks to other locales if possible + # this will not work if we generate them in parallel. + # thus we need to run fdupes on /usr/lib/locale/ + # Still, on my system this is a speed advantage: + # non-parallel build for install-locales: 9:34mins + # parallel build with fdupes: 7:08mins + make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales + %fdupes %{buildroot}/usr/lib/locale + cd .. +%endif +# Create file list for glibc-locale package +%{find_lang} libc + +# Prepare obsolete/, used only on some architectures: +export RPM_BUILD_ROOT +%ifarch i586 +mkdir -p %{buildroot}/%{_lib}/obsolete +%endif + +# Miscelanna: + +install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} + +install -m 644 %{SOURCE7} %{buildroot}/etc +install -m 644 %{SOURCE5} %{buildroot}/etc +install -m 644 posix/gai.conf %{buildroot}/etc + +mkdir -p %{buildroot}/etc/default +install -m 644 nis/nss %{buildroot}/etc/default/ + +mkdir -p %{buildroot}%{_includedir}/resolv +install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/ +install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/ + +%if %{build_html} +mkdir -p %{buildroot}%{_datadir}/doc/glibc +cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc +%endif + +cd manpages; make install_root=%{buildroot} install; cd .. + +# crypt_blowfish man pages +pushd crypt_blowfish-%{crypt_bf_version} +install -m755 -d %{buildroot}%{_mandir}/man3 +install -m644 *.3 %{buildroot}%{_mandir}/man3 +popd + +# nscd tools: + +%ifnarch i686 +cp nscd/nscd.conf %{buildroot}/etc +mkdir -p %{buildroot}/etc/init.d +ln -sf /sbin/service %{buildroot}/usr/sbin/rcnscd +mkdir -p %{buildroot}/run/nscd +mkdir -p %{buildroot}/var/lib/nscd +%endif + +# +# Create ld.so.conf +# +cat > %{buildroot}/etc/ld.so.conf <>"$l" + cat "$l.d"/* >>"$l" +done +/usr/sbin/iconvconfig + +%post info +%install_info --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%preun info +%install_info_delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%pre -n nscd +getent group nscd >/dev/null || %{_sbindir}/groupadd -r nscd +getent passwd nscd >/dev/null || %{_sbindir}/useradd -r -g nscd -c "User for nscd" -s /sbin/nologin -d /run/nscd nscd +%service_add_pre nscd.service + +%preun -n nscd +%service_del_preun nscd.service + +%post -n nscd +%service_add_post nscd.service +%tmpfiles_create /usr/lib/tmpfiles.d/nscd.conf +# Previously we had nscd.socket, remove it +test -x /usr/bin/systemctl && /usr/bin/systemctl stop nscd.socket 2>/dev/null || : +test -x /usr/bin/systemctl && /usr/bin/systemctl disable nscd.socket 2>/dev/null || : +# Hard removal in case the above did not work +rm -f /etc/systemd/system/sockets.target.wants/nscd.socket +exit 0 + +%postun -n nscd +%service_del_postun nscd.service +exit 0 + +%if %{build_main} +%files +####################################################################### +### +### FILES +### +####################################################################### + +# glibc +%defattr(-,root,root) +%doc LICENSES +%config(noreplace) /etc/bindresvport.blacklist +%config /etc/ld.so.conf +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache +%config(noreplace) /etc/rpc +%verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf +%verify(not md5 size mtime) %config(noreplace) /etc/gai.conf +%config(noreplace) /etc/default/nss +%doc %{_mandir}/man1/gencat.1.gz +%doc %{_mandir}/man1/getconf.1.gz +%doc %{_mandir}/man5/* +/%{_lib}/ld-%{libversion}.so + +# Each architecture has a different name for the dynamic linker: +%ifarch %arm +%ifarch armv6hl armv7hl +/%{_lib}/ld-linux-armhf.so.3 +# Keep compatibility link +/%{_lib}/ld-linux.so.3 +%else +/%{_lib}/ld-linux.so.3 +%endif +%endif +%ifarch ia64 +/%{_lib}/ld-linux-ia64.so.2 +%endif +%ifarch ppc s390 mips hppa m68k +/%{_lib}/ld.so.1 +%endif +%ifarch ppc64 +/%{_lib}/ld64.so.1 +%endif +%ifarch ppc64le +/%{_lib}/ld64.so.2 +%endif +%ifarch s390x +/lib/ld64.so.1 +/%{_lib}/ld64.so.1 +%endif +%ifarch x86_64 +/%{_lib}/ld-linux-x86-64.so.2 +%endif +%ifarch %ix86 %sparc +/%{_lib}/ld-linux.so.2 +%endif +%ifarch aarch64 +/lib/ld-linux-aarch64.so.1 +/%{_lib}/ld-linux-aarch64.so.1 +%endif +%ifarch %ix86 x86_64 ppc ppc64 s390 s390x +# LSB +/%{_lib}/*-lsb*.so.3 +%endif + +/%{_lib}/libBrokenLocale-%{libversion}.so +/%{_lib}/libBrokenLocale.so.1 +/%{_lib}/libSegFault.so +/%{_lib}/libanl-%{libversion}.so +/%{_lib}/libanl.so.1 +/%{_lib}/libc-%{libversion}.so +/%{_lib}/libc.so.6* +/%{_lib}/libcidn-%{libversion}.so +/%{_lib}/libcidn.so.1 +/%{_lib}/libcrypt-%{libversion}.so +/%{_lib}/libcrypt.so.1 +/%{_lib}/libowcrypt-%{libversion}.so +/%{_lib}/libowcrypt.so.1 +/%{_lib}/libdl-%{libversion}.so +/%{_lib}/libdl.so.2* +/%{_lib}/libm-%{libversion}.so +/%{_lib}/libm.so.6* +%ifarch x86_64 +/%{_lib}/libmvec-%{libversion}.so +/%{_lib}/libmvec.so.1 +%endif +/%{_lib}/libnsl-%{libversion}.so +/%{_lib}/libnsl.so.1 +/%{_lib}/libnss_compat-%{libversion}.so +/%{_lib}/libnss_compat.so.2 +/%{_lib}/libnss_db-%{libversion}.so +/%{_lib}/libnss_db.so.2 +/%{_lib}/libnss_dns-%{libversion}.so +/%{_lib}/libnss_dns.so.2 +/%{_lib}/libnss_files-%{libversion}.so +/%{_lib}/libnss_files.so.2 +/%{_lib}/libnss_hesiod-%{libversion}.so +/%{_lib}/libnss_hesiod.so.2 +/%{_lib}/libnss_nis-%{libversion}.so +/%{_lib}/libnss_nis.so.2 +/%{_lib}/libnss_nisplus-%{libversion}.so +/%{_lib}/libnss_nisplus.so.2 +/%{_lib}/libpthread-%{libversion}.so +/%{_lib}/libpthread.so.0 +/%{_lib}/libresolv-%{libversion}.so +/%{_lib}/libresolv.so.2 +/%{_lib}/librt-%{libversion}.so +/%{_lib}/librt.so.1 +/%{_lib}/libthread_db-1.0.so +/%{_lib}/libthread_db.so.1 +/%{_lib}/libutil-%{libversion}.so +/%{_lib}/libutil.so.1 +%define optimized_libs() \ + %dir %attr(0755,root,root) /%{_lib}/%1\ + /%{_lib}/%1/libc-%{libversion}.so\ + /%{_lib}/%1/libc.so.6*\ + /%{_lib}/%1/libm-%{libversion}.so\ + /%{_lib}/%1/libm.so.6*\ + /%{_lib}/%1/libpthread-%{libversion}.so\ + /%{_lib}/%1/libpthread.so.0\ + /%{_lib}/%1/librt-%{libversion}.so\ + /%{_lib}/%1/librt.so.1\ + /%{_lib}/%1/libthread_db-1.0.so\ + /%{_lib}/%1/libthread_db.so.1 + +%if %{optimize_power} + %if %{powerpc_optimize_cpu_power4} + %{optimized_libs power4} + %endif + %if %{powerpc_optimize_cpu_power6} + %{optimized_libs power6} + %{optimized_libs power6x} + %endif + %if %{powerpc_optimize_cpu_power7} + %{optimized_libs power7} + %endif + %if %{powerpc_optimize_cpu_cell} + %{optimized_libs ppc-cell-be} + %endif +%endif # optimize_power +%ifarch i686 x86_64 +/%{_lib}/noelision +%endif +%dir %attr(0700,root,root) /var/cache/ldconfig +/sbin/ldconfig +%{_bindir}/gencat +%{_bindir}/getconf +%{_bindir}/getent +%{_bindir}/iconv +%attr(755,root,root) %{_bindir}/ldd +%ifarch %ix86 sparc sparcv9 m68k + %{_bindir}/lddlibc4 +%endif +%{_bindir}/locale +%{_bindir}/localedef +%dir %attr(0755,root,root) %{_libexecdir}/getconf +%{_libexecdir}/getconf/* +%{_sbindir}/glibc_post_upgrade +%{_sbindir}/iconvconfig + +%ifarch i586 +%files obsolete +%defattr (755,root,root,755) +/%{_lib}/obsolete +%endif + +%files locale -f libc.lang +%defattr(-,root,root) +%{_datadir}/locale/locale.alias +%if %{build_locales} + /usr/lib/locale +%endif +%{_libdir}/gconv + +%files devel +%defattr(-,root,root) +%doc COPYING COPYING.LIB NEWS README BUGS CONFORMANCE +%doc %{_mandir}/man1/catchsegv.1.gz +%doc %{_mandir}/man1/rpcgen.1.gz +%doc %{_mandir}/man3/* +%{_bindir}/catchsegv +%{_bindir}/rpcgen +%{_bindir}/sprof +%{_includedir}/* +%{_libdir}/*.o +%{_libdir}/*.so +# These static libraries are needed even for shared builds +%{_libdir}/libc_nonshared.a +%{_libdir}/libg.a +%{_libdir}/libieee.a +%ifarch ppc ppc64 ppc64le s390 s390x sparc sparcv8 sparcv9 sparcv9v +# This is not built on sparc64. + %{_libdir}/libnldbl_nonshared.a +%endif +%{_libdir}/libmcheck.a +%ifarch x86_64 +%{_libdir}/libmvec_nonshared.a +%endif +%{_libdir}/libpthread_nonshared.a +%{_libdir}/librpcsvc.a + +%files devel-static +%defattr(-,root,root) +%{_libdir}/libBrokenLocale.a +%{_libdir}/libanl.a +%{_libdir}/libc.a +%{_libdir}/libcrypt.a +%{_libdir}/libowcrypt.a +%{_libdir}/libdl.a +%{_libdir}/libm.a +%ifarch x86_64 +%{_libdir}/libm-%{libversion}.a +%{_libdir}/libmvec.a +%endif +%{_libdir}/libnsl.a +%{_libdir}/libpthread.a +%{_libdir}/libresolv.a +%{_libdir}/librt.a +%{_libdir}/libutil.a + +%ifnarch i686 +%files info +%defattr(-,root,root) +%doc %{_infodir}/libc.info.gz +%doc %{_infodir}/libc.info-?.gz +%doc %{_infodir}/libc.info-??.gz + +%if %{build_html} +%files html +%defattr(-,root,root) +%doc %{_prefix}/share/doc/glibc +%endif + +%files i18ndata +%defattr(-,root,root) +%{_prefix}/share/i18n + +%files -n nscd +%defattr(-,root,root) +%config(noreplace) /etc/nscd.conf +%{_sbindir}/nscd +%{_sbindir}/rcnscd +/usr/lib/systemd/system/nscd.service +%dir /usr/lib/tmpfiles.d +/usr/lib/tmpfiles.d/nscd.conf +%dir %attr(0755,root,root) %ghost /run/nscd +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /run/nscd/nscd.pid +%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /run/nscd/socket +%dir %attr(0755,root,root) /var/lib/nscd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/passwd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/group +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/hosts +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/services +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/netgroup +%endif # !i686 + +%if %{build_profile} +%files profile +%defattr(-,root,root) +%{_libdir}/libc_p.a +%{_libdir}/libBrokenLocale_p.a +%{_libdir}/libanl_p.a +%{_libdir}/libm_p.a +%ifarch x86_64 +%{_libdir}/libmvec_p.a +%endif +%{_libdir}/libcrypt_p.a +%{_libdir}/libowcrypt_p.a +%{_libdir}/libpthread_p.a +%{_libdir}/libresolv_p.a +%{_libdir}/libnsl_p.a +%{_libdir}/librt_p.a +%{_libdir}/librpcsvc_p.a +%{_libdir}/libutil_p.a +%{_libdir}/libdl_p.a +%endif + +%ifnarch i686 +%files extra +%defattr(-,root,root) +%{_bindir}/makedb +/var/lib/misc/Makefile +%endif # !i686 + +%endif # main + +%if %{build_utils} +%files utils +%defattr(-,root,root) +/%{_lib}/libmemusage.so +/%{_lib}/libpcprofile.so +%dir %{_libdir}/audit +%{_libdir}/audit/sotruss-lib.so +%{_bindir}/memusage +%{_bindir}/memusagestat +%{_bindir}/mtrace +%{_bindir}/pcprofiledump +%{_bindir}/sotruss +%{_bindir}/xtrace +%{_bindir}/pldd +%endif # utils + +%changelog diff --git a/glibc.i686.spec b/glibc.i686.spec new file mode 100644 index 0000000..73d62f3 --- /dev/null +++ b/glibc.i686.spec @@ -0,0 +1,1436 @@ +# +# spec file for package glibc +# +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +# Run with osc --with=fast_build to have a shorter turnaround +# It will avoid building some parts of glibc +%bcond_with fast_build + +%define crypt_bf_version 1.3 +%define build_snapshot 0 + +%define flavor i686 + +%bcond_with all +%define build_main 1 +%define build_utils %{with all} +%define build_testsuite %{with all} +%if "%flavor" == "utils" +%define build_main 0 +%define build_utils 1 +%define build_testsuite 0 +%endif +%if "%flavor" == "testsuite" +%define build_main 0 +%define build_utils 0 +%define build_testsuite 1 +%endif + +Name: glibc +Summary: Standard Shared Libraries (from the GNU C Library) +License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: System/Libraries +BuildRequires: audit-devel +BuildRequires: fdupes +BuildRequires: libcap-devel +BuildRequires: libselinux-devel +BuildRequires: makeinfo +BuildRequires: pwdutils +BuildRequires: systemd-rpm-macros +BuildRequires: xz +%if %{build_testsuite} +BuildRequires: gcc-c++ +BuildRequires: gdb +BuildRequires: glibc-devel-static +BuildRequires: libstdc++-devel +BuildRequires: python-pexpect +%endif +%if %{build_utils} +BuildRequires: gd-devel +%endif +%if "%flavor" == "i686" +ExclusiveArch: i586 i686 +BuildArch: i686 +%global optflags %(echo "%optflags"|sed -e s/i586/i686/) -march=i686 -mtune=generic +%endif + +%define __filter_GLIBC_PRIVATE 1 +%ifarch i686 +# For i686 let's only build what's different from i586, so +# no need to build documentation +%define build_profile 1 +%define build_locales 1 +%define build_html 0 +%else +%if %{with fast_build} || %{build_utils} && %{without all} +%define build_profile 0 +%define build_locales 0 +%define build_html 0 +%else +# Default: +%define build_profile 1 +%define build_locales 1 +%define build_html 1 +%endif +%endif + +%define build_variants %{build_main} + +%define disable_assert 0 +%define enable_stackguard_randomization 1 +%ifarch ppc ppc64 + %define optimize_power 1 + %ifarch ppc + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_tune power3 + %define powerpc_optimize_cpu_power4 1 + %else + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_tune power5 + %define powerpc_optimize_cpu_power4 0 + %endif + # We are not building Power CPU specific optimizations for openSUSE. + %define powerpc_optimize_cpu_power6 0 + %define powerpc_optimize_cpu_power7 0 + %define powerpc_optimize_cpu_cell 0 +%else + %define optimize_power 0 + %define powerpc_optimize_base %{nil} + %define powerpc_optimize_cpu_power4 0 + %define powerpc_optimize_cpu_power6 0 + %define powerpc_optimize_cpu_power7 0 + %define powerpc_optimize_cpu_cell 0 +%endif # ppc, ppc64 +# 3.0 is the SLES 11 SP3 kernel +# 3.1 is the openSUSE 12.1 kernel +%define enablekernel 3.0 + +Version: 2.25 +Release: 0 +%if !%{build_snapshot} +%define git_id db0242e30234 +%define libversion %version +%else +%define git_id %(echo %version | sed 's/.*\.g//') +%define libversion %(echo %version | sed 's/\.[^.]*\.g.*//') +%endif +Url: http://www.gnu.org/software/libc/libc.html +BuildRoot: %{_tmppath}/%{name}-%{version}-build +Source: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz +%if !%{build_snapshot} +Source1: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz.sig +%endif +Source2: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=libc&download=1#/glibc.keyring +Source3: noversion.tar.bz2 +Source4: manpages.tar.bz2 +Source5: nsswitch.conf +Source7: bindresvport.blacklist +Source8: glibc_post_upgrade.c +Source9: glibc.rpmlintrc +Source10: baselibs.conf +# For systemd +Source20: nscd.conf +Source21: nscd.service +# crypt_blowfish +Source50: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz +# The sign key uses MD5 which is no longer accepted by gpg +#Source51: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz.sign + +# ngpt was used in 8.1 and SLES8 +Obsoletes: ngpt < 2.2.2 +Obsoletes: ngpt-devel < 2.2.2 +Provides: ngpt = 2.2.2 +Provides: ngpt-devel = 2.2.2 +Conflicts: kernel < %{enablekernel} +# bug437293 - handle update from SLES10 on PowerPC +%ifarch ppc64 +Obsoletes: glibc-64bit +%endif +%ifarch ppc +Obsoletes: glibc-32bit +%endif +%ifarch armv6hl armv7hl +# The old runtime linker link gets not provided by rpm find.provides, but it exists +Provides: ld-linux.so.3 +Provides: ld-linux.so.3(GLIBC_2.4) +%endif +Requires(pre): filesystem +Recommends: glibc-extra +Provides: rtld(GNU_HASH) +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%ifarch i686 +# We need to avoid to have only the src rpm from i686 on the media, +# since it does not work on other architectures. +NoSource: 0 +%endif +# + +### +# Patches are ordered in the following groups: +# Patches that we will never upstream or which have not been looked at: 0-999 +# Patches taken from upstream: 1000-2000 +# Patches that are going upstream, waiting approval: 2000-3000 +### + +### +# Patches that upstream will not accept +### + +### +# openSUSE specific patches - won't go upstream +### +### openSUSE extensions, configuration +# PATCH-FEATURE-OPENSUSE -- add crypt_blowfish support - bnc#700876 +Patch1: glibc-2.14-crypt.diff +# PATCH-FEATURE-OPENSUSE constify crypt_blowfish +Patch2: crypt_blowfish-const.patch +# PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de +Patch3: crypt_blowfish-1.2-sha.diff +# PATCH-FEATURE-OPENSUSE Move crypt_gensalt_rn to separate library +Patch4: crypt_blowfish-gensalt.patch +# PATCH-FEATURE-OPENSUSE Avoid build failure on noexecstack marker on ARM dmueller@suse.de +Patch5: crypt_blowfish-1.2-hack_around_arm.diff +# PATCH-FIX-OPENSUSE Fix path for nscd databases +Patch6: glibc-2.3.3-nscd-db-path.diff +# PATCH-FIX-OPENSUSE Fix path for nss_db (bnc#753657) - aj@suse.de +Patch7: nss-db-path.patch +# PATCH-FIX-OPENSUSE adjust nscd.conf +Patch8: glibc-nscd.conf.patch +# PATCH-FIX-OPENSUSE do not use compile time in binaries +Patch9: glibc-nodate.patch +# PATCH-FIX-OPENSUSE -- add some extra information to version output - kukuk@suse.de +Patch10: glibc-version.diff +# PATCH-FIX-OPENSUSE handle old glibc binaries +Patch12: glibc-2.3.90-noversion.diff +# PATCH-FIX-OPENSUSE -- Make --no-archive default for localedef - kukuk@suse.de +Patch13: glibc-2.3.2.no_archive.diff +# PATCH-FIX-OPENSUSE -- add blacklist for bindresvport +Patch14: glibc-bindresvport-blacklist.diff +# PATCH-FIX-OPENSUSE prefer -lang rpm packages +Patch15: glibc-2.3.90-langpackdir.diff +# PATCH-FEATURE-SLE Use nscd user for nscd +Patch19: nscd-server-user.patch +# PATCH-FEATURE-SLE powerpc: enable TLE only if GLIBC_ELISION_ENABLE=yes is defined +Patch21: powerpc-elision-enable-envvar.patch + +### Locale related patches +# PATCH-FIX-OPENSUSE Add additional locales +Patch100: add-locales.patch +# PATCH-FIX-OPENSUSE -- Add no_NO back (XXX: Still needed?) +Patch102: glibc-2.4.90-no_NO.diff +# PATCH-FIX-OPENSUSE -- Renames for China +Patch103: glibc-2.4-china.diff +# PATCH-FIX-OPENSUSE -- Add C.UTF-8 locale +Patch104: glibc-c-utf8-locale.patch +# PATCH-FIX-OPENSUSE -- Disable gettext for C.UTF-8 locale +Patch105: glibc-disable-gettext-for-c-utf8.patch + +### Broken patches in glibc that we revert for now: + +### Network related patches +# PATCH-FIX-OPENSUSE reload /etc/resolv.conf on change +Patch300: glibc-resolv-reload.diff +# PATCH-FIX-OPENSUSE Fix hangs in UDP RPC calls bso#5379 bnc#257745 aj@suse.de +Patch301: glibc-2.2-sunrpc.diff +# PATCH-FIX-OPENSUSE Warn about usage of mdns in resolv.conv +Patch304: glibc-resolv-mdnshint.diff +# PATCH-FIX-OPENSUSE disable rewriting ::1 to 127.0.0.1 for /etc/hosts bnc#684534, bnc#706719 +Patch306: glibc-fix-double-loopback.diff + +### +# Patches from upstream +### +# PATCH-FIX-UPSTREAM Fix getting tunable values on big-endian (BZ #21109) +Patch1000: tunables-bigendian.patch +# PATCH-FIX-UPSTREAM Fix i686 memchr overflow calculation (BZ #21182) +Patch1001: i686-memchr-sse.patch +# PATCH-FIX-UPSTREAM Avoid use-after-free read access in clntudp_call (BZ #21115) +Patch1002: sunrpc-use-after-free.patch +# PATCH-FIX-UPSTREAM Fix test-math-vector-sincos.h aliasing +Patch1003: test-math-vector-sincos-aliasing.patch +# PATCH-FIX-UPSTREAM Fix symbol redirect for fts_set (BZ #21289) +Patch1004: fts-symbol-redirect.patch +# PATCH-FIX-UPSTREAM Ignore and remove LD_HWCAP_MASK for AT_SECURE programs (BZ #21209) +Patch1005: ld-hwcap-mask-suid.patch +# PATCH-FIX-UPSTREAM rtld: Completely ignore LD_LIBRARY_PATH for AT_SECURE=1 programs (CVE-2017-1000366, BZ #21624) +Patch1006: ld-library-path-suid.patch + +### +# Patches awaiting upstream approval +### +# PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142) +Patch2000: fix-locking-in-_IO_cleanup.patch +# PATCH-FIX-UPSTREAM Never try to execute the file in ldd (BZ #16750) +Patch2001: ldd-system-interp.patch +# PATCH-FIX-UPSTREAM Don't close or flush stdio streams on abort (BZ #15436) +Patch2002: abort-no-flush.patch +# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976) +Patch2004: fnmatch-collating-elements.patch +# PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991) +Patch2005: nss-files-long-lines-2.patch +# PATCH-FIX-UPSTREAM Fix iconv buffer handling with IGNORE error handler (BZ #18830) +Patch2006: iconv-reset-input-buffer.patch +# PATCH-FIX-UPSTREAM Reinitialize dl_load_write_lock on fork (BZ #19282) +Patch2008: reinitialize-dl_load_write_lock.patch + +# Non-glibc patches +# PATCH-FIX-OPENSUSE Remove debianisms from manpages +Patch3000: manpages.patch + +%description +The GNU C Library provides the most important standard libraries used +by nearly all programs: the standard C library, the standard math +library, and the POSIX thread library. A system is not functional +without these libraries. + +%package utils +Summary: Development utilities from the GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ +Requires: glibc = %{version} + +%description utils +The glibc-utils package contains mtrace, a memory leak tracer and +xtrace, a function call tracer which can be helpful during program +debugging. + +If you are unsure if you need this, do not install this package. + +%package testsuite +Summary: Testsuite results from the GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ + +%description testsuite +This package contains the testsuite results from the GNU C Library. + +%package info +Summary: Info Files for the GNU C Library +License: GFDL-1.1 +Group: Documentation/Other +Requires(post): %{install_info_prereq} +Requires(preun): %{install_info_prereq} +BuildArch: noarch + +%description info +This package contains the documentation for the GNU C library stored as +info files. Due to a lack of resources, this documentation is not +complete and is partially out of date. + +%package html +Summary: HTML Documentation for the GNU C Library +License: GFDL-1.1 +Group: Documentation/HTML +BuildArch: noarch + +%description html +This package contains the HTML documentation for the GNU C library. Due +to a lack of resources, this documentation is not complete and is +partially out of date. + +%package i18ndata +Summary: Database Sources for 'locale' +License: GPL-2.0+ and MIT +Group: System/Libraries +BuildArch: noarch + +%description i18ndata +This package contains the data needed to build the locale data files to +use the internationalization features of the GNU libc. It is normally +not necessary to install this packages, the data files are already +created. + +%package locale +Summary: Locale Data for Localized Programs +License: GPL-2.0+ and MIT and LGPL-2.1+ +Group: System/Libraries +Requires(post): /bin/cat +Requires: glibc = %{version} +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-locale-64bit +%endif +%ifarch ppc +Obsoletes: glibc-locale-32bit +%endif + +%description locale +Locale data for the internationalisation features of the GNU C library. + +%package -n nscd +Summary: Name Service Caching Daemon +License: GPL-2.0+ +Group: System/Daemons +Provides: glibc:/usr/sbin/nscd +Requires: glibc = %{version} +Obsoletes: unscd <= 0.48 +Requires(pre): pwdutils +%{?systemd_requires} + +%description -n nscd +Nscd caches name service lookups and can dramatically improve +performance with NIS, NIS+, and LDAP. + +%package profile +Summary: Libc Profiling and Debugging Versions +License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: glibc = %{version} +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-profile-64bit +%endif +%ifarch ppc +Obsoletes: glibc-profile-32bit +%endif + +%description profile +This package contains special versions of the GNU C library which are +necessary for profiling and debugging. + +%package devel +Summary: Include Files and Libraries Mandatory for Development +License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Obsoletes: epoll = 1.0 +Provides: epoll < 1.0 +# bug437293 +%ifarch ppc64 +Obsoletes: glibc-devel-64bit +%endif +%ifarch ppc +Obsoletes: glibc-devel-32bit +%endif +Requires: glibc = %{version} +Requires: linux-kernel-headers + +%description devel +These libraries are needed to develop programs which use the standard C +library. + +%package devel-static +Summary: C library static libraries for -static linking +License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+ +Group: Development/Libraries/C and C++ +Requires: %{name}-devel = %{version} +# Provide Fedora name for package to make packaging easier +Provides: %{name}-static = %{version} + +%description devel-static +The glibc-devel-static package contains the C library static libraries +for -static linking. You don't need these, unless you link statically, +which is highly discouraged. + +# makedb requires libselinux. We add this program in a separate +# package so that glibc does not require libselinux. +%package extra +Summary: Extra binaries from GNU C Library +License: LGPL-2.1+ +Group: Development/Languages/C and C++ +Requires: glibc = %{version} + +%description extra +The glibc-extra package contains some extra binaries for glibc that +are not essential but recommend to use. + +makedb: A program to create a database for nss + +%package obsolete +Summary: Obsolete Shared Libraries from the GNU C Library +License: LGPL-2.0+ +Group: System/Libraries +Requires: glibc = %{version} + +%description obsolete +This package provides some old libraries from the GNU C Library which +are no longer supported. Additional it provides a compatibility library +for old binaries linked against glibc 2.0. + +Install this package if you need one of this libraries to get old +binaries working, but since this libraries are not supported and there +is no gurantee that they work for you, you should try to get newer +versions of your software. + +%prep +%setup -n glibc-%{version} -q -a 3 -a 4 +# Owl crypt_blowfish +tar -xzf %SOURCE50 +pushd crypt_blowfish-%{crypt_bf_version} +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 +popd +mv crypt/{crypt.h,gnu-crypt.h} +mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/ +# +%patch1 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +# avoid changing nscd_stat.c mtime to avoid code generation +# differences on each rebuild +touch -r nscd/nscd_stat.c nscd/s-stamp +%patch9 -p1 +touch -r nscd/s-stamp nscd/nscd_stat.c +rm nscd/s-stamp +%patch10 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch19 -p1 +%patch21 -p1 + +%patch100 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 +%patch105 -p1 + +%patch300 -p1 +%patch301 -p1 +%patch304 -p1 +%patch306 -p1 + +%patch1000 -p1 +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 +%patch1006 -p1 + +%patch2000 -p1 +%patch2001 -p1 +%patch2002 -p1 +%patch2004 -p1 +%patch2005 -p1 +%patch2006 -p1 +%patch2008 -p1 + +%patch3000 + +# +# Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed! +# +# Glibc 2.8 introduced the HP_TIMING element to the rtld_global_ro struct # definition. +# If the base is built without power4 the loader won't have this element in +# the struct whereas the power4/5/6/... libc will, so there will be a disconnect +# between the size of the rtld_global_ro struct between the two and dl_close +# ends up getting called incorrectly when it's actually attempting to call a +# resolver function. This is because the GLRO() macro simply attempts to +# compute an offset and gets the wrong one. +# Building the base glibc with --with-cpu=power4 solves this problem. +# But: ppc32 can not default to -mcpu=power4 because it would emit instructions +# which are not available on G3, G4 etc. +# +# We simply remove the power4 files, and build the base glibc for a generic powerpc cpu +# Additional cputuned libs can now be used on powerpc32 +# +rm -fv sysdeps/powerpc/powerpc32/power4/hp-timing.c sysdeps/powerpc/powerpc32/power4/hp-timing.h +find . -name configure | xargs touch + +####################################################################### +### +### BUILD +### +####################################################################### + +%build +if [ -x /bin/uname.bin ]; then + /bin/uname.bin -a +else + uname -a +fi +uptime || : +ulimit -a +nice +# We do not want configure to figure out the system its building one +# to support a common ground and thus set build and host to the +# target_cpu. +%ifarch %arm +%define target %{_target_cpu}-suse-linux-gnueabi +%else +%define target %{_target_cpu}-suse-linux +%endif +# Don't use as-needed, it breaks glibc assumptions +# Before enabling it, run the testsuite and verify that it +# passes completely +export SUSE_ASNEEDED=0 +# Adjust glibc version.h +echo "#define CONFHOST \"%{target}\"" >> version.h +echo "#define GITID \"%{git_id}\"" >> version.h +# +# Default CFLAGS and Compiler +# +BuildFlags="%{optflags} -U_FORTIFY_SOURCE" +enable_stack_protector= +for opt in $BuildFlags; do + case $opt in + -fstack-protector-strong) enable_stack_protector=strong ;; + -fstack-protector-all) enable_stack_protector=all ;; + -fstack-protector) enable_stack_protector=yes ;; + esac +done +BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector[^ ]*##' -e 's#-ffortify=[0-9]*##') +BuildCC="%__cc" +BuildCCplus="%__cxx" +add_ons=libidn +# +#now overwrite for some architectures +# +%ifarch sparc64 + BuildFlags="-O2 -mcpu=ultrasparc -mvis -fcall-used-g6" + BuildCC="gcc -m64" + BuildCCplus="$BuildCCplus -m64" +%endif +%ifarch sparc + BuildFlags="$BuildFlags -fcall-used-g6" + BuildCC="gcc -m32" + BuildCCplus="$BuildCCplus -m32" +%endif +%ifarch sparcv9 + BuildFlags="$BuildFlags -mcpu=ultrasparc -fcall-used-g6" + BuildCC="gcc -m32" + BuildCCplus="$BuildCCplus -m32" +%endif +%ifarch alphaev6 + BuildFlags="-mcpu=ev6" +%endif +%ifarch ppc ppc64 + BuildFlags="$(echo $BuildFlags | sed 's#-mminimal-toc##')" +%endif +%ifarch ppc64 + BuildCC="$BuildCC -m64" + BuildCCplus="$BuildCCplus -m64" +%endif +%ifarch hppa + BuildFlags="$BuildFlags -mpa-risc-1-1 -fstrict-aliasing" +%endif +# Add flags for all plattforms except AXP +%ifnarch alpha + BuildFlags="$BuildFlags -g" +%endif +%if %{disable_assert} + BuildFlags="$BuildFlags -DNDEBUG=1" +%endif +%ifarch %ix86 + add_ons=$add_ons,noversion +%endif +%ifarch mipsel + # fails to build otherwise - need to recheck and fix + %define enable_stackguard_randomization 0 +%endif + +configure_and_build_glibc() { + local dirname="$1"; shift + local cflags="$1"; shift + mkdir "cc-$dirname" + cd "cc-$dirname" +%ifarch %arm aarch64 + # remove asynchronous-unwind-tables during configure as it causes + # some checks to fail spuriously on arm + conf_cflags="${cflags/-fasynchronous-unwind-tables/}" + conf_cflags="${conf_cflags/-funwind-tables/}" +%else + conf_cflags="$cflags" +%endif + + profile="--disable-profile" +%if %{build_profile} + if [ "$dirname" = "base" ] ; then + profile="--enable-profile" + fi +%endif + elision=--enable-lock-elision + if [ "$dirname" = "noelision" ]; then + elision=--disable-lock-elision + fi + ../configure \ + CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ + CC="$BuildCC" CXX="$BuildCCplus" \ + --prefix=%{_prefix} \ + --libexecdir=%{_libexecdir} --infodir=%{_infodir} \ + --enable-add-ons=$add_ons \ + $profile $elision \ + "$@" \ + --build=%{target} --host=%{target} \ +%ifarch armv7hl ppc ppc64 ppc64le i686 x86_64 sparc sparc64 s390 s390x + --enable-multi-arch \ +%endif +%ifarch mipsel + --without-fp \ +%endif +%ifarch ppc64p7 + --with-cpu=power7 \ +%endif +%if %{enable_stackguard_randomization} + --enable-stackguard-randomization \ +%endif + ${enable_stack_protector:+--enable-stack-protector=$enable_stack_protector} \ + --enable-tunables \ + --enable-kernel=%{enablekernel} \ + --with-bugurl=http://bugs.opensuse.org \ + --enable-bind-now --enable-obsolete-rpc \ + --disable-timezone-tools +# Should we enable --enable-systemtap? +# Should we enable --enable-nss-crypt to build use freebl3 hash functions? + # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) + make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags" + cd .. +} + +%if !%{optimize_power} + # + # Build base glibc + # + configure_and_build_glibc base "$BuildFlags" +%else + # + # Build POWER-optimized glibc + # + # First, base build: + pBuildFlags="$BuildFlags -mtune=%{powerpc_optimize_tune}" + %if "%{powerpc_optimize_base}" != "" + pBuildFlags+=" -mcpu=%{powerpc_optimize_base}" + %endif + %if "%{powerpc_optimize_base}" != "" + configure_and_build_glibc base "$pBuildFlags" --with-cpu=%{powerpc_optimize_base} + %else + # Use no default CPU + configure_and_build_glibc base "$pBuildFlags" + %endif + %if %{build_variants} + # Then other power variants: + for pcpu in \ + %if %{powerpc_optimize_cpu_power4} + power4 \ + %endif + %if %{powerpc_optimize_cpu_power6} + power6 \ + %endif + %if %{powerpc_optimize_cpu_power7} + power7 \ + %endif + ; do + configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" \ + --with-cpu=$pcpu + done + # Eventually, special Cell variant: + %if %{powerpc_optimize_cpu_cell} + configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell" + %endif + %endif # %{build_variants} +%endif # optimize_power + +%if %{build_variants} +%ifarch i686 x86_64 +configure_and_build_glibc noelision "$BuildFlags" +%endif +%endif + +# +# Build html documentation +# +%if %{build_html} +make -C cc-base html +%endif + +# +# Build glibc_post_upgrade binary +# +$BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \ + -Lcc-base -Bcc-base/csu \ + '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \ +%ifarch ppc ppc64 + %if !%{powerpc_optimize_cpu_power4} + '-DREMOVE_PPC_OPTIMIZE_POWER4' \ + %endif + %if !%{powerpc_optimize_cpu_power6} + '-DREMOVE_PPC_OPTIMIZE_POWER6' \ + %endif + %if !%{powerpc_optimize_cpu_power7} + '-DREMOVE_PPC_OPTIMIZE_POWER7' \ + %endif + %if !%{powerpc_optimize_cpu_cell} + '-DREMOVE_PPC_OPTIMIZE_CELL' \ + %endif +%endif + '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"' + +# crypt_blowfish man pages +pushd crypt_blowfish-%{crypt_bf_version} +make man +popd + +####################################################################### +### +### CHECK +### +####################################################################### + +%check +%if %{build_testsuite} +# The testsuite will fail if asneeded is used +export SUSE_ASNEEDED=0 +# Increase timeout +export TIMEOUTFACTOR=16 +# The testsuite does its own malloc checking +unset MALLOC_CHECK_ +make -C cc-base -k check || { + cd cc-base + o=$- + set +x + for sum in subdir-tests.sum */subdir-tests.sum; do + while read s t; do + case $s in + XPASS:|PASS:) + echo ++++++ $s $t ++++++ + ;; + *) # X?FAIL: + echo ------ $s $t ------ + test ! -f $t.out || cat $t.out + ;; + esac + done < $sum + done + set -$o + # Fail build if there where compilation errors during testsuite run + test -f tests.sum +} +%else +# This has to pass on all platforms! +# Exceptions: +# None! +make %{?_smp_mflags} -C cc-base check-abi +%endif + +####################################################################### +### +### INSTALL +### +####################################################################### + +%install +%if %{build_main} +# We don't want to strip the .symtab from our libraries in find-debuginfo.sh, +# certainly not from libpthread.so.* because it is used by libthread_db to find +# some non-exported symbols in order to detect if threading support +# should be enabled. These symbols are _not_ exported, and we can't easily +# export them retroactively without changing the ABI. So we have to +# continue to "export" them via .symtab, instead of .dynsym :-( +# But we also want to keep .symtab and .strtab of other libraries since some +# debugging tools currently require these sections directly inside the main +# files - specifically valgrind and PurifyPlus. +export STRIP_KEEP_SYMTAB=*.so* + +# Make sure we will create the gconv-modules.cache +mkdir -p %{buildroot}%{_libdir}/gconv +touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache + +# Install base glibc +make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base + +install_optimized_variant() { + local dirname="$1"; shift + local subdir="$1"; shift + local subdir_up="$1"; shift + +cd "cc-$dirname" +destdir=$RPM_BUILD_ROOT/%{_lib}/$subdir +mkdir -p $destdir +# Don't run a complete make install, we know which libraries +# we want +for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db +do + libbase=${lib#*/} + libbaseso=$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}-*.so) + # Only install if different from base lib + if cmp -s ${lib}.so ../cc-base/${lib}.so; then + ln -sf $subdir_up/$libbaseso $destdir/$libbaseso + else + cp -a ${lib}.so $destdir/$libbaseso + fi +done +cd .. +cc-base/elf/ldconfig -vn $destdir +} + +# Install power-optimized glibc +%if %{optimize_power} + %if %{powerpc_optimize_cpu_power4} + install_optimized_variant power4 power4 ".." + %endif + %if %{powerpc_optimize_cpu_power6} + install_optimized_variant power6 power6 ".." + %endif + %if %{powerpc_optimize_cpu_power7} + install_optimized_variant power7 power7 ".." + %endif + %if %{powerpc_optimize_cpu_cell} + install_optimized_variant ppc-cell-be ppc-cell-be ".." + %endif + %if %{powerpc_optimize_cpu_power6} + # power6 is compatible with power6x + # doing a directory symlink doesnt work, ldconfig follows them and accepts only the first real dir + if test -d %{buildroot}/%{_lib}/power6; then + mkdir -p %{buildroot}/%{_lib}/power6x + for i in %{buildroot}/%{_lib}/power6/*.so; do + b=$(basename $i) + ln -vs ../power6/$b %{buildroot}/%{_lib}/power6x/$b + done + cc-base/elf/ldconfig -vn %{buildroot}/%{_lib}/power6x + fi + %endif +%endif # optimize_power + +%ifarch i686 x86_64 +cd cc-noelision +destdir=$RPM_BUILD_ROOT/%{_lib}/noelision +mkdir -p $destdir +install -m 755 nptl/libpthread.so $destdir/libpthread-%{libversion}.so +cd .. +cc-base/elf/ldconfig -vn $destdir +%endif + +# Install locales +%if %{build_locales} + # XXX Do not install locales in parallel! + cd cc-base + # localedef creates hardlinks to other locales if possible + # this will not work if we generate them in parallel. + # thus we need to run fdupes on /usr/lib/locale/ + # Still, on my system this is a speed advantage: + # non-parallel build for install-locales: 9:34mins + # parallel build with fdupes: 7:08mins + make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales + %fdupes %{buildroot}/usr/lib/locale + cd .. +%endif +# Create file list for glibc-locale package +%{find_lang} libc + +# Prepare obsolete/, used only on some architectures: +export RPM_BUILD_ROOT +%ifarch i586 +mkdir -p %{buildroot}/%{_lib}/obsolete +%endif + +# Miscelanna: + +install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} + +install -m 644 %{SOURCE7} %{buildroot}/etc +install -m 644 %{SOURCE5} %{buildroot}/etc +install -m 644 posix/gai.conf %{buildroot}/etc + +mkdir -p %{buildroot}/etc/default +install -m 644 nis/nss %{buildroot}/etc/default/ + +mkdir -p %{buildroot}%{_includedir}/resolv +install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/ +install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/ + +%if %{build_html} +mkdir -p %{buildroot}%{_datadir}/doc/glibc +cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc +%endif + +cd manpages; make install_root=%{buildroot} install; cd .. + +# crypt_blowfish man pages +pushd crypt_blowfish-%{crypt_bf_version} +install -m755 -d %{buildroot}%{_mandir}/man3 +install -m644 *.3 %{buildroot}%{_mandir}/man3 +popd + +# nscd tools: + +%ifnarch i686 +cp nscd/nscd.conf %{buildroot}/etc +mkdir -p %{buildroot}/etc/init.d +ln -sf /sbin/service %{buildroot}/usr/sbin/rcnscd +mkdir -p %{buildroot}/run/nscd +mkdir -p %{buildroot}/var/lib/nscd +%endif + +# +# Create ld.so.conf +# +cat > %{buildroot}/etc/ld.so.conf <>"$l" + cat "$l.d"/* >>"$l" +done +/usr/sbin/iconvconfig + +%post info +%install_info --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%preun info +%install_info_delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz + +%pre -n nscd +getent group nscd >/dev/null || %{_sbindir}/groupadd -r nscd +getent passwd nscd >/dev/null || %{_sbindir}/useradd -r -g nscd -c "User for nscd" -s /sbin/nologin -d /run/nscd nscd +%service_add_pre nscd.service + +%preun -n nscd +%service_del_preun nscd.service + +%post -n nscd +%service_add_post nscd.service +%tmpfiles_create /usr/lib/tmpfiles.d/nscd.conf +# Previously we had nscd.socket, remove it +test -x /usr/bin/systemctl && /usr/bin/systemctl stop nscd.socket 2>/dev/null || : +test -x /usr/bin/systemctl && /usr/bin/systemctl disable nscd.socket 2>/dev/null || : +# Hard removal in case the above did not work +rm -f /etc/systemd/system/sockets.target.wants/nscd.socket +exit 0 + +%postun -n nscd +%service_del_postun nscd.service +exit 0 + +%if %{build_main} +%files +####################################################################### +### +### FILES +### +####################################################################### + +# glibc +%defattr(-,root,root) +%doc LICENSES +%config(noreplace) /etc/bindresvport.blacklist +%config /etc/ld.so.conf +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache +%config(noreplace) /etc/rpc +%verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf +%verify(not md5 size mtime) %config(noreplace) /etc/gai.conf +%config(noreplace) /etc/default/nss +%doc %{_mandir}/man1/gencat.1.gz +%doc %{_mandir}/man1/getconf.1.gz +%doc %{_mandir}/man5/* +/%{_lib}/ld-%{libversion}.so + +# Each architecture has a different name for the dynamic linker: +%ifarch %arm +%ifarch armv6hl armv7hl +/%{_lib}/ld-linux-armhf.so.3 +# Keep compatibility link +/%{_lib}/ld-linux.so.3 +%else +/%{_lib}/ld-linux.so.3 +%endif +%endif +%ifarch ia64 +/%{_lib}/ld-linux-ia64.so.2 +%endif +%ifarch ppc s390 mips hppa m68k +/%{_lib}/ld.so.1 +%endif +%ifarch ppc64 +/%{_lib}/ld64.so.1 +%endif +%ifarch ppc64le +/%{_lib}/ld64.so.2 +%endif +%ifarch s390x +/lib/ld64.so.1 +/%{_lib}/ld64.so.1 +%endif +%ifarch x86_64 +/%{_lib}/ld-linux-x86-64.so.2 +%endif +%ifarch %ix86 %sparc +/%{_lib}/ld-linux.so.2 +%endif +%ifarch aarch64 +/lib/ld-linux-aarch64.so.1 +/%{_lib}/ld-linux-aarch64.so.1 +%endif +%ifarch %ix86 x86_64 ppc ppc64 s390 s390x +# LSB +/%{_lib}/*-lsb*.so.3 +%endif + +/%{_lib}/libBrokenLocale-%{libversion}.so +/%{_lib}/libBrokenLocale.so.1 +/%{_lib}/libSegFault.so +/%{_lib}/libanl-%{libversion}.so +/%{_lib}/libanl.so.1 +/%{_lib}/libc-%{libversion}.so +/%{_lib}/libc.so.6* +/%{_lib}/libcidn-%{libversion}.so +/%{_lib}/libcidn.so.1 +/%{_lib}/libcrypt-%{libversion}.so +/%{_lib}/libcrypt.so.1 +/%{_lib}/libowcrypt-%{libversion}.so +/%{_lib}/libowcrypt.so.1 +/%{_lib}/libdl-%{libversion}.so +/%{_lib}/libdl.so.2* +/%{_lib}/libm-%{libversion}.so +/%{_lib}/libm.so.6* +%ifarch x86_64 +/%{_lib}/libmvec-%{libversion}.so +/%{_lib}/libmvec.so.1 +%endif +/%{_lib}/libnsl-%{libversion}.so +/%{_lib}/libnsl.so.1 +/%{_lib}/libnss_compat-%{libversion}.so +/%{_lib}/libnss_compat.so.2 +/%{_lib}/libnss_db-%{libversion}.so +/%{_lib}/libnss_db.so.2 +/%{_lib}/libnss_dns-%{libversion}.so +/%{_lib}/libnss_dns.so.2 +/%{_lib}/libnss_files-%{libversion}.so +/%{_lib}/libnss_files.so.2 +/%{_lib}/libnss_hesiod-%{libversion}.so +/%{_lib}/libnss_hesiod.so.2 +/%{_lib}/libnss_nis-%{libversion}.so +/%{_lib}/libnss_nis.so.2 +/%{_lib}/libnss_nisplus-%{libversion}.so +/%{_lib}/libnss_nisplus.so.2 +/%{_lib}/libpthread-%{libversion}.so +/%{_lib}/libpthread.so.0 +/%{_lib}/libresolv-%{libversion}.so +/%{_lib}/libresolv.so.2 +/%{_lib}/librt-%{libversion}.so +/%{_lib}/librt.so.1 +/%{_lib}/libthread_db-1.0.so +/%{_lib}/libthread_db.so.1 +/%{_lib}/libutil-%{libversion}.so +/%{_lib}/libutil.so.1 +%define optimized_libs() \ + %dir %attr(0755,root,root) /%{_lib}/%1\ + /%{_lib}/%1/libc-%{libversion}.so\ + /%{_lib}/%1/libc.so.6*\ + /%{_lib}/%1/libm-%{libversion}.so\ + /%{_lib}/%1/libm.so.6*\ + /%{_lib}/%1/libpthread-%{libversion}.so\ + /%{_lib}/%1/libpthread.so.0\ + /%{_lib}/%1/librt-%{libversion}.so\ + /%{_lib}/%1/librt.so.1\ + /%{_lib}/%1/libthread_db-1.0.so\ + /%{_lib}/%1/libthread_db.so.1 + +%if %{optimize_power} + %if %{powerpc_optimize_cpu_power4} + %{optimized_libs power4} + %endif + %if %{powerpc_optimize_cpu_power6} + %{optimized_libs power6} + %{optimized_libs power6x} + %endif + %if %{powerpc_optimize_cpu_power7} + %{optimized_libs power7} + %endif + %if %{powerpc_optimize_cpu_cell} + %{optimized_libs ppc-cell-be} + %endif +%endif # optimize_power +%ifarch i686 x86_64 +/%{_lib}/noelision +%endif +%dir %attr(0700,root,root) /var/cache/ldconfig +/sbin/ldconfig +%{_bindir}/gencat +%{_bindir}/getconf +%{_bindir}/getent +%{_bindir}/iconv +%attr(755,root,root) %{_bindir}/ldd +%ifarch %ix86 sparc sparcv9 m68k + %{_bindir}/lddlibc4 +%endif +%{_bindir}/locale +%{_bindir}/localedef +%dir %attr(0755,root,root) %{_libexecdir}/getconf +%{_libexecdir}/getconf/* +%{_sbindir}/glibc_post_upgrade +%{_sbindir}/iconvconfig + +%ifarch i586 +%files obsolete +%defattr (755,root,root,755) +/%{_lib}/obsolete +%endif + +%files locale -f libc.lang +%defattr(-,root,root) +%{_datadir}/locale/locale.alias +%if %{build_locales} + /usr/lib/locale +%endif +%{_libdir}/gconv + +%files devel +%defattr(-,root,root) +%doc COPYING COPYING.LIB NEWS README BUGS CONFORMANCE +%doc %{_mandir}/man1/catchsegv.1.gz +%doc %{_mandir}/man1/rpcgen.1.gz +%doc %{_mandir}/man3/* +%{_bindir}/catchsegv +%{_bindir}/rpcgen +%{_bindir}/sprof +%{_includedir}/* +%{_libdir}/*.o +%{_libdir}/*.so +# These static libraries are needed even for shared builds +%{_libdir}/libc_nonshared.a +%{_libdir}/libg.a +%{_libdir}/libieee.a +%ifarch ppc ppc64 ppc64le s390 s390x sparc sparcv8 sparcv9 sparcv9v +# This is not built on sparc64. + %{_libdir}/libnldbl_nonshared.a +%endif +%{_libdir}/libmcheck.a +%ifarch x86_64 +%{_libdir}/libmvec_nonshared.a +%endif +%{_libdir}/libpthread_nonshared.a +%{_libdir}/librpcsvc.a + +%files devel-static +%defattr(-,root,root) +%{_libdir}/libBrokenLocale.a +%{_libdir}/libanl.a +%{_libdir}/libc.a +%{_libdir}/libcrypt.a +%{_libdir}/libowcrypt.a +%{_libdir}/libdl.a +%{_libdir}/libm.a +%ifarch x86_64 +%{_libdir}/libm-%{libversion}.a +%{_libdir}/libmvec.a +%endif +%{_libdir}/libnsl.a +%{_libdir}/libpthread.a +%{_libdir}/libresolv.a +%{_libdir}/librt.a +%{_libdir}/libutil.a + +%ifnarch i686 +%files info +%defattr(-,root,root) +%doc %{_infodir}/libc.info.gz +%doc %{_infodir}/libc.info-?.gz +%doc %{_infodir}/libc.info-??.gz + +%if %{build_html} +%files html +%defattr(-,root,root) +%doc %{_prefix}/share/doc/glibc +%endif + +%files i18ndata +%defattr(-,root,root) +%{_prefix}/share/i18n + +%files -n nscd +%defattr(-,root,root) +%config(noreplace) /etc/nscd.conf +%{_sbindir}/nscd +%{_sbindir}/rcnscd +/usr/lib/systemd/system/nscd.service +%dir /usr/lib/tmpfiles.d +/usr/lib/tmpfiles.d/nscd.conf +%dir %attr(0755,root,root) %ghost /run/nscd +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /run/nscd/nscd.pid +%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /run/nscd/socket +%dir %attr(0755,root,root) /var/lib/nscd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/passwd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/group +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/hosts +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/services +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/nscd/netgroup +%endif # !i686 + +%if %{build_profile} +%files profile +%defattr(-,root,root) +%{_libdir}/libc_p.a +%{_libdir}/libBrokenLocale_p.a +%{_libdir}/libanl_p.a +%{_libdir}/libm_p.a +%ifarch x86_64 +%{_libdir}/libmvec_p.a +%endif +%{_libdir}/libcrypt_p.a +%{_libdir}/libowcrypt_p.a +%{_libdir}/libpthread_p.a +%{_libdir}/libresolv_p.a +%{_libdir}/libnsl_p.a +%{_libdir}/librt_p.a +%{_libdir}/librpcsvc_p.a +%{_libdir}/libutil_p.a +%{_libdir}/libdl_p.a +%endif + +%ifnarch i686 +%files extra +%defattr(-,root,root) +%{_bindir}/makedb +/var/lib/misc/Makefile +%endif # !i686 + +%endif # main + +%if %{build_utils} +%files utils +%defattr(-,root,root) +/%{_lib}/libmemusage.so +/%{_lib}/libpcprofile.so +%dir %{_libdir}/audit +%{_libdir}/audit/sotruss-lib.so +%{_bindir}/memusage +%{_bindir}/memusagestat +%{_bindir}/mtrace +%{_bindir}/pcprofiledump +%{_bindir}/sotruss +%{_bindir}/xtrace +%{_bindir}/pldd +%endif # utils + +%changelog diff --git a/glibc.spec b/glibc.spec index 7c380fe..e081ad2 100644 --- a/glibc.spec +++ b/glibc.spec @@ -23,16 +23,18 @@ %define crypt_bf_version 1.3 %define build_snapshot 0 +%define flavor %{nil} + %bcond_with all %define build_main 1 %define build_utils %{with all} %define build_testsuite %{with all} -%if "@BUILD_FLAVOR@" == "utils" +%if "%flavor" == "utils" %define build_main 0 %define build_utils 1 %define build_testsuite 0 %endif -%if "@BUILD_FLAVOR@" == "testsuite" +%if "%flavor" == "testsuite" %define build_main 0 %define build_utils 0 %define build_testsuite 1 @@ -60,7 +62,7 @@ BuildRequires: python-pexpect %if %{build_utils} BuildRequires: gd-devel %endif -%if "@BUILD_FLAVOR@" == "i686" +%if "%flavor" == "i686" ExclusiveArch: i586 i686 BuildArch: i686 %global optflags %(echo "%optflags"|sed -e s/i586/i686/) -march=i686 -mtune=generic diff --git a/pre_checkin.sh b/pre_checkin.sh new file mode 100644 index 0000000..9288970 --- /dev/null +++ b/pre_checkin.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for flavor in -utils -testsuite .i686; do + sed "/^%define flavor/s/%{nil}/${flavor#?}/" glibc.spec > glibc$flavor.spec +done