packaging: Add support for enable_static_pie project config macro
[platform/upstream/glibc.git] / packaging / glibc.spec
1 #
2 # spec file for package glibc
3 #
4 # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
5 # Copyright (c) 2021 Samsung Electronics Co. Ltd.
6 #
7 # All modifications and additions to the file contributed by third parties
8 # remain the property of their copyright owners, unless otherwise agreed
9 # upon. The license for this file, and modifications and additions to the
10 # file, is the same license as for the pristine package itself (unless the
11 # license for the pristine package is not an Open Source License, in which
12 # case the license is the MIT License). An "Open Source License" is a
13 # license that conforms to the Open Source Definition (Version 1.9)
14 # published by the Open Source Initiative.
15
16 %if 0%{?run_tests}
17 %define glibc_run_tests 1
18 %endif
19
20 # Enable this when testing on device to:
21 # 1. Enable macro to turn on testsuite building ('glibc_run_tests 1')
22 # 2. Keep 'build/' folder in build stage as we do not want to rebuild all
23 # glibc again on device after invoking rpmbuild --short-circuit -bc ...
24 # 3. Skip configure and make commands and go directly to 'make check'
25 %if 0%{?run_tests_on_device}
26 %define glibc_run_tests 1
27 %define glibc_keep_build_dir 1
28 %define glibc_skip_configure 1
29 %define glibc_skip_make 1
30 %endif
31
32 # Exit right after 'make ..' step to keep all object files produced by glibc build
33 %if 0%{?exit_on_make_finish}
34 %define glibc_exit_on_make_finish 1
35 %endif
36
37 %if 0%{?dump_configure}
38 %define glibc_dump_configure 1
39 %endif
40
41 # This will avoid building some parts of glibc
42 %define asan_arch x86_64 armv7l aarch64
43 %define hwasan_arch aarch64
44 %bcond_with    fast_build
45 Name:           glibc
46 Summary:        Standard Shared Libraries (from the GNU C Library)
47 License:        LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
48 Group:          Base/Libraries
49 BuildRequires:  fdupes
50 BuildRequires:  makeinfo
51 BuildRequires:  xz
52 BuildRequires:  gcc-c++
53 BuildRequires:  gettext-tools
54 BuildRequires:  libstdc++-devel
55 BuildRequires:  bison
56 BuildRequires:  python3-base
57 %{?asan:
58 %ifarch %asan_arch
59 #BuildRequires:  python
60 BuildRequires:  glibc-devel-static
61 %endif
62 }
63 %if 0%{?glibc_dump_configure}
64 BuildRequires: configure-dumper
65 %endif
66 #BuildRequires:  pkgconfig(systemd)
67 %define _filter_GLIBC_PRIVATE 1
68 %if %_target_cpu == "i686"
69 # For i686 let's only build what's different from i586, so
70 # no need to build documentation
71 %define build_profile 1
72 %define build_locales 0
73 %define build_html 0
74 %else
75 %if %{with fast_build}
76 %define build_profile 0
77 %define build_locales 0
78 %define build_html 0
79 %else
80 # Default:
81 %define build_profile 1
82 %define build_locales 0
83 %define build_html 1
84 %endif
85 %endif
86
87 %define disable_assert 0
88 %define enable_stackguard_randomization 1
89 %define multiarcharches %{ix86} x86_64
90
91 %ifarch x86_64
92 %define enablekernel 2.6.16
93 %else
94 %define enablekernel 2.6.16
95 %endif
96 Conflicts:      kernel < %{enablekernel}
97 %ifarch armv7l armv7hl
98 # The old runtime linker link gets not provided by rpm find.provides, but it exists
99 Provides:       ld-linux.so.3
100 Provides:       ld-linux.so.3(GLIBC_2.4)
101 %endif
102 Version:        2.30
103 Release:        0
104 %define glibc_major_version %{version}
105 %define git_id 0a8262a1b2
106
107 Url:            http://www.gnu.org/software/libc/libc.html
108 Source:         glibc-%{version}.tar.xz
109 Source5:        nsswitch.conf
110 Source7:        bindresvport.blacklist
111 Source8:        glibc_post_upgrade.c
112 Source9:        glibc.rpmlintrc
113 Source10:       baselibs.conf
114 # For systemd
115 Source1001:     glibc.manifest
116
117 Requires(pre):  filesystem
118 Provides:       rtld(GNU_HASH)
119
120 %description
121 The GNU C Library provides the most important standard libraries used
122 by nearly all programs: the standard C library, the standard math
123 library, and the POSIX thread library. A system is not functional
124 without these libraries.
125
126 %package info
127 Summary:        Info Files for the GNU C Library
128 License:        GFDL-1.1
129 Group:          Documentation
130 BuildArch:      noarch
131
132 %description info
133 This package contains the documentation for the GNU C library stored as
134 info files. Due to a lack of resources, this documentation is not
135 complete and is partially out of date.
136
137 %package html
138 Summary:        HTML Documentation for the GNU C Library
139 License:        GFDL-1.1
140 Group:          Documentation
141 BuildArch:      noarch
142
143 %description html
144 This package contains the HTML documentation for the GNU C library. Due
145 to a lack of resources, this documentation is not complete and is
146 partially out of date.
147
148 %package i18ndata
149 Summary:        Database Sources for 'locale'
150 License:        GPL-2.0+ and MIT
151 Group:          Base/Libraries
152 BuildArch:      noarch
153
154 %description i18ndata
155 This package contains the data needed to build the locale data files to
156 use the internationalization features of the GNU libc. It is normally
157 not necessary to install this packages, the data files are already
158 created.
159
160 %package locale
161 Summary:        Locale Data for Localized Programs
162 License:        GPL-2.0+ and MIT and LGPL-2.1+
163 Requires(post): /usr/bin/cat
164 Requires:       glibc = %{version}
165 %description locale
166 Locale data for the internationalisation features of the GNU C library.
167
168 %package profile
169 Summary:        Libc Profiling and Debugging Versions
170 License:        LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
171 Group:          Base/Utilities
172 Requires:       glibc = %{version}
173
174 %description profile
175 This package contains special versions of the GNU C library which are
176 necessary for profiling and debugging.
177
178 %package devel
179 Summary:        Include Files and Libraries Mandatory for Development
180 License:        BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
181 Requires:       glibc = %{version}
182 Requires:       linux-kernel-headers
183
184 %description devel
185 These libraries are needed to develop programs which use the standard C
186 library.
187
188 %package devel-static
189 Summary:        C library static libraries for -static linking
190 License:        BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
191 Requires:       %{name}-devel = %{version}
192 # Provide Fedora name for package to make packaging easier
193 Provides:       %{name}-static = %version
194
195 %description devel-static
196 The glibc-devel-static package contains the C library static libraries
197 for -static linking.  You don't need these, unless you link statically,
198 which is highly discouraged.
199
200 %package devel-utils
201 Summary:        Development utilities from GNU C library
202 License:        LGPL-2.1+
203 Requires:       glibc = %{version}
204
205 %description devel-utils
206 The glibc-devel-utils package contains various binaries which can be helpful during program
207 debugging.
208
209 If you are unsure if you need this, don't install this package.
210
211 %package extra
212 Summary:        Extra binaries from GNU C Library
213 License:        LGPL-2.1+
214 Requires:       glibc = %{version}
215
216 %description extra
217 The glibc-extra package contains some extra binaries for glibc that
218 are not essential but recommend to use.
219
220 makedb: A program to create a database for nss
221
222 %package obsolete
223 Summary:        Obsolete Shared Libraries from the GNU C Library
224 License:        LGPL-2.0+
225 Requires:       glibc = %{version}
226
227 %description obsolete
228 This package provides some old libraries from the GNU C Library which
229 are no longer supported. Additional it provides a compatibility library
230 for old binaries linked against glibc 2.0.
231
232 Install this package if you need one of this libraries to get old
233 binaries working, but since this libraries are not supported and there
234 is no gurantee that they work for you, you should try to get newer
235 versions of your software.
236
237 %package testresults
238 Summary:       Testsuite results
239 License:       LGPL-2.1+
240 Group:         Development/Languages
241 %description testresults
242 Results from running the glibc testsuites.
243
244 %{?asan:
245 %ifarch %asan_arch
246 %package asan
247 Summary:     glibc with ASan instrumentation
248 License:     LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
249 Requires:    glibc = %{version}
250 Requires:    rpm
251
252 %description asan
253 This package provides glibc with ASan instrumentation
254
255 %post asan
256 ln -s --force /%{_lib}/libc-%{version}-asan.so /%{_lib}/libc.so.6
257
258 %preun asan
259 ln -s --force /%{_lib}/libc-%{version}.so /%{_lib}/libc.so.6
260
261 %endif
262 }
263
264 %{?hwasan:
265 %ifarch %hwasan_arch
266 %package hwasan
267 Summary:     glibc with Hwasan instrumentation
268 License:     LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
269 Requires:    glibc = %{version}
270 Requires:    rpm
271
272 %description hwasan
273 This package provides glibc with Hwasan instrumentation
274
275 %post hwasan
276 ln -s --force /%{_lib}/libc-%{version}-hwasan.so /%{_lib}/libc.so.6
277
278 %preun hwasan
279 ln -s --force /%{_lib}/libc-%{version}.so /%{_lib}/libc.so.6
280
281 %endif
282 }
283
284
285 %{?glibc_dump_configure:
286 %package configure-dump
287 Summary:       GNU Glibc configure dump
288 License:       GPL-3.0+
289 Group:         Development/Languages
290 %description configure-dump
291 This package contains dump of configure variables of Glibc
292 }
293
294 %prep
295 %setup -n glibc-%{version} -q
296 cp %{SOURCE1001} .
297
298 %build
299 %{?asan:%gcc_unforce_options}
300 %{?hwasan:%gcc_unforce_options}
301 if [ -x /bin/uname.bin ]; then
302         /bin/uname.bin -a
303 else
304         uname -a
305 fi
306 uptime || :
307 ulimit -a
308 nice
309 # We do not want configure to figure out the system its building one
310 # to support a common ground and thus set build and host to the
311 # target_cpu.
312 %ifarch %arm
313 %define target %{_target_cpu}-tizen-linux-gnueabi
314 %else
315 %define target %{_target_cpu}-tizen-linux
316 %endif
317 # Don't use as-needed, it breaks glibc assumptions
318 # Before enabling it, run the testsuite and verify that it
319 # passes completely
320 export LD_AS_NEEDED=0
321 # Adjust glibc version.h
322 echo "#define CONFHOST \"%{target}\"" >> version.h
323 echo "#define GITID \"%{git_id}\"" >> version.h
324 #
325 # Default CFLAGS and Compiler
326 #
327 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//" )
328 BuildFlags="$BuildFlags -O2 -g -U_FORTIFY_SOURCE"
329 BuildFlags="$(echo $BuildFlags | sed -e 's#-ffortify=[0-9]*##')"
330 BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector-strong##')"
331 BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##')"
332 BuildFlags="$(echo $BuildFlags | sed -e 's/-Wa,-mimplicit-it=thumb\(-interwork\)\?//g' | sed -e 's/-mthumb\(-interwork\)\?//g')"
333 # Turn off all -Wformat enable flags as there are glibc tests that explicitly
334 # append -Wno-format and with enabled Wformat options that produced warnings
335 # that turns into errors. Remove -Wformat=1|2 or -Wformat-..-arg
336 BuildFlags="$(echo $BuildFlags | sed -re 's/-Wformat((=[1-2])|((-\w+)+))?(\s|$)//g')"
337
338 %ifarch %arm
339 # Support DA build with armv8 cpu in 32bit mode: prevent Werror on sqrt function
340 (echo ${BuildFlags} | grep '\-march=armv8') && BuildFlags="${BuildFlags} -Wno-error=unused-variable"
341 %endif
342
343 BuildCC="%__cc"
344 BuildCCplus="%__cxx"
345 add_ons=",libidn"
346
347 BuildFlags="$BuildFlags -g"
348
349 %ifarch %arm aarch64
350 # Glibc must have both functions' implementations
351 BuildFlags="$BuildFlags -U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
352 %endif
353 %if %{disable_assert}
354         BuildFlags="$BuildFlags -DNDEBUG=1"
355 %endif
356 %ifarch %ix86
357         add_ons=$add_ons
358 %endif
359 %ifarch %arm aarch64
360         add_ons=$add_ons
361 %endif
362 %ifarch mipsel
363         # fails to build otherwise - need to recheck and fix
364         %define enable_stackguard_randomization 0
365 %endif
366
367 #
368 # Build glibc
369 #
370 %{!?glibc_keep_build_dir:
371   rm -rf "build"
372   mkdir "build"
373   pushd "build"
374  }
375
376 conf_cflags="$BuildFlags -funwind-tables -fPIC"
377 %{?asan: conf_cflags="$conf_cflags -DASAN_INIT_FIRST"}
378 %{?hwasan: conf_cflags="$conf_cflags -DASAN_INIT_FIRST -Wno-error=pragmas"}
379 profile="--disable-profile"
380 %{?build_profile:profile="--enable-profile"}
381 %{?glibc_dump_configure:patch_configure.pl ..}
382
383 %{!?glibc_skip_configure:
384   CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \
385   CC="$BuildCC" CXX="$BuildCCplus" \
386   ../configure \
387   --prefix=%{_prefix} \
388   --libexecdir=%{_libexecdir} --infodir=%{_infodir} \
389   --enable-add-ons=$add_ons \
390   $profile \
391   --enable-kernel=%{enablekernel} \
392   --enable-bind-now \
393   --enable-obsolete-rpc \
394   --disable-nscd \
395   --disable-experimental-malloc \
396   libc_cv_cc_pie_default=yes \
397 %if %{enable_stackguard_randomization}
398   --enable-stackguard-randomization \
399 %endif
400   --build=%{target} --host=%{target} \
401 %ifnarch %{multiarcharches}
402   --disable-multi-arch \
403 %endif
404 %ifarch %{ix86} x86_64
405   --disable-mathvec \
406 %endif
407 %if 0%{?enable_static_pie}
408   --enable-static-pie \
409 %endif
410  }
411
412 %{!?glibc_skip_make:
413   make %{?_smp_mflags}
414 %{?glibc_dump_configure:
415     dump_configure.pl .. . \
416     --project glibc \
417     --project-version %{version} \
418     --out_db glibc-%{version}-%{release}-%_project-%_repository.db
419  }
420
421 #
422 # Build glibc_post_upgrade binary
423 #
424 $BuildCC \
425     -static %{optflags} -Os \
426     $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \
427     -L. -Bcsu \
428     '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \
429     '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"'
430
431 %{!?glibc_keep_build_dir:
432   popd
433  }
434 #
435 # Build html documentation
436 #
437 %if %{build_html}
438 make %{?_smp_mflags} -C "build" html
439 %endif
440
441 #
442 # Build ASan version of glibc
443 #
444 %{?asan:
445 %ifarch %{asan_arch}
446 configure_flags="--prefix=/usr --without-cvs --without-selinux --enable-stackguard-randomization --enable-obsolete-rpc --disable-mathvec"
447 configure_flags="$configure_flags --disable-sanity-checks"
448
449 HERE=%{_builddir}/%{name}-%{version}
450 J=${J:-32}
451 GLIBC=$HERE
452 ASAN_BUILD=$HERE/asan-build
453 unset CXXFLAGS
454 unset CFLAGS
455 unset LDFLAGS
456 %ifarch %arm
457 # Glibc must have both functions' implementations
458 CPPFLAGS="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
459 %endif
460 CPPFLAGS+=" -DASAN_INIT_FIRST"
461
462 # chmod +x $HERE/asan-glibc-gcc-wrapper.py
463 # build static wrapper, because we don't want asan to intercept allocators
464 g++ -o gcc-wrapper gcc-wrapper.cc -O3 -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-exceptions -static
465
466 rm -rf $ASAN_BUILD
467 mkdir -p $ASAN_BUILD
468 pushd $ASAN_BUILD
469 # Legacy python wrapper call was:
470 #   CC=$HERE/asan-glibc-gcc-wrapper.py $GLIBC/configure $configure_flags
471 CPPFLAGS=$CPPFLAGS \
472         CC=$HERE/gcc-wrapper $GLIBC/configure $configure_flags
473
474 # Quick build - builds only libraries, but does not create symlinks.
475 make -r -j $J -C $GLIBC objdir=`pwd` subdir_lib
476 # make -r -j $J -C $GLIBC objdir=`pwd` install_root=$ASAN_INST install-lib
477 popd
478 %endif
479 }
480
481 %{?hwasan:
482 %ifarch %{hwasan_arch}
483 configure_flags="--prefix=/usr --without-cvs --without-selinux --enable-stackguard-randomization --enable-obsolete-rpc --disable-mathvec"
484 configure_flags="$configure_flags --disable-sanity-checks"
485
486 HERE=%{_builddir}/%{name}-%{version}
487 J=${J:-32}
488 GLIBC=$HERE
489 ASAN_BUILD=$HERE/hwasan-build
490 unset CXXFLAGS
491 unset CFLAGS
492 unset LDFLAGS
493 %ifarch %arm aarch64
494 # Glibc must have both functions' implementations
495 CPPFLAGS="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
496 %endif
497 CPPFLAGS+=" -DASAN_INIT_FIRST"
498
499 # chmod +x $HERE/asan-glibc-gcc-wrapper.py
500 # build static wrapper, because we don't want asan to intercept allocators
501 g++ -o gcc-wrapper gcc-wrapper.cc -O3 -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-exceptions -static -DHWASAN_BUILD
502
503 rm -rf $ASAN_BUILD
504 mkdir -p $ASAN_BUILD
505 pushd $ASAN_BUILD
506 # Legacy python wrapper call was:
507 #   CC=$HERE/asan-glibc-gcc-wrapper.py $GLIBC/configure $configure_flags
508 CPPFLAGS=$CPPFLAGS \
509         CC=$HERE/gcc-wrapper $GLIBC/configure $configure_flags
510
511 # Quick build - builds only libraries, but does not create symlinks.
512 make -r -j $J -C $GLIBC objdir=`pwd` subdir_lib
513 # make -r -j $J -C $GLIBC objdir=`pwd` install_root=$ASAN_INST install-lib
514 popd
515 %endif
516 }
517
518
519 %{?glibc_exit_on_make_finish:
520   echo "Glibc build is complete and environment is ready, exiting"
521   exit 1
522  }
523
524  }
525
526 #
527 # Build testsuite
528 #
529 # #check sections could be redefined/disabled, so keep this inside #build
530
531 %{?glibc_run_tests:
532   export LD_AS_NEEDED=0
533   (make %{?_smp_mflags} -k -C build check || true) 2>&1 | tee check.log
534  }
535
536 #######################################################################
537 ###
538 ### CHECK
539 ###
540 #######################################################################
541
542 %check
543 # The testsuite will fail if asneeded is used
544 export LD_AS_NEEDED=0
545 # This has to pass on all platforms!
546 # Exceptions:
547 # None!
548 make %{?_smp_mflags} -k -C build check-abi
549
550 #######################################################################
551 ###
552 ### INSTALL
553 ###
554 #######################################################################
555
556 %install
557 # We don't want to strip the .symtab from our libraries in find-debuginfo.sh,
558 # certainly not from libpthread.so.* because it is used by libthread_db to find
559 # some non-exported symbols in order to detect if threading support
560 # should be enabled.  These symbols are _not_ exported, and we can't easily
561 # export them retroactively without changing the ABI.  So we have to
562 # continue to "export" them via .symtab, instead of .dynsym :-(
563 # But we also want to keep .symtab and .strtab of other libraries since some
564 # debugging tools currently require these sections directly inside the main
565 # files - specifically valgrind and PurifyPlus.
566 export STRIP_KEEP_SYMTAB=*.so*
567
568 # Make sure we will create the gconv-modules.cache
569 mkdir -p %{buildroot}%{_libdir}/gconv
570 touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache
571
572 # Install base glibc
573 make %{?_smp_mflags} install_root=%{buildroot} install -C build
574
575 %{?glibc_dump_configure:
576   install -D -m 0644 build/glibc-%{version}-%{release}-%_project-%_repository.db %{buildroot}%{_datadir}/glibc-%{version}-%{release}-%_project-%_repository.db
577 }
578
579 # Install locales
580 %if %{build_locales}
581 # XXX Do not install locales in parallel!
582 pushd build
583 # localedef creates hardlinks to other locales if possible
584 # this will not work if we generate them in parallel.
585 # thus we need to run fdupes on  /usr/lib/locale/
586 # Still, on my system this is a speed advantage:
587 # non-parallel build for install-locales: 9:34mins
588 # parallel build with fdupes: 7:08mins
589 make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales
590 %fdupes %{buildroot}/usr/lib/locale
591 popd
592 %endif
593
594 # Create file list for glibc-locale package
595 %{find_lang} libc
596
597 # Prepare obsolete/, used only on some architectures:
598 export RPM_BUILD_ROOT
599 %ifarch %ix86
600 mkdir -p %{buildroot}/%{_lib}/obsolete
601 %endif
602
603 # Miscelanna:
604
605 install -m 0700 build/glibc_post_upgrade %{buildroot}%{_sbindir}
606
607 install -m 644 %{SOURCE7} %{buildroot}/etc
608 install -m 644 %{SOURCE5} %{buildroot}/etc
609 install -m 644 posix/gai.conf %{buildroot}/etc
610
611 mkdir -p %{buildroot}/etc/default
612 install -m 644 nis/nss %{buildroot}/etc/default/
613
614 mkdir -p %{buildroot}%{_includedir}/resolv
615 install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/
616 install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/
617
618 %if %{build_html}
619 mkdir -p %{buildroot}%{_datadir}/doc/glibc
620 cp -p build/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc
621 %endif
622
623 #
624 # Create ld.so.conf
625 #
626 cat > %{buildroot}/etc/ld.so.conf <<EOF
627 %if "%{_lib}" == "lib64"
628 /usr/local/lib64
629 %endif
630 /usr/local/lib
631 include /etc/ld.so.conf.d/*.conf
632 # /lib64, /lib, /usr/lib64 and /usr/lib gets added
633 # automatically by ldconfig after parsing this file.
634 # So, they do not need to be listed.
635 EOF
636 # Add ldconfig cache directory for directory ownership
637 mkdir -p %{buildroot}/var/cache/ldconfig
638 # Empty the ld.so.cache:
639 rm -f %{buildroot}/etc/ld.so.cache
640 touch %{buildroot}/etc/ld.so.cache
641
642 # Don't look at ldd! We don't wish a /bin/sh requires
643 chmod 644 %{buildroot}%{_bindir}/ldd
644
645 # Remove timezone data, now coming in standalone package:
646 for i in sbin/sln usr/bin/tzselect usr/sbin/zic usr/sbin/zdump etc/localtime; do
647         rm -f %{buildroot}/$i
648 done
649 rm -rf %{buildroot}%{_datadir}/zoneinfo
650
651 %ifarch armv7hl
652 # Provide compatibility link
653 ln -s ld-%{glibc_major_version}.so %{buildroot}/lib/ld-linux.so.3
654 %endif
655
656 # Move getconf to %{_libexecdir}/getconf/ to avoid cross device link
657 mv %{buildroot}%{_bindir}/getconf %{buildroot}%{_libexecdir}/getconf/getconf
658 ln -s %{_libexecdir}/getconf/getconf %{buildroot}%{_bindir}/getconf
659
660 #######################################################################
661 ###
662 ### ...
663 ###
664 #######################################################################
665
666 %{?asan:
667 %ifarch %{asan_arch}
668 HERE=%{_builddir}/%{name}-%{version}
669 GLIBC=$HERE
670 ASAN_BUILD=$HERE/asan-build
671 cp $ASAN_BUILD/libc.so %{buildroot}/%{_lib}/libc-%{version}-asan.so
672 %endif
673 }
674
675 %{?hwasan:
676 %ifarch %{hwasan_arch}
677 HERE=%{_builddir}/%{name}-%{version}
678 GLIBC=$HERE
679 ASAN_BUILD=$HERE/hwasan-build
680 cp $ASAN_BUILD/libc.so %{buildroot}/%{_lib}/libc-%{version}-hwasan.so
681 %endif
682 }
683
684 %{?glibc_run_tests:
685   mkdir testresults
686   find build \
687        \( -name "*tests.sum" -o -name "*.out" -o -name "*.test-result" \) \
688        -exec cp --parents {} testresults/ \;
689   find testresults/ -type f -exec chmod 644 {} \;
690   cp check.log testresults/
691 }
692
693 %post -p %{_sbindir}/glibc_post_upgrade
694
695 %postun -p /sbin/ldconfig
696
697 %post locale
698 for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do
699         [ -d "$l.d" ] || continue
700         echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l"
701         cat "$l.d"/* >>"$l"
702 done
703 /usr/sbin/iconvconfig
704
705 %post info
706 %install_info --info-dir=%{_infodir} %{_infodir}/libc.info.gz
707
708 %postun info
709 %install_info_delete --info-dir=%{_infodir} %{_infodir}/libc.info.gz
710
711 %files
712 %manifest %{name}.manifest
713 # glibc
714 %defattr(-,root,root)
715 %license LICENSES COPYING COPYING.LIB
716 %config(noreplace) /etc/bindresvport.blacklist
717 %config /etc/ld.so.conf
718 %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
719 %config(noreplace) /etc/rpc
720 %verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf
721 %verify(not md5 size mtime) %config(noreplace) /etc/gai.conf
722 %config(noreplace) /etc/default/nss
723 /%{_lib}/ld-%{glibc_major_version}.so
724
725 # Each architecture has a different name for the dynamic linker:
726 %ifarch %arm
727 %ifarch armv7hl
728 /%{_lib}/ld-linux-armhf.so.3
729 # Keep compatibility link
730 /%{_lib}/ld-linux.so.3
731 %else
732 /%{_lib}/ld-linux.so.3
733 %endif
734 %endif
735 %ifarch x86_64
736 /%{_lib}/ld-linux-x86-64.so.2
737 %endif
738 %ifarch %ix86 %sparc
739 /%{_lib}/ld-linux.so.2
740 %endif
741 %ifarch aarch64
742 /lib/ld-linux-aarch64.so.1
743 /%{_lib}/ld-linux-aarch64.so.1
744 %endif
745
746 /%{_lib}/libanl-%{glibc_major_version}.so
747 /%{_lib}/libanl.so.1
748 /%{_lib}/libc-%{glibc_major_version}.so
749 /%{_lib}/libc.so.6*
750 /%{_lib}/libcrypt-%{glibc_major_version}.so
751 /%{_lib}/libcrypt.so.1
752 /%{_lib}/libdl-%{glibc_major_version}.so
753 /%{_lib}/libdl.so.2*
754 /%{_lib}/libm-%{glibc_major_version}.so
755 /%{_lib}/libm.so.6*
756 /%{_lib}/libnsl-%{glibc_major_version}.so
757 /%{_lib}/libnsl.so.1
758 /%{_lib}/libnss_compat-%{glibc_major_version}.so
759 /%{_lib}/libnss_compat.so.2
760 /%{_lib}/libnss_db-%{glibc_major_version}.so
761 /%{_lib}/libnss_db.so.2
762 /%{_lib}/libnss_dns-%{glibc_major_version}.so
763 /%{_lib}/libnss_dns.so.2
764 /%{_lib}/libnss_files-%{glibc_major_version}.so
765 /%{_lib}/libnss_files.so.2
766 /%{_lib}/libnss_optfiles-%{glibc_major_version}.so
767 /%{_lib}/libnss_optfiles.so.2
768 /%{_lib}/libnss_hesiod-%{glibc_major_version}.so
769 /%{_lib}/libnss_hesiod.so.2
770 /%{_lib}/libpthread-%{glibc_major_version}.so
771 /%{_lib}/libpthread.so.0
772 /%{_lib}/libthread_db-1.0.so
773 /%{_lib}/libthread_db.so.1
774 /%{_lib}/libresolv-%{glibc_major_version}.so
775 /%{_lib}/libresolv.so.2
776 /%{_lib}/librt-%{glibc_major_version}.so
777 /%{_lib}/librt.so.1
778 /%{_lib}/libutil-%{glibc_major_version}.so
779 /%{_lib}/libutil.so.1
780 %define optimized_libs() \
781         %dir %attr(0755,root,root) /%{_lib}/%1\
782         /%{_lib}/%1/libc-%{glibc_major_version}.so\
783         /%{_lib}/%1/libc.so.6*\
784         /%{_lib}/%1/libm-%{glibc_major_version}.so\
785         /%{_lib}/%1/libm.so.6*\
786         /%{_lib}/%1/libpthread-%{glibc_major_version}.so\
787         /%{_lib}/%1/libpthread.so.0\
788         /%{_lib}/%1/librt-%{glibc_major_version}.so\
789         /%{_lib}/%1/librt.so.1\
790         /%{_lib}/%1/libthread_db-1.0.so\
791         /%{_lib}/%1/libthread_db.so.1
792
793 %dir %attr(0700,root,root) /var/cache/ldconfig
794 /sbin/ldconfig
795 %{_bindir}/gencat
796 %{_bindir}/getconf
797 %{_bindir}/getent
798 %{_bindir}/iconv
799 %attr(755,root,root) %{_bindir}/ldd
800 %ifarch %ix86 sparc sparcv9
801         %{_bindir}/lddlibc4
802 %endif
803 %{_bindir}/locale
804 %{_bindir}/localedef
805 %dir %attr(0755,root,root) %{_libexecdir}/getconf
806 %{_libexecdir}/getconf/*
807 %{_sbindir}/glibc_post_upgrade
808 %{_sbindir}/iconvconfig
809 /%{_lib}/libBrokenLocale-%{glibc_major_version}.so
810 /%{_lib}/libBrokenLocale.so.1
811
812 %ifarch %ix86
813
814 %files obsolete
815 %manifest %{name}.manifest
816 %license COPYING.LIB
817 %defattr (755,root,root,755)
818 %dir /%{_lib}/obsolete/
819         #%dir /%{_lib}/obsolete/noversion
820         #/%{_lib}/obsolete/noversion/libNoVersion-%{glibc_major_version}.so
821         #/%{_lib}/obsolete/noversion/libNoVersion.so.1
822 %endif
823
824 %files locale -f libc.lang
825 %manifest %{name}.manifest
826 %license COPYING COPYING.LIB
827 %defattr(-,root,root)
828 %{_datadir}/locale/locale.alias
829 %if %{build_locales}
830 /usr/lib/locale/*
831 %endif
832 %{_libdir}/gconv
833
834 %{?asan:
835 %ifarch %{asan_arch}
836 %files asan
837 %manifest %{name}.manifest
838 /%{_lib}/libc-%{version}-asan.so
839 %endif
840 }
841
842 %{?hwasan:
843 %ifarch %{hwasan_arch}
844 %files hwasan
845 %manifest %{name}.manifest
846 /%{_lib}/libc-%{version}-hwasan.so
847 %endif
848 }
849
850 %files devel
851 %manifest %{name}.manifest
852 %defattr(-,root,root)
853 %license COPYING COPYING.LIB
854 %doc NEWS README
855 %{_bindir}/rpcgen
856 %{_includedir}/*
857 %{_libdir}/*.o
858 %{_libdir}/*.so
859 # These static libraries are needed even for shared builds
860 %{_libdir}/libc_nonshared.a
861 %{_libdir}/libg.a
862 %ifarch ppc ppc64 s390 s390x sparc sparcv8 sparcv9 sparcv9v
863 # This is not built on sparc64.
864         %{_libdir}/libnldbl_nonshared.a
865 %endif
866 %{_libdir}/libmcheck.a
867 %{_libdir}/librpcsvc.a
868
869 %files devel-static
870 %manifest %{name}.manifest
871 %defattr(-,root,root)
872 %{_libdir}/libBrokenLocale.a
873 %{_libdir}/libanl.a
874 %{_libdir}/libc.a
875 %{_libdir}/libcrypt.a
876 %{_libdir}/libdl.a
877 %{_libdir}/libm.a
878 %{_libdir}/libpthread.a
879 %{_libdir}/libresolv.a
880 %{_libdir}/librt.a
881 %{_libdir}/libutil.a
882
883 %files info
884 %manifest %{name}.manifest
885 %defattr(-,root,root)
886 %doc %{_infodir}/libc.info.gz
887 %doc %{_infodir}/libc.info-?.gz
888 %doc %{_infodir}/libc.info-??.gz
889
890 %if %{build_html}
891 %files html
892 %manifest %{name}.manifest
893 %defattr(-,root,root)
894 %doc %{_prefix}/share/doc/glibc
895 %endif
896
897 %files i18ndata
898 %manifest %{name}.manifest
899 %defattr(-,root,root)
900 %{_prefix}/share/i18n
901
902 %if %{build_profile}
903 %files profile
904 %manifest %{name}.manifest
905 %license COPYING COPYING.LIB
906 %defattr(-,root,root)
907 %{_libdir}/libc_p.a
908 %{_libdir}/libBrokenLocale_p.a
909 %{_libdir}/libanl_p.a
910 %{_libdir}/libm_p.a
911 %{_libdir}/libcrypt_p.a
912 %{_libdir}/libpthread_p.a
913 %{_libdir}/libresolv_p.a
914 %{_libdir}/librt_p.a
915 %{_libdir}/librpcsvc_p.a
916 %{_libdir}/libutil_p.a
917 %{_libdir}/libdl_p.a
918 %endif
919
920 %files devel-utils
921 %manifest %{name}.manifest
922 %defattr(-,root,root)
923 /%{_lib}/libmemusage.so
924 /%{_lib}/libpcprofile.so
925 /%{_libdir}/libBrokenLocale.so
926 /%{_lib}/libSegFault.so
927 /%{_lib}/libthread_db-1.0.so
928 /%{_lib}/libthread_db.so.1
929 /%{_libdir}/libthread_db.so
930 %dir /%{_libdir}/audit
931 /%{_libdir}/audit/sotruss-lib.so
932 # These need gd-devel for building
933 # %%{_bindir}/memusage
934 # %%{_bindir}/memusagestat
935 %{_bindir}/mtrace
936 %{_bindir}/pcprofiledump
937 %{_bindir}/sotruss
938 %{_bindir}/xtrace
939 %{_bindir}/pldd
940 %{_bindir}/catchsegv
941 %{_bindir}/sprof
942
943 %files extra
944 %manifest %{name}.manifest
945 %license COPYING.LIB
946 %defattr(-,root,root)
947 %{_bindir}/makedb
948 /var/db/Makefile
949
950 %{?glibc_run_tests:
951 %files testresults
952 %defattr(-,root,root)
953 %doc testresults/check.log
954 %doc testresults/*
955 }
956
957 %{?glibc_dump_configure:
958 %files configure-dump
959 %manifest glibc.manifest
960 %{_datadir}/glibc-%{version}-%{release}-%_project-%_repository.db
961 }
962
963 %docs_package