Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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