Magellan Linux

Annotation of /smage/trunk/core/eglibc/eglibc-2.12.2_20110125-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1067 - (hide annotations) (download)
Tue Jan 25 18:28:17 2011 UTC (13 years, 3 months ago) by niro
File size: 15126 byte(s)
auto added: ver bump to 2.12.2_20110125-r1
1 niro 1067 # $Id: eglibc-2.10.0_20091229-r4.smage2 497 2010-05-07 20:36:34Z niro $
2    
3     PNAME="eglibc"
4     PVER="2.12.2_20110125"
5     PBUILD="r1"
6    
7     PCATEGORIE="sys-libs"
8     STATE="unstable"
9    
10     HOMEPAGE="http://www.eglibc.org/"
11    
12     # we force headers to one specific version
13     # (for x86_64 2.6.12.0-r2 bi-arch headers are needed!)
14     SDEPEND="== sys-kernel/linux-libc-headers-2.6.37
15     >= sys-libs/libstdc++-4.5
16     >= virtual/base-files"
17    
18     # functions to include in the mage file
19     SPECIAL_FUNCTIONS="fix_db_files"
20    
21     SRCFILE="${PNAME}-${PVER}.tar.bz2"
22     SRCDIR="${BUILDDIR}/${PNAME}-${PVER}/libc"
23    
24     sminclude mtools cleanutils
25    
26     SRC_URI=(
27     gnu://${PNAME}/${SRCFILE}
28     mirror://${PNAME}/${SRCFILE}
29     mirror://${PNAME}/nsswitch.conf
30     mirror://${PNAME}/nscd.conf
31     mirror://${PNAME}/eglibc.envd
32     mirror://${PNAME}/locale-gen
33     mirror://${PNAME}/locale.gen
34     mirror://glibc/glibc-2.12.1-bz4781.patch
35     mirror://glibc/glibc-2.12.1-i686.patch
36     mirror://glibc/glibc-2.12.1-static-shared-getpagesize.patch
37     mirror://glibc/glibc-2.12.2-ignore-origin-of-privileged-program.patch
38     )
39    
40     # glibc don't like strong CFLAGS
41     export CFLAGS="${CFLAGS//-O?} -O2"
42     # glibc -> nptl thread don't like striping
43     NOSTRIP=true
44     # gcc 3.0 - 3.3 needs this:
45     export CFLAGS="${CFLAGS} -finline-limit=2000"
46     export CXXFLAGS="${CFLAGS}"
47     export LDFLAGS="${LDFLAGS//-Wl,--relax}"
48    
49     # hack to fix NPTL issues with xen, only required on 32bit arches
50     if [[ ${ARCH} = i*86 ]]
51     then
52     export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs"
53     fi
54    
55     # glibc-2.6.1 and above needs march CFLAGS: -march=${ARCH} -mtune=generic
56     # first filter -mtune and -march from flags
57     for flag in ${CFLAGS}
58     do
59     case ${flag} in
60     -mtune=*) continue ;;
61     -march=*) continue ;;
62     esac
63     newflags="${newflags} ${flag}"
64     done
65     # than add our defaults for glibc
66     export CFLAGS="${CFLAGS} -march=${ARCH} -mtune=generic"
67     export CXXFLAGS="${CFLAGS}"
68    
69     # use other linux-headers
70     [[ -z ${ALT_HEADERS} ]] && export ALT_HEADERS="/usr/include"
71    
72     # kernel support
73     export ENABLE_KERNEL=2.6.18
74    
75     SPLIT_PACKAGES="eglibc eglibc-dev"
76    
77     split_info_eglibc()
78     {
79     DESCRIPTION="Embedded GNU libc6 (also called glibc2) C library with NPTL Threads."
80     DEPEND=">= sys-libs/libstdc++-4.5
81     >= virtual/base-files"
82     PROVIDE="virtual/glibc"
83    
84     preinstall()
85     {
86     # remove libmemusage and libpcprofile as these libs now
87     # resides in /usr/lib and are symlinked to /lib
88     if [[ -f ${MROOT}/$(mlibdir)/libmemusage.so ]]
89     then
90     rm ${MROOT}/$(mlibdir)/libmemusage.so
91     fi
92    
93     if [[ -f ${MROOT}/$(mlibdir)/libpcprofile.so ]]
94     then
95     rm ${MROOT}/$(mlibdir)/libpcprofile.so
96     fi
97     }
98    
99     postinstall()
100     {
101     # first save the old libpthread.so.0;
102     # it will later used to determinate that there are no stale
103     # libpthreads that breaks ldconfig
104     local OLD_PTHREAD
105     OLD_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)"
106    
107     # slackware install method
108    
109     # we cannot easily install the glibc libs,
110     # because our tools for cp etc needs them to run
111    
112     local file
113    
114     echo " Switching to new glibc ..."
115     # swap libraries on the fly:
116     if [ -x /sbin/ldconfig -a -d /$(mlibdir)/incoming ] && [[ -z ${MROOT} ]]
117     then
118     # first create copies of the incoming libraries:
119     cd /$(mlibdir)/incoming
120     for file in $(find /$(mlibdir)/incoming -type f)
121     do
122     if [ ! -r "../$(basename ${file}).incoming" ]
123     then
124     cp -a ${file} ../$(basename ${file}).incoming
125     fi
126     done
127    
128     # then switch to them all at once:
129     /sbin/ldconfig -l /$(mlibdir)/*.incoming 2> /dev/null
130    
131     # finally, rename them and clean up:
132     cd /$(mlibdir)
133     for file in *.incoming
134     do
135     rm -f $(basename ${file} .incoming)
136     cp -a ${file} $(basename ${file} .incoming)
137     /sbin/ldconfig -l $(basename ${file} .incoming)
138     rm -f ${file}
139     done
140    
141     # no ldconfig?
142     # good, it's safe to just jam it on home (and make links below):
143     else
144     (
145     cd ${MROOT}/$(mlibdir)/incoming
146     for file in *
147     do
148     cp -a ${file} ..
149     done
150    
151     local my_sym
152     local my_dest
153    
154     # rebuild symlinks
155     echo " Recreating Symlinks:"
156     for i in $(find ${MROOT}/$(mlibdir)/incoming -type l)
157     do
158     my_sym="$(readlink ${i})"
159     my_dest="$(basename ${i})"
160    
161     echo " ${my_dest} -> ${my_dest}"
162    
163     # assure to remove the old ones;
164     [ -L ${MROOT}/$(mlibdir)/"${my_dest}" ] && \
165     rm ${MROOT}/$(mlibdir)/"${my_dest}"
166    
167     ln -snf "${my_sym}" ${MROOT}/$(mlibdir)/"${my_dest}"
168     done
169     )
170     fi
171    
172     # now, get rid of the temporary directory:
173     rm -rf ${MROOT}/$(mlibdir)/incoming
174    
175     # remove stale nptl libpthread-2.?.?.so,
176     # fix only needed for glibc with linuxthreads;
177     # prevent reloc errors such as:
178     # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
179    
180     # get our new libpthread.so.0
181     local NEW_PTHREAD
182     NEW_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)"
183    
184     if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ]
185     then
186     echo " Removing stale libpthread libraries ..."
187     for file in ${MROOT}/$(mlibdir)/libpthread-*
188     do
189     if [ "$(basename ${file})" != "${NEW_PTHREAD}" ]
190     then
191     rm -f ${file}
192     fi
193     done
194    
195     #rm -f /lib/${OLD_PTHREAD}
196    
197     ln -snf ${NEW_PTHREAD} ${MROOT}/$(mlibdir)/libpthread.so.0
198     fi
199    
200     if [ -x /usr/sbin/iconvconfig ]
201     then
202     # generate fastloading iconv module configuration file.
203     echo " Generate iconv module config ..."
204     /usr/sbin/iconvconfig --prefix=${MROOT}/
205     fi
206    
207     # not working with busybox
208     if [[ $(basename $(readlink /sbin/init)) != busybox ]]
209     then
210     # reloading init
211     echo " Reloading init ..."
212     [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null
213     fi
214    
215     if [[ -x /usr/sbin/locale-gen ]] && [[ -z ${MROOT} ]]
216     then
217     # generating user def locales
218     echo " Generating user defined locales ..."
219     /usr/sbin/locale-gen
220     fi
221    
222     # now we must fix the mage db files
223     # to stop the annoying errors messages
224     fix_db_files
225     }
226    
227     }
228    
229     split_info_eglibc-dev()
230     {
231     DESCRIPTION="Development files for sys-libs/eglibc-${PVER}."
232     DEPEND="== sys-libs/eglibc-${PVER}"
233    
234     unset preinstall
235     postinstall()
236     {
237    
238     if [ -x /usr/sbin/iconvconfig ]
239     then
240     # generate fastloading iconv module configuration file.
241     echo " Generate iconv module config ..."
242     /usr/sbin/iconvconfig --prefix=${MROOT}/
243     fi
244    
245     # not working with busybox
246     if [[ $(basename $(readlink /sbin/init)) != busybox ]]
247     then
248     # reloading init
249     echo " Reloading init ..."
250     [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null
251     fi
252    
253     if [[ -x /usr/sbin/locale-gen ]] && [[ -z ${MROOT} ]]
254     then
255     # generating user def locales
256     echo " Generating user defined locales ..."
257     /usr/sbin/locale-gen
258     fi
259     }
260     }
261    
262     src_prepare()
263     {
264     munpack ${SRCFILE} || die
265     cd ${SRCDIR}
266    
267     # disable binutils -as-needed
268     sed -i 's/^have-as-needed.*/have-as-needed = no/' ${SRCDIR}/config.make.in || die
269    
270     # http://sources.redhat.com/bugzilla/show_bug.cgi?id=4781
271     mpatch glibc-2.12.1-bz4781.patch || die
272    
273     # http://sources.redhat.com/bugzilla/show_bug.cgi?id=411
274     # http://sourceware.org/ml/libc-alpha/2009-07/msg00072.html
275     mpatch glibc-2.12.1-i686.patch || die
276    
277     # fixes static link issues
278     # http://bugs.gentoo.org/332927
279     mpatch glibc-2.12.1-static-shared-getpagesize.patch || die
280    
281     # security fix, fixes CVE-2010-3847
282     # see: http://www.exploit-db.com/exploits/15274/
283     mpatch glibc-2.12.2-ignore-origin-of-privileged-program.patch || die
284    
285     # fix permissions on some of the scripts
286     chmod u+x ${SRCDIR}/scripts/*.sh || die
287    
288     install -d ${SRCDIR}/build || die
289     cd ${SRCDIR}/build
290    
291     if [ ! -f /etc/ld.so.conf ]
292     then
293     touch /etc/ld.so.conf || die
294     fi
295    
296     # disable some eglibc defaults:
297     # no ipv6 support
298     # sed -i "s:^\(OPTION_EGLIBC_ADVANCED_INET6 =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
299     # only some default charsets
300     # sed -i "s:^\(OPTION_EGLIBC_CHARSETS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
301     # disable support for locales
302     # sed -i "s:^\(OPTION_EGLIBC_CATGETS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
303     # sed -i "s:^\(OPTION_EGLIBC_LOCALES =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
304     # sed -i "s:^\(OPTION_EGLIBC_LOCALE_CODE =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
305     # disable mail aliases support
306     # sed -i "s:^\(OPTION_EGLIBC_DB_ALIASES =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
307     # # disable nis support
308     # sed -i "s:^\(OPTION_EGLIBC_NIS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
309     # no remote services via rsh
310     # sed -i "s:^\(OPTION_EGLIBC_RCMD =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
311     # no sunrpc
312     # sed -i "s:^\(OPTION_EGLIBC_SUNRPC =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
313     # no support for old access of utmp
314     # sed -i "s:^\(OPTION_EGLIBC_UTMP =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
315     }
316    
317     src_compile()
318     {
319     # support multilib lib64 dir (x86_64 only)
320     if [[ ${ARCH} = x86_64 ]]
321     then
322     # first build a -m32 version
323     install -d ${SRCDIR}/build-m32
324     cd ${SRCDIR}/build-m32
325    
326     CC="gcc -m32" CXX="g++ -m32" \
327     CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \
328     CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \
329     ../configure \
330     --build=${CHOST} \
331     --host=i686-pc-linux-gnu \
332     --prefix=/usr \
333     --mandir=/usr/share/man \
334     --infodir=/usr/share/info \
335     --disable-profile \
336     --enable-add-ons=nptl,libidn \
337     --with-tls \
338     --with-__thread \
339     --enable-kernel=${ENABLE_KERNEL} \
340     --without-cvs \
341     --without-gd \
342     --libdir=/usr/lib \
343     --libexecdir=/usr/lib/eglibc \
344     --with-headers=${ALT_HEADERS} \
345     --disable-nls \
346     --enable-bind-now \
347     || die
348    
349     make PARALLELMFLAGS="${MAKEOPTS}" || die
350     fi
351    
352     cd ${SRCDIR}/build
353    
354     if [[ ${ARCH} = x86_64 ]]; then
355     # make sure the -m64 libs goes really to /lib64
356     echo "slibdir=/$(mlibdir)" >> ${SRCDIR}/build/configparms || die
357     fi
358    
359     # kernel-2.6 with nptl needs this
360     ../configure \
361     --build=${CHOST} \
362     --host=${CHOST} \
363     --prefix=/usr \
364     --mandir=/usr/share/man \
365     --infodir=/usr/share/info \
366     --disable-profile \
367     --enable-add-ons=nptl,libidn \
368     --with-tls \
369     --with-__thread \
370     --enable-kernel=${ENABLE_KERNEL} \
371     --without-cvs \
372     --without-gd \
373     --libdir=/usr/$(mlibdir) \
374     --libexecdir=/usr/$(mlibdir)/eglibc \
375     --with-headers=${ALT_HEADERS} \
376     --enable-bind-now \
377     || die
378    
379     make PARALLELMFLAGS="${MAKEOPTS}" || die
380     }
381    
382     src_install_eglibc()
383     {
384     if [[ ${ARCH} = x86_64 ]]
385     then
386     # install -m32 libs
387     cd ${SRCDIR}/build-m32
388     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
389     fi
390    
391     cd ${SRCDIR}/build
392     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
393    
394     # cleanup
395     zapmost ${BINDIR} $(mlibdir) \
396     usr/$(mlibdir)/*.so \
397     $([[ ${ARCH} = x86_64 ]] && echo 'lib usr/lib/*.so') \
398     sbin/ldconfig \
399     usr/bin/iconv \
400     usr/bin/locale \
401     usr/$(mlibdir)/gconv/ISO8859-1.so \
402     usr/$(mlibdir)/gconv/UNICODE.so \
403     usr/$(mlibdir)/gconv/gconv-modules \
404     $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-1.so') \
405     $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UNICODE.so') \
406     $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/gconv-modules') \
407     || die
408    
409     # base environment
410     minstallenv eglibc.envd 00eglibc || die
411     if [[ ${ARCH} = x86_64 ]]
412     then
413     echo "LDPATH=\"/usr/local/$(mlibdir)\"" >> ${BINDIR}/etc/env.d/00eglibc || die
414     echo "LDPATH=\"/opt/$(mlibdir)\"" >> ${BINDIR}/etc/env.d/00eglibc || die
415     fi
416    
417     # move some libs and tools to proper locations
418     # will suppress some ldconfig errors too
419     mv ${BINDIR}/$(mlibdir)/libmemusage.so ${BINDIR}/usr/$(mlibdir) || die
420     mv ${BINDIR}/$(mlibdir)/libpcprofile.so ${BINDIR}/usr/$(mlibdir) || die
421     mlink ../usr/$(mlibdir)/libmemusage.so /$(mlibdir)/libmemusage.so || die
422     mlink ../usr/$(mlibdir)/libpcprofile.so /$(mlibdir)/libpcprofile.so || die
423    
424     # strip all binaries
425     find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
426    
427     # strip all libraries
428     # want to be safe here; --strip-unneeded seems to cause pthread problems
429     # strip all but libpthread
430     install -d ${BUILDDIR}/thread-backup || die
431     mv ${BINDIR}/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die
432     # now strip
433     find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
434     mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/$(mlibdir)/ || die
435     # remove stale directory
436     rm -rf ${BUILDDIR}/thread-backup || die
437    
438     # prepare glibc for installation; slackware method
439     minstalldir /incoming || die
440     mv ${BINDIR}/$(mlibdir)/* ${BINDIR}/incoming || die
441     mv ${BINDIR}/incoming ${BINDIR}/$(mlibdir)/incoming || die
442     mv ${BINDIR}/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/$(mlibdir) || die
443     }
444    
445     src_install_eglibc-dev()
446     {
447     if [[ ${ARCH} = x86_64 ]]
448     then
449     # install -m32 libs
450     cd ${SRCDIR}/build-m32
451     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
452     fi
453    
454     cd ${SRCDIR}/build
455     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
456    
457     # cleanup -> in eglibc
458     rm -r ${BINDIR}/$(mlibdir) || die
459     rm ${BINDIR}/usr/$(mlibdir)/*.so || die
460     rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-1.so || die
461     rm ${BINDIR}/usr/$(mlibdir)/gconv/UNICODE.so || die
462     rm ${BINDIR}/usr/$(mlibdir)/gconv/gconv-modules || die
463     if [[ ${ARCH} = x86_64 ]]
464     then
465     rm -r ${BINDIR}/lib || die
466     rm ${BINDIR}/usr/lib/*.so || die
467     rm ${BINDIR}/usr/lib/gconv/ISO8859-1.so || die
468     rm ${BINDIR}/usr/lib/gconv/UNICODE.so || die
469     rm ${BINDIR}/usr/lib/gconv/gconv-modules || die
470     fi
471     rm ${BINDIR}/sbin/ldconfig || die
472     rm ${BINDIR}/usr/bin/iconv || die
473     rm ${BINDIR}/usr/bin/locale || die
474    
475     # do not generate the locales here, let it the user do with the locale-gen tool
476     # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die
477    
478     # install locales list and generate tools
479     # to generate this listing see the glibc-2.5/localedata/SUPPORTED file
480     minstalletc locale.gen || die
481     minstalldir /usr/sbin || die
482     minstallexec -s locale-gen /usr/sbin || die
483    
484     # nsswitch configuration file
485     minstalletc nsswitch.conf || die
486    
487     # nscd configuration file
488     minstalletc nscd.conf || die
489    
490     # we use Berlin as default
491     cp --remove-destination ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die
492     [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; }
493     [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; }
494    
495     # strip all binaries
496     find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
497    
498     # strip all libraries
499     find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
500     }
501    
502     fix_db_files()
503     {
504     local i
505     local DB_ENTRY="${BUILDDIR}/${PKGNAME}"
506    
507     for i in .files .symlinks .dirs
508     do
509     [ ! -f ${DB_ENTRY}/${i} ] && continue
510     [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue
511    
512     echo " fixing /$(mlibdir)/incoming from db-entry '${i}' ..."
513    
514     # /lib/incoming -> empty line; sed2 removes all empty lines
515     #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
516     # do not simply emtpy the line, but change it the the correct path,
517     # so no stale libs are around if the package gets updated!
518     sed -i -e "s:/$(mlibdir)/incoming:/$(mlibdir):g" \
519     -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
520     done
521     }