/[packages]/updates/3/glibc/current/SPECS/glibc.spec
ViewVC logotype

Annotation of /updates/3/glibc/current/SPECS/glibc.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 58170 - (hide annotations) (download)
Wed Feb 23 23:15:59 2011 UTC (13 years, 1 month ago) by misc
Original Path: cauldron/glibc/current/SPECS/glibc.spec
File size: 45268 byte(s)
- clean old Obsoletes
1 tmb 180 # RH 2.2.4-20, SuSE 2.3.1-32
2     %define name %{cross_prefix}glibc
3    
4     # <epoch>:<version>-<release> tags for glibc main package
5     %define glibcversion 2.12.1
6     %define __glibcrelease 9
7     %define glibcepoch 6
8    
9     # CVS snapshots of glibc
10     %define RELEASE 1
11     %if %{RELEASE}
12     %define source_package glibc-%{glibcversion}
13     %define source_dir glibc-%{glibcversion}
14     %define _glibcrelease %{__glibcrelease}
15     %else
16     %define snapshot 20081113
17     %define source_package glibc-%{glibcversion}-%{snapshot}
18     %define source_dir glibc-%{glibcversion}
19     %define _glibcrelease 0.%{snapshot}.%{__glibcrelease}
20     %endif
21    
22     %define glibcrelease %mkrel %{_glibcrelease}
23    
24     # crypt blowfish support
25     %define crypt_bf_ver 1.0.2
26    
27     # Define "cross" to an architecture to which glibc is to be
28     # cross-compiled
29     %define build_cross 0
30     %{expand: %{?cross: %%global build_cross 1}}
31    
32     %if %{build_cross}
33     %define target_cpu %{cross}
34     %define cross_prefix cross-%{target_cpu}-
35     %define _prefix /usr/%{target_cpu}-linux
36     %define _lib lib
37     %define _slibdir %{_prefix}/%{_lib}
38     %define _slibdir32 %{_prefix}/lib
39     %else
40     %define target_cpu %{_target_cpu}
41     %define cross_prefix %{nil}
42     %define _slibdir /%{_lib}
43     %define _slibdir32 /lib
44     %endif
45    
46     # Define target (base) architecture
47     %define arch %(echo %{target_cpu}|sed -e "s/\\(i.86\\|athlon\\)/i386/" -e "s/amd64/x86_64/" -e "s/\\(sun4.*\\|sparcv[89]\\)/sparc/")
48     %define isarch() %(case " %* " in (*" %{arch} "*) echo 1;; (*) echo 0;; esac)
49    
50     # Define Xen arches to build with -mno-tls-direct-direct-seg-refs
51     %define xenarches %{ix86} x86_64
52    
53     # Define to build nscd with selinux support
54     %define build_selinux 0
55    
56     # Flag for build_pdf_doc:
57     # 1 build glibc with PDF documentation
58     # 0 don't build PDF glibc documentation (e.g. for bootstrap build)
59     %define build_pdf_doc 1
60    
61     # Enable checking by default for arches where we know tests all pass
62     %define build_check 1
63    
64     # Allow make check to fail only when running kernels where we know
65     # tests must pass (no missing features or bugs in the kernel)
66     %define check_min_kver 2.6.21
67    
68     # Define to build a biarch package
69     %define build_biarch 0
70     %if %isarch sparc64 x86_64 ppc64
71     %define build_biarch 1
72     %endif
73    
74     # Define to build glibc-debug package
75     %define build_debug 1
76     %define _enable_debug_packages 1
77     %if "%{_enable_debug_packages}" == "1"
78     %define build_debug 0
79     %endif
80    
81     # Define to bootstrap new glibc
82     %define build_bootstrap 0
83     %{expand: %{!?build_cross_bootstrap: %global build_cross_bootstrap 0}}
84    
85     %define build_profile 1
86     %define build_nscd 1
87     %define build_doc 1
88     %define build_utils 1
89     %define build_i18ndata 1
90     %define build_timezone 0
91    
92     # Disable a few defaults when cross-compiling a glibc
93     %if %{build_cross}
94     %define build_doc 0
95     %define build_pdf_doc 0
96     %define build_biarch 0
97     %define build_check 0
98     %define build_debug 0
99     %define build_nscd 0
100     %define build_profile 0
101     %define build_utils 0
102     %define build_i18ndata 0
103     %define build_timezone 0
104     %endif
105    
106     # Allow --with[out] <feature> at rpm command line build
107     %{expand: %{?_without_PDF: %%global build_pdf_doc 0}}
108     %{expand: %{?_without_CHECK: %%global build_check 0}}
109     %{expand: %{?_without_UTILS: %%global build_utils 0}}
110     %{expand: %{?_without_BOOTSTRAP:%%global build_bootstrap 0}}
111     %{expand: %{?_with_PDF: %%global build_pdf_doc 1}}
112     %{expand: %{?_with_CHECK: %%global build_check 1}}
113     %{expand: %{?_with_UTILS: %%global build_utils 1}}
114     %{expand: %{?_with_BOOTSTRAP: %%global build_bootstrap 1}}
115    
116     Summary: The GNU libc libraries
117     Name: %{name}
118     Version: %{glibcversion}
119     Release: %{glibcrelease}
120     Epoch: %{glibcepoch}
121     License: LGPL
122     Group: System/Libraries
123     Url: http://www.gnu.org/software/libc/
124    
125     # FSF source
126     Source0: http://ftp.gnu.org/gnu/glibc/%{source_package}.tar.xz
127     %if %{RELEASE}
128     Source1: http://ftp.gnu.org/gnu/glibc/%{source_package}.tar.xz.sig
129     %endif
130    
131     # Red Hat tarball
132     Source2: glibc-redhat.tar.bz2
133     Source3: glibc-manpages.tar.bz2
134     Source4: glibc-find-requires.sh
135     Source5: glibc-check.sh
136    
137     # wrapper to avoid rpm circular dependencies
138     Source14: glibc-post-wrapper.c
139    
140     # <http://penguinppc.org/dev/glibc/glibc-powerpc-cpu-addon.html>
141     # NOTE: this check is weak. The rationale is: Cell PPU optimized by
142     # default
143     %define powerpc_cpu_list noarch
144     Source15: glibc-powerpc-cpu-addon-v0.03.tar.bz2
145    
146     # Blowfish support
147     Source16: crypt_blowfish-%{crypt_bf_ver}.tar.gz
148     Source17: crypt_freesec.c
149     Source18: crypt_freesec.h
150    
151     Buildroot: %{_tmppath}/glibc-%{PACKAGE_VERSION}-root
152     %if %{build_cross}
153     Autoreq: false
154     Autoprov: false
155     %else
156     Provides: glibc-crypt_blowfish = %{crypt_bf_ver}
157     Provides: should-restart = system
158     %if %isarch %{xenarches}
159     Obsoletes: %{name}-xen
160     Provides: %{name}-xen
161     %endif
162     # The dynamic linker supports DT_GNU_HASH
163     Provides: rtld(GNU_HASH)
164     Autoreq: false
165     %endif
166     BuildRequires: patch, gettext, perl
167     BuildRequires: linux-userspace-headers
168     %if %{build_selinux}
169     BuildRequires: libselinux-devel >= 1.17.10
170     %endif
171     # need linker for -Wl,--hash-style=both (>= 2.16.91.0.7-6})
172     # need gnu indirect function for multiarch (>= 2.19.51.0.14-1)
173     %define binutils_version 2.19.51.0.14-1
174     BuildRequires: %{cross_prefix}binutils >= %{binutils_version}
175     # we need the static dash
176     %define ash_bin /bin/dash.static
177     Requires(pre): dash-static
178     Requires(post): dash-static
179     # we need an ldconfig with TLS support
180     %if %{build_cross}
181     BuildRequires: %{cross_prefix}gcc >= 3.2.2-4
182     %endif
183     %ifarch %{ix86} alpha
184     BuildRequires: %{cross_prefix}gcc >= 2.96-0.50
185     %endif
186     %ifarch ia64
187     BuildRequires: %{cross_prefix}gcc >= 3.2.3-1
188     %endif
189     %ifarch x86_64
190     BuildRequires: %{cross_prefix}gcc >= 3.1.1-0.5
191     %endif
192     BuildRequires: %{cross_prefix}gcc >= 4.0.1-2
193     %if !%{build_cross}
194     %ifarch alpha
195     Provides: ld.so.2
196     %endif
197     %ifarch ppc
198     Provides: ld.so.1
199     %endif
200     %ifarch sparc
201     Obsoletes: libc
202     %endif
203     %endif
204    
205     # Old prelink versions brakes the system with glibc 2.11
206     Conflicts: prelink < 1:0.4.2-1.20091104.1
207    
208     BuildRequires: texinfo
209     %if %{build_pdf_doc}
210     BuildRequires: tetex, tetex-latex
211     %endif
212     %if %{build_utils}
213     BuildRequires: gd-devel
214     %endif
215     BuildRequires: autoconf2.5
216     BuildRequires: libcap-devel
217     BuildRequires: rpm-mageia-setup-build >= 1.104
218     BuildRequires: spec-helper >= 0.31.2
219    
220     Patch00: glibc-2.11.1-localedef-archive-follow-symlinks.patch
221     Patch01: glibc-2.12.1-fhs.patch
222     Patch02: glibc-2.9-ldd-non-exec.patch
223     Patch03: glibc-2.11-bz10851.patch
224     Patch04: glibc-2.2-nss-upgrade.patch
225     Patch05: glibc-2.12.1-assign-global-scope-to-RFC-1918-addresses.patch
226     Patch06: glibc-2.9-share-locale.patch
227     Patch07: glibc-2.3.6-nsswitch.conf.patch
228     Patch08: glibc-2.12.1-make-3.82-fix.patch
229     Patch09: glibc-2.2.4-xterm-xvt.patch
230     Patch10: glibc-2.12.1-submitted-translit-colon.patch
231     Patch11: glibc-2.4.90-compat-EUR-currencies.patch
232     Patch12: glibc-2.3.6-ppc-build-lddlibc4.patch
233     Patch13: glibc-2.3.3-nscd-enable.patch
234     Patch14: glibc-2.9-nscd-no-host-cache.patch
235     Patch15: glibc-2.12.1-ldconfig-chroot-aux-cache.patch
236     Patch16: glibc-2.12.1-workaround-shortest-stem-in-make-3.82.patch
237     Patch17: glibc-2.4.90-i386-hwcapinfo.patch
238     Patch18: glibc-2.7-provide_CFI_for_the_outermost_function.patch
239     Patch19: glibc-2.8-nscd-init-should-start.patch
240     Patch20: glibc-2.12.1-never-expand-ORIGIN-in-privileged-programs.patch
241     Patch22: glibc-2.3.2-tcsetattr-kernel-bug-workaround.patch
242     Patch23: glibc-2.3.4-timezone.patch
243     Patch24: glibc-2.10.1-biarch-cpp-defines.patch
244     Patch26: glibc-2.6-nice_fix.patch
245     Patch27: glibc-2.8-ENOTTY-fr-translation.patch
246     Patch28: glibc-2.4.90-gcc4-fortify.patch
247     Patch29: glibc-2.3.5-biarch-utils.patch
248     Patch30: glibc-2.10.1-multiarch.patch
249     Patch31: glibc-2.4.90-i586-hptiming.patch
250     Patch32: glibc-2.3.4-i586-if-no-cmov.patch
251     Patch33: glibc-2.3.6-pt_BR-i18nfixes.patch
252     Patch34: glibc-2.4.90-testsuite-ldbl-bits.patch
253     Patch35: glibc-2.12.1-fix-error-handling-in-Linux-getlogin.patch
254     Patch36: glibc-2.12.1-more-fixes-to-error-handling-in-getlogin_r.patch
255     Patch37: glibc-2.12.1-__getlogin_r_loginuid-fail-if-tpwd-after-pwuid-is-NULL.patch
256     Patch38: glibc-2.4.90-testsuite-rt-notparallel.patch
257     Patch39: glibc-2.10.1-mdv-owl-crypt_freesec.patch
258     Patch40: glibc-2.9-avx-relocate_fcrypt.patch
259     Patch41: glibc-2.3.6-avx-increase_BF_FRAME.patch
260     Patch42: glibc-2.10.1-mdv-avx-owl-crypt.patch
261     Patch43: glibc-2.7-mdv-wrapper_handle_sha.patch
262     Patch44: glibc-2.11-dont-tie-libcap-with-selinux.patch
263     Patch45: glibc-2.12.1-CVE-2010-3856.diff
264    
265     # Determine minium kernel versions
266     %define enablekernel 2.6.9
267     %if %isarch ppc ppc64
268     # waitid syscall is available in 2.6.12+ there
269     %define enablekernel 2.6.12
270     %endif
271     Conflicts: kernel < %{enablekernel}
272    
273     # People changed location of rpm scripts...
274     %define rpmscripts /usr/lib/rpm/%{_real_vendor}
275    
276     # Don't try to explicitly provide GLIBC_PRIVATE versioned libraries
277     %define __find_provides %{_builddir}/%{source_dir}/find_provides.sh
278     %define __find_requires %{_builddir}/%{source_dir}/find_requires.sh
279    
280     %if !%{build_cross}
281     Obsoletes: ld.so
282     Provides: ld.so
283     %endif
284    
285     Obsoletes: ldconfig
286     Provides: ldconfig = %{glibcepoch}:%{glibcversion}-%{glibcrelease} /sbin/ldconfig
287    
288     %description
289     The glibc package contains standard libraries which are used by
290     multiple programs on the system. In order to save disk space and
291     memory, as well as to make upgrading easier, common system code is
292     kept in one place and shared between programs. This particular package
293     contains the most important sets of shared libraries: the standard C
294     library and the standard math library. Without these two libraries, a
295     Linux system will not function. The glibc package also contains
296     national language (locale) support.
297    
298     This package now also provides ldconfig which was package seperately in
299     the past. Ldconfig is a basic system program which determines run-time
300     link bindings between ld.so and shared libraries. Ldconfig scans a running
301     system and sets up the symbolic links that are used to load shared
302     libraries properly. It also creates a cache (/etc/ld.so.cache) which
303     speeds the loading of programs which use shared libraries.
304    
305     %package devel
306     Summary: Header and object files for development using standard C libraries
307     Group: Development/C
308     Requires(post): info-install
309     Requires(preun): info-install
310     Requires(post): coreutils
311     Requires(postun): coreutils, awk
312     Obsoletes: libc-debug, libc-headers, libc-devel, linuxthreads-devel, nptl-devel
313     %if !%{build_debug}
314     Obsoletes: %{name}-debug < 6:2.3.2-15
315     %endif
316     Requires: %{name} = %{glibcepoch}:%{glibcversion}-%{glibcrelease}
317     %if !%{build_cross}
318     Requires: linux-userspace-headers
319     %endif
320     %if !%isarch ppc
321     Conflicts: %{cross_prefix}gcc < 2.96-0.50
322     %endif
323     # needs a gcc4 fortify capable compiler
324     Conflicts: gcc4.0 < 4.0.1-2
325     %if %{build_cross}
326     Autoreq: false
327     Autoprov: false
328     %else
329     Autoreq: true
330     %endif
331     Provides: glibc-crypt_blowfish-devel = %{crypt_bf_ver}
332    
333     %description devel
334     The glibc-devel package contains the header and object files necessary
335     for developing programs which use the standard C libraries (which are
336     used by nearly all programs). If you are developing programs which
337     will use the standard C libraries, your system needs to have these
338     standard header and object files available in order to create the
339     executables.
340    
341     This package also includes the C header files for the Linux kernel.
342     The header files define structures and constants that are needed for
343     building most standard programs. The header files are also needed for
344     rebuilding the kernel.
345    
346     Install glibc-devel if you are going to develop programs which will
347     use the standard C libraries.
348    
349     %package static-devel
350     Summary: Static libraries for GNU C library
351     Group: Development/C
352     Requires: %{name}-devel = %{glibcepoch}:%{glibcversion}-%{glibcrelease}
353    
354     %description static-devel
355     The glibc-static-devel package contains the static libraries necessary
356     for developing programs which use the standard C libraries. Install
357     glibc-static-devel if you need to statically link your program or
358     library.
359    
360     %package profile
361     Summary: The GNU libc libraries, including support for gprof profiling
362     Group: Development/C
363     Obsoletes: libc-profile
364     Provides: libc-profile = %{glibcversion}-%{glibcrelease}
365     Autoreq: true
366    
367     %description profile
368     The glibc-profile package includes the GNU libc libraries and support
369     for profiling using the gprof program. Profiling is analyzing a
370     program's functions to see how much CPU time they use and determining
371     which functions are calling other functions during execution. To use
372     gprof to profile a program, your program needs to use the GNU libc
373     libraries included in glibc-profile (instead of the standard GNU libc
374     libraries included in the glibc package).
375    
376     If you are going to use the gprof program to profile a program, you'll
377     need to install the glibc-profile program.
378    
379     %package -n nscd
380     Summary: A Name Service Caching Daemon (nscd)
381     Group: System/Servers
382     Requires(pre): rpm-helper
383     Requires(preun): rpm-helper
384     Requires(post): rpm-helper
385     Requires(postun): rpm-helper
386     Autoreq: true
387    
388     %description -n nscd
389     Nscd caches name service lookups and can dramatically improve
390     performance with NIS+, and may help with DNS as well. Note that you
391     can't use nscd with 2.0 kernels because of bugs in the kernel-side
392     thread support. Unfortunately, nscd happens to hit these bugs
393     particularly hard.
394    
395     Install nscd if you need a name service lookup caching daemon, and
396     you're not using a version 2.0 kernel.
397    
398     %if %{build_debug}
399     %package debug
400     Summary: Shared standard C libraries with debugging information
401     Group: System/Libraries
402     Requires: %{name} = %{glibcepoch}:%{glibcversion}-%{glibcrelease}
403     Autoreq: false
404    
405     %description debug
406     The glibc-debug package contains shared standard C libraries with
407     debugging information. You need this only if you want to step into C
408     library routines during debugging.
409    
410     To use these libraries, you need to add %{_libdir}/debug to your
411     LD_LIBRARY_PATH variable prior to starting the debugger.
412     %endif
413    
414     %package utils
415     Summary: Development utilities from GNU C library
416     Group: Development/Other
417     Requires: %{name} = %{glibcepoch}:%{glibcversion}-%{glibcrelease}
418    
419     %description utils
420     The glibc-utils package contains memusage, a memory usage profiler,
421     mtrace, a memory leak tracer and xtrace, a function call tracer which
422     can be helpful during program debugging.
423    
424     If unsure if you need this, don't install this package.
425    
426     %if %{build_i18ndata}
427     %package i18ndata
428     Summary: Database sources for 'locale'
429     Group: System/Libraries
430    
431     %description i18ndata
432     This package contains the data needed to build the locale data files
433     to use the internationalization features of the GNU libc.
434     %endif
435    
436     %if %{build_timezone}
437     %package -n timezone
438     Summary: Time zone descriptions
439     Group: System/Base
440    
441     %description -n timezone
442     These are configuration files that describe possible
443     time zones.
444     %endif
445    
446     %package doc
447     Summary: GNU C library documentation
448     Group: Development/Other
449    
450     %description doc
451     The glibc-doc package contains documentation for the GNU C library in
452     info format.
453    
454     %if %{build_pdf_doc}
455     %package doc-pdf
456     Summary: GNU C library documentation
457     Group: Development/Other
458    
459     %description doc-pdf
460     The glibc-doc-pdf package contains the printable documentation for the
461     GNU C library in PDF format.
462     %endif
463    
464     %prep
465     %setup -q -n %{source_dir} -a 3 -a 2 -a 15 -a 16
466    
467     %patch00 -p1 -b .localedef-archive-follow-symlinks
468     %patch01 -p1 -b .fhs
469     %patch02 -p1 -b .ldd-non-exec
470     %patch03 -p1 -b .bz10851
471     %patch04 -p1 -b .nss-upgrade
472     %patch05 -p1 -b .assign-global-scope-to-RFC-1918-addresses
473     %patch06 -p1 -b .share-locale
474     %patch07 -p1 -b .nsswitch.conf
475     %patch08 -p1 -b .make-3.82-fix
476     %patch09 -p1 -b .xterm-xvt
477     %patch10 -p1 -b .translit-colon
478     %patch11 -p1 -b .compat-EUR-currencies
479     %patch12 -p1 -b .ppc-lddlibc4
480     %patch13 -p1 -b .nscd-enable
481     %patch14 -p1 -b .nscd-no-host-cache
482     %patch15 -p1 -b .ldconfig-chroot-aux-cache
483     %patch16 -p1 -b .workaround-shortest-stem-in-make-3.82.patch
484     %patch17 -p1 -b .i386-hwcapinfo
485     %patch18 -p0 -R -b .provide_CFI_for_the_outermost_function
486     %patch19 -p1 -b .nscd-init-should-start
487     %patch20 -p1 -b .never-expand-ORIGIN-in-privileged-programs
488     %patch22 -p1 -b .tcsetattr-kernel-bug-workaround
489     %patch23 -p1 -b .timezone
490     %patch24 -p1 -b .biarch-cpp-defines
491     %patch26 -p1 -b .nice-fix
492     %patch27 -p1 -b .ENOTTY-fr-translation
493     %patch28 -p1 -b .gcc4-fortify
494     %patch29 -p1 -b .biarch-utils
495     %patch30 -p1 -b .multiarch-check
496     %patch31 -p1 -b .i586-hptiming
497     %patch32 -p1 -b .i586-if-no-cmov
498     %patch33 -p1 -b .pt_BR-i18nfixes
499     %patch34 -p1 -b .testsuite-ldbl-bits
500     %patch35 -p1 -b .fix-error-handling-in-Linux-getlogin
501     %patch36 -p1 -b .more-fixes-to-error-handling-in-getlogin_r
502     %patch37 -p1 -b .__getlogin_r_loginuid-fail-if-tpwd-after-pwuid-is-NULL
503     %patch38 -p1 -b .testsuite-rt-notparallel
504     %patch44 -p1 -b .dont-tie-libcap-with-selinux
505     %patch45 -p1 -b .CVE-2010-3856
506    
507     # copy freesec source
508     cp %{_sourcedir}/crypt_freesec.[ch] crypt/
509     echo "Applying crypt_blowfish patch:"
510     %patch42 -p1 -b .mdv-avx-owl-crypt
511     #patch -p1 -s < crypt_blowfish-%{crypt_bf_ver}/glibc-2.3.2-crypt.diff
512     mv crypt/crypt.h crypt/gnu-crypt.h
513     cp -a crypt_blowfish-%{crypt_bf_ver}/*.[chS] crypt/
514    
515     ## FreeSec support for extended/new-style/BSDI hashes in crypt(3)
516     %patch39 -p1 -b .mdv-owl-crypt_freesec
517     %patch40 -p1 -b .avx-relocate_fcrypt
518     %patch41 -p1 -b .avx-increase_BF_FRAME
519     # add sha256-crypt and sha512-crypt support to the Openwall wrapper
520     %patch43 -p0 -b .mdv-wrapper_handle_sha
521    
522     %if %{build_selinux}
523     # XXX kludge to build nscd with selinux support as it added -nostdinc
524     # so /usr/include/selinux is not found
525     ln -s %{_includedir}/selinux selinux
526     %endif
527    
528     find . -type f -size 0 -o -name "*.orig" -exec rm -f {} \;
529    
530     # (Anssi 03/2008) FIXME: use _provides_exceptions
531     cat > find_provides.sh << EOF
532     #!/bin/sh
533     %{rpmscripts}/find-provides | grep -v GLIBC_PRIVATE
534     exit 0
535     EOF
536     chmod +x find_provides.sh
537    
538     cat > find_requires.bootstrap.sh << EOF
539     /bin/sh %{SOURCE4} %{buildroot} %{_target_cpu} | grep -v "\(GLIBC_PRIVATE\|linux-gate\|linux-vdso\)"
540     exit 0
541     EOF
542     chmod +x find_requires.bootstrap.sh
543    
544     # XXX: use better way later to avoid LD_LIBRARY_PATH issue
545     cat %{rpmscripts}/find-requires | sed '/.*LD_LIBRARY_PATH.*/d;' > find_requires
546     chmod +x find_requires
547     # (Anssi 03/2008) FIXME: use _requires_exceptions
548     cat > find_requires.noprivate.sh << EOF
549     %{_builddir}/%{source_dir}/find_requires %{buildroot} %{_target_cpu} | \
550     grep -v GLIBC_PRIVATE
551     exit 0
552     EOF
553     chmod +x find_requires.noprivate.sh
554    
555     # FIXME: fix system rpm find-requires to use the prefix cross version
556     %if %{build_bootstrap} || "%{_target_cpu}" != "%{target_cpu}"
557     ln -s find_requires.bootstrap.sh find_requires.sh
558     %else
559     ln -s find_requires.noprivate.sh find_requires.sh
560     %endif
561    
562     # Remove patch backups from files we ship in glibc packages
563     rm -f ChangeLog.[^0-9]*
564     rm -f localedata/locales/{???_??,??_??}.*
565     rm -f localedata/locales/[a-z_]*.*
566    
567     %build
568     # Prepare test matrix in the next function
569     CheckList=$PWD/Check.list
570     rm -f $CheckList
571     touch $CheckList
572    
573     #
574     # CompareKver <kernel version>
575     # function to compare the desired kernel version with running kernel
576     # version (package releases not taken into account in comparison). The
577     # function returns:
578     # -1 = <kernel version> is lesser than current running kernel
579     # 0 = <kernel version> is equal to the current running kernel
580     # 1 = <kernel version> is greater than current running kernel
581     #
582     function CompareKver() {
583     v1=`echo $1 | sed 's/\.\?$/./'`
584     v2=`uname -r | sed 's/[^.0-9].*//' | sed 's/\.\?$/./'`
585     n=1
586     s=0
587     while true; do
588     c1=`echo "$v1" | cut -d "." -f $n`
589     c2=`echo "$v2" | cut -d "." -f $n`
590     if [ -z "$c1" -a -z "$c2" ]; then
591     break
592     elif [ -z "$c1" ]; then
593     s=-1
594     break
595     elif [ -z "$c2" ]; then
596     s=1
597     break
598     elif [ "$c1" -gt "$c2" ]; then
599     s=1
600     break
601     elif [ "$c2" -gt "$c1" ]; then
602     s=-1
603     break
604     fi
605     n=$((n + 1))
606     done
607     echo $s
608     }
609    
610     #
611     # BuildGlibc <arch> [<extra_configure_options>+]
612     #
613     function BuildGlibc() {
614     arch="$1"
615     shift 1
616    
617     # PowerPC CPU add-on
618     case $arch in
619     cpu-addon,*)
620     cpu=` echo "$arch" | sed -n "/.*,\([^,]*\),.*$/s//\1/p"`
621     arch=`echo "$arch" | sed -n "/.*,.*,\([^,]*\)$/s//\1/p"`
622     ;;
623     *)
624     cpu=$arch
625     ;;
626     esac
627    
628     # Select optimization flags and compiler to use
629     BuildAltArch="no"
630     BuildCompFlags=""
631     BuildFlags=""
632     case $arch in
633     i[3456]86 | athlon)
634     BuildFlags="-march=$arch -mtune=generic"
635     if [[ "`uname -m`" = "x86_64" ]]; then
636     BuildAltArch="yes"
637     BuildCompFlags="-m32"
638     fi
639     ;;
640     x86_64)
641     BuildFlags="-mtune=generic"
642     ;;
643     ppc)
644     if [[ "`uname -m`" = "ppc64" ]]; then
645     BuildAltArch="yes"
646     BuildCompFlags="-m32"
647     # 64-bit processors we support do support power4+ ISA (2.01)
648     if [[ "$cpu" != "$arch" ]]; then
649     BuildFlags="-mcpu=$cpu"
650     else
651     BuildFlags="-mcpu=power4 -mtune=cell"
652     fi
653     fi
654     ;;
655     ppc64)
656     if [[ "$cpu" != "$arch" ]]; then
657     BuildFlags="-mcpu=$cpu"
658     else
659     BuildFlags="-mcpu=power4 -mtune=cell"
660     fi
661     ;;
662     alphaev6)
663     BuildFlags="-mcpu=ev6"
664     ;;
665     sparc)
666     BuildFlags="-fcall-used-g6"
667     BuildCompFlags="-m32"
668     ;;
669     sparcv9)
670     BuildFlags="-mcpu=ultrasparc -fcall-used-g6"
671     BuildCompFlags="-m32"
672     ;;
673     sparc64)
674     BuildFlags="-mcpu=ultrasparc -mvis -fcall-used-g6"
675     BuildCompFlags="-m64 -mcpu=ultrasparc"
676     ;;
677     esac
678    
679     # Choose multiarch support
680     MultiArchFlags=
681     case $arch in
682     i686 | x86_64)
683     MultiArchFlags="--enable-multi-arch"
684     ;;
685     esac
686    
687     # Determine C & C++ compilers
688     BuildCC="%{__cc} $BuildCompFlags"
689     BuildCXX="%{__cxx} $BuildCompFlags"
690    
691     # Are we supposed to cross-compile?
692     if [[ "%{target_cpu}" != "%{_target_cpu}" ]]; then
693     BuildCC="%{target_cpu}-linux-$BuildCC"
694     BuildCXX="%{target_cpu}-linux-$BuildCXX"
695     BuildCross="--build=%{_target_platform}"
696     export libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes
697     fi
698    
699     BuildFlags="$BuildFlags -DNDEBUG=1 -O2 -finline-functions -g"
700     if $BuildCC -v 2>&1 | grep -q 'gcc version 3.0'; then
701     # gcc3.0 had really poor inlining heuristics causing problems in
702     # resulting ld.so
703     BuildFlags="$BuildFlags -finline-limit=2000"
704     fi
705    
706     # Do not use direct references against %gs when accessing tls data
707     # XXX make it the default in GCC? (for other non glibc specific usage)
708     case $arch in
709     i[3456]86 | x86_64)
710     BuildFlags="$BuildFlags -mno-tls-direct-seg-refs"
711     ;;
712     esac
713    
714     # Arch specific compilation flags
715     if [[ "$arch" = "ppc64" ]]; then
716     BuildFlags="$BuildFlags -fno-inline-functions -mno-minimal-toc"
717     fi
718    
719     # Extra configure flags
720     ExtraFlags=
721     if [[ "%{build_profile}" != "0" ]]; then
722     ExtraFlags="$ExtraFlags --enable-profile"
723     fi
724    
725     # NPTL+TLS are now the default
726     Pthreads="nptl"
727     TlsFlags="--with-tls --with-__thread"
728    
729     # Add-ons
730     AddOns="$Pthreads,libidn"
731     if [[ "$cpu" != "$arch" ]]; then
732     AddOns="$AddOns,powerpc-cpu"
733     BuildFlags="$BuildFlags -mcpu=$cpu"
734     ExtraFlags="$ExtraFlags --with-cpu=$cpu"
735     fi
736    
737     # Build with selinux support?
738     %if %{build_selinux}
739     SElinuxFlags="--with-selinux"
740     %else
741     SElinuxFlags="--without-selinux"
742     %endif
743    
744     # Kernel headers directory
745     KernelHeaders=%{_includedir}
746    
747     # Determine library name
748     glibc_cv_cc_64bit_output=no
749     if echo ".text" | $BuildCC -c -o test.o -xassembler -; then
750     case `/usr/bin/file test.o` in
751     *"ELF 64"*)
752     glibc_cv_cc_64bit_output=yes
753     ;;
754     esac
755     fi
756     rm -f test.o
757    
758     # Force a separate and clean object dir
759     rm -rf build-$cpu-linux
760     mkdir build-$cpu-linux
761     pushd build-$cpu-linux
762     [[ "$BuildAltArch" = "yes" ]] && touch ".alt" || touch ".main"
763     CC="$BuildCC" CXX="$BuildCXX" CFLAGS="$BuildFlags" ../configure \
764     $arch-mageia-linux-gnu $BuildCross \
765     --prefix=%{_prefix} \
766     --libexecdir=%{_prefix}/libexec \
767     --infodir=%{_infodir} \
768     --enable-add-ons=$AddOns --without-cvs \
769     $TlsFlags $ExtraFlags $MultiArchFlags $SElinuxFlags \
770     --enable-experimental-malloc \
771     --enable-kernel=%{enablekernel} \
772     --with-headers=$KernelHeaders ${1+"$@"}
773     %make -r
774     popd
775    
776     # All tests are expected to pass on certain platforms, depending also
777     # on the version of the kernel running
778     case $arch in
779     athlon | ia64 | ppc | ppc64)
780     if [ "`CompareKver %{check_min_kver}`" -lt 0 ]; then
781     check_flags=""
782     else
783     check_flags="-k"
784     fi
785     ;;
786     *)
787     check_flags="-k"
788     ;;
789     esac
790    
791     # Generate test matrix
792     [[ -d "build-$arch-linux" ]] || {
793     echo "ERROR: PrepareGlibcTest: build-$arch-linux does not exist!"
794     return 1
795     }
796     local BuildJobs="-j`getconf _NPROCESSORS_ONLN`"
797     echo "$BuildJobs -d build-$arch-linux $check_flags" >> $CheckList
798    
799     case $cpu in
800     i686|athlon) base_arch=i586;;
801     power*) base_arch=$arch;;
802     *) base_arch=none;;
803     esac
804    
805     [[ -d "build-$base_arch-linux" ]] && {
806     check_flags="$check_flags -l build-$base_arch-linux/elf/ld.so"
807     echo "$BuildJobs -d build-$arch-linux $check_flags" >> $CheckList
808     }
809     return 0
810     }
811    
812     # Build main glibc
813     BuildGlibc %{target_cpu}
814    
815     %if %{build_biarch}
816     %if %isarch sparc64
817     BuildGlibc sparcv9
818     %endif
819     %if %isarch x86_64
820     BuildGlibc i686
821     %endif
822     %if %isarch ppc64
823     BuildGlibc ppc
824     %endif
825     %endif
826    
827     %if %isarch ppc ppc64
828     for cpu in %{powerpc_cpu_list}; do
829     [[ "$cpu" = "noarch" ]] && continue
830     BuildGlibc cpu-addon,$cpu,%{_arch} --disable-profile
831     done
832     %endif
833    
834     # Build i686 libraries if not already building for i686/athlon
835     case %{target_cpu} in
836     i686 | athlon)
837     ;;
838     i[3-6]86)
839     BuildGlibc i686 --disable-profile
840     ;;
841     esac
842    
843     make -C crypt_blowfish-%{crypt_bf_ver} man
844    
845     %if %{build_check}
846     export TMPDIR=/tmp
847     export TIMEOUTFACTOR=16
848     Check="$PWD/glibc-check.sh"
849     cat %{SOURCE5} > $Check
850     chmod +x $Check
851     while read arglist; do
852     $Check $arglist || exit 1
853     done < $CheckList
854     %endif
855    
856     %install
857     rm -rf $RPM_BUILD_ROOT
858    
859     # force use of _NPROCESSORS_ONLN jobs since RPM_BUILD_NCPUS could be
860     # greater for icecream
861     BuildJobs="-j`getconf _NPROCESSORS_ONLN`"
862    
863     make install_root=$RPM_BUILD_ROOT install -C build-%{target_cpu}-linux
864     %if %{build_i18ndata}
865     (cd build-%{target_cpu}-linux;
866     make $BuildJobs -C ../localedata objdir=`pwd` \
867     install_root=$RPM_BUILD_ROOT \
868     install-locales
869     )
870     install -m 0644 localedata/SUPPORTED $RPM_BUILD_ROOT/%{_datadir}/i18n/
871     %endif
872     sh manpages/Script.sh
873    
874     # Empty filelist for non i686/athlon targets
875     > extralibs.filelist
876    
877     # Install biarch libraries
878     %if %{build_biarch}
879     %if %isarch sparc64
880     ALT_ARCH=sparcv9-linux
881     %endif
882     %if %isarch x86_64
883     ALT_ARCH=i686-linux
884     %endif
885     %if %isarch ppc64
886     ALT_ARCH=ppc-linux
887     %endif
888     mkdir -p $RPM_BUILD_ROOT/$ALT_ARCH
889     make install_root=$RPM_BUILD_ROOT/$ALT_ARCH install -C build-$ALT_ARCH
890    
891     # Dispatch */lib only
892     mv $RPM_BUILD_ROOT/$ALT_ARCH/lib $RPM_BUILD_ROOT/
893     mv $RPM_BUILD_ROOT/$ALT_ARCH%{_prefix}/libexec/getconf/* \
894     $RPM_BUILD_ROOT%{_prefix}/libexec/getconf/
895     mkdir $RPM_BUILD_ROOT%{_prefix}/lib
896     mv $RPM_BUILD_ROOT/$ALT_ARCH%{_prefix}/lib/* $RPM_BUILD_ROOT%{_prefix}/lib/
897     # We want 32-bit binaries on sparc64
898     %if %isarch sparc64
899     mv -f $RPM_BUILD_ROOT/$ALT_ARCH/sbin/* $RPM_BUILD_ROOT/sbin
900     mv -f $RPM_BUILD_ROOT/$ALT_ARCH/%{_bindir}/* $RPM_BUILD_ROOT%{_bindir}
901     mv -f $RPM_BUILD_ROOT/$ALT_ARCH/%{_sbindir}/* $RPM_BUILD_ROOT%{_sbindir}
902     %endif
903     rm -rf $RPM_BUILD_ROOT/$ALT_ARCH
904     # XXX Dispatch 32-bit stubs
905     (sed '/^@/d' include/stubs-prologue.h; LC_ALL=C sort $(find build-$ALT_ARCH -name stubs)) \
906     > $RPM_BUILD_ROOT%{_includedir}/gnu/stubs-32.h
907     %endif
908    
909     # Install extra glibc libraries
910     function InstallGlibc() {
911     local BuildDir="$1"
912     local SubDir="$2"
913     local LibDir="$3"
914    
915     case $BuildDir in
916     *) Pthreads=nptl ;;
917     esac
918    
919     [[ -z "$LibDir" ]] && LibDir="%{_slibdir}"
920    
921     pushd $BuildDir
922     mkdir -p $RPM_BUILD_ROOT$LibDir/$SubDir/
923     install -m755 libc.so $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/libc-*.so`
924     ln -sf `basename $RPM_BUILD_ROOT$LibDir/libc-*.so` $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/libc.so.*`
925     install -m755 math/libm.so $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/libm-*.so`
926     ln -sf `basename $RPM_BUILD_ROOT$LibDir/libm-*.so` $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/libm.so.*`
927     install -m755 $Pthreads/libpthread.so $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/libpthread-*.so`
928     ln -sf `basename $RPM_BUILD_ROOT$LibDir/libpthread-*.so` $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/libpthread.so.*`
929     install -m755 ${Pthreads}_db/libthread_db.so $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/libthread_db-*.so`
930     ln -sf `basename $RPM_BUILD_ROOT$LibDir/libthread_db-*.so` $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/libthread_db.so.*`
931     install -m755 rt/librt.so $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/librt-*.so`
932     ln -sf `basename $RPM_BUILD_ROOT$LibDir/librt-*.so` $RPM_BUILD_ROOT$LibDir/$SubDir/`basename $RPM_BUILD_ROOT$LibDir/librt.so.*`
933     echo "%dir $LibDir/$SubDir" >> ../extralibs.filelist
934     find $RPM_BUILD_ROOT$LibDir/$SubDir -maxdepth 1 -type f -o -type l | sed -e "s|$RPM_BUILD_ROOT||" >> ../extralibs.filelist
935     popd
936     }
937    
938     # Install arch-specific optimized libraries
939     %if %isarch %{ix86}
940     case %{target_cpu} in
941     i[3-5]86)
942     InstallGlibc build-i686-linux i686
943     ;;
944     esac
945     %endif
946     %if %isarch ppc ppc64
947     for cpu in %{powerpc_cpu_list}; do
948     [[ "$cpu" = "noarch" ]] && continue
949     InstallGlibc build-$cpu-linux $cpu
950     done
951     # Use hardlinks, not symlinks
952     # see upper NOTE if you really want dedicated power5+ hwcap...
953     [[ -d "$RPM_BUILD_ROOT/%{_lib}/power5" ]] && {
954     mkdir -p $RPM_BUILD_ROOT/%{_lib}/power5+
955     ln -v $RPM_BUILD_ROOT/%{_lib}/power5/*.so \
956     $RPM_BUILD_ROOT/%{_lib}/power5+/
957     $RPM_BUILD_ROOT/sbin/ldconfig -n $RPM_BUILD_ROOT/%{_lib}/power5+/
958     echo "%dir /%{_lib}/power5+" >> extralibs.filelist
959     find $RPM_BUILD_ROOT$LibDir/%{_lib}/power5+/ -maxdepth 1 -type f -o -type l | sed -e "s|$RPM_BUILD_ROOT||" >> extralibs.filelist
960     }
961     %endif
962    
963     # NPTL <bits/stdio-lock.h> is not usable outside of glibc, so include
964     # the generic one (RH#162634)
965     install -m644 bits/stdio-lock.h $RPM_BUILD_ROOT%{_includedir}/bits/stdio-lock.h
966    
967     # Compatibility hack: this locale has vanished from glibc, but some other
968     # programs are still using it. Normally we would handle it in the %pre
969     # section but with glibc that is simply not an option
970     mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/ru_RU/LC_MESSAGES
971    
972     # Remove the files we don't want to distribute
973     rm -f $RPM_BUILD_ROOT%{_libdir}/libNoVersion*
974     rm -f $RPM_BUILD_ROOT%{_slibdir}/libNoVersion*
975    
976     ln -sf libbsd-compat.a $RPM_BUILD_ROOT%{_libdir}/libbsd.a
977     %if %{build_biarch}
978     ln -sf libbsd-compat.a $RPM_BUILD_ROOT%{_prefix}/lib/libbsd.a
979     %endif
980    
981     %if "%{name}" == "glibc"
982     install -m 644 mageia/nsswitch.conf $RPM_BUILD_ROOT%{_sysconfdir}/nsswitch.conf
983     %endif
984    
985     # This is for ncsd - in glibc 2.2
986     %if %{build_nscd}
987     install -m 644 nscd/nscd.conf $RPM_BUILD_ROOT%{_sysconfdir}
988     mkdir -p $RPM_BUILD_ROOT%{_initrddir}
989     install -m 755 nscd/nscd.init $RPM_BUILD_ROOT%{_initrddir}/nscd
990     %endif
991    
992     # These man pages require special attention
993     mkdir -p %{buildroot}%{_mandir}/man3
994     install -p -m 0644 crypt_blowfish-%{crypt_bf_ver}/*.3 %{buildroot}%{_mandir}/man3/
995    
996     # Useless and takes place
997     rm -rf %buildroot/%{_datadir}/zoneinfo/{posix,right}
998    
999     # Include ld.so.conf
1000     %if "%{name}" == "glibc"
1001     echo "include /etc/ld.so.conf.d/*.conf" > $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf
1002     chmod 644 $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf
1003     mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d
1004     %endif
1005    
1006     # ldconfig cache
1007     mkdir -p $RPM_BUILD_ROOT%{_var}/cache/ldconfig
1008     touch $RPM_BUILD_ROOT%{_var}/cache/ldconfig/aux-cache
1009    
1010     # automatic ldconfig cache update on rpm installs/removals
1011     # (see http://wiki.mandriva.com/en/Rpm_filetriggers)
1012     install -d %buildroot%{_var}/lib/rpm/filetriggers
1013     cat > %buildroot%{_var}/lib/rpm/filetriggers/ldconfig.filter << EOF
1014     ^.((/lib|/usr/lib)(64)?/[^/]*\.so\.|/etc/ld.so.conf.d/[^/]*\.conf)
1015     EOF
1016     cat > %buildroot%{_var}/lib/rpm/filetriggers/ldconfig.script << EOF
1017     #!/bin/sh
1018     ldconfig -X
1019     EOF
1020     chmod 755 %buildroot%{_var}/lib/rpm/filetriggers/ldconfig.script
1021    
1022     # Include %{_libdir}/gconv/gconv-modules.cache
1023     > $RPM_BUILD_ROOT%{_libdir}/gconv/gconv-modules.cache
1024     chmod 644 $RPM_BUILD_ROOT%{_libdir}/gconv/gconv-modules.cache
1025    
1026     touch $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.cache
1027    
1028     # Add libraries to debug sub-package
1029     %if %{build_debug}
1030     mkdir $RPM_BUILD_ROOT%{_libdir}/debug
1031     #cp -a $RPM_BUILD_ROOT%{_libdir}/*.a $RPM_BUILD_ROOT%{_libdir}/debug/
1032     #rm -f $RPM_BUILD_ROOT%{_libdir}/debug/*_p.a
1033     cp -a $RPM_BUILD_ROOT%{_slibdir}/lib*.so* $RPM_BUILD_ROOT%{_libdir}/debug/
1034    
1035     pushd $RPM_BUILD_ROOT%{_libdir}/debug
1036     for lib in *.so*; do
1037     [[ -f "$lib" ]] && DEBUG_LIBS="$DEBUG_LIBS %{_libdir}/debug/$lib"
1038     done
1039     popd
1040     %endif
1041    
1042     # Are we cross-compiling?
1043     Strip="strip"
1044     if [[ "%{_target_cpu}" != "%{target_cpu}" ]]; then
1045     Strip="%{target_cpu}-linux-$Strip"
1046     fi
1047    
1048     # Strip libpthread but keep some symbols
1049     find $RPM_BUILD_ROOT%{_slibdir} -type f -name "libpthread-*.so" \
1050     -o -type f -name "libc-*.so" | \
1051     xargs $Strip -g -R .comment
1052    
1053     %if %{build_biarch}
1054     find $RPM_BUILD_ROOT/lib -type f -name "libpthread-*.so" \
1055     -o -type f -name "libc-*.so" | \
1056     xargs $Strip -g -R .comment
1057     %endif
1058    
1059     # Strip debugging info from all static libraries
1060     pushd $RPM_BUILD_ROOT%{_libdir}
1061     for i in *.a; do
1062     if [ -f "$i" ]; then
1063     case "$i" in
1064     *_p.a) ;;
1065     *) $Strip -g -R .comment $i ;;
1066     esac
1067     fi
1068     done
1069     popd
1070    
1071     # post install wrapper
1072     %__cc -Os -DSLIBDIR="\"%{_slibdir}\"" -DASH_BIN="\"%{ash_bin}\"" %{SOURCE14} -static \
1073     -L $RPM_BUILD_ROOT%{_libdir}/ \
1074     -o $RPM_BUILD_ROOT%{_sbindir}/glibc-post-wrapper
1075     chmod 700 $RPM_BUILD_ROOT%{_sbindir}/glibc-post-wrapper
1076    
1077     # rquota.x and rquota.h are now provided by quota
1078     rm -f $RPM_BUILD_ROOT%{_includedir}/rpcsvc/rquota.[hx]
1079    
1080     # Hardlink identical locale files together
1081     %if %{build_i18ndata}
1082     gcc -O2 -o build-%{_target_cpu}-linux/hardlink redhat/hardlink.c
1083     build-%{_target_cpu}-linux/hardlink -vc $RPM_BUILD_ROOT%{_datadir}/locale
1084     %endif
1085    
1086     rm -rf $RPM_BUILD_ROOT%{_includedir}/netatalk/
1087    
1088     # Build file list for devel package
1089     find $RPM_BUILD_ROOT%{_includedir} -type f -or -type l > devel.filelist
1090     find $RPM_BUILD_ROOT%{_includedir} -type d | sed "s/^/%dir /" | \
1091     grep -v "%{_libdir}/libnss1.*.so$" | \
1092     grep -v "%{_includedir}$" | >> devel.filelist
1093     find $RPM_BUILD_ROOT%{_libdir} -maxdepth 1 -name "*.so" -o -name "*.o" | egrep -v "(libmemusage.so|libpcprofile.so)" >> devel.filelist
1094     # biarch libs
1095     %if %{build_biarch}
1096     find $RPM_BUILD_ROOT%{_prefix}/lib -maxdepth 1 -name "*.so" -o -name "*.o" | egrep -v "(libmemusage.so|libpcprofile.so)" >> devel.filelist
1097     %endif
1098     perl -pi -e "s|$RPM_BUILD_ROOT||" devel.filelist
1099    
1100 blino 3100 # /etc/localtime - we're proud of our timezone #Well we may put Paris
1101 tmb 180 %if %{build_timezone}
1102     rm -f $RPM_BUILD_ROOT%{_sysconfdir}/localtime
1103     cp -f $RPM_BUILD_ROOT%{_datadir}/zoneinfo/US/Eastern $RPM_BUILD_ROOT%{_sysconfdir}/localtime
1104     #ln -sf ..%{_datadir}/zoneinfo/US/Eastern $RPM_BUILD_ROOT%{_sysconfdir}/localtime
1105     %endif
1106    
1107     # [gg] build PDF documentation
1108     %if %{build_pdf_doc}
1109     (cd manual; texi2dvi -p -t @afourpaper -t @finalout libc.texinfo)
1110     %endif
1111    
1112     # the last bit: more documentation
1113     rm -rf documentation
1114     mkdir documentation
1115     cp timezone/README documentation/README.timezone
1116     cp ChangeLog* documentation
1117     gzip -9 documentation/ChangeLog*
1118     mkdir documentation/crypt_blowfish-%{crypt_bf_ver}
1119     install -m 644 crypt_blowfish-%{crypt_bf_ver}/{README,LINKS,PERFORMANCE} \
1120     documentation/crypt_blowfish-%{crypt_bf_ver}
1121    
1122     # Generate final rpm filelist, with localized libc.mo files
1123     rm -f rpm.filelist
1124     %if "%{name}" == "glibc"
1125     %find_lang libc
1126     perl -ne '/^\s*$/ or print' libc.lang > rpm.filelist
1127     %endif
1128     cat extralibs.filelist >> rpm.filelist
1129    
1130     # Remove unpackaged files
1131     rm -f $RPM_BUILD_ROOT%{_infodir}/dir.old*
1132     rm -rf $RPM_BUILD_ROOT%{_includedir}/asm-*/mach-*/
1133     rm -f $RPM_BUILD_ROOT%{_datadir}/locale/locale-archive*
1134    
1135     %if !%{build_utils}
1136     %if %{build_biarch}
1137     rm -f $RPM_BUILD_ROOT%{_slibdir32}/libmemusage.so
1138     rm -f $RPM_BUILD_ROOT%{_slibdir32}/libpcprofile.so
1139     %endif
1140     rm -f $RPM_BUILD_ROOT%{_slibdir}/libmemusage.so
1141     rm -f $RPM_BUILD_ROOT%{_slibdir}/libpcprofile.so
1142     rm -f $RPM_BUILD_ROOT%{_bindir}/memusage
1143     rm -f $RPM_BUILD_ROOT%{_bindir}/memusagestat
1144     rm -f $RPM_BUILD_ROOT%{_bindir}/mtrace
1145     rm -f $RPM_BUILD_ROOT%{_bindir}/pcprofiledump
1146     rm -f $RPM_BUILD_ROOT%{_bindir}/xtrace
1147     %endif
1148    
1149     %if !%{build_timezone}
1150     rm -f $RPM_BUILD_ROOT%{_sysconfdir}/localtime
1151     rm -f $RPM_BUILD_ROOT%{_sbindir}/zdump
1152     rm -f $RPM_BUILD_ROOT%{_sbindir}/zic
1153     rm -f $RPM_BUILD_ROOT%{_mandir}/man1/zdump.1*
1154     rm -rf $RPM_BUILD_ROOT%{_datadir}/zoneinfo
1155     %endif
1156    
1157     %if !%{build_i18ndata}
1158     rm -rf $RPM_BUILD_ROOT%{_datadir}/i18n
1159     %endif
1160    
1161     %if "%{name}" != "glibc"
1162     rm -rf $RPM_BUILD_ROOT/boot
1163     rm -rf $RPM_BUILD_ROOT/sbin
1164     rm -rf $RPM_BUILD_ROOT/usr/share
1165     rm -rf $RPM_BUILD_ROOT%{_bindir}
1166     rm -rf $RPM_BUILD_ROOT%{_sbindir}
1167     rm -rf $RPM_BUILD_ROOT%{_datadir}
1168     rm -rf $RPM_BUILD_ROOT%{_mandir}
1169     rm -rf $RPM_BUILD_ROOT%{_infodir}
1170     rm -rf $RPM_BUILD_ROOT%{_prefix}/etc
1171     rm -rf $RPM_BUILD_ROOT%{_libdir}/gconv
1172     %endif
1173    
1174     # In case we are cross-compiling, don't bother to remake symlinks and
1175     # fool spec-helper when stripping files
1176     %if "%{name}" != "glibc"
1177     export DONT_SYMLINK_LIBS=1
1178     export PATH=%{_bindir}:$PATH
1179     %endif
1180    
1181     EXCLUDE_FROM_STRIP="ld-%{glibcversion}.so libpthread libc-%{glibcversion}.so $DEBUG_LIBS"
1182     export EXCLUDE_FROM_STRIP
1183    
1184     %if "%{name}" == "glibc"
1185     %define upgradestamp %{_slibdir}/glibc.upgraded
1186     %define broken_link %{_slibdir}/libnss_nis.so.1 %{_slibdir}/libnss_files.so.1 %{_slibdir}/libnss_dns.so.1 %{_slibdir}/libnss_compat.so.1
1187    
1188     %pre -p %{ash_bin}
1189     # test(1) and echo(1) are built-ins
1190     if [ -d %{_slibdir} ] && [ ! -f %{_slibdir}/libnss_files-%{glibcversion}.so ]; then
1191     echo > %{upgradestamp}
1192     fi
1193    
1194     %post -p %{_sbindir}/glibc-post-wrapper
1195     export LC_ALL=C
1196    
1197     if [ "$1" -gt 1 ]; then
1198     # migrate /etc/ld.so.conf to include the new /etc/ld.so.conf.d/
1199     # without external commands but for removing the temporary file
1200     ldso_conf=/etc/ld.so.conf
1201     while read i; do
1202     [ "$i" = "include /etc/ld.so.conf.d/*.conf" ] && keep=1
1203     # Remove previously used include line without absolute path
1204     [ "$i" = "include ld.so.conf.d/*.conf" ] || echo $i
1205     done < $ldso_conf > $ldso_conf-
1206     if [ -z "$keep" ]; then
1207     echo "include /etc/ld.so.conf.d/*.conf" > $ldso_conf
1208     while read i; do
1209     echo $i
1210     done < $ldso_conf- >> $ldso_conf
1211     fi
1212     [ -x /bin/rm ] && /bin/rm -f $ldso_conf-
1213     fi
1214     /sbin/ldconfig
1215    
1216     if [ "$1" -gt 1 ]; then
1217     # On upgrade the services doesn't work because libnss couldn't be
1218     # loaded anymore.
1219     if [ -f %{upgradestamp} ]; then
1220     if /usr/bin/readlink /proc/1/exe >/dev/null && \
1221     /usr/bin/readlink /proc/1/root >/dev/null; then
1222     if [ -x /sbin/telinit -a -p /dev/initctl ]; then
1223     /sbin/telinit u
1224     fi
1225     if [ -x /etc/init.d/sshd -a \
1226     -x /usr/sbin/sshd -a \
1227     -x /bin/bash ]; then
1228     /etc/init.d/sshd condrestart
1229     fi
1230     fi
1231     fi
1232     if [ -f /bin/rm ]; then
1233     for i in %broken_link; do
1234     if [ -e $i ] && [ ! -L $i ]; then
1235     /bin/rm -f $i
1236     fi
1237     done
1238     fi
1239     fi
1240     [ -x /bin/rm ] && /bin/rm -f %{upgradestamp}
1241    
1242     # always generate the gconv-modules.cache
1243     %{_sbindir}/iconvconfig -o %{_libdir}/gconv/gconv-modules.cache --nostdlib %{_libdir}/gconv
1244    
1245 blino 3102 %endif
1246    
1247 tmb 180 %pre devel
1248     if [ -L %{_includedir}/scsi ]; then
1249     rm -f %{_includedir}/scsi
1250     fi
1251     if [ -L %{_includedir}/sound ]; then
1252     rm -f %{_includedir}/sound
1253     fi
1254     if [ -L %{_includedir}/linux ]; then
1255     rm -f %{_includedir}/linux
1256     fi
1257     if [ -L %{_includedir}/asm ]; then
1258     rm -f %{_includedir}/asm
1259     fi
1260     if [ -L %{_includedir}/asm-generic ]; then
1261     rm -f %{_includedir}/asm-generic
1262     fi
1263     %if %isarch x86_64
1264     if [ -L %{_includedir}/asm-x86_64 ]; then
1265     rm -f %{_includedir}/asm-x86_64
1266     fi
1267     if [ -L %{_includedir}/asm-i386 ]; then
1268     rm -f %{_includedir}/asm-i386
1269     fi
1270     %endif
1271     %if %isarch ppc64
1272     if [ -L %{_includedir}/asm-ppc64 ]; then
1273     rm -f %{_includedir}/asm-ppc64
1274     fi
1275     if [ -L %{_includedir}/asm-ppc ]; then
1276     rm -f %{_includedir}/asm-ppc
1277     fi
1278     %endif
1279     %if %isarch sparc64
1280     if [ -L %{_includedir}/asm-sparc64 ]; then
1281     rm -f %{_includedir}/asm-sparc64
1282     fi
1283     if [ -L %{_includedir}/asm-sparc ]; then
1284     rm -f %{_includedir}/asm-sparc
1285     fi
1286     %endif
1287     exit 0
1288    
1289     %if %{build_doc}
1290     %post doc
1291     %_install_info libc.info
1292    
1293     %preun doc
1294     %_remove_install_info libc.info
1295     %endif
1296    
1297     %if %{build_nscd}
1298     %pre -n nscd
1299     %_pre_useradd nscd / /bin/false
1300    
1301     %post -n nscd
1302     %_post_service nscd
1303    
1304     %preun -n nscd
1305     %_preun_service nscd
1306    
1307     %postun -n nscd
1308     %_postun_userdel nscd
1309    
1310     if [ "$1" -ge "1" ]; then
1311     /sbin/service nscd condrestart > /dev/null 2>&1 || :
1312     fi
1313     %endif
1314    
1315     %clean
1316     #rm -rf "$RPM_BUILD_ROOT"
1317     #rm -f *.filelist*
1318    
1319     #
1320     # glibc
1321     #
1322     %files -f rpm.filelist
1323     %defattr(-,root,root)
1324     %if "%{name}" == "glibc"
1325     %if %{build_timezone}
1326     %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/localtime
1327     %endif
1328     %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/nsswitch.conf
1329     %verify(not md5 size mtime) %config(noreplace) %{_sysconfdir}/ld.so.conf
1330     %dir %{_sysconfdir}/ld.so.conf.d
1331     %config(noreplace) %{_sysconfdir}/rpc
1332     %doc nis/nss
1333     %doc posix/gai.conf
1334     %{_mandir}/man1/*
1335     %{_mandir}/man8/rpcinfo.8*
1336     %{_mandir}/man8/ld.so*
1337     %{_datadir}/locale/locale.alias
1338     /sbin/sln
1339     %dir %{_prefix}/libexec/getconf
1340     %{_prefix}/libexec/getconf/*
1341     %endif
1342     %{_slibdir}/ld-%{glibcversion}.so
1343     %if %isarch i386 alpha sparc sparc64
1344     %{_slibdir}/ld-linux.so.2
1345     %endif
1346     %if %isarch ppc
1347     %{_slibdir}/ld.so.1
1348     %endif
1349     %if %isarch ppc64
1350     %{_slibdir}/ld64.so.1
1351     %endif
1352     %if %isarch ia64
1353     %{_slibdir}/ld-linux-ia64.so.2
1354     %endif
1355     %if %isarch x86_64
1356     %{_slibdir}/ld-linux-x86-64.so.2
1357     %endif
1358     %if %isarch m68k
1359     %{_slibdir}/ld.so.1
1360     %endif
1361     %{_slibdir}/lib*-[.0-9]*.so
1362     %{_slibdir}/lib*.so.[0-9]*
1363     %{_slibdir}/libSegFault.so
1364     %if "%{name}" == "glibc"
1365     %dir %{_libdir}/gconv
1366     %{_libdir}/gconv/*.so
1367     %{_libdir}/gconv/gconv-modules
1368     %ghost %{_libdir}/gconv/gconv-modules.cache
1369     %attr(4755,root,root) %{_prefix}/libexec/pt_chown
1370     %{_bindir}/catchsegv
1371     %{_bindir}/gencat
1372     %{_bindir}/getconf
1373     %{_bindir}/getent
1374     #%{_bindir}/glibcbug
1375     %{_bindir}/iconv
1376     %{_bindir}/ldd
1377     %if %isarch i386 ppc sparc sparc64
1378     %{_bindir}/lddlibc4
1379     %endif
1380     %{_bindir}/locale
1381     %{_bindir}/localedef
1382     %{_bindir}/rpcgen
1383     %{_bindir}/sprof
1384     %{_bindir}/tzselect
1385     %{_sbindir}/rpcinfo
1386     %{_sbindir}/iconvconfig
1387     %{_sbindir}/glibc-post-wrapper
1388     %endif
1389    
1390     %if %{build_biarch}
1391     %{_slibdir32}/ld-%{glibcversion}.so
1392     %if %isarch ppc64
1393     %{_slibdir32}/ld.so.1
1394     %else
1395     %{_slibdir32}/ld-linux*.so.2
1396     %endif
1397     %{_slibdir32}/lib*-[.0-9]*.so
1398     %{_slibdir32}/lib*.so.[0-9]*
1399     %{_slibdir32}/libSegFault.so
1400     %dir %{_prefix}/lib/gconv
1401     %{_prefix}/lib/gconv/*
1402     %endif
1403     #
1404     # ldconfig
1405     #
1406     %if "%{name}" == "glibc"
1407     %defattr(-,root,root)
1408     /sbin/ldconfig
1409     %{_mandir}/man8/ldconfig*
1410     %ghost %{_sysconfdir}/ld.so.cache
1411     %dir %{_var}/cache/ldconfig
1412     %ghost %{_var}/cache/ldconfig/aux-cache
1413     %{_var}/lib/rpm/filetriggers/ldconfig.*
1414     %endif
1415    
1416     #
1417     # glibc-devel
1418     #
1419     %files devel -f devel.filelist
1420     %defattr(-,root,root)
1421     %doc README NEWS INSTALL FAQ BUGS NOTES PROJECTS CONFORMANCE
1422     %doc COPYING COPYING.LIB
1423     %doc documentation/* README.libm
1424     %doc hesiod/README.hesiod
1425     %doc crypt/README.ufc-crypt
1426     %{_mandir}/man3/*
1427     %{_libdir}/libbsd-compat.a
1428     %{_libdir}/libbsd.a
1429     %{_libdir}/libc_nonshared.a
1430     %{_libdir}/libg.a
1431     %{_libdir}/libieee.a
1432     %{_libdir}/libmcheck.a
1433     %{_libdir}/libpthread_nonshared.a
1434     %if "%{name}" == "glibc"
1435     %{_libdir}/librpcsvc.a
1436     %endif
1437     %if %isarch ppc ppc64 sparc
1438     %{_libdir}/libnldbl_nonshared.a
1439     %endif
1440    
1441     %if %{build_biarch}
1442     %{_prefix}/lib/libbsd-compat.a
1443     %{_prefix}/lib/libbsd.a
1444     %{_prefix}/lib/libc_nonshared.a
1445     %{_prefix}/lib/libg.a
1446     %{_prefix}/lib/libieee.a
1447     %{_prefix}/lib/libmcheck.a
1448     %{_prefix}/lib/libpthread_nonshared.a
1449     %{_prefix}/lib/librpcsvc.a
1450     %if %isarch ppc64 sparc64
1451     %{_prefix}/lib/libnldbl_nonshared.a
1452     %endif
1453     %endif
1454    
1455     #
1456     # glibc-static-devel
1457     #
1458     %files static-devel
1459     %defattr(-,root,root)
1460     %doc COPYING COPYING.LIB
1461     %{_libdir}/libBrokenLocale.a
1462     %{_libdir}/libanl.a
1463     %{_libdir}/libc.a
1464     %{_libdir}/libcrypt.a
1465     %{_libdir}/libdl.a
1466     %{_libdir}/libm.a
1467     %{_libdir}/libnsl.a
1468     %{_libdir}/libpthread.a
1469     %{_libdir}/libresolv.a
1470     %{_libdir}/librt.a
1471     %{_libdir}/libutil.a
1472    
1473     %if %{build_biarch}
1474     %{_prefix}/lib/libBrokenLocale.a
1475     %{_prefix}/lib/libanl.a
1476     %{_prefix}/lib/libc.a
1477     %{_prefix}/lib/libcrypt.a
1478     %{_prefix}/lib/libdl.a
1479     %{_prefix}/lib/libm.a
1480     %{_prefix}/lib/libnsl.a
1481     %{_prefix}/lib/libpthread.a
1482     %{_prefix}/lib/libresolv.a
1483     %{_prefix}/lib/librt.a
1484     %{_prefix}/lib/libutil.a
1485     %endif
1486    
1487     #
1488     # glibc-doc
1489     #
1490     %if %{build_doc}
1491     %files doc
1492     %defattr(-,root,root)
1493     %{_infodir}/libc.info*
1494     %endif
1495    
1496     #
1497     # glibc-doc-pdf
1498     #
1499     %if %{build_pdf_doc}
1500     %files doc-pdf
1501     %defattr(-,root,root)
1502     %doc manual/libc.pdf
1503     %endif
1504    
1505     #
1506     # glibc-debug
1507     #
1508     %if %{build_debug}
1509     %files debug
1510     %defattr(-,root,root)
1511     %dir %{_libdir}/debug
1512     %{_libdir}/debug/*.so
1513     %{_libdir}/debug/*.so.*
1514     %endif
1515    
1516     #
1517     # glibc-profile
1518     #
1519     %if %{build_profile}
1520     %files profile
1521     %defattr(-,root,root)
1522     %{_libdir}/lib*_p.a
1523     %if %{build_biarch}
1524     %{_prefix}/lib/lib*_p.a
1525     %endif
1526     %endif
1527    
1528     #
1529     # glibc-utils
1530     #
1531     %if %{build_utils}
1532     %files utils
1533     %defattr(-,root,root)
1534     %if %{build_biarch}
1535     %{_slibdir32}/libmemusage.so
1536     %{_slibdir32}/libpcprofile.so
1537     %endif
1538     %{_slibdir}/libmemusage.so
1539     %{_slibdir}/libpcprofile.so
1540     %{_bindir}/memusage
1541     %{_bindir}/memusagestat
1542     %{_bindir}/mtrace
1543     %{_bindir}/pcprofiledump
1544     %{_bindir}/xtrace
1545     %endif
1546    
1547     #
1548     # nscd
1549     #
1550     %if %{build_nscd}
1551     %files -n nscd
1552     %defattr(-,root,root)
1553     %config(noreplace) %{_sysconfdir}/nscd.conf
1554     %config(noreplace) %{_initrddir}/nscd
1555     %{_sbindir}/nscd
1556     %endif
1557    
1558     #
1559     # timezone
1560     #
1561     %if %{build_timezone}
1562     %files -n timezone
1563     %defattr(-,root,root)
1564     %{_sbindir}/zdump
1565     %{_sbindir}/zic
1566     %{_mandir}/man1/zdump.1*
1567     %dir %{_datadir}/zoneinfo
1568     %{_datadir}/zoneinfo/*
1569     %endif
1570    
1571     #
1572     # glibc-i18ndata
1573     #
1574     %if %{build_i18ndata}
1575     %files i18ndata
1576     %defattr(-,root,root)
1577     %dir %{_datadir}/i18n
1578     %dir %{_datadir}/i18n/charmaps
1579     %{_datadir}/i18n/charmaps/*
1580     %dir %{_datadir}/i18n/locales
1581     %{_datadir}/i18n/locales/*
1582     %{_datadir}/i18n/SUPPORTED
1583     %endif
1584    
1585    
1586    
1587    

  ViewVC Help
Powered by ViewVC 1.1.30