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