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 0
38 %if %{with fast_build}
39 %define build_profile 0
40 %define build_locales 0
44 %define build_profile 1
45 %define build_locales 0
50 %define disable_assert 0
51 %define enable_stackguard_randomization 1
52 %define multiarcharches %{ix86} x86_64
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.24
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
78 Source1001: glibc.manifest
80 Requires(pre): filesystem
81 Provides: rtld(GNU_HASH)
84 The GNU C Library provides the most important standard libraries used
85 by nearly all programs: the standard C library, the standard math
86 library, and the POSIX thread library. A system is not functional
87 without these libraries.
90 Summary: Info Files for the GNU C Library
96 This package contains the documentation for the GNU C library stored as
97 info files. Due to a lack of resources, this documentation is not
98 complete and is partially out of date.
101 Summary: HTML Documentation for the GNU C Library
107 This package contains the HTML documentation for the GNU C library. Due
108 to a lack of resources, this documentation is not complete and is
109 partially out of date.
112 Summary: Database Sources for 'locale'
113 License: GPL-2.0+ and MIT
114 Group: Base/Libraries
117 %description i18ndata
118 This package contains the data needed to build the locale data files to
119 use the internationalization features of the GNU libc. It is normally
120 not necessary to install this packages, the data files are already
124 Summary: Locale Data for Localized Programs
125 License: GPL-2.0+ and MIT and LGPL-2.1+
126 Requires(post): /usr/bin/cat
127 Requires: glibc = %{version}
129 Locale data for the internationalisation features of the GNU C library.
132 Summary: Libc Profiling and Debugging Versions
133 License: LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
134 Group: Base/Utilities
135 Requires: glibc = %{version}
138 This package contains special versions of the GNU C library which are
139 necessary for profiling and debugging.
142 Summary: Include Files and Libraries Mandatory for Development
143 License: BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
144 Requires: glibc = %{version}
145 Requires: linux-kernel-headers
148 These libraries are needed to develop programs which use the standard C
151 %package devel-static
152 Summary: C library static libraries for -static linking
153 License: BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
154 Requires: %{name}-devel = %{version}
155 # Provide Fedora name for package to make packaging easier
156 Provides: %{name}-static = %version
158 %description devel-static
159 The glibc-devel-static package contains the C library static libraries
160 for -static linking. You don't need these, unless you link statically,
161 which is highly discouraged.
164 Summary: Development utilities from GNU C library
166 Requires: glibc = %{version}
168 %description devel-utils
169 The glibc-devel-utils package contains various binaries which can be helpful during program
172 If you are unsure if you need this, don't install this package.
175 Summary: Extra binaries from GNU C Library
177 Requires: glibc = %{version}
180 The glibc-extra package contains some extra binaries for glibc that
181 are not essential but recommend to use.
183 makedb: A program to create a database for nss
186 Summary: Obsolete Shared Libraries from the GNU C Library
188 Requires: glibc = %{version}
190 %description obsolete
191 This package provides some old libraries from the GNU C Library which
192 are no longer supported. Additional it provides a compatibility library
193 for old binaries linked against glibc 2.0.
195 Install this package if you need one of this libraries to get old
196 binaries working, but since this libraries are not supported and there
197 is no gurantee that they work for you, you should try to get newer
198 versions of your software.
201 %setup -n glibc-%{version} -q
205 if [ -x /bin/uname.bin ]; then
213 # We do not want configure to figure out the system its building one
214 # to support a common ground and thus set build and host to the
217 %define target %{_target_cpu}-tizen-linux-gnueabi
219 %define target %{_target_cpu}-tizen-linux
221 # Don't use as-needed, it breaks glibc assumptions
222 # Before enabling it, run the testsuite and verify that it
224 export LD_AS_NEEDED=0
225 # Adjust glibc version.h
226 echo "#define CONFHOST \"%{target}\"" >> version.h
227 echo "#define GITID \"%{git_id}\"" >> version.h
229 # Default CFLAGS and Compiler
231 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//" | sed -e "s/-fno-omit-frame-pointer//" )
232 BuildFlags="$BuildFlags -O2 -g -U_FORTIFY_SOURCE"
233 BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')"
234 BuildFlags="$(echo $BuildFlags | sed -e 's/-Wa,-mimplicit-it=thumb//g' | sed -e 's/-mthumb//g')"
240 BuildFlags="$BuildFlags -g"
241 %if %{disable_assert}
242 BuildFlags="$BuildFlags -DNDEBUG=1"
251 # fails to build otherwise - need to recheck and fix
252 %define enable_stackguard_randomization 0
255 configure_and_build_glibc() {
256 local dirname="$1"; shift
257 local cflags="$1"; shift
258 local addons="$1"; shift
261 conf_cflags="$cflags -funwind-tables"
263 profile="--disable-profile"
265 if [ "$dirname" = "base" ] ; then
266 profile="--enable-profile"
269 CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \
270 CC="$BuildCC" CXX="$BuildCCplus" ../configure \
271 --prefix=%{_prefix} \
272 --libexecdir=%{_libexecdir} --infodir=%{_infodir} \
273 --enable-add-ons=$addons \
276 %if %{enable_stackguard_randomization}
277 --enable-stackguard-randomization \
279 --build=%{target} --host=%{target} \
280 %ifnarch %{multiarcharches}
281 --disable-multi-arch \
283 %ifarch %{ix86} x86_64
286 --enable-kernel=%{enablekernel} \
287 --enable-bind-now --enable-obsolete-rpc \
289 # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure)
290 make %{?_smp_mflags} #CFLAGS="$cflags" BUILD_CFLAGS="$cflags"
297 configure_and_build_glibc base "$BuildFlags" "$add_ons"
300 # Build html documentation
307 # Build glibc_post_upgrade binary
309 $BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \
310 -Lcc-base -Bcc-base/csu \
311 '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \
312 '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"'
315 #######################################################################
319 #######################################################################
322 # The testsuite will fail if asneeded is used
323 export LD_AS_NEEDED=0
324 # This has to pass on all platforms!
327 make %{?_smp_mflags} -C cc-base check-abi
329 #######################################################################
333 #######################################################################
336 # We don't want to strip the .symtab from our libraries in find-debuginfo.sh,
337 # certainly not from libpthread.so.* because it is used by libthread_db to find
338 # some non-exported symbols in order to detect if threading support
339 # should be enabled. These symbols are _not_ exported, and we can't easily
340 # export them retroactively without changing the ABI. So we have to
341 # continue to "export" them via .symtab, instead of .dynsym :-(
342 # But we also want to keep .symtab and .strtab of other libraries since some
343 # debugging tools currently require these sections directly inside the main
344 # files - specifically valgrind and PurifyPlus.
345 export STRIP_KEEP_SYMTAB=*.so*
347 # Make sure we will create the gconv-modules.cache
348 mkdir -p %{buildroot}%{_libdir}/gconv
349 touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache
352 make %{?_smp_mflags} install_root=%{buildroot} install -C cc-base
354 install_optimized_variant() {
355 local dirname="$1"; shift
356 local subdir="$1"; shift
357 local subdir_up="$1"; shift
360 destdir=$RPM_BUILD_ROOT/%{_lib}/$subdir
362 # Don't run a complete make install, we know which libraries
364 for lib in libc math/libm nptl/libpthread rt/librt nptl_db/libthread_db
367 libbaseso=$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}-*.so)
368 # Only install if different from base lib
369 if cmp -s ${lib}.so ../cc-base/${lib}.so; then
370 ln -sf $subdir_up/$libbaseso $destdir/$libbaseso
372 cp -a ${lib}.so $destdir/$libbaseso
375 ln -sf $libbaseso $destdir/$(basename $RPM_BUILD_ROOT/%{_lib}/${libbase}.so.*)
383 # XXX Do not install locales in parallel!
385 # localedef creates hardlinks to other locales if possible
386 # this will not work if we generate them in parallel.
387 # thus we need to run fdupes on /usr/lib/locale/
388 # Still, on my system this is a speed advantage:
389 # non-parallel build for install-locales: 9:34mins
390 # parallel build with fdupes: 7:08mins
391 make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales
392 %fdupes %{buildroot}/usr/lib/locale
395 # Create file list for glibc-locale package
398 # Prepare obsolete/, used only on some architectures:
399 export RPM_BUILD_ROOT
401 mkdir -p %{buildroot}/%{_lib}/obsolete
404 # NPTL <bits/stdio-lock.h> is not usable outside of glibc, so include
405 # the generic one (RH#162634)
406 # cp -av bits/stdio-lock.h %{buildroot}%{_includedir}/bits/stdio-lock.h
411 install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir}
413 install -m 644 %{SOURCE7} %{buildroot}/etc
414 install -m 644 %{SOURCE5} %{buildroot}/etc
415 install -m 644 posix/gai.conf %{buildroot}/etc
417 mkdir -p %{buildroot}/etc/default
418 install -m 644 nis/nss %{buildroot}/etc/default/
420 mkdir -p %{buildroot}%{_includedir}/resolv
421 install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/
422 install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/
425 mkdir -p %{buildroot}%{_datadir}/doc/glibc
426 cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc
433 cat > %{buildroot}/etc/ld.so.conf <<EOF
434 %if "%{_lib}" == "lib64"
438 include /etc/ld.so.conf.d/*.conf
439 # /lib64, /lib, /usr/lib64 and /usr/lib gets added
440 # automatically by ldconfig after parsing this file.
441 # So, they do not need to be listed.
443 # Add ldconfig cache directory for directory ownership
444 mkdir -p %{buildroot}/var/cache/ldconfig
445 # Empty the ld.so.cache:
446 rm -f %{buildroot}/etc/ld.so.cache
447 touch %{buildroot}/etc/ld.so.cache
449 # Don't look at ldd! We don't wish a /bin/sh requires
450 chmod 644 %{buildroot}%{_bindir}/ldd
452 # Remove timezone data, now coming in standalone package:
453 for i in sbin/sln usr/bin/tzselect usr/sbin/zic usr/sbin/zdump etc/localtime; do
454 rm -f %{buildroot}/$i
456 rm -rf %{buildroot}%{_datadir}/zoneinfo
459 # Provide compatibility link
460 ln -s ld-%{glibc_major_version}.so %{buildroot}/lib/ld-linux.so.3
463 # Move getconf to %{_libexecdir}/getconf/ to avoid cross device link
464 mv %{buildroot}%{_bindir}/getconf %{buildroot}%{_libexecdir}/getconf/getconf
465 ln -s %{_libexecdir}/getconf/getconf %{buildroot}%{_bindir}/getconf
467 #######################################################################
471 #######################################################################
473 %post -p %{_sbindir}/glibc_post_upgrade
475 %postun -p /sbin/ldconfig
478 for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do
479 [ -d "$l.d" ] || continue
480 echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l"
483 /usr/sbin/iconvconfig
486 %install_info --info-dir=%{_infodir} %{_infodir}/libc.info.gz
489 %install_info_delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz
492 %manifest %{name}.manifest
494 %defattr(-,root,root)
495 %license LICENSES COPYING COPYING.LIB
496 %config(noreplace) /etc/bindresvport.blacklist
497 %config /etc/ld.so.conf
498 %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
499 %config(noreplace) /etc/rpc
500 %verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf
501 %verify(not md5 size mtime) %config(noreplace) /etc/gai.conf
502 %config(noreplace) /etc/default/nss
503 /%{_lib}/ld-%{glibc_major_version}.so
505 # Each architecture has a different name for the dynamic linker:
508 /%{_lib}/ld-linux-armhf.so.3
509 # Keep compatibility link
510 /%{_lib}/ld-linux.so.3
512 /%{_lib}/ld-linux.so.3
516 /%{_lib}/ld-linux-x86-64.so.2
519 /%{_lib}/ld-linux.so.2
522 /lib/ld-linux-aarch64.so.1
523 /%{_lib}/ld-linux-aarch64.so.1
526 /%{_lib}/libanl-%{glibc_major_version}.so
528 /%{_lib}/libc-%{glibc_major_version}.so
530 /%{_lib}/libcidn-%{glibc_major_version}.so
531 /%{_lib}/libcidn.so.1
532 /%{_lib}/libcrypt-%{glibc_major_version}.so
533 /%{_lib}/libcrypt.so.1
534 /%{_lib}/libdl-%{glibc_major_version}.so
536 /%{_lib}/libm-%{glibc_major_version}.so
538 /%{_lib}/libnsl-%{glibc_major_version}.so
540 /%{_lib}/libnss_compat-%{glibc_major_version}.so
541 /%{_lib}/libnss_compat.so.2
542 /%{_lib}/libnss_db-%{glibc_major_version}.so
543 /%{_lib}/libnss_db.so.2
544 /%{_lib}/libnss_dns-%{glibc_major_version}.so
545 /%{_lib}/libnss_dns.so.2
546 /%{_lib}/libnss_files-%{glibc_major_version}.so
547 /%{_lib}/libnss_files.so.2
548 /%{_lib}/libnss_hesiod-%{glibc_major_version}.so
549 /%{_lib}/libnss_hesiod.so.2
550 /%{_lib}/libnss_nis-%{glibc_major_version}.so
551 /%{_lib}/libnss_nis.so.2
552 /%{_lib}/libnss_nisplus-%{glibc_major_version}.so
553 /%{_lib}/libnss_nisplus.so.2
554 /%{_lib}/libpthread-%{glibc_major_version}.so
555 /%{_lib}/libpthread.so.0
556 /%{_lib}/libthread_db-1.0.so
557 /%{_lib}/libthread_db.so.1
558 /%{_lib}/libresolv-%{glibc_major_version}.so
559 /%{_lib}/libresolv.so.2
560 /%{_lib}/librt-%{glibc_major_version}.so
562 /%{_lib}/libutil-%{glibc_major_version}.so
563 /%{_lib}/libutil.so.1
564 %define optimized_libs() \
565 %dir %attr(0755,root,root) /%{_lib}/%1\
566 /%{_lib}/%1/libc-%{glibc_major_version}.so\
567 /%{_lib}/%1/libc.so.6*\
568 /%{_lib}/%1/libm-%{glibc_major_version}.so\
569 /%{_lib}/%1/libm.so.6*\
570 /%{_lib}/%1/libpthread-%{glibc_major_version}.so\
571 /%{_lib}/%1/libpthread.so.0\
572 /%{_lib}/%1/librt-%{glibc_major_version}.so\
573 /%{_lib}/%1/librt.so.1\
574 /%{_lib}/%1/libthread_db-1.0.so\
575 /%{_lib}/%1/libthread_db.so.1
577 %dir %attr(0700,root,root) /var/cache/ldconfig
583 %attr(755,root,root) %{_bindir}/ldd
584 %ifarch %ix86 sparc sparcv9
589 %dir %attr(0755,root,root) %{_libexecdir}/getconf
590 %{_libexecdir}/getconf/*
591 %{_sbindir}/glibc_post_upgrade
592 %{_sbindir}/iconvconfig
593 /%{_lib}/libBrokenLocale-%{glibc_major_version}.so
594 /%{_lib}/libBrokenLocale.so.1
599 %manifest %{name}.manifest
601 %defattr (755,root,root,755)
602 %dir /%{_lib}/obsolete/
603 #%dir /%{_lib}/obsolete/noversion
604 #/%{_lib}/obsolete/noversion/libNoVersion-%{glibc_major_version}.so
605 #/%{_lib}/obsolete/noversion/libNoVersion.so.1
608 %files locale -f libc.lang
609 %manifest %{name}.manifest
610 %license COPYING COPYING.LIB
611 %defattr(-,root,root)
612 %{_datadir}/locale/locale.alias
619 %manifest %{name}.manifest
620 %defattr(-,root,root)
621 %license COPYING COPYING.LIB
622 %doc NEWS README BUGS CONFORMANCE
627 # These static libraries are needed even for shared builds
628 %{_libdir}/libc_nonshared.a
631 %ifarch ppc ppc64 s390 s390x sparc sparcv8 sparcv9 sparcv9v
632 # This is not built on sparc64.
633 %{_libdir}/libnldbl_nonshared.a
635 %{_libdir}/libmcheck.a
636 %{_libdir}/libpthread_nonshared.a
637 %{_libdir}/librpcsvc.a
640 %manifest %{name}.manifest
641 %defattr(-,root,root)
642 %{_libdir}/libBrokenLocale.a
645 %{_libdir}/libcrypt.a
649 %{_libdir}/libpthread.a
650 %{_libdir}/libresolv.a
655 %manifest %{name}.manifest
656 %defattr(-,root,root)
657 %doc %{_infodir}/libc.info.gz
658 %doc %{_infodir}/libc.info-?.gz
659 %doc %{_infodir}/libc.info-??.gz
663 %manifest %{name}.manifest
664 %defattr(-,root,root)
665 %doc %{_prefix}/share/doc/glibc
669 %manifest %{name}.manifest
670 %defattr(-,root,root)
671 %{_prefix}/share/i18n
675 %manifest %{name}.manifest
676 %license COPYING COPYING.LIB
677 %defattr(-,root,root)
679 %{_libdir}/libBrokenLocale_p.a
680 %{_libdir}/libanl_p.a
682 %{_libdir}/libcrypt_p.a
683 %{_libdir}/libpthread_p.a
684 %{_libdir}/libresolv_p.a
685 %{_libdir}/libnsl_p.a
687 %{_libdir}/librpcsvc_p.a
688 %{_libdir}/libutil_p.a
693 %manifest %{name}.manifest
694 %defattr(-,root,root)
695 /%{_lib}/libmemusage.so
696 /%{_lib}/libpcprofile.so
697 /%{_libdir}/libBrokenLocale.so
698 /%{_lib}/libSegFault.so
699 /%{_lib}/libthread_db-1.0.so
700 /%{_lib}/libthread_db.so.1
701 /%{_libdir}/libthread_db.so
702 %dir /%{_libdir}/audit
703 /%{_libdir}/audit/sotruss-lib.so
704 # These need gd-devel for building
705 # %%{_bindir}/memusage
706 # %%{_bindir}/memusagestat
708 %{_bindir}/pcprofiledump
716 %manifest %{name}.manifest
718 %defattr(-,root,root)