Magellan Linux

Annotation of /branches/R11-stable/core/glibc/glibc-2.20-r6.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23510 - (hide annotations) (download)
Wed Jan 14 09:14:40 2015 UTC (9 years, 4 months ago) by niro
Original Path: trunk/core/glibc/glibc-2.20-r6.smage2
File size: 12073 byte(s)
-linux-libc-headers-3.18.2, binutils-2.15, glibc-2.20, gcc-4.8.4 bootstrap phase2
1 niro 23509 # $Id$
2    
3     PNAME="glibc"
4     PVER="2.20"
5 niro 23510 PBUILD="r6"
6 niro 23509
7     PCAT="sys-libs"
8    
9     DESCRIPTION="GNU libc6 (also called glibc2) C library with NPTL Threads."
10     HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
11    
12     DEPEND=">= sys-apps/base-files-0.7
13     >= sys-libs/tzdata-2014"
14    
15     # we force headers to one specific version
16     SDEPEND="== sys-kernel/linux-libc-headers-3.18.2"
17     PROVIDE="virtual/glibc"
18    
19     # functions to include in the mage file
20     SPECIAL_FUNCTIONS="fix_db_files"
21    
22     SRCFILE="glibc-${PVER}.tar.xz"
23     SRCDIR="${BUILDDIR}/glibc-${PVER}"
24    
25     ENVD_REV="1.2"
26    
27     sminclude mtools
28    
29     SRC_URI=(
30     ftp://sources.redhat.com/pub/glibc/releases/${SRCFILE}
31     ftp://sources.redhat.com/pub/glibc/snapshots/${SRCFILE}
32     gnu://${PNAME}/${SRCFILE}
33     mirror://${PNAME}/${SRCFILE}
34     mirror://${PNAME}/glibc.envd-${ENVD_REV}
35     mirror://${PNAME}/locale.gen-header
36     mirror://${PNAME}/locale-gen
37     mirror://${PNAME}/${PNAME}-2.17-syscalld-infinite-loop.patch
38     )
39    
40     # sed line: on 2 digits add an zero: 2.7 -> 2.7.0
41     UP2DATE="updatecmd_gnu ${PNAME/-nptl/} | sed 's/^\([0-9]\.[0-9]\$\)/\1.0/'"
42    
43     # glibc don't like strong CFLAGS
44     export CFLAGS="${CFLAGS//-O?} -O2"
45     # glibc -> nptl thread don't like striping
46     msetfeature "!strip"
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     export CFLAGS="${newflags}"
65    
66     # than add our defaults for glibc
67     [[ ${ARCH} = i*86 ]] && export CFLAGS="${CFLAGS} -march=${ARCH}" # only i*86
68     export CFLAGS="${CFLAGS} -mtune=generic" # all arches
69     export CXXFLAGS="${CFLAGS}"
70    
71     # use other linux-headers
72     [[ -z ${ALT_HEADERS} ]] && export ALT_HEADERS="/usr/include"
73    
74     # kernel support
75     export ENABLE_KERNEL=2.6.32
76    
77     src_prepare()
78     {
79     munpack ${SRCFILE} || die
80     cd ${SRCDIR}
81    
82     # fixes an infinite loop while syscall.d creation
83     # see: http://sourceware.org/bugzilla/show_bug.cgi?id=15711
84     mpatch ${PNAME}-2.17-syscalld-infinite-loop.patch || die
85     # use 1.0 second instead of 0.5 (required by arch i686 builds on 64bit machines)
86     sed -i 's:0.5 seconds ago:1.0 seconds ago:' ${SRCDIR}/Makerules || die
87    
88     # scripts/test-installation.pl sometime fails
89     #
90     # CC="gcc" /usr/bin/perl scripts/test-installation.pl
91     # /usr/src/glibc-2.16.0.bld/
92     # Unmatched ( in regex; marked by <-- HERE in m/$( <-- HERE if $(abi-32-ld-soname),$(abi-32-ld-soname),ld/ at scripts/test-installation.pl line 172, <LDD>
93     # line 1
94     sed -i 's:CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)::' Makefile || die
95    
96     # binutils patch needs reconf
97     # autoconf --force || die
98    
99     # fix permissions on some of the scripts
100     chmod u+x ${SRCDIR}/scripts/*.sh || die
101    
102     install -d ${SRCDIR}/build || die
103     cd ${SRCDIR}/build
104    
105     if [ ! -f /etc/ld.so.conf ]
106     then
107     touch /etc/ld.so.conf || die
108     fi
109     }
110    
111     src_compile()
112     {
113     local myopts
114    
115     # generic pathes
116     myopts="--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info"
117     # disable profiling
118     myopts+=" --disable-profile"
119     # enable addons
120     myopts+=" --enable-add-ons"
121     # enable tls
122     myopts+=" --with-tls --with-__thread"
123     # supported kernel-release
124     myopts+=" --enable-kernel=${ENABLE_KERNEL}"
125     # disable cvs and gd support
126     myopts+=" --without-cvs --without-gd"
127     # enable bindnow
128     myopts+=" --enable-bind-now"
129     # enable obsolete rpc implementation
130     myopts+=" --enable-obsolete-rpc"
131     # enable lock elesion
132     myopts+=" --enable-lock-elision"
133    
134     # support multilib lib64 dir (x86_64 only)
135     if [[ ${ARCH} = x86_64 ]]
136     then
137     # first build a -m32 version
138     install -d ${SRCDIR}/build-m32
139     cd ${SRCDIR}/build-m32
140    
141     # honor /usr move
142     echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build-m32/configparms || die
143     # make sure the -m32 libs goes really to /usr/lib
144     echo "slibdir=/usr/lib" >> ${SRCDIR}/build/configparms || die
145     echo "rtlddir=/usr/lib" >> ${SRCDIR}/build/configparms || die
146    
147     CC="gcc -m32" CXX="g++ -m32" \
148     CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \
149     CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \
150     ../configure \
151     --build=${CHOST} \
152     --host=i686-pc-linux-gnu \
153     --libdir=/usr/lib \
154     --libexecdir=/usr/lib/glibc \
155     ${myopts} \
156     || die
157    
158     make PARALLELMFLAGS="${MAKEOPTS}" || die
159     fi
160    
161     cd ${SRCDIR}/build
162    
163     # honor /usr move
164     echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build/configparms || die
165     # make sure the -m64 libs goes really to /lib64
166     echo "slibdir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die
167     echo "rtlddir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die
168    
169     # kernel-2.6 with nptl needs this
170     ../configure \
171     --build=${CHOST} \
172     --host=${CHOST} \
173     --libdir=/usr/$(mlibdir) \
174     --libexecdir=/usr/$(mlibdir)/glibc \
175     ${myopts} \
176     || die
177    
178     make PARALLELMFLAGS="${MAKEOPTS}" || die
179     }
180    
181     src_install()
182     {
183     if [[ ${ARCH} = x86_64 ]]
184     then
185     # install -m32 libs
186     cd ${SRCDIR}/build-m32
187     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
188     fi
189    
190     cd ${SRCDIR}/build
191     make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
192    
193     # do not generate the locales here, let it the user do with the locale-gen tool
194     # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die
195    
196     # install locales list and generate tools
197     # generate locale.gen file from localedata/SUPPORTED file
198     minstalletc locale.gen-header locale.gen || die
199     sed \
200     -e 's:/: :g' \
201     -e 's:\\: :g' \
202     -e 's:SUPPORTED-LOCALES=::' \
203     -e 's:\ \ $::g' \
204     -e '/^#/d' \
205     -e 's:^:#:g' \
206     ${SRCDIR}/localedata/SUPPORTED \
207     >> ${BINDIR}/etc/locale.gen || die
208     minstalldir /usr/sbin || die
209     minstallexec -s locale-gen /usr/sbin || die
210    
211     # nsswitch configuration file
212     minstalletc ${SRCDIR}/nss/nsswitch.conf || die
213    
214     # nscd configuration file
215     minstalletc ${SRCDIR}/nscd/nscd.conf || die
216     # systemd services, but do not include systemd.sminc to have a hard depend on systemd
217     minstalldir /usr/lib/systemd/system || die
218     minstallfile ${SRCDIR}/nscd/nscd.service /usr/lib/systemd/system || die
219     minstalldir /etc/tmpfiles.d || die
220     minstallfile ${SRCDIR}/nscd/nscd.tmpfiles /etc/tmpfiles.d/nscd.conf || die
221    
222     # gai configuration file
223     minstalletc ${SRCDIR}/posix/gai.conf || die
224    
225     # now in tzdata
226     ## we use Berlin as default
227     ## busybox compat
228     #local args
229     #if need_busybox_support /bin/cp
230     #then
231     # args="-f"
232     #else
233     # args="--remove-destination"
234     #fi
235     #cp ${args} ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die
236     [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; }
237     [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; }
238    
239     # base environment
240     minstallenv glibc.envd-${ENVD_REV} 00glibc || die
241     if [[ ${ARCH} = x86_64 ]]
242     then
243     MCONFIG="/etc/env.d/00glibc"
244     maddconfig "LDPATH=\"/$(mlibdir)\"" || die
245     maddconfig "LDPATH=\"/usr/$(mlibdir)\"" || die
246     maddconfig "LDPATH=\"/usr/local/$(mlibdir)\"" || die
247     maddconfig "LDPATH=\"/opt/$(mlibdir)\"" || die
248     fi
249    
250     # strip all binaries
251     find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
252    
253     # strip all libraries
254     # want to be safe here; --strip-unneeded seems to cause pthread problems
255     # strip all but libpthread
256     install -d ${BUILDDIR}/thread-backup || die
257     mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die
258    
259     # now strip but only debuging symbols
260     find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-debug || die
261     find ${BINDIR} | xargs file | grep "ar archive" | cut -f 1 -d : | xargs strip --strip-debug || die
262     mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/usr/$(mlibdir)/ || die
263     # remove stale directory
264     rm -rf ${BUILDDIR}/thread-backup || die
265    
266     # prepare glibc for installation; slackware method
267     minstalldir /incoming || die
268     mv ${BINDIR}/usr/$(mlibdir)/*.so ${BINDIR}/incoming || die
269     mv ${BINDIR}/usr/$(mlibdir)/*.so.* ${BINDIR}/incoming || die
270     mv ${BINDIR}/incoming ${BINDIR}/usr/$(mlibdir)/incoming || die
271     mv ${BINDIR}/usr/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/usr/$(mlibdir) || die
272     }
273    
274     fix_db_files()
275     {
276     local i
277     local DB_ENTRY="${BUILDDIR}/${PKGNAME}"
278    
279     for i in .files .symlinks .dirs
280     do
281     [ ! -f ${DB_ENTRY}/${i} ] && continue
282     [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue
283    
284     echo " fixing /usr/$(mlibdir)/incoming from db-entry '${i}' ..."
285    
286     # /usr/lib/incoming -> empty line; sed2 removes all empty lines
287     #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
288     # do not simply emtpy the line, but change it the the correct path,
289     # so no stale libs are around if the package gets updated!
290     sed -i \
291     -e "s:/usr/$(mlibdir)/incoming:/usr/$(mlibdir):g" \
292     -e "s:/usr/$(mlibdir)/incoming.*::g" \
293     -e '/^$/d' ${DB_ENTRY}/${i}
294     done
295     }
296    
297     postinstall()
298     {
299     # first save the old libpthread.so.0;
300     # it will later used to determinate that there are no stale
301     # libpthreads that breaks ldconfig
302     local OLD_PTHREAD
303     OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)"
304    
305     # slackware install method
306    
307     # we cannot easily install the glibc libs,
308     # because our tools for cp etc needs them to run
309    
310     local file
311    
312     echo " Switching to new glibc ..."
313     # swap libraries on the fly:
314     if [ -x /usr/sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]]
315     then
316     # first create copies of the incoming libraries:
317     cd /usr/$(mlibdir)/incoming
318     for file in $(find /usr/$(mlibdir)/incoming -type f)
319     do
320     if [ ! -r "../$(basename ${file}).incoming" ]
321     then
322     cp -a ${file} ../$(basename ${file}).incoming
323     fi
324     done
325    
326     # then switch to them all at once:
327     /usr/sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null
328    
329     # finally, rename them and clean up:
330     cd /usr/$(mlibdir)
331     for file in *.incoming
332     do
333     rm -f $(basename ${file} .incoming)
334     cp -a ${file} $(basename ${file} .incoming)
335     /usr/sbin/ldconfig -l $(basename ${file} .incoming)
336     rm -f ${file}
337     done
338    
339     # no ldconfig?
340     # good, it's safe to just jam it on home (and make links below):
341     else
342     (
343     cd ${MROOT}/usr/$(mlibdir)/incoming
344     for file in *
345     do
346     cp -a ${file} ..
347     done
348    
349     local my_sym
350     local my_dest
351    
352     # rebuild symlinks
353     echo " Recreating Symlinks:"
354     for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l)
355     do
356     my_sym="$(readlink ${i})"
357     my_dest="$(basename ${i})"
358    
359     echo " ${my_dest} -> ${my_dest}"
360    
361     # assure to remove the old ones;
362     [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \
363     rm ${MROOT}/usr/$(mlibdir)/"${my_dest}"
364    
365     ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}"
366     done
367     )
368     fi
369    
370     # now, get rid of the temporary directory:
371     rm -rf ${MROOT}/usr/$(mlibdir)/incoming
372    
373     # remove stale nptl libpthread-2.?.?.so,
374     # fix only needed for glibc with linuxthreads;
375     # prevent reloc errors such as:
376     # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
377    
378     # get our new libpthread.so.0
379     local NEW_PTHREAD
380     NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)"
381    
382     if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ]
383     then
384     echo " Removing stale libpthread libraries ..."
385     for file in ${MROOT}/usr/$(mlibdir)/libpthread-*
386     do
387     if [ "$(basename ${file})" != "${NEW_PTHREAD}" ]
388     then
389     rm -f ${file}
390     fi
391     done
392    
393     #rm -f /lib/${OLD_PTHREAD}
394    
395     ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0
396     fi
397    
398     if [ -x /usr/sbin/iconvconfig ]
399     then
400     # generate fastloading iconv module configuration file.
401     echo " Generate iconv module config ..."
402     /usr/sbin/iconvconfig --prefix=${MROOT}/
403     fi
404    
405     # not working with busybox
406     if ! need_busybox_support /sbin/init
407     then
408     # reloading init
409     echo " Reloading init ..."
410     [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null
411     fi
412    
413     # generating user def locales
414     echo " Generating user defined locales ..."
415     [[ -z ${MROOT} ]] && /usr/sbin/locale-gen
416    
417     # now we must fix the mage db files
418     # to stop the annoying errors messages
419     fix_db_files
420     }