Magellan Linux

Contents of /trunk/core/glibc-nptl/glibc-nptl-2.7.0-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:keywords Id