Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1071 - (hide annotations) (download)
Tue Jan 25 19:09:07 2011 UTC (13 years, 3 months ago) by niro
File size: 15573 byte(s)
-only run autoconf
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 niro 1069 mirror://glibc/glibc-2.12.2-binutils-2.21.patch
39 niro 1067 )
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 niro 1068 export ENABLE_KERNEL=2.6.27
75 niro 1067
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.5
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 sys-libs/eglibc-${PVER}."
233     DEPEND="== sys-libs/eglibc-${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     # security fix, fixes CVE-2010-3847
283     # see: http://www.exploit-db.com/exploits/15274/
284     mpatch glibc-2.12.2-ignore-origin-of-privileged-program.patch || die
285    
286 niro 1068 # http://sourceware.org/bugzilla/show_bug.cgi?id=12403
287     if [[ ${ARCH} = x86_64 ]]
288     then
289     sed -i '/__ASSUME_PRIVATE_FUTEX/d' glibc/sysdeps/unix/sysv/linux/kernel-features.h || die
290     fi
291    
292 niro 1069 # fixes build with newer binutil (>= 2.21)
293     # see: http://sourceware.org/bugzilla/show_bug.cgi?id=12343
294     mpatch glibc-2.12.2-binutils-2.21.patch || die
295    
296     # binutils patch needs reconf
297 niro 1071 autoconf --force || die
298 niro 1069
299 niro 1067 # fix permissions on some of the scripts
300     chmod u+x ${SRCDIR}/scripts/*.sh || die
301    
302     install -d ${SRCDIR}/build || die
303     cd ${SRCDIR}/build
304    
305     if [ ! -f /etc/ld.so.conf ]
306     then
307     touch /etc/ld.so.conf || die
308     fi
309    
310     # disable some eglibc defaults:
311     # no ipv6 support
312     # sed -i "s:^\(OPTION_EGLIBC_ADVANCED_INET6 =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
313     # only some default charsets
314     # sed -i "s:^\(OPTION_EGLIBC_CHARSETS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
315     # disable support for locales
316     # sed -i "s:^\(OPTION_EGLIBC_CATGETS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
317     # sed -i "s:^\(OPTION_EGLIBC_LOCALES =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
318     # sed -i "s:^\(OPTION_EGLIBC_LOCALE_CODE =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
319     # disable mail aliases support
320     # sed -i "s:^\(OPTION_EGLIBC_DB_ALIASES =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
321     # # disable nis support
322     # sed -i "s:^\(OPTION_EGLIBC_NIS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
323     # no remote services via rsh
324     # sed -i "s:^\(OPTION_EGLIBC_RCMD =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
325     # no sunrpc
326     # sed -i "s:^\(OPTION_EGLIBC_SUNRPC =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
327     # no support for old access of utmp
328     # sed -i "s:^\(OPTION_EGLIBC_UTMP =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
329     }
330    
331     src_compile()
332     {
333     # support multilib lib64 dir (x86_64 only)
334     if [[ ${ARCH} = x86_64 ]]
335     then
336     # first build a -m32 version
337     install -d ${SRCDIR}/build-m32
338     cd ${SRCDIR}/build-m32
339    
340     CC="gcc -m32" CXX="g++ -m32" \
341     CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \
342     CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \
343     ../configure \
344     --build=${CHOST} \
345     --host=i686-pc-linux-gnu \
346     --prefix=/usr \
347     --mandir=/usr/share/man \
348     --infodir=/usr/share/info \
349     --disable-profile \
350     --enable-add-ons=nptl,libidn \
351     --with-tls \
352     --with-__thread \
353     --enable-kernel=${ENABLE_KERNEL} \
354     --without-cvs \
355     --without-gd \
356     --libdir=/usr/lib \
357     --libexecdir=/usr/lib/eglibc \
358     --with-headers=${ALT_HEADERS} \
359     --disable-nls \
360     --enable-bind-now \
361     || die
362    
363     make PARALLELMFLAGS="${MAKEOPTS}" || die
364     fi
365    
366     cd ${SRCDIR}/build
367    
368     if [[ ${ARCH} = x86_64 ]]; then
369     # make sure the -m64 libs goes really to /lib64
370     echo "slibdir=/$(mlibdir)" >> ${SRCDIR}/build/configparms || die
371     fi
372    
373     # kernel-2.6 with nptl needs this
374     ../configure \
375     --build=${CHOST} \
376     --host=${CHOST} \
377     --prefix=/usr \
378     --mandir=/usr/share/man \
379     --infodir=/usr/share/info \
380     --disable-profile \
381     --enable-add-ons=nptl,libidn \
382     --with-tls \
383     --with-__thread \
384     --enable-kernel=${ENABLE_KERNEL} \
385     --without-cvs \
386     --without-gd \
387     --libdir=/usr/$(mlibdir) \
388     --libexecdir=/usr/$(mlibdir)/eglibc \
389     --with-headers=${ALT_HEADERS} \
390     --enable-bind-now \
391     || die
392    
393     make PARALLELMFLAGS="${MAKEOPTS}" || die
394     }
395    
396     src_install_eglibc()
397     {
398     if [[ ${ARCH} = x86_64 ]]
399     then
400     # install -m32 libs
401     cd ${SRCDIR}/build-m32
402     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
403     fi
404    
405     cd ${SRCDIR}/build
406     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
407    
408     # cleanup
409     zapmost ${BINDIR} $(mlibdir) \
410     usr/$(mlibdir)/*.so \
411     $([[ ${ARCH} = x86_64 ]] && echo 'lib usr/lib/*.so') \
412     sbin/ldconfig \
413     usr/bin/iconv \
414     usr/bin/locale \
415     usr/$(mlibdir)/gconv/ISO8859-1.so \
416     usr/$(mlibdir)/gconv/UNICODE.so \
417     usr/$(mlibdir)/gconv/gconv-modules \
418     $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-1.so') \
419     $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UNICODE.so') \
420     $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/gconv-modules') \
421     || die
422    
423     # base environment
424     minstallenv eglibc.envd 00eglibc || die
425     if [[ ${ARCH} = x86_64 ]]
426     then
427     echo "LDPATH=\"/usr/local/$(mlibdir)\"" >> ${BINDIR}/etc/env.d/00eglibc || die
428     echo "LDPATH=\"/opt/$(mlibdir)\"" >> ${BINDIR}/etc/env.d/00eglibc || die
429     fi
430    
431     # move some libs and tools to proper locations
432     # will suppress some ldconfig errors too
433     mv ${BINDIR}/$(mlibdir)/libmemusage.so ${BINDIR}/usr/$(mlibdir) || die
434     mv ${BINDIR}/$(mlibdir)/libpcprofile.so ${BINDIR}/usr/$(mlibdir) || die
435     mlink ../usr/$(mlibdir)/libmemusage.so /$(mlibdir)/libmemusage.so || die
436     mlink ../usr/$(mlibdir)/libpcprofile.so /$(mlibdir)/libpcprofile.so || die
437    
438     # strip all binaries
439     find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
440    
441     # strip all libraries
442     # want to be safe here; --strip-unneeded seems to cause pthread problems
443     # strip all but libpthread
444     install -d ${BUILDDIR}/thread-backup || die
445     mv ${BINDIR}/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die
446     # now strip
447     find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
448     mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/$(mlibdir)/ || die
449     # remove stale directory
450     rm -rf ${BUILDDIR}/thread-backup || die
451    
452     # prepare glibc for installation; slackware method
453     minstalldir /incoming || die
454     mv ${BINDIR}/$(mlibdir)/* ${BINDIR}/incoming || die
455     mv ${BINDIR}/incoming ${BINDIR}/$(mlibdir)/incoming || die
456     mv ${BINDIR}/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/$(mlibdir) || die
457     }
458    
459     src_install_eglibc-dev()
460     {
461     if [[ ${ARCH} = x86_64 ]]
462     then
463     # install -m32 libs
464     cd ${SRCDIR}/build-m32
465     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
466     fi
467    
468     cd ${SRCDIR}/build
469     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
470    
471     # cleanup -> in eglibc
472     rm -r ${BINDIR}/$(mlibdir) || die
473     rm ${BINDIR}/usr/$(mlibdir)/*.so || die
474     rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-1.so || die
475     rm ${BINDIR}/usr/$(mlibdir)/gconv/UNICODE.so || die
476     rm ${BINDIR}/usr/$(mlibdir)/gconv/gconv-modules || die
477     if [[ ${ARCH} = x86_64 ]]
478     then
479     rm -r ${BINDIR}/lib || die
480     rm ${BINDIR}/usr/lib/*.so || die
481     rm ${BINDIR}/usr/lib/gconv/ISO8859-1.so || die
482     rm ${BINDIR}/usr/lib/gconv/UNICODE.so || die
483     rm ${BINDIR}/usr/lib/gconv/gconv-modules || die
484     fi
485     rm ${BINDIR}/sbin/ldconfig || die
486     rm ${BINDIR}/usr/bin/iconv || die
487     rm ${BINDIR}/usr/bin/locale || die
488    
489     # do not generate the locales here, let it the user do with the locale-gen tool
490     # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die
491    
492     # install locales list and generate tools
493     # to generate this listing see the glibc-2.5/localedata/SUPPORTED file
494     minstalletc locale.gen || die
495     minstalldir /usr/sbin || die
496     minstallexec -s locale-gen /usr/sbin || die
497    
498     # nsswitch configuration file
499     minstalletc nsswitch.conf || die
500    
501     # nscd configuration file
502     minstalletc nscd.conf || die
503    
504     # we use Berlin as default
505     cp --remove-destination ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die
506     [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; }
507     [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; }
508    
509     # strip all binaries
510     find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
511    
512     # strip all libraries
513     find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
514     }
515    
516     fix_db_files()
517     {
518     local i
519     local DB_ENTRY="${BUILDDIR}/${PKGNAME}"
520    
521     for i in .files .symlinks .dirs
522     do
523     [ ! -f ${DB_ENTRY}/${i} ] && continue
524     [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue
525    
526     echo " fixing /$(mlibdir)/incoming from db-entry '${i}' ..."
527    
528     # /lib/incoming -> empty line; sed2 removes all empty lines
529     #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
530     # do not simply emtpy the line, but change it the the correct path,
531     # so no stale libs are around if the package gets updated!
532     sed -i -e "s:/$(mlibdir)/incoming:/$(mlibdir):g" \
533     -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
534     done
535     }