Add script to devel-static as well
[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 0
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 Source7:        bindresvport.blacklist
110 Source8:        glibc_post_upgrade.c
111 Source9:        glibc.rpmlintrc
112 Source10:       baselibs.conf
113 # For systemd
114 Source1001:     glibc.manifest
115
116 Requires(pre):  filesystem
117 Provides:       rtld(GNU_HASH)
118
119 %description
120 The GNU C Library provides the most important standard libraries used
121 by nearly all programs: the standard C library, the standard math
122 library, and the POSIX thread library. A system is not functional
123 without these libraries.
124
125 %package info
126 Summary:        Info Files for the GNU C Library
127 License:        GFDL-1.1
128 Group:          Documentation
129 BuildArch:      noarch
130
131 %description info
132 This package contains the documentation for the GNU C library stored as
133 info files. Due to a lack of resources, this documentation is not
134 complete and is partially out of date.
135
136 %package html
137 Summary:        HTML Documentation for the GNU C Library
138 License:        GFDL-1.1
139 Group:          Documentation
140 BuildArch:      noarch
141
142 %description html
143 This package contains the HTML documentation for the GNU C library. Due
144 to a lack of resources, this documentation is not complete and is
145 partially out of date.
146
147 %package i18ndata
148 Summary:        Database Sources for 'locale'
149 License:        GPL-2.0+ and MIT
150 Group:          Base/Libraries
151 BuildArch:      noarch
152
153 %description i18ndata
154 This package contains the data needed to build the locale data files to
155 use the internationalization features of the GNU libc. It is normally
156 not necessary to install this packages, the data files are already
157 created.
158
159 %package locale
160 Summary:        Locale Data for Localized Programs
161 License:        GPL-2.0+ and MIT and LGPL-2.1+
162 Requires(post): /usr/bin/cat
163 Requires:       glibc = %{version}
164 %description locale
165 Locale data for the internationalisation features of the GNU C library.
166
167 %package profile
168 Summary:        Libc Profiling and Debugging Versions
169 License:        LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
170 Group:          Base/Utilities
171 Requires:       glibc = %{version}
172
173 %description profile
174 This package contains special versions of the GNU C library which are
175 necessary for profiling and debugging.
176
177 %package devel
178 Summary:        Include Files and Libraries Mandatory for Development
179 License:        BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
180 Requires:       glibc = %{version}
181 Requires:       linux-kernel-headers
182
183 %description devel
184 These libraries are needed to develop programs which use the standard C
185 library.
186
187 %package devel-static
188 Summary:        C library static libraries for -static linking
189 License:        BSD-3-Clause and LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
190 Requires:       %{name}-devel = %{version}
191 # Provide Fedora name for package to make packaging easier
192 Provides:       %{name}-static = %version
193
194 %description devel-static
195 The glibc-devel-static package contains the C library static libraries
196 for -static linking.  You don't need these, unless you link statically,
197 which is highly discouraged.
198
199 %package devel-utils
200 Summary:        Development utilities from GNU C library
201 License:        LGPL-2.1+
202 Requires:       glibc = %{version}
203
204 %description devel-utils
205 The glibc-devel-utils package contains various binaries which can be helpful during program
206 debugging.
207
208 If you are unsure if you need this, don't install this package.
209
210 %package extra
211 Summary:        Extra binaries from GNU C Library
212 License:        LGPL-2.1+
213 Requires:       glibc = %{version}
214
215 %description extra
216 The glibc-extra package contains some extra binaries for glibc that
217 are not essential but recommend to use.
218
219 makedb: A program to create a database for nss
220
221 %package obsolete
222 Summary:        Obsolete Shared Libraries from the GNU C Library
223 License:        LGPL-2.0+
224 Requires:       glibc = %{version}
225
226 %description obsolete
227 This package provides some old libraries from the GNU C Library which
228 are no longer supported. Additional it provides a compatibility library
229 for old binaries linked against glibc 2.0.
230
231 Install this package if you need one of this libraries to get old
232 binaries working, but since this libraries are not supported and there
233 is no gurantee that they work for you, you should try to get newer
234 versions of your software.
235
236 %package testresults
237 Summary:       Testsuite results
238 License:       LGPL-2.1+
239 Group:         Development/Languages
240 %description testresults
241 Results from running the glibc testsuites.
242
243 %{?asan:
244 %ifarch %asan_arch
245 %package asan
246 Summary:     glibc with ASan instrumentation
247 License:     LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
248 Requires:    glibc = %{version}
249 Requires:    rpm
250
251 %description asan
252 This package provides glibc with ASan instrumentation
253
254 %post asan
255 ln -s --force /%{_lib}/libc-%{version}-asan.so /%{_lib}/libc.so.6
256
257 %preun asan
258 ln -s --force /%{_lib}/libc-%{version}.so /%{_lib}/libc.so.6
259
260 %endif
261 }
262
263 %{?hwasan:
264 %ifarch %hwasan_arch
265 %package hwasan
266 Summary:     glibc with Hwasan instrumentation
267 License:     LGPL-2.1+ and LGPL-2.1+-with-GCC-exception and GPL-2.0+
268 Requires:    glibc = %{version}
269 Requires:    rpm
270
271 %description hwasan
272 This package provides glibc with Hwasan instrumentation
273
274 %post hwasan
275 ln -s --force /%{_lib}/libc-%{version}-hwasan.so /%{_lib}/libc.so.6
276
277 %preun hwasan
278 ln -s --force /%{_lib}/libc-%{version}.so /%{_lib}/libc.so.6
279
280 %endif
281 }
282
283
284 %{?glibc_dump_configure:
285 %package configure-dump
286 Summary:       GNU Glibc configure dump
287 License:       GPL-3.0+
288 Group:         Development/Languages
289 %description configure-dump
290 This package contains dump of configure variables of Glibc
291 }
292
293 %prep
294 %setup -n glibc-%{version} -q
295 cp %{SOURCE1001} .
296
297 %build
298 %{?asan:%gcc_unforce_options}
299 %{?hwasan:%gcc_unforce_options}
300 if [ -x /bin/uname.bin ]; then
301         /bin/uname.bin -a
302 else
303         uname -a
304 fi
305 uptime || :
306 ulimit -a
307 nice
308 # We do not want configure to figure out the system its building one
309 # to support a common ground and thus set build and host to the
310 # target_cpu.
311 %ifarch %arm
312 %define target %{_target_cpu}-tizen-linux-gnueabi
313 %else
314 %define target %{_target_cpu}-tizen-linux
315 %endif
316 # Don't use as-needed, it breaks glibc assumptions
317 # Before enabling it, run the testsuite and verify that it
318 # passes completely
319 export LD_AS_NEEDED=0
320 # Adjust glibc version.h
321 echo "#define CONFHOST \"%{target}\"" >> version.h
322 echo "#define GITID \"%{git_id}\"" >> version.h
323 #
324 # Default CFLAGS and Compiler
325 #
326 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//" )
327 BuildFlags="$BuildFlags -O2 -g -U_FORTIFY_SOURCE"
328 BuildFlags="$(echo $BuildFlags | sed -e 's#-ffortify=[0-9]*##')"
329 BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector-strong##')"
330 BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##')"
331 BuildFlags="$(echo $BuildFlags | sed -e 's/-Wa,-mimplicit-it=thumb\(-interwork\)\?//g' | sed -e 's/-mthumb\(-interwork\)\?//g')"
332 # Turn off all -Wformat enable flags as there are glibc tests that explicitly
333 # append -Wno-format and with enabled Wformat options that produced warnings
334 # that turns into errors. Remove -Wformat=1|2 or -Wformat-..-arg
335 BuildFlags="$(echo $BuildFlags | sed -re 's/-Wformat((=[1-2])|((-\w+)+))?(\s|$)//g')"
336
337 %ifarch %arm
338 # Support DA build with armv8 cpu in 32bit mode: prevent Werror on sqrt function
339 (echo ${BuildFlags} | grep '\-march=armv8') && BuildFlags="${BuildFlags} -Wno-error=unused-variable"
340 %endif
341
342 BuildCC="%__cc"
343 BuildCCplus="%__cxx"
344 add_ons=",libidn"
345
346 BuildFlags="$BuildFlags -g"
347
348 %ifarch %arm aarch64
349 # Glibc must have both functions' implementations
350 BuildFlags="$BuildFlags -U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
351 %endif
352 %if %{disable_assert}
353         BuildFlags="$BuildFlags -DNDEBUG=1"
354 %endif
355 %ifarch %ix86
356         add_ons=$add_ons
357 %endif
358 %ifarch %arm aarch64
359         add_ons=$add_ons
360 %endif
361 %ifarch mipsel
362         # fails to build otherwise - need to recheck and fix
363         %define enable_stackguard_randomization 0
364 %endif
365
366 #
367 # Build glibc
368 #
369 %{!?glibc_keep_build_dir:
370   rm -rf "build"
371   mkdir "build"
372   pushd "build"
373  }
374
375 conf_cflags="$BuildFlags -funwind-tables -fPIC"
376 %{?asan: conf_cflags="$conf_cflags -DASAN_INIT_FIRST"}
377 %{?hwasan: conf_cflags="$conf_cflags -DASAN_INIT_FIRST -Wno-error=pragmas"}
378 profile="--disable-profile"
379 %{?build_profile:profile="--enable-profile"}
380 %{?glibc_dump_configure:patch_configure.pl ..}
381
382 %{!?glibc_skip_configure:
383   CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \
384   CC="$BuildCC" CXX="$BuildCCplus" \
385   ../configure \
386   --prefix=%{_prefix} \
387   --libexecdir=%{_libexecdir} --infodir=%{_infodir} \
388   --enable-add-ons=$add_ons \
389   $profile \
390   --enable-kernel=%{enablekernel} \
391   --enable-bind-now \
392   --disable-nscd \
393   --disable-experimental-malloc \
394   libc_cv_cc_pie_default=yes \
395 %if %{enable_stackguard_randomization}
396   --enable-stackguard-randomization \
397 %endif
398   --build=%{target} --host=%{target} \
399 %ifnarch %{multiarcharches}
400   --disable-multi-arch \
401 %endif
402 %ifarch %{ix86} x86_64
403   --disable-mathvec \
404 %endif
405 %if 0%{?enable_static_pie}
406   --enable-static-pie \
407 %endif
408  }
409
410 %{!?glibc_skip_make:
411   make %{?_smp_mflags}
412 %{?glibc_dump_configure:
413     dump_configure.pl .. . \
414     --project glibc \
415     --project-version %{version} \
416     --out_db glibc-%{version}-%{release}-%_project-%_repository.db
417  }
418
419 #
420 # Build glibc_post_upgrade binary
421 #
422 $BuildCC \
423     -static %{optflags} -Os \
424     $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \
425     -L. -Bcsu \
426     '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \
427     '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"'
428
429 %{!?glibc_keep_build_dir:
430   popd
431  }
432 #
433 # Build html documentation
434 #
435 %if %{build_html}
436 make %{?_smp_mflags} -C "build" html
437 %endif
438
439 #
440 # Build ASan version of glibc
441 #
442 %{?asan:
443 %ifarch %{asan_arch}
444 configure_flags="--prefix=/usr --without-cvs --without-selinux --enable-stackguard-randomization --disable-mathvec"
445 configure_flags="$configure_flags --disable-sanity-checks"
446
447 HERE=%{_builddir}/%{name}-%{version}
448 J=${J:-32}
449 GLIBC=$HERE
450 ASAN_BUILD=$HERE/asan-build
451 unset CXXFLAGS
452 unset CFLAGS
453 unset LDFLAGS
454 %ifarch %{arm} aarch64
455 # Glibc must have both functions' implementations
456 CPPFLAGS="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
457 %endif
458 CPPFLAGS+=" -DASAN_INIT_FIRST"
459
460 # chmod +x $HERE/asan-glibc-gcc-wrapper.py
461 # build static wrapper, because we don't want asan to intercept allocators
462 g++ -o gcc-wrapper gcc-wrapper.cc -O3 -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-exceptions -static
463
464 rm -rf $ASAN_BUILD
465 mkdir -p $ASAN_BUILD
466 pushd $ASAN_BUILD
467 # Legacy python wrapper call was:
468 #   CC=$HERE/asan-glibc-gcc-wrapper.py $GLIBC/configure $configure_flags
469 CPPFLAGS=$CPPFLAGS \
470         CC=$HERE/gcc-wrapper $GLIBC/configure $configure_flags
471
472 # Quick build - builds only libraries, but does not create symlinks.
473 make -r -j $J -C $GLIBC objdir=`pwd` subdir_lib
474 # make -r -j $J -C $GLIBC objdir=`pwd` install_root=$ASAN_INST install-lib
475 popd
476 %endif
477 }
478
479 %{?hwasan:
480 %ifarch %{hwasan_arch}
481 configure_flags="--prefix=/usr --without-cvs --without-selinux --enable-stackguard-randomization --disable-mathvec"
482 configure_flags="$configure_flags --disable-sanity-checks"
483
484 HERE=%{_builddir}/%{name}-%{version}
485 J=${J:-32}
486 GLIBC=$HERE
487 ASAN_BUILD=$HERE/hwasan-build
488 unset CXXFLAGS
489 unset CFLAGS
490 unset LDFLAGS
491 %ifarch %arm aarch64
492 # Glibc must have both functions' implementations
493 CPPFLAGS="-U_LARGEFILE_SOURCE -U_LARGEFILE64_SOURCE -U_FILE_OFFSET_BITS"
494 %endif
495 CPPFLAGS+=" -DASAN_INIT_FIRST"
496
497 # chmod +x $HERE/asan-glibc-gcc-wrapper.py
498 # build static wrapper, because we don't want asan to intercept allocators
499 g++ -o gcc-wrapper gcc-wrapper.cc -O3 -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-exceptions -static -DHWASAN_BUILD
500
501 rm -rf $ASAN_BUILD
502 mkdir -p $ASAN_BUILD
503 pushd $ASAN_BUILD
504 # Legacy python wrapper call was:
505 #   CC=$HERE/asan-glibc-gcc-wrapper.py $GLIBC/configure $configure_flags
506 CPPFLAGS=$CPPFLAGS \
507         CC=$HERE/gcc-wrapper $GLIBC/configure $configure_flags
508
509 # Quick build - builds only libraries, but does not create symlinks.
510 make -r -j $J -C $GLIBC objdir=`pwd` subdir_lib
511 # make -r -j $J -C $GLIBC objdir=`pwd` install_root=$ASAN_INST install-lib
512 popd
513 %endif
514 }
515
516
517 %{?glibc_exit_on_make_finish:
518   echo "Glibc build is complete and environment is ready, exiting"
519   exit 1
520  }
521
522  }
523
524 #
525 # Build testsuite
526 #
527 # #check sections could be redefined/disabled, so keep this inside #build
528
529 %{?glibc_run_tests:
530   export LD_AS_NEEDED=0
531   (make %{?_smp_mflags} -k -C build check || true) 2>&1 | tee check.log
532  }
533
534 #######################################################################
535 ###
536 ### CHECK
537 ###
538 #######################################################################
539
540 %check
541 # The testsuite will fail if asneeded is used
542 export LD_AS_NEEDED=0
543 # This has to pass on all platforms!
544 # Exceptions:
545 # None!
546 make %{?_smp_mflags} -k -C build check-abi
547
548 #######################################################################
549 ###
550 ### INSTALL
551 ###
552 #######################################################################
553
554 %install
555 # We don't want to strip the .symtab from our libraries in find-debuginfo.sh,
556 # certainly not from libpthread.so.* because it is used by libthread_db to find
557 # some non-exported symbols in order to detect if threading support
558 # should be enabled.  These symbols are _not_ exported, and we can't easily
559 # export them retroactively without changing the ABI.  So we have to
560 # continue to "export" them via .symtab, instead of .dynsym :-(
561 # But we also want to keep .symtab and .strtab of other libraries since some
562 # debugging tools currently require these sections directly inside the main
563 # files - specifically valgrind and PurifyPlus.
564 export STRIP_KEEP_SYMTAB=*.so*
565
566 # Make sure we will create the gconv-modules.cache
567 mkdir -p %{buildroot}%{_libdir}/gconv
568 touch %{buildroot}%{_libdir}/gconv/gconv-modules.cache
569
570 # Install base glibc
571 make %{?_smp_mflags} install_root=%{buildroot} install -C build
572
573 %{?glibc_dump_configure:
574   install -D -m 0644 build/glibc-%{version}-%{release}-%_project-%_repository.db %{buildroot}%{_datadir}/glibc-%{version}-%{release}-%_project-%_repository.db
575 }
576
577 # Install locales
578 %if %{build_locales}
579 # XXX Do not install locales in parallel!
580 pushd build
581 # localedef creates hardlinks to other locales if possible
582 # this will not work if we generate them in parallel.
583 # thus we need to run fdupes on  /usr/lib/locale/
584 # Still, on my system this is a speed advantage:
585 # non-parallel build for install-locales: 9:34mins
586 # parallel build with fdupes: 7:08mins
587 make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales
588 %fdupes %{buildroot}/usr/lib/locale
589 popd
590 %endif
591
592 # Create file list for glibc-locale package
593 %{find_lang} libc
594
595 # Prepare obsolete/, used only on some architectures:
596 export RPM_BUILD_ROOT
597 %ifarch %ix86
598 mkdir -p %{buildroot}/%{_lib}/obsolete
599 %endif
600
601 # Miscelanna:
602
603 install -m 0700 build/glibc_post_upgrade %{buildroot}%{_sbindir}
604
605 install -m 644 %{SOURCE7} %{buildroot}/etc
606 install -m 644 posix/gai.conf %{buildroot}/etc
607
608 mkdir -p %{buildroot}/etc/default
609
610 mkdir -p %{buildroot}%{_includedir}/resolv
611 install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/
612 install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/
613
614 %if %{build_html}
615 mkdir -p %{buildroot}%{_datadir}/doc/glibc
616 cp -p build/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc
617 %endif
618
619 # TODO: REMOVE ME AFTER ISSUE IS RESOLVED
620 # Somehow there's no libpthread.so symlink
621 ln -sf %{_libdir}/libpthread.so.0 %{buildroot}%{_libdir}/libpthread.so
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/bin/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-linux-armhf.so.3 %{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 %post devel
712 # TODO: REMOVE ME AFTER ISSUE IS IDENTIFIED
713 find %{_libdir}/gcc -name 'statx.h' -exec sed -e 's/__glibc_has_include/__has_include/' -i {} \;
714
715 %post devel-static
716 # TODO: REMOVE ME AFTER ISSUE IS IDENTIFIED
717 find %{_libdir}/gcc -name 'statx.h' -exec sed -e 's/__glibc_has_include/__has_include/' -i {} \;
718
719 %files
720 %manifest %{name}.manifest
721 # glibc
722 %defattr(-,root,root)
723 %license LICENSES COPYING COPYING.LIB
724 %config(noreplace) /etc/bindresvport.blacklist
725 %config /etc/ld.so.conf
726 %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
727 %config(noreplace) /etc/rpc
728 %verify(not md5 size mtime) %config(noreplace) /etc/gai.conf
729
730 # Each architecture has a different name for the dynamic linker:
731 %ifarch %arm
732 %ifarch armv7hl
733 /lib/ld-linux-armhf.so.3
734 %endif
735 # Keep as compatibility link for armv7lh
736 /lib/ld-linux.so.3
737 %endif
738 %ifarch x86_64
739 /lib64/ld-linux-x86-64.so.2
740 %endif
741 %ifarch %ix86 %sparc
742 /lib/ld-linux.so.2
743 %endif
744 %ifarch aarch64
745 /lib/ld-linux-aarch64.so.1
746 %endif
747
748 /%{_lib}/libanl.so.1
749 /%{_lib}/libc.so.6*
750 /%{_lib}/libcrypt.so.1
751 /%{_lib}/libdl.so.2*
752 /%{_lib}/libm.so.6*
753 /%{_lib}/libnsl.so.1
754 /%{_lib}/libnss_compat.so.2
755 /%{_lib}/libnss_db.so.2
756 /%{_lib}/libnss_dns.so.2
757 /%{_lib}/libnss_files.so.2
758 /%{_lib}/libnss_optfiles.so.2
759 /%{_lib}/libnss_hesiod.so.2
760 /%{_lib}/libpthread.so*
761 /%{_lib}/libthread_db.so.1
762 /%{_lib}/libresolv.so.2
763 /%{_lib}/librt.so.1
764 /%{_lib}/libutil.so.1
765 /%{_lib}/libc_malloc_debug.so.0
766 %define optimized_libs() \
767         %dir %attr(0755,root,root) /%{_lib}/%1\
768         /%{_lib}/%1/libc.so.6*\
769         /%{_lib}/%1/libm.so.6*\
770         /%{_lib}/%1/libpthread.so*\
771         /%{_lib}/%1/librt.so.1\
772         /%{_lib}/%1/libthread_db.so.1
773
774 %dir %attr(0700,root,root) /var/cache/ldconfig
775 /sbin/ldconfig
776 %{_bindir}/ld.so
777 %{_bindir}/gencat
778 %{_bindir}/getconf
779 %{_bindir}/getent
780 %{_bindir}/iconv
781 %attr(755,root,root) %{_bindir}/ldd
782 %ifarch %ix86 sparc sparcv9
783         %{_bindir}/lddlibc4
784 %endif
785 %{_bindir}/locale
786 %{_bindir}/localedef
787 %dir %attr(0755,root,root) %{_libexecdir}/getconf
788 %{_libexecdir}/getconf/*
789 %{_sbindir}/glibc_post_upgrade
790 %{_sbindir}/iconvconfig
791 /%{_lib}/libBrokenLocale.so.1
792
793 %ifarch %ix86
794
795 %files obsolete
796 %manifest %{name}.manifest
797 %license COPYING.LIB
798 %defattr (755,root,root,755)
799 %dir /%{_lib}/obsolete/
800         # %dir /{_lib}/obsolete/noversion
801         # /{_lib}/obsolete/noversion/libNoVersion.so.1
802 %endif
803
804 %files locale -f libc.lang
805 %manifest %{name}.manifest
806 %license COPYING COPYING.LIB
807 %defattr(-,root,root)
808 %{_datadir}/locale/locale.alias
809 %if %{build_locales}
810 /usr/lib/locale/*
811 %endif
812 %{_libdir}/gconv
813
814 %{?asan:
815 %ifarch %{asan_arch}
816 %files asan
817 %manifest %{name}.manifest
818 /%{_lib}/libc-%{version}-asan.so
819 %endif
820 }
821
822 %{?hwasan:
823 %ifarch %{hwasan_arch}
824 %files hwasan
825 %manifest %{name}.manifest
826 /%{_lib}/libc-%{version}-hwasan.so
827 %endif
828 }
829
830 %files devel
831 %manifest %{name}.manifest
832 %defattr(-,root,root)
833 %license COPYING COPYING.LIB
834 %doc NEWS README
835 %{_includedir}/*
836 %{_libdir}/*.o
837 %{_libdir}/*.so
838 # These static libraries are needed even for shared builds
839 %{_libdir}/libc_nonshared.a
840 %{_libdir}/libg.a
841 %ifarch ppc ppc64 s390 s390x sparc sparcv8 sparcv9 sparcv9v
842 # This is not built on sparc64.
843         %{_libdir}/libnldbl_nonshared.a
844 %endif
845 %{_libdir}/libmcheck.a
846
847 %files devel-static
848 %manifest %{name}.manifest
849 %defattr(-,root,root)
850 %{_libdir}/libBrokenLocale.a
851 %{_libdir}/libanl.a
852 %{_libdir}/libc.a
853 %{_libdir}/libcrypt.a
854 %{_libdir}/libdl.a
855 %{_libdir}/libm.a
856 %{_libdir}/libpthread.a
857 %{_libdir}/libresolv.a
858 %{_libdir}/librt.a
859 %{_libdir}/libutil.a
860
861 %files info
862 %manifest %{name}.manifest
863 %defattr(-,root,root)
864 %doc %{_infodir}/libc.info.gz
865 %doc %{_infodir}/libc.info-?.gz
866 %doc %{_infodir}/libc.info-??.gz
867
868 %if %{build_html}
869 %files html
870 %manifest %{name}.manifest
871 %defattr(-,root,root)
872 %doc %{_prefix}/share/doc/glibc
873 %endif
874
875 %files i18ndata
876 %manifest %{name}.manifest
877 %defattr(-,root,root)
878 %{_prefix}/share/i18n
879
880 %if %{build_profile}
881 %files profile
882 %manifest %{name}.manifest
883 %license COPYING COPYING.LIB
884 %defattr(-,root,root)
885 %{_libdir}/libc_p.a
886 %{_libdir}/libBrokenLocale_p.a
887 %{_libdir}/libanl_p.a
888 %{_libdir}/libm_p.a
889 %{_libdir}/libcrypt_p.a
890 %{_libdir}/libpthread_p.a
891 %{_libdir}/libresolv_p.a
892 %{_libdir}/librt_p.a
893 %{_libdir}/libutil_p.a
894 %{_libdir}/libdl_p.a
895 %endif
896
897 %files devel-utils
898 %manifest %{name}.manifest
899 %defattr(-,root,root)
900 /%{_lib}/libmemusage.so
901 /%{_lib}/libpcprofile.so
902 /%{_libdir}/libBrokenLocale.so
903 /%{_lib}/libthread_db.so.1
904 /%{_libdir}/libthread_db.so
905 %dir /%{_libdir}/audit
906 /%{_libdir}/audit/sotruss-lib.so
907 # These need gd-devel for building
908 # %%{_bindir}/memusage
909 # %%{_bindir}/memusagestat
910 %{_bindir}/mtrace
911 %{_bindir}/pcprofiledump
912 %{_bindir}/sotruss
913 %{_bindir}/xtrace
914 %{_bindir}/pldd
915 %{_bindir}/sprof
916
917 %files extra
918 %manifest %{name}.manifest
919 %license COPYING.LIB
920 %defattr(-,root,root)
921 %{_bindir}/makedb
922 /var/db/Makefile
923
924 %{?glibc_run_tests:
925 %files testresults
926 %defattr(-,root,root)
927 %doc testresults/check.log
928 %doc testresults/*
929 }
930
931 %{?glibc_dump_configure:
932 %files configure-dump
933 %manifest glibc.manifest
934 %{_datadir}/glibc-%{version}-%{release}-%_project-%_repository.db
935 }
936
937 %docs_package