Magellan Linux

Annotation of /branches/magellan-next/core/glibc-nptl/glibc-nptl-2.12.2-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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