Magellan Linux

Annotation of /smage/trunk/core/eglibc/eglibc-2.12.0_20101019-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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