Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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