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