Contents of /trunk/core/glibc/glibc-2.16.0-r1.smage2
Parent Directory | Revision Log
Revision 12924 -
(show annotations)
(download)
Mon Aug 13 17:07:16 2012 UTC (12 years, 1 month ago) by niro
File size: 11640 byte(s)
Mon Aug 13 17:07:16 2012 UTC (12 years, 1 month ago) by niro
File size: 11640 byte(s)
auto added: ver bump to 2.16.0-r1
1 | # $Id$ |
2 | |
3 | PNAME="glibc" |
4 | PVER="2.16.0" |
5 | PBUILD="r1" |
6 | |
7 | PCAT="sys-libs" |
8 | |
9 | DESCRIPTION="GNU libc6 (also called glibc2) C library with NPTL Threads." |
10 | HOMEPAGE="http://www.gnu.org/software/libc/libc.html" |
11 | |
12 | DEPEND=">= sys-apps/base-files-0.1" |
13 | |
14 | # we force headers to one specific version |
15 | # (for x86_64 2.6.12.0-r2 bi-arch headers are needed!) |
16 | SDEPEND="== sys-kernel/linux-libc-headers-3.4.8" |
17 | PROVIDE="virtual/glibc" |
18 | |
19 | # functions to include in the mage file |
20 | SPECIAL_FUNCTIONS="fix_db_files" |
21 | |
22 | SRCFILE="glibc-${PVER}.tar.xz" |
23 | SRCDIR="${BUILDDIR}/glibc-${PVER}" |
24 | |
25 | ENVD_REV="1.2" |
26 | |
27 | sminclude mtools |
28 | |
29 | SRC_URI=( |
30 | ftp://sources.redhat.com/pub/glibc/releases/${SRCFILE} |
31 | ftp://sources.redhat.com/pub/glibc/snapshots/${SRCFILE} |
32 | gnu://${PNAME}/${SRCFILE} |
33 | mirror://${PNAME}/${SRCFILE} |
34 | mirror://${PNAME}/glibc.envd-${ENVD_REV} |
35 | mirror://${PNAME}/locale.gen-header |
36 | mirror://${PNAME}/locale-gen |
37 | mirror://${PNAME}/${PNAME}-2.15-fix-res_query-assert.patch |
38 | mirror://${PNAME}/${PNAME}-${PVER}-revert-c5a0802a.patch |
39 | ) |
40 | |
41 | # sed line: on 2 digits add an zero: 2.7 -> 2.7.0 |
42 | UP2DATE="updatecmd_gnu ${PNAME/-nptl/} | sed 's/^\([0-9]\.[0-9]\$\)/\1.0/'" |
43 | |
44 | # glibc don't like strong CFLAGS |
45 | export CFLAGS="${CFLAGS//-O?} -O2" |
46 | # glibc -> nptl thread don't like striping |
47 | msetfeature "!strip" |
48 | # gcc 3.0 - 3.3 needs this: |
49 | export CFLAGS="${CFLAGS} -finline-limit=2000" |
50 | export CXXFLAGS="${CFLAGS}" |
51 | export LDFLAGS="${LDFLAGS//-Wl,--relax}" |
52 | |
53 | # hack to fix NPTL issues with xen, only required on 32bit arches |
54 | if [[ ${ARCH} = i*86 ]] |
55 | then |
56 | export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs" |
57 | fi |
58 | |
59 | # glibc-2.6.1 and above needs march CFLAGS: -march=${ARCH} -mtune=generic |
60 | # first filter -mtune and -march from flags |
61 | for flag in ${CFLAGS} |
62 | do |
63 | case ${flag} in |
64 | -mtune=*) continue ;; |
65 | -march=*) continue ;; |
66 | esac |
67 | newflags="${newflags} ${flag}" |
68 | done |
69 | export CFLAGS="${newflags}" |
70 | |
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 | # kernel support |
80 | export ENABLE_KERNEL=2.6.32 |
81 | |
82 | src_prepare() |
83 | { |
84 | munpack ${SRCFILE} || die |
85 | cd ${SRCDIR} |
86 | |
87 | # fix res_query assertion |
88 | # http://sourceware.org/bugzilla/show_bug.cgi?id=13013 |
89 | mpatch ${PNAME}-2.15-fix-res_query-assert.patch || die |
90 | |
91 | # revert commit c5a0802a - causes various hangs |
92 | # https://bugzilla.redhat.com/show_bug.cgi?id=769421 |
93 | # Note: fedora may have actual fix (not submitted upstream yet...) |
94 | # http://pkgs.fedoraproject.org/gitweb/?p=glibc.git;a=blob_plain;f=glibc-rh552960-2.patch |
95 | mpatch ${PNAME}-${PVER}-revert-c5a0802a.patch || die |
96 | |
97 | # scripts/test-installation.pl sometime fails |
98 | # |
99 | # CC="gcc" /usr/bin/perl scripts/test-installation.pl |
100 | # /usr/src/glibc-2.16.0.bld/ |
101 | # Unmatched ( in regex; marked by <-- HERE in m/$( <-- HERE if $(abi-32-ld-soname),$(abi-32-ld-soname),ld/ at scripts/test-installation.pl line 172, <LDD> |
102 | # line 1 |
103 | sed -i 's:CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)::' Makefile || die |
104 | |
105 | # binutils patch needs reconf |
106 | # autoconf --force || die |
107 | |
108 | # fix permissions on some of the scripts |
109 | chmod u+x ${SRCDIR}/scripts/*.sh || die |
110 | |
111 | install -d ${SRCDIR}/build || die |
112 | cd ${SRCDIR}/build |
113 | |
114 | if [ ! -f /etc/ld.so.conf ] |
115 | then |
116 | touch /etc/ld.so.conf || die |
117 | fi |
118 | } |
119 | |
120 | src_compile() |
121 | { |
122 | local myopts |
123 | |
124 | # generic pathes |
125 | myopts="--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info" |
126 | # disable profiling |
127 | myopts+=" --disable-profile" |
128 | # enable addons |
129 | myopts+=" --enable-add-ons=nptl,libidn" |
130 | # enable tls |
131 | myopts+=" --with-tls --with-__thread" |
132 | # supported kernel-release |
133 | myopts+=" --enable-kernel=${ENABLE_KERNEL}" |
134 | # disable cvs and gd support |
135 | myopts+=" --without-cvs --without-gd" |
136 | # enable bindnow |
137 | myopts+=" --enable-bind-now" |
138 | # enable obsolete rpc implementation |
139 | myopts+=" --enable-obsolete-rpc" |
140 | |
141 | # support multilib lib64 dir (x86_64 only) |
142 | if [[ ${ARCH} = x86_64 ]] |
143 | then |
144 | # first build a -m32 version |
145 | install -d ${SRCDIR}/build-m32 |
146 | cd ${SRCDIR}/build-m32 |
147 | |
148 | CC="gcc -m32" CXX="g++ -m32" \ |
149 | CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \ |
150 | CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \ |
151 | ../configure \ |
152 | --build=${CHOST} \ |
153 | --host=i686-pc-linux-gnu \ |
154 | --libdir=/usr/lib \ |
155 | --libexecdir=/usr/lib/glibc \ |
156 | ${myopts} \ |
157 | || die |
158 | |
159 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
160 | fi |
161 | |
162 | cd ${SRCDIR}/build |
163 | |
164 | if [[ ${ARCH} = x86_64 ]]; then |
165 | # make sure the -m64 libs goes really to /lib64 |
166 | echo "slibdir=/$(mlibdir)" >> ${SRCDIR}/build/configparms || die |
167 | fi |
168 | |
169 | # kernel-2.6 with nptl needs this |
170 | ../configure \ |
171 | --build=${CHOST} \ |
172 | --host=${CHOST} \ |
173 | --libdir=/usr/$(mlibdir) \ |
174 | --libexecdir=/usr/$(mlibdir)/glibc \ |
175 | ${myopts} \ |
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} slibdir=/usr/lib rootsbindir=/usr/sbin install || die |
188 | fi |
189 | |
190 | cd ${SRCDIR}/build |
191 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} slibdir=/usr/$(mlibdir) rootsbindir=/usr/sbin 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 | # generate locale.gen file from localedata/SUPPORTED file |
198 | minstalletc locale.gen-header locale.gen || die |
199 | sed \ |
200 | -e 's:/: :g' \ |
201 | -e 's:\\: :g' \ |
202 | -e 's:SUPPORTED-LOCALES=::' \ |
203 | -e 's:\ \ $::g' \ |
204 | -e '/^#/d' \ |
205 | -e 's:^:#:g' \ |
206 | ${SRCDIR}/localedata/SUPPORTED \ |
207 | >> ${BINDIR}/etc/locale.gen || die |
208 | minstalldir /usr/sbin || die |
209 | minstallexec -s locale-gen /usr/sbin || die |
210 | |
211 | # nsswitch configuration file |
212 | minstalletc ${SRCDIR}/nss/nsswitch.conf || die |
213 | |
214 | # nscd configuration file |
215 | minstalletc ${SRCDIR}/nscd/nscd.conf || die |
216 | |
217 | # gai configuration file |
218 | minstalletc ${SRCDIR}/posix/gai.conf || die |
219 | |
220 | # now in tzdata |
221 | ## we use Berlin as default |
222 | ## busybox compat |
223 | #local args |
224 | #if need_busybox_support /bin/cp |
225 | #then |
226 | # args="-f" |
227 | #else |
228 | # args="--remove-destination" |
229 | #fi |
230 | #cp ${args} ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die |
231 | [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; } |
232 | [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; } |
233 | |
234 | # base environment |
235 | minstallenv glibc.envd-${ENVD_REV} 00glibc || die |
236 | if [[ ${ARCH} = x86_64 ]] |
237 | then |
238 | MCONFIG="/etc/env.d/00glibc" |
239 | maddconfig "LDPATH=\"/$(mlibdir)\"" || die |
240 | maddconfig "LDPATH=\"/usr/$(mlibdir)\"" || die |
241 | maddconfig "LDPATH=\"/usr/local/$(mlibdir)\"" || die |
242 | maddconfig "LDPATH=\"/opt/$(mlibdir)\"" || die |
243 | fi |
244 | |
245 | # strip all binaries |
246 | find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die |
247 | |
248 | # strip all libraries |
249 | # want to be safe here; --strip-unneeded seems to cause pthread problems |
250 | # strip all but libpthread |
251 | install -d ${BUILDDIR}/thread-backup || die |
252 | mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die |
253 | |
254 | # now strip |
255 | find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die |
256 | mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/usr/$(mlibdir)/ || die |
257 | # remove stale directory |
258 | rm -rf ${BUILDDIR}/thread-backup || die |
259 | |
260 | # prepare glibc for installation; slackware method |
261 | minstalldir /incoming || die |
262 | mv ${BINDIR}/usr/$(mlibdir)/*.so ${BINDIR}/incoming || die |
263 | mv ${BINDIR}/usr/$(mlibdir)/*.so.* ${BINDIR}/incoming || die |
264 | mv ${BINDIR}/incoming ${BINDIR}/usr/$(mlibdir)/incoming || die |
265 | mv ${BINDIR}/usr/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/usr/$(mlibdir) || die |
266 | } |
267 | |
268 | fix_db_files() |
269 | { |
270 | local i |
271 | local DB_ENTRY="${BUILDDIR}/${PKGNAME}" |
272 | |
273 | for i in .files .symlinks .dirs |
274 | do |
275 | [ ! -f ${DB_ENTRY}/${i} ] && continue |
276 | [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue |
277 | |
278 | echo " fixing /usr/$(mlibdir)/incoming from db-entry '${i}' ..." |
279 | |
280 | # /usr/lib/incoming -> empty line; sed2 removes all empty lines |
281 | #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} |
282 | # do not simply emtpy the line, but change it the the correct path, |
283 | # so no stale libs are around if the package gets updated! |
284 | sed -i \ |
285 | -e "s:/usr/$(mlibdir)/incoming:/usr/$(mlibdir):g" \ |
286 | -e "s:/usr/$(mlibdir)/incoming.*::g" \ |
287 | -e '/^$/d' ${DB_ENTRY}/${i} |
288 | done |
289 | } |
290 | |
291 | postinstall() |
292 | { |
293 | # first save the old libpthread.so.0; |
294 | # it will later used to determinate that there are no stale |
295 | # libpthreads that breaks ldconfig |
296 | local OLD_PTHREAD |
297 | OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
298 | |
299 | # slackware install method |
300 | |
301 | # we cannot easily install the glibc libs, |
302 | # because our tools for cp etc needs them to run |
303 | |
304 | local file |
305 | |
306 | echo " Switching to new glibc ..." |
307 | # swap libraries on the fly: |
308 | if [ -x /usr/sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] |
309 | then |
310 | # first create copies of the incoming libraries: |
311 | cd /usr/$(mlibdir)/incoming |
312 | for file in $(find /usr/$(mlibdir)/incoming -type f) |
313 | do |
314 | if [ ! -r "../$(basename ${file}).incoming" ] |
315 | then |
316 | cp -a ${file} ../$(basename ${file}).incoming |
317 | fi |
318 | done |
319 | |
320 | # then switch to them all at once: |
321 | /usr/sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null |
322 | |
323 | # finally, rename them and clean up: |
324 | cd /usr/$(mlibdir) |
325 | for file in *.incoming |
326 | do |
327 | rm -f $(basename ${file} .incoming) |
328 | cp -a ${file} $(basename ${file} .incoming) |
329 | /usr/sbin/ldconfig -l $(basename ${file} .incoming) |
330 | rm -f ${file} |
331 | done |
332 | |
333 | # no ldconfig? |
334 | # good, it's safe to just jam it on home (and make links below): |
335 | else |
336 | ( |
337 | cd ${MROOT}/usr/$(mlibdir)/incoming |
338 | for file in * |
339 | do |
340 | cp -a ${file} .. |
341 | done |
342 | |
343 | local my_sym |
344 | local my_dest |
345 | |
346 | # rebuild symlinks |
347 | echo " Recreating Symlinks:" |
348 | for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l) |
349 | do |
350 | my_sym="$(readlink ${i})" |
351 | my_dest="$(basename ${i})" |
352 | |
353 | echo " ${my_dest} -> ${my_dest}" |
354 | |
355 | # assure to remove the old ones; |
356 | [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \ |
357 | rm ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
358 | |
359 | ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
360 | done |
361 | ) |
362 | fi |
363 | |
364 | # now, get rid of the temporary directory: |
365 | rm -rf ${MROOT}/usr/$(mlibdir)/incoming |
366 | |
367 | # remove stale nptl libpthread-2.?.?.so, |
368 | # fix only needed for glibc with linuxthreads; |
369 | # prevent reloc errors such as: |
370 | # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory |
371 | |
372 | # get our new libpthread.so.0 |
373 | local NEW_PTHREAD |
374 | NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
375 | |
376 | if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] |
377 | then |
378 | echo " Removing stale libpthread libraries ..." |
379 | for file in ${MROOT}/usr/$(mlibdir)/libpthread-* |
380 | do |
381 | if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] |
382 | then |
383 | rm -f ${file} |
384 | fi |
385 | done |
386 | |
387 | #rm -f /lib/${OLD_PTHREAD} |
388 | |
389 | ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0 |
390 | fi |
391 | |
392 | if [ -x /usr/sbin/iconvconfig ] |
393 | then |
394 | # generate fastloading iconv module configuration file. |
395 | echo " Generate iconv module config ..." |
396 | /usr/sbin/iconvconfig --prefix=${MROOT}/ |
397 | fi |
398 | |
399 | # not working with busybox |
400 | if ! need_busybox_support /sbin/init |
401 | then |
402 | # reloading init |
403 | echo " Reloading init ..." |
404 | [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null |
405 | fi |
406 | |
407 | # generating user def locales |
408 | echo " Generating user defined locales ..." |
409 | [[ -z ${MROOT} ]] && /usr/sbin/locale-gen |
410 | |
411 | # now we must fix the mage db files |
412 | # to stop the annoying errors messages |
413 | fix_db_files |
414 | } |