2 # spec file for package glibc
4 # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
6 # All modifications and additions to the file contributed by third parties
7 # remain the property of their copyright owners, unless otherwise agreed
8 # upon. The license for this file, and modifications and additions to the
9 # file, is the same license as for the pristine package itself (unless the
10 # license for the pristine package is not an Open Source License, in which
11 # case the license is the MIT License). An "Open Source License" is a
12 # license that conforms to the Open Source Definition (Version 1.9)
13 # published by the Open Source Initiative.
15 # This will avoid building some parts of glibc
16 %bcond_with fast_build
19 Summary: Standard Shared Libraries (from the GNU C Library)
20 License: LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
23 BuildRequires: makeinfo
25 BuildRequires: gcc-c++
26 BuildRequires: gettext-tools
27 BuildRequires: libstdc++-devel
28 #BuildRequires: pkgconfig(systemd)
30 %define _filter_GLIBC_PRIVATE 1
31 %if %_target_cpu == "i686"
32 # For i686 let's only build what's different from i586, so
33 # no need to build documentation
34 %define build_profile 1
35 %define build_locales 1
38 %if %{with fast_build}
39 %define build_profile 0
40 %define build_locales 0
44 %define build_profile 1
45 %define build_locales 1
50 %define disable_assert 0
51 %define enable_stackguard_randomization 1
55 %define enablekernel 2.6.16
57 %define enablekernel 2.6.16
59 Conflicts: kernel < %{enablekernel}
60 %ifarch armv7l armv7hl
61 # The old runtime linker link gets not provided by rpm find.provides, but it exists
62 Provides: ld-linux.so.3
63 Provides: ld-linux.so.3(GLIBC_2.4)
67 %define glibc_major_version 2.21
68 %define git_id 4e42b5b8f89f
70 Url: http://www.gnu.org/software/libc/libc.html
71 Source: glibc-%{version}.tar.xz
72 Source5: nsswitch.conf
73 Source7: bindresvport.blacklist
74 Source8: glibc_post_upgrade.c
75 Source9: glibc.rpmlintrc
76 Source10: baselibs.conf
79 Source21: nscd.service
80 Source1001: glibc.manifest
82 Requires(pre): filesystem
83 Provides: rtld(GNU_HASH)
86 The GNU C Library provides the most important standard libraries used
87 by nearly all programs: the standard C library, the standard math
88 library, and the POSIX thread library. A system is not functional
89 without these libraries.
92 Summary: Info Files for the GNU C Library
98 This package contains the documentation for the GNU C library stored as
99 info files. Due to a lack of resources, this documentation is not
100 complete and is partially out of date.
103 Summary: HTML Documentation for the GNU C Library
109 This package contains the HTML documentation for the GNU C library. Due
110 to a lack of resources, this documentation is not complete and is
111 partially out of date.
114 Summary: Database Sources for 'locale'
115 License: GPL-2.0+ and MIT
116 Group: Base/Libraries
119 %description i18ndata
120 This package contains the data needed to build the locale data files to
121 use the internationalization features of the GNU libc. It is normally
122 not necessary to install this packages, the data files are already
126 Summary: Locale Data for Localized Programs
127 License: GPL-2.0+ and MIT and LGPL-2.1+
128 Requires(post): /usr/bin/cat
129 Requires: glibc = %{version}
132 Locale data for the internationalisation features of the GNU C library.
135 Summary: Name Service Caching Daemon
137 Group: System/Service
138 Provides: glibc:/usr/sbin/nscd
139 Requires: glibc = %{version}
142 Nscd caches name service lookups and can dramatically improve
143 performance with NIS, NIS+, and LDAP.
146 Summary: Libc Profiling and Debugging Versions
147 License: LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
148 Group: Base/Utilities
149 Requires: glibc = %{version}
152 This package contains special versions of the GNU C library which are
153 necessary for profiling and debugging.
156 Summary: Include Files and Libraries Mandatory for Development
157 License: BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
158 Requires: glibc = %{version}
159 Requires: linux-kernel-headers
162 These libraries are needed to develop programs which use the standard C
165 %package devel-static
166 Summary: C library static libraries for -static linking
167 License: BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
168 Requires: %{name}-devel = %{version}
169 # Provide Fedora name for package to make packaging easier
170 Provides: %{name}-static = %version
172 %description devel-static
173 The glibc-devel-static package contains the C library static libraries
174 for -static linking. You don't need these, unless you link statically,
175 which is highly discouraged.
178 Summary: Development utilities from GNU C library
180 Requires: glibc = %{version}
182 %description devel-utils
183 The glibc-devel-utils package contains various binaries which can be helpful during program
186 If you are unsure if you need this, don't install this package.
189 Summary: Extra binaries from GNU C Library
191 Requires: glibc = %{version}
194 The glibc-extra package contains some extra binaries for glibc that
195 are not essential but recommend to use.
197 makedb: A program to create a database for nss
200 Summary: Obsolete Shared Libraries from the GNU C Library
202 Requires: glibc = %{version}
204 %description obsolete
205 This package provides some old libraries from the GNU C Library which
206 are no longer supported. Additional it provides a compatibility library
207 for old binaries linked against glibc 2.0.
209 Install this package if you need one of this libraries to get old
210 binaries working, but since this libraries are not supported and there
211 is no gurantee that they work for you, you should try to get newer
212 versions of your software.
215 %setup -n glibc-%{version} -q
219 if [ -x /bin/uname.bin ]; then
227 # We do not want configure to figure out the system its building one
228 # to support a common ground and thus set build and host to the
231 %define target %{_target_cpu}-tizen-linux-gnueabi
233 %define target %{_target_cpu}-tizen-linux
235 # Don't use as-needed, it breaks glibc assumptions
236 # Before enabling it, run the testsuite and verify that it
238 export LD_AS_NEEDED=0
239 # Adjust glibc version.h
240 echo "#define CONFHOST \"%{target}\"" >> version.h
241 echo "#define GITID \"%{git_id}\"" >> version.h
243 # Default CFLAGS and Compiler
245 BuildFlags=$(echo %{optflags} | sed -e "s/-Wp,-D_FORTIFY_SOURCE=2//g" | sed -e "s/-ffast-math//" | sed -e "s/atom/i686/g" | sed -e "s/-fexceptions//" )
246 BuildFlags="$BuildFlags -O2 -g -U_FORTIFY_SOURCE"
247 BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')"
253 BuildFlags="$BuildFlags -g"
254 %if %{disable_assert}
255 BuildFlags="$BuildFlags -DNDEBUG=1"
264 # fails to build otherwise - need to recheck and fix
265 %define enable_stackguard_randomization 0
268 configure_and_build_glibc() {
269 local dirname="$1"; shift
270 local cflags="$1"; shift
271 local addons="$1"; shift
274 conf_cflags="$cflags -funwind-tables"
276 profile="--disable-profile"
278 if [ "$dirname" = "base" ] ; then
279 profile="--enable-profile"
282 CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \
283 CC="$BuildCC" CXX="$BuildCCplus" ../configure \
284 --prefix=%{_prefix} \
285 --libexecdir=%{_libexecdir} --infodir=%{_infodir} \
286 --enable-add-ons=$addons \
289 %if %{enable_stackguard_randomization}
290 --enable-stackguard-randomization \
292 --build=%{target} --host=%{target} \
293 %ifarch %{ix86} x86_64
294 --enable-multi-arch \
296 --enable-kernel=%{enablekernel} \
297 --enable-bind-now --enable-obsolete-rpc
298 # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure)
299 make %{?_smp_mflags} #CFLAGS="$cflags" BUILD_CFLAGS="$cflags"
306 configure_and_build_glibc base "$BuildFlags" "$add_ons"
309 # Build html documentation
316 # Build glibc_post_upgrade binary
318 $BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \
319 -Lcc-base -Bcc-base/csu \
320 '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \
321 '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"'
324 #######################################################################
328 #######################################################################
331 # The testsuite will fail if asneeded is used
332 export LD_AS_NEEDED=0
333 # This has to pass on all platforms!
336 make %{?_smp_mflags} -C cc-base check-abi
338 #######################################################################
342 #######################################################################
345 # We don't want to strip the .symtab from our libraries in find-debuginfo.sh,
346 # certainly not from libpthread.so.* because it is used by libthread_db to find
347 # some non-exported symbols in order to detect if threading support
348 # should be enabled. These symbols are _not_ exported, and we can't easily
349 # export them retroactively without changing the ABI. So we have to
350 # continue to "export" them via .symtab, instead of .dynsym :-(
351 # But we also want to keep .symtab and .strtab of other libraries since some
352 # debugging tools currently require these sections directly inside the main
353 # files - specifically valgrind and PurifyPlus.
354 export STRIP_KEEP_SYMTAB=*.so*
356 # Make sure we will create the gconv-modules.cache
357 mkdir -p %{buildroot}%{_libdir}/gconv
358 touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache
361 make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base
363 install_optimized_variant() {
364 local dirname="$1"; shift
365 local subdir="$1"; shift
366 local subdir_up="$1"; shift
369 destdir=$RPM_BUILD_ROOT/%{_lib}/$subdir
371 # Don't run a complete make install, we know which libraries
373 for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db
376 libbaseso=$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}-*.so)
377 # Only install if different from base lib
378 if cmp -s ${lib}.so ../cc-base/${lib}.so; then
379 ln -sf $subdir_up/$libbaseso $destdir/$libbaseso
381 cp -a ${lib}.so $destdir/$libbaseso
384 ln -sf $libbaseso $destdir/$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}.so.*)
392 # XXX Do not install locales in parallel!
394 # localedef creates hardlinks to other locales if possible
395 # this will not work if we generate them in parallel.
396 # thus we need to run fdupes on /usr/lib/locale/
397 # Still, on my system this is a speed advantage:
398 # non-parallel build for install-locales: 9:34mins
399 # parallel build with fdupes: 7:08mins
400 make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales
401 %fdupes %{buildroot}/usr/lib/locale
404 # Create file list for glibc-locale package
407 # Prepare obsolete/, used only on some architectures:
408 export RPM_BUILD_ROOT
410 mkdir -p %{buildroot}/%{_lib}/obsolete
413 # NPTL <bits/stdio-lock.h> is not usable outside of glibc, so include
414 # the generic one (RH#162634)
415 cp -av bits/stdio-lock.h %{buildroot}%{_includedir}/bits/stdio-lock.h
420 install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir}
422 install -m 644 %{SOURCE7} %{buildroot}/etc
423 install -m 644 %{SOURCE5} %{buildroot}/etc
424 install -m 644 posix/gai.conf %{buildroot}/etc
426 mkdir -p %{buildroot}/etc/default
427 install -m 644 nis/nss %{buildroot}/etc/default/
429 mkdir -p %{buildroot}%{_includedir}/resolv
430 install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/
431 install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/
434 mkdir -p %{buildroot}%{_datadir}/doc/glibc
435 cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc
441 cp nscd/nscd.conf %{buildroot}/etc
442 mkdir -p %{buildroot}/etc/init.d
443 ln -sf /sbin/service %{buildroot}/usr/sbin/rcnscd
444 mkdir -p %{buildroot}/var/run/nscd
445 touch %{buildroot}/var/run/nscd/{passwd,group,hosts}
446 touch %{buildroot}/var/run/nscd/{socket,nscd.pid}
451 cat > %{buildroot}/etc/ld.so.conf <<EOF
452 %if "%{_lib}" == "lib64"
456 include /etc/ld.so.conf.d/*.conf
457 # /lib64, /lib, /usr/lib64 and /usr/lib gets added
458 # automatically by ldconfig after parsing this file.
459 # So, they do not need to be listed.
461 # Add ldconfig cache directory for directory ownership
462 mkdir -p %{buildroot}/var/cache/ldconfig
463 # Empty the ld.so.cache:
464 rm -f %{buildroot}/etc/ld.so.cache
465 touch %{buildroot}/etc/ld.so.cache
467 # Don't look at ldd! We don't wish a /bin/sh requires
468 chmod 644 %{buildroot}%{_bindir}/ldd
470 # Remove timezone data, now coming in standalone package:
471 for i in sbin/sln usr/bin/tzselect usr/sbin/zic usr/sbin/zdump etc/localtime; do
472 rm -f %{buildroot}/$i
474 rm -rf %{buildroot}%{_datadir}/zoneinfo
476 mkdir -p %{buildroot}/usr/lib/tmpfiles.d/
477 install -m 644 %{SOURCE20} %{buildroot}/usr/lib/tmpfiles.d/
478 mkdir -p %{buildroot}/usr/lib/systemd/system
479 install -m 644 %{SOURCE21} %{buildroot}/usr/lib/systemd/system
482 # Provide compatibility link
483 ln -s ld-%{glibc_major_version}.so %{buildroot}/lib/ld-linux.so.3
486 # Move getconf to %{_libexecdir}/getconf/ to avoid cross device link
487 mv %{buildroot}%{_bindir}/getconf %{buildroot}%{_libexecdir}/getconf/getconf
488 ln -s %{_libexecdir}/getconf/getconf %{buildroot}%{_bindir}/getconf
490 #######################################################################
494 #######################################################################
496 %post -p %{_sbindir}/glibc_post_upgrade
498 %postun -p /sbin/ldconfig
501 for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do
502 [ -d "$l.d" ] || continue
503 echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l"
506 /usr/sbin/iconvconfig
509 %install_info --info-dir=%{_infodir} %{_infodir}/libc.info.gz
512 %install_info_delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz
515 mkdir -p /var/run/nscd
520 %manifest %{name}.manifest
522 %defattr(-,root,root)
524 %config(noreplace) /etc/bindresvport.blacklist
525 %config /etc/ld.so.conf
526 %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
527 %config(noreplace) /etc/rpc
528 %verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf
529 %verify(not md5 size mtime) %config(noreplace) /etc/gai.conf
530 %config(noreplace) /etc/default/nss
531 /%{_lib}/ld-%{glibc_major_version}.so
533 # Each architecture has a different name for the dynamic linker:
536 /%{_lib}/ld-linux-armhf.so.3
537 # Keep compatibility link
538 /%{_lib}/ld-linux.so.3
540 /%{_lib}/ld-linux.so.3
544 /%{_lib}/ld-linux-x86-64.so.2
547 /%{_lib}/ld-linux.so.2
550 /lib/ld-linux-aarch64.so.1
551 /%{_lib}/ld-linux-aarch64.so.1
554 /%{_lib}/libanl-%{glibc_major_version}.so
556 /%{_lib}/libc-%{glibc_major_version}.so
558 /%{_lib}/libcidn-%{glibc_major_version}.so
559 /%{_lib}/libcidn.so.1
560 /%{_lib}/libcrypt-%{glibc_major_version}.so
561 /%{_lib}/libcrypt.so.1
562 /%{_lib}/libdl-%{glibc_major_version}.so
564 /%{_lib}/libm-%{glibc_major_version}.so
566 /%{_lib}/libnsl-%{glibc_major_version}.so
568 /%{_lib}/libnss_compat-%{glibc_major_version}.so
569 /%{_lib}/libnss_compat.so.2
570 /%{_lib}/libnss_db-%{glibc_major_version}.so
571 /%{_lib}/libnss_db.so.2
572 /%{_lib}/libnss_dns-%{glibc_major_version}.so
573 /%{_lib}/libnss_dns.so.2
574 /%{_lib}/libnss_files-%{glibc_major_version}.so
575 /%{_lib}/libnss_files.so.2
576 /%{_lib}/libnss_hesiod-%{glibc_major_version}.so
577 /%{_lib}/libnss_hesiod.so.2
578 /%{_lib}/libnss_nis-%{glibc_major_version}.so
579 /%{_lib}/libnss_nis.so.2
580 /%{_lib}/libnss_nisplus-%{glibc_major_version}.so
581 /%{_lib}/libnss_nisplus.so.2
582 /%{_lib}/libpthread-%{glibc_major_version}.so
583 /%{_lib}/libpthread.so.0
584 /%{_lib}/libresolv-%{glibc_major_version}.so
585 /%{_lib}/libresolv.so.2
586 /%{_lib}/librt-%{glibc_major_version}.so
588 /%{_lib}/libutil-%{glibc_major_version}.so
589 /%{_lib}/libutil.so.1
590 %define optimized_libs() \
591 %dir %attr(0755,root,root) /%{_lib}/%1\
592 /%{_lib}/%1/libc-%{glibc_major_version}.so\
593 /%{_lib}/%1/libc.so.6*\
594 /%{_lib}/%1/libm-%{glibc_major_version}.so\
595 /%{_lib}/%1/libm.so.6*\
596 /%{_lib}/%1/libpthread-%{glibc_major_version}.so\
597 /%{_lib}/%1/libpthread.so.0\
598 /%{_lib}/%1/librt-%{glibc_major_version}.so\
599 /%{_lib}/%1/librt.so.1\
600 /%{_lib}/%1/libthread_db-1.0.so\
601 /%{_lib}/%1/libthread_db.so.1
603 %dir %attr(0700,root,root) /var/cache/ldconfig
609 %attr(755,root,root) %{_bindir}/ldd
610 %ifarch %ix86 sparc sparcv9
615 %dir %attr(0755,root,root) %{_libexecdir}/getconf
616 %{_libexecdir}/getconf/*
617 %{_sbindir}/glibc_post_upgrade
618 %{_sbindir}/iconvconfig
623 %manifest %{name}.manifest
624 %defattr (755,root,root,755)
625 %dir /%{_lib}/obsolete/
626 #%dir /%{_lib}/obsolete/noversion
627 #/%{_lib}/obsolete/noversion/libNoVersion-%{glibc_major_version}.so
628 #/%{_lib}/obsolete/noversion/libNoVersion.so.1
631 %files locale -f libc.lang
632 %manifest %{name}.manifest
633 %defattr(-,root,root)
634 %{_datadir}/locale/locale.alias
641 %manifest %{name}.manifest
642 %defattr(-,root,root)
643 %license COPYING COPYING.LIB
644 %doc NEWS README BUGS CONFORMANCE
649 # These static libraries are needed even for shared builds
650 %{_libdir}/libc_nonshared.a
653 %ifarch ppc ppc64 s390 s390x sparc sparcv8 sparcv9 sparcv9v
654 # This is not built on sparc64.
655 %{_libdir}/libnldbl_nonshared.a
657 %{_libdir}/libmcheck.a
658 %{_libdir}/libpthread_nonshared.a
659 %{_libdir}/librpcsvc.a
662 %manifest %{name}.manifest
663 %defattr(-,root,root)
664 %{_libdir}/libBrokenLocale.a
667 %{_libdir}/libcrypt.a
671 %{_libdir}/libpthread.a
672 %{_libdir}/libresolv.a
677 %manifest %{name}.manifest
678 %defattr(-,root,root)
679 %doc %{_infodir}/libc.info.gz
680 %doc %{_infodir}/libc.info-?.gz
681 %doc %{_infodir}/libc.info-??.gz
685 %manifest %{name}.manifest
686 %defattr(-,root,root)
687 %doc %{_prefix}/share/doc/glibc
691 %manifest %{name}.manifest
692 %defattr(-,root,root)
693 %{_prefix}/share/i18n
696 %manifest %{name}.manifest
697 %defattr(-,root,root)
698 %config(noreplace) /etc/nscd.conf
701 /usr/lib/systemd/system/nscd.service
702 %dir /usr/lib/tmpfiles.d
703 /usr/lib/tmpfiles.d/nscd.conf
704 %dir %attr(0755,root,root) %ghost /var/run/nscd
705 %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid
706 %attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket
707 %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/passwd
708 %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/group
709 %attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/hosts
713 %manifest %{name}.manifest
714 %defattr(-,root,root)
716 %{_libdir}/libBrokenLocale_p.a
717 %{_libdir}/libanl_p.a
719 %{_libdir}/libcrypt_p.a
720 %{_libdir}/libpthread_p.a
721 %{_libdir}/libresolv_p.a
722 %{_libdir}/libnsl_p.a
724 %{_libdir}/librpcsvc_p.a
725 %{_libdir}/libutil_p.a
730 %manifest %{name}.manifest
731 %defattr(-,root,root)
732 /%{_lib}/libmemusage.so
733 /%{_lib}/libpcprofile.so
734 /%{_lib}/libBrokenLocale-%{glibc_major_version}.so
735 /%{_lib}/libBrokenLocale.so.1
736 /%{_libdir}/libBrokenLocale.so
737 /%{_lib}/libSegFault.so
738 /%{_lib}/libthread_db-1.0.so
739 /%{_lib}/libthread_db.so.1
740 /%{_libdir}/libthread_db.so
741 %dir /%{_libdir}/audit
742 /%{_libdir}/audit/sotruss-lib.so
743 # These need gd-devel for building
744 # %%{_bindir}/memusage
745 # %%{_bindir}/memusagestat
747 %{_bindir}/pcprofiledump
755 %manifest %{name}.manifest
756 %defattr(-,root,root)
758 /var/lib/misc/Makefile