Magellan Linux

Contents of /trunk/core/glibc-nptl/glibc-nptl-2.10.1-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3007 - (show annotations) (download)
Tue Oct 6 05:41:08 2009 UTC (14 years, 7 months ago) by niro
File size: 11297 byte(s)
auto added: ver bump to 2.10.1-r1
1 # $Id$
2
3 PNAME="glibc-nptl"
4 PVER="2.10.1"
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.3
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.31"
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 # locale.gen CVS revision
31 LOCALEGEN_CVS_REV=1.3
32
33 sminclude mtools
34
35 SRC_URI=(
36 ftp://sources.redhat.com/pub/glibc/snapshots/${SRCFILE}
37 gnu://glibc/${SRCFILE}
38 mirror://glibc/${SRCFILE}
39 gnu://glibc/${GLIBC_LIBIDN}
40 mirror://glibc/${GLIBC_LIBIDN}
41 mirror://glibc/nsswitch.conf
42 mirror://glibc/nscd.conf
43 mirror://glibc/glibc.envd
44 mirror://glibc/locale-gen
45 mirror://glibc/locale.gen-${LOCALEGEN_CVS_REV}
46 mirror://glibc/glibc-2.3.5-localedef_segfault-1.patch
47 mirror://glibc/glibc-2.9.0-linker-scripts.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 # use the full libidn library not the bundled addon
93 # many apps that rely on libidn needs the full lib
94 munpack ${GLIBC_LIBIDN} || die
95 mv ${GLIBC_LIBIDN_SRCDIR} ${SRCDIR}/libidn || die
96 cd ${SRCDIR}
97
98 # disable binutils -as-needed
99 sed -i 's/^have-as-needed.*/have-as-needed = no/' ${SRCDIR}/config.make.in || die
100
101 # fix segfault of localdef on arches beside x86-32
102 mpatch glibc-2.3.5-localedef_segfault-1.patch || die
103
104 # fixes link issues with newer binutils (>=2.19.51.0.2)
105 mpatch glibc-2.9.0-linker-scripts.patch || die
106
107 # fix permissions on some of the scripts
108 chmod u+x ${SRCDIR}/scripts/*.sh || die
109
110 install -d ${SRCDIR}/build || die
111 cd ${SRCDIR}/build
112
113 if [ ! -f /etc/ld.so.conf ]
114 then
115 touch /etc/ld.so.conf || die
116 fi
117 }
118
119 src_compile()
120 {
121 # support multilib lib64 dir (x86_64 only)
122 if [[ ${ARCH} = x86_64 ]]
123 then
124 # first build a -m32 version
125 install -d ${SRCDIR}/build-m32
126 cd ${SRCDIR}/build-m32
127
128 CC="gcc -m32" CXX="g++ -m32" \
129 CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \
130 CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \
131 ../configure \
132 --build=${CHOST} \
133 --host=i686-pc-linux-gnu \
134 --prefix=/usr \
135 --mandir=/usr/share/man \
136 --infodir=/usr/share/info \
137 --disable-profile \
138 --enable-add-ons=nptl,libidn \
139 --with-tls \
140 --with-__thread \
141 --enable-kernel=${ENABLE_KERNEL} \
142 --without-cvs \
143 --without-gd \
144 --libdir=/usr/lib \
145 --libexecdir=/usr/lib/glibc \
146 --with-headers=${ALT_HEADERS} \
147 || die
148
149 make PARALLELMFLAGS="${MAKEOPTS}" || die
150 fi
151
152 cd ${SRCDIR}/build
153
154 if [[ ${ARCH} = x86_64 ]]; then
155 # make sure the -m64 libs goes really to /lib64
156 echo "slibdir=/$(mlibdir)" >> ${SRCDIR}/build/configparms || die
157 fi
158
159 # kernel-2.6 with nptl needs this
160 ../configure \
161 --build=${CHOST} \
162 --host=${CHOST} \
163 --prefix=/usr \
164 --mandir=/usr/share/man \
165 --infodir=/usr/share/info \
166 --disable-profile \
167 --enable-add-ons=nptl,libidn \
168 --with-tls \
169 --with-__thread \
170 --enable-kernel=${ENABLE_KERNEL} \
171 --without-cvs \
172 --without-gd \
173 --libdir=/usr/$(mlibdir) \
174 --libexecdir=/usr/$(mlibdir)/glibc \
175 --with-headers=${ALT_HEADERS} \
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 # to generate this listing see the glibc-2.5/localedata/SUPPORTED file
198 minstalletc locale.gen-${LOCALEGEN_CVS_REV} locale.gen || die
199 minstalldir /usr/sbin || die
200 minstallexec -s locale-gen /usr/sbin || die
201
202 # nsswitch configuration file
203 minstalletc nsswitch.conf || die
204
205 # nscd configuration file
206 minstalletc nscd.conf || die
207
208 # we use Berlin as default
209 cp --remove-destination ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die
210 [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; }
211 [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; }
212
213 # base environment
214 minstallenv glibc.envd 00glibc || die
215 if [[ ${ARCH} = x86_64 ]]
216 then
217 echo "LDPATH=\"/usr/local/$(mlibdir)\"" >> ${BINDIR}/etc/env.d/00glibc || die
218 echo "LDPATH=\"/opt/$(mlibdir)\"" >> ${BINDIR}/etc/env.d/00glibc || die
219 fi
220
221 # move some libs and tools to proper locations
222 # will suppress some ldconfig errors too
223 mv ${BINDIR}/$(mlibdir)/libmemusage.so ${BINDIR}/usr/$(mlibdir) || die
224 mv ${BINDIR}/$(mlibdir)/libpcprofile.so ${BINDIR}/usr/$(mlibdir) || die
225 mlink ../usr/$(mlibdir)/libmemusage.so /$(mlibdir)/libmemusage.so || die
226 mlink ../usr/$(mlibdir)/libpcprofile.so /$(mlibdir)/libpcprofile.so || die
227
228 # strip all binaries
229 find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
230
231 # strip all libraries
232 # want to be safe here; --strip-unneeded seems to cause pthread problems
233 # strip all but libpthread
234 install -d ${BUILDDIR}/thread-backup || die
235 mv ${BINDIR}/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die
236
237 # now strip
238 find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
239 mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/$(mlibdir)/ || die
240 # remove stale directory
241 rm -rf ${BUILDDIR}/thread-backup || die
242
243 # prepare glibc for installation; slackware method
244 minstalldir /incoming || die
245 mv ${BINDIR}/$(mlibdir)/* ${BINDIR}/incoming || die
246 mv ${BINDIR}/incoming ${BINDIR}/$(mlibdir)/incoming || die
247 mv ${BINDIR}/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/$(mlibdir) || die
248 }
249
250 fix_db_files()
251 {
252 local i
253 local DB_ENTRY="${BUILDDIR}/${PKGNAME}"
254
255 for i in .files .symlinks .dirs
256 do
257 [ ! -f ${DB_ENTRY}/${i} ] && continue
258 [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue
259
260 echo " fixing /$(mlibdir)/incoming from db-entry '${i}' ..."
261
262 # /lib/incoming -> empty line; sed2 removes all empty lines
263 #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
264 # do not simply emtpy the line, but change it the the correct path,
265 # so no stale libs are around if the package gets updated!
266 sed -i -e "s:/$(mlibdir)/incoming:/$(mlibdir):g" \
267 -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
268 done
269 }
270
271 preinstall()
272 {
273 # remove libmemusage and libpcprofile as these libs now
274 # resides in /usr/lib and are symlinked to /lib
275 if [[ -f ${MROOT}/$(mlibdir)/libmemusage.so ]]
276 then
277 rm ${MROOT}/$(mlibdir)/libmemusage.so
278 fi
279
280 if [[ -f ${MROOT}/$(mlibdir)/libpcprofile.so ]]
281 then
282 rm ${MROOT}/$(mlibdir)/libpcprofile.so
283 fi
284 }
285
286 postinstall()
287 {
288 # first save the old libpthread.so.0;
289 # it will later used to determinate that there are no stale
290 # libpthreads that breaks ldconfig
291 local OLD_PTHREAD
292 OLD_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)"
293
294 # slackware install method
295
296 # we cannot easily install the glibc libs,
297 # because our tools for cp etc needs them to run
298
299 local file
300
301 echo " Switching to new glibc ..."
302 # swap libraries on the fly:
303 if [ -x /sbin/ldconfig -a -d /$(mlibdir)/incoming ] && [[ -z ${MROOT} ]]
304 then
305 # first create copies of the incoming libraries:
306 cd /$(mlibdir)/incoming
307 for file in $(find /$(mlibdir)/incoming -type f)
308 do
309 if [ ! -r "../$(basename ${file}).incoming" ]
310 then
311 cp -a ${file} ../$(basename ${file}).incoming
312 fi
313 done
314
315 # then switch to them all at once:
316 /sbin/ldconfig -l /$(mlibdir)/*.incoming 2> /dev/null
317
318 # finally, rename them and clean up:
319 cd /$(mlibdir)
320 for file in *.incoming
321 do
322 rm -f $(basename ${file} .incoming)
323 cp -a ${file} $(basename ${file} .incoming)
324 /sbin/ldconfig -l $(basename ${file} .incoming)
325 rm -f ${file}
326 done
327
328 # no ldconfig?
329 # good, it's safe to just jam it on home (and make links below):
330 else
331 (
332 cd ${MROOT}/$(mlibdir)/incoming
333 for file in *
334 do
335 cp -a ${file} ..
336 done
337
338 local my_sym
339 local my_dest
340
341 # rebuild symlinks
342 echo " Recreating Symlinks:"
343 for i in $(find ${MROOT}/$(mlibdir)/incoming -type l)
344 do
345 my_sym="$(readlink ${i})"
346 my_dest="$(basename ${i})"
347
348 echo " ${my_dest} -> ${my_dest}"
349
350 # assure to remove the old ones;
351 [ -L ${MROOT}/$(mlibdir)/"${my_dest}" ] && \
352 rm ${MROOT}/$(mlibdir)/"${my_dest}"
353
354 ln -snf "${my_sym}" ${MROOT}/$(mlibdir)/"${my_dest}"
355 done
356 )
357 fi
358
359 # now, get rid of the temporary directory:
360 rm -rf ${MROOT}/$(mlibdir)/incoming
361
362 # remove stale nptl libpthread-2.?.?.so,
363 # fix only needed for glibc with linuxthreads;
364 # prevent reloc errors such as:
365 # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
366
367 # get our new libpthread.so.0
368 local NEW_PTHREAD
369 NEW_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)"
370
371 if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ]
372 then
373 echo " Removing stale libpthread libraries ..."
374 for file in ${MROOT}/$(mlibdir)/libpthread-*
375 do
376 if [ "$(basename ${file})" != "${NEW_PTHREAD}" ]
377 then
378 rm -f ${file}
379 fi
380 done
381
382 #rm -f /lib/${OLD_PTHREAD}
383
384 ln -snf ${NEW_PTHREAD} ${MROOT}/$(mlibdir)/libpthread.so.0
385 fi
386
387 if [ -x /usr/sbin/iconvconfig ]
388 then
389 # generate fastloading iconv module configuration file.
390 echo " Generate iconv module config ..."
391 /usr/sbin/iconvconfig --prefix=${MROOT}/
392 fi
393
394 # reloading init
395 echo " Reloading init ..."
396 [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null
397
398 # generating user def locales
399 echo " Generating user defined locales ..."
400 [[ -z ${MROOT} ]] && /usr/sbin/locale-gen
401
402 # now we must fix the mage db files
403 # to stop the annoying errors messages
404 fix_db_files
405 }

Properties

Name Value
svn:keywords Id