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