/[gentoo-x86]/sys-libs/glibc/glibc-2.3.6-r5.ebuild
Gentoo

Contents of /sys-libs/glibc/glibc-2.3.6-r5.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.29 - (show annotations) (download)
Mon Dec 14 14:44:09 2009 UTC (5 years, 2 months ago) by vapier
Branch: MAIN
CVS Tags: HEAD
Changes since 1.28: +1 -1 lines
FILE REMOVED
old
(Portage version: 2.2_rc55/cvs/Linux x86_64)

1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.3.6-r5.ebuild,v 1.28 2009/12/10 01:31:25 vapier Exp $
4
5 # Here's how the cross-compile logic breaks down ...
6 # CTARGET - machine that will target the binaries
7 # CHOST - machine that will host the binaries
8 # CBUILD - machine that will build the binaries
9 # If CTARGET != CHOST, it means you want a libc for cross-compiling.
10 # If CHOST != CBUILD, it means you want to cross-compile the libc.
11 # CBUILD = CHOST = CTARGET - native build/install
12 # CBUILD != (CHOST = CTARGET) - cross-compile a native build
13 # (CBUILD = CHOST) != CTARGET - libc for cross-compiler
14 # CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
15 # For install paths:
16 # CHOST = CTARGET - install into /
17 # CHOST != CTARGET - install into /usr/CTARGET/
18
19 KEYWORDS="-* alpha amd64 arm hppa ia64 mips ppc ppc64 ~s390 sh sparc x86"
20
21 BRANCH_UPDATE=""
22
23 # Generated man pages
24 GLIBC_MANPAGE_VERSION="2.3.6-1"
25
26 # Generated stuff in manual subdir
27 GLIBC_INFOPAGE_VERSION="2.3.6"
28
29 # Gentoo patchset
30 PATCH_VER="1.19"
31
32 GENTOO_TOOLCHAIN_BASE_URI="mirror://gentoo"
33 GENTOO_TOOLCHAIN_DEV_URI="http://dev.gentoo.org/~azarah/glibc/XXX http://dev.gentoo.org/~vapier/dist/XXX"
34
35 ### PUNT OUT TO ECLASS?? ###
36 inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib
37
38 DESCRIPTION="GNU libc6 (also called glibc2) C library"
39 HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
40 LICENSE="LGPL-2"
41
42 IUSE="nls build nptl nptlonly erandom hardened multilib selinux glibc-compat20 glibc-omitfp profile"
43
44 export CBUILD=${CBUILD:-${CHOST}}
45 export CTARGET=${CTARGET:-${CHOST}}
46 if [[ ${CTARGET} == ${CHOST} ]] ; then
47 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
48 export CTARGET=${CATEGORY/cross-}
49 fi
50 fi
51 if [[ ${CTARGET} == ${CHOST} ]] ; then
52 PROVIDE="virtual/libc"
53 fi
54
55 is_crosscompile() {
56 [[ ${CHOST} != ${CTARGET} ]]
57 }
58 just_headers() {
59 is_crosscompile && use crosscompile_opts_headers-only
60 }
61
62 GLIBC_RELEASE_VER=$(get_version_component_range 1-3)
63
64 # Don't set this to :-, - allows BRANCH_UPDATE=""
65 BRANCH_UPDATE=${BRANCH_UPDATE-$(get_version_component_range 4)}
66
67 # (Recent snapshots fails with 2.6.5 and earlier with NPTL)
68 NPTL_KERNEL_VERSION=${NPTL_KERNEL_VERSION:-"2.6.9"}
69 LT_KERNEL_VERSION=${LT_KERNEL_VERSION:-"2.4.1"}
70
71 ### SRC_URI ###
72
73 # This function handles the basics of setting the SRC_URI for a glibc ebuild.
74 # To use, set SRC_URI with:
75 #
76 # SRC_URI="$(get_glibc_src_uri)"
77 #
78 # Other than the variables normally set by portage, this function's behavior
79 # can be altered by setting the following:
80 #
81 # GENTOO_TOOLCHAIN_BASE_URI
82 # This sets the base URI for all gentoo-specific patch files. Note
83 # that this variable is only important for a brief period of time,
84 # before your source files get picked up by mirrors. However, it is
85 # still highly suggested that you keep files in this location
86 # available.
87 #
88 # BRANCH_UPDATE
89 # If set, this variable signals that we should be using the main
90 # release tarball (determined by ebuild version) and applying a
91 # CVS branch update patch against it. The location of this branch
92 # update patch is assumed to be in ${GENTOO_TOOLCHAIN_BASE_URI}.
93 # Just like with SNAPSHOT, this variable is ignored if the ebuild
94 # has a _pre suffix.
95 #
96 # PATCH_VER
97 # PATCH_GLIBC_VER
98 # This should be set to the version of the gentoo patch tarball.
99 # The resulting filename of this tarball will be:
100 # glibc-${PATCH_GLIBC_VER:-${GLIBC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2
101 #
102 # GLIBC_MANPAGE_VERSION
103 # GLIBC_INFOPAGE_VERSION
104 # The version of glibc for which we will download pages. This will
105 # default to ${GLIBC_RELEASE_VER}, but we may not want to pre-generate man pages
106 # for prerelease test ebuilds for example. This allows you to
107 # continue using pre-generated manpages from the last stable release.
108 # If set to "none", this will prevent the downloading of manpages,
109 # which is useful for individual library targets.
110 #
111 get_glibc_src_uri() {
112 GENTOO_TOOLCHAIN_BASE_URI=${GENTOO_TOOLCHAIN_BASE_URI:-"mirror://gentoo"}
113
114 # GLIBC_SRC_URI="http://ftp.gnu.org/gnu/glibc/glibc-${GLIBC_RELEASE_VER}.tar.bz2
115 # http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-${GLIBC_RELEASE_VER}.tar.bz2
116 # http://ftp.gnu.org/gnu/glibc/glibc-libidn-${GLIBC_RELEASE_VER}.tar.bz2
117 GLIBC_SRC_URI="mirror://gnu/glibc/glibc-${GLIBC_RELEASE_VER}.tar.bz2
118 mirror://gnu/glibc/glibc-linuxthreads-${GLIBC_RELEASE_VER}.tar.bz2
119 mirror://gnu/glibc/glibc-libidn-${GLIBC_RELEASE_VER}.tar.bz2"
120
121 if [[ -n ${BRANCH_UPDATE} ]] ; then
122 GLIBC_SRC_URI="${GLIBC_SRC_URI}
123 ${GENTOO_TOOLCHAIN_BASE_URI}/glibc-${GLIBC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
124 ${GENTOO_TOOLCHAIN_DEV_URI//XXX/glibc-${GLIBC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2}"
125 fi
126
127 if [[ -n ${PATCH_VER} ]] ; then
128 GLIBC_SRC_URI="${GLIBC_SRC_URI}
129 ${GENTOO_TOOLCHAIN_BASE_URI}/glibc-${PATCH_GLIBC_VER:-${GLIBC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2
130 ${GENTOO_TOOLCHAIN_DEV_URI//XXX/glibc-${PATCH_GLIBC_VER:-${GLIBC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2}"
131 fi
132
133 if [[ ${GLIBC_MANPAGE_VERSION} != "none" ]] ; then
134 GLIBC_SRC_URI="${GLIBC_SRC_URI}
135 ${GENTOO_TOOLCHAIN_BASE_URI}/glibc-manpages-${GLIBC_MANPAGE_VERSION:-${GLIBC_RELEASE_VER}}.tar.bz2
136 ${GENTOO_TOOLCHAIN_DEV_URI//XXX/glibc-manpages-${GLIBC_MANPAGE_VERSION:-${GLIBC_RELEASE_VER}}.tar.bz2}"
137 fi
138
139 if [[ ${GLIBC_INFOPAGE_VERSION} != "none" ]] ; then
140 GLIBC_SRC_URI="${GLIBC_SRC_URI}
141 ${GENTOO_TOOLCHAIN_BASE_URI}/glibc-infopages-${GLIBC_INFOPAGE_VERSION:-${GLIBC_RELEASE_VER}}.tar.bz2
142 ${GENTOO_TOOLCHAIN_DEV_URI//XXX/glibc-infopages-${GLIBC_INFOPAGE_VERSION:-${GLIBC_RELEASE_VER}}.tar.bz2}"
143 fi
144
145 echo "${GLIBC_SRC_URI}"
146 }
147
148 SRC_URI=$(get_glibc_src_uri)
149 S=${WORKDIR}/glibc-${GLIBC_RELEASE_VER}
150
151 ### EXPORTED FUNCTIONS ###
152 toolchain-glibc_src_unpack() {
153 # Check NPTL support _before_ we unpack things to save some time
154 want_nptl && check_nptl_support
155
156 unpack glibc-${GLIBC_RELEASE_VER}.tar.bz2
157
158 cd "${S}"
159 unpack glibc-linuxthreads-${GLIBC_RELEASE_VER}.tar.bz2
160 unpack glibc-libidn-${GLIBC_RELEASE_VER}.tar.bz2
161
162 if [[ -n ${PATCH_VER} ]] ; then
163 cd "${WORKDIR}"
164 unpack glibc-${PATCH_GLIBC_VER:-${GLIBC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2
165 # pull out all the addons
166 local d
167 for d in extra/*/configure ; do
168 mv "${d%/configure}" "${S}" || die "moving ${d}"
169 done
170 fi
171
172 # XXX: We should do the branchupdate, before extracting the manpages and
173 # infopages else it does not help much (mtimes change if there is a change
174 # to them with branchupdate)
175 if [[ -n ${BRANCH_UPDATE} ]] ; then
176 cd "${S}"
177 epatch "${DISTDIR}"/glibc-${GLIBC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
178
179 # Snapshot date patch
180 einfo "Patching version to display snapshot date ..."
181 sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" version.h
182 fi
183
184 if [[ ${GLIBC_MANPAGE_VERSION} != "none" ]] ; then
185 cd "${WORKDIR}"
186 unpack glibc-manpages-${GLIBC_MANPAGE_VERSION:-${GLIBC_RELEASE_VER}}.tar.bz2
187 fi
188
189 if [[ ${GLIBC_INFOPAGE_VERSION} != "none" ]] ; then
190 cd "${S}"
191 unpack glibc-infopages-${GLIBC_INFOPAGE_VERSION:-${GLIBC_RELEASE_VER}}.tar.bz2
192 fi
193
194 if [[ -n ${PATCH_VER} ]] ; then
195 cd "${S}"
196 EPATCH_MULTI_MSG="Applying Gentoo Glibc Patchset ${PATCH_GLIBC_VER:-${GLIBC_RELEASE_VER}}-${PATCH_VER} ..." \
197 EPATCH_EXCLUDE=${GLIBC_PATCH_EXCLUDE} \
198 EPATCH_SUFFIX="patch" \
199 ARCH=$(tc-arch) \
200 epatch "${WORKDIR}"/patches
201
202 # tag, glibc is it
203 [[ -e csu/Banner ]] && die "need new banner location"
204 echo "Gentoo patchset ${PATCH_VER}" > csu/Banner
205 fi
206
207 gnuconfig_update
208 }
209
210 toolchain-glibc_src_compile() {
211 echo
212 local v
213 for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC CFLAGS ; do
214 einfo " $(printf '%15s' ${v}:) ${!v}"
215 done
216 echo
217
218 if want_linuxthreads ; then
219 glibc_do_configure linuxthreads
220 einfo "Building GLIBC with linuxthreads..."
221 make PARALLELMFLAGS="${MAKEOPTS}" || die "make for ${ABI} failed"
222 fi
223 if want_nptl ; then
224 # ... and then do the optional nptl build
225 unset LD_ASSUME_KERNEL
226 glibc_do_configure nptl
227 einfo "Building GLIBC with NPTL..."
228 make PARALLELMFLAGS="${MAKEOPTS}" || die "make for ${ABI} failed"
229 fi
230 }
231
232 toolchain-glibc_headers_compile() {
233 local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers
234 mkdir -p "${GBUILDDIR}"
235 cd "${GBUILDDIR}"
236
237 # Pick out the correct location for build headers
238 local myconf="--disable-sanity-checks --enable-hacker-mode"
239 myconf="${myconf}
240 --enable-add-ons=linuxthreads
241 --without-cvs
242 --enable-bind-now
243 --build=${CBUILD_OPT:-${CBUILD}}
244 --host=${CTARGET_OPT:-${CTARGET}}
245 --with-headers=$(alt_build_headers)
246 --prefix=/usr
247 ${EXTRA_ECONF}"
248
249 einfo "Configuring GLIBC headers with: ${myconf// /\n\t\t}"
250 CC=gcc \
251 CFLAGS="-O1 -pipe" \
252 "${S}"/configure ${myconf} || die "failed to configure glibc"
253 }
254
255 toolchain-glibc_src_test() {
256 # This is wrong, but glibc's tests fail bad when screwing
257 # around with sandbox, so lets just punt it
258 unset LD_PRELOAD
259
260 # do the linuxthreads build unless we're using nptlonly
261 if want_linuxthreads ; then
262 cd "${WORKDIR}"/build-${ABI}-${CTARGET}-linuxthreads
263 einfo "Checking GLIBC with linuxthreads..."
264 make check || die "linuxthreads glibc did not pass make check"
265 fi
266 if want_nptl ; then
267 cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
268 unset LD_ASSUME_KERNEL || :
269 einfo "Checking GLIBC with NPTL..."
270 make check || die "nptl glibc did not pass make check"
271 fi
272 }
273
274 toolchain-glibc_pkg_preinst() {
275 # PPC64+others may want to eventually be added to this logic if they
276 # decide to be multilib compatible and FHS compliant. note that this
277 # chunk of FHS compliance only applies to 64bit archs where 32bit
278 # compatibility is a major concern (not IA64, for example).
279
280 # amd64's 2005.0 is the first amd64 profile to not need this code.
281 # 2005.0 is setup properly, and this is executed as part of the
282 # 2004.3 -> 2005.0 upgrade script.
283 # It can be removed after 2004.3 has been purged from portage.
284 { use amd64 || use ppc64; } && [ "$(get_libdir)" == "lib64" ] && ! has_multilib_profile && fix_lib64_symlinks
285
286 # it appears that /lib/tls is sometimes not removed. See bug
287 # 69258 for more info.
288 if [[ -d ${ROOT}/$(alt_libdir)/tls ]] && ! { want_nptl && want_linuxthreads; }; then
289 addwrite "${ROOT}"/$(alt_libdir)/
290 ewarn "nptlonly or -nptl in USE, removing /${ROOT}$(alt_libdir)/tls..."
291 rm -r "${ROOT}"/$(alt_libdir)/tls || die
292 fi
293
294 # Shouldnt need to keep this updated
295 [[ -e ${ROOT}/etc/locale.gen ]] && rm -f "${D}"/etc/locale.gen
296 }
297
298 toolchain-glibc_src_install() {
299 # These should not be set, else the
300 # zoneinfo do not always get installed ...
301 unset LANGUAGE LANG LC_ALL
302
303 local GBUILDDIR
304 if want_linuxthreads ; then
305 GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-linuxthreads
306 else
307 GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-nptl
308 fi
309
310 local install_root=${D}
311 if is_crosscompile ; then
312 install_root="${install_root}/usr/${CTARGET}"
313 fi
314 if want_linuxthreads ; then
315 cd "${WORKDIR}"/build-${ABI}-${CTARGET}-linuxthreads
316 einfo "Installing GLIBC ${ABI} with linuxthreads ..."
317 make PARALLELMFLAGS="${MAKEOPTS} -j1" \
318 install_root="${install_root}" \
319 install || die
320 else # nptlonly
321 cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
322 einfo "Installing GLIBC ${ABI} with NPTL ..."
323 make PARALLELMFLAGS="${MAKEOPTS} -j1" \
324 install_root="${install_root}" \
325 install || die
326 fi
327
328 if is_crosscompile ; then
329 # punt all the junk not needed by a cross-compiler
330 cd "${D}"/usr/${CTARGET} || die
331 rm -rf ./{,usr/}{bin,etc,sbin,share} ./{,usr/}*/{gconv,misc}
332 fi
333
334 if want_linuxthreads && want_nptl ; then
335 einfo "Installing NPTL to $(alt_libdir)/tls/..."
336 cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
337 dodir $(alt_libdir)/tls $(alt_usrlibdir)/nptl
338
339 local l src_lib
340 for l in libc libm librt libpthread libthread_db ; do
341 # take care of shared lib first ...
342 l=${l}.so
343 if [[ -e ${l} ]] ; then
344 src_lib=${l}
345 else
346 src_lib=$(eval echo */${l})
347 fi
348 cp -a ${src_lib} "${D}"$(alt_libdir)/tls/${l} || die "copying nptl ${l}"
349 fperms a+rx $(alt_libdir)/tls/${l}
350 dosym ${l} $(alt_libdir)/tls/$(scanelf -qSF'%S#F' ${src_lib})
351
352 # then grab the linker script or the symlink ...
353 if [[ -L ${D}$(alt_usrlibdir)/${l} ]] ; then
354 dosym $(alt_libdir)/tls/${l} $(alt_usrlibdir)/nptl/${l}
355 else
356 sed \
357 -e "s:/${l}:/tls/${l}:g" \
358 -e "s:/${l/%.so/_nonshared.a}:/nptl/${l/%.so/_nonshared.a}:g" \
359 "${D}"$(alt_usrlibdir)/${l} > "${D}"$(alt_usrlibdir)/nptl/${l}
360 fi
361
362 # then grab the static lib ...
363 src_lib=${src_lib/%.so/.a}
364 [[ ! -e ${src_lib} ]] && src_lib=${src_lib/%.a/_pic.a}
365 cp -a ${src_lib} "${D}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
366 src_lib=${src_lib/%.a/_nonshared.a}
367 if [[ -e ${src_lib} ]] ; then
368 cp -a ${src_lib} "${D}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
369 fi
370 done
371
372 # use the nptl linker instead of the linuxthreads one as the linuxthreads
373 # one may lack TLS support and that can be really bad for business
374 cp -a elf/ld.so "${D}"$(alt_libdir)/$(scanelf -qSF'%S#F' elf/ld.so) || die "copying nptl interp"
375 fi
376
377 # We'll take care of the cache ourselves
378 rm -f "${D}"/etc/ld.so.cache
379
380 # Some things want this, notably ash.
381 dosym libbsd-compat.a $(alt_usrlibdir)/libbsd.a
382
383 # Handle includes for different ABIs
384 prep_ml_includes $(alt_headers)
385
386 # When cross-compiling for a non-multilib setup, make sure we have
387 # lib and a proper symlink setup
388 if is_crosscompile && ! use multilib && ! has_multilib_profile && [[ $(get_libdir) != "lib" ]] ; then
389 cd "${D}"$(alt_libdir)/..
390 mv $(get_libdir) lib || die
391 ln -s lib $(get_libdir) || die
392 cd "${D}"$(alt_usrlibdir)/..
393 mv $(get_libdir) lib || die
394 ln -s lib $(get_libdir) || die
395 fi
396
397 #################################################################
398 # EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
399 # Make sure we install some symlink hacks so that when we build
400 # a 2nd stage cross-compiler, gcc finds the target system
401 # headers correctly. See gcc/doc/gccinstall.info
402 if is_crosscompile ; then
403 dosym usr/include /usr/${CTARGET}/sys-include
404 return 0
405 fi
406
407 # Everything past this point just needs to be done once ...
408 is_final_abi || return 0
409
410 # Make sure the non-native interp can be found on multilib systems
411 if has_multilib_profile ; then
412 case $(tc-arch) in
413 amd64)
414 [[ ! -e ${D}/lib ]] && dosym $(get_abi_LIBDIR amd64) /lib
415 dosym /$(get_abi_LIBDIR x86)/ld-linux.so.2 /lib/ld-linux.so.2
416 ;;
417 ppc64)
418 [[ ! -e ${D}/lib ]] && dosym $(get_abi_LIBDIR ppc64) /lib
419 dosym /$(get_abi_LIBDIR ppc)/ld.so.1 /lib/ld.so.1
420 ;;
421 esac
422 fi
423
424 # Files for Debian-style locale updating
425 dodir /usr/share/i18n
426 sed \
427 -e "/^#/d" \
428 -e "/SUPPORTED-LOCALES=/d" \
429 -e "s: \\\\::g" -e "s:/: :g" \
430 "${S}"/localedata/SUPPORTED > "${D}"/usr/share/i18n/SUPPORTED \
431 || die "generating /usr/share/i18n/SUPPORTED failed"
432 cd "${WORKDIR}"/extra/locale
433 dosbin locale-gen || die
434 doman *.[0-8]
435 insinto /etc
436 doins locale.gen || die
437
438 # Make sure all the ABI's can find the locales and so we only
439 # have to generate one set
440 local a
441 keepdir /usr/$(get_libdir)/locale
442 for a in $(get_install_abis) ; do
443 if [[ ! -e ${D}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
444 dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
445 fi
446 done
447
448 if ! has noinfo ${FEATURES} && [[ ${GLIBC_INFOPAGE_VERSION} != "none" ]] ; then
449 einfo "Installing info pages..."
450
451 make \
452 -C "${GBUILDDIR}" \
453 PARALLELMFLAGS="${MAKEOPTS} -j1" \
454 install_root="${install_root}" \
455 info -i || die
456 fi
457
458 if [[ ${GLIBC_MANPAGE_VERSION} != "none" ]] ; then
459 einfo "Installing man pages..."
460
461 # Install linuxthreads man pages even if nptl is enabled
462 cd "${WORKDIR}"/man
463 doman *.3thr
464 fi
465
466 # Install misc network config files
467 insinto /etc
468 doins "${WORKDIR}"/extra/etc/*.conf || die
469 doinitd "${WORKDIR}"/extra/etc/nscd || die
470
471 cd "${S}"
472 dodoc BUGS ChangeLog* CONFORMANCE FAQ INTERFACE NEWS NOTES PROJECTS README*
473
474 # Prevent overwriting of the /etc/localtime symlink. We'll handle the
475 # creation of the "factory" symlink in pkg_postinst().
476 rm -f "${D}"/etc/localtime
477
478 # simple test to make sure our new glibc isnt completely broken.
479 # for now, skip the multilib scenario. also make sure we don't
480 # test with statically built binaries since they will fail.
481 [[ ${CBUILD} != ${CHOST} ]] && return 0
482 [[ $(get_libdir) != "lib" ]] && return 0
483 for x in date env ls true uname ; do
484 x=$(type -p ${x})
485 [[ -z ${x} ]] && continue
486 striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null)
487 [[ -z ${striptest} ]] && continue
488 [[ ${striptest} == *"statically linked"* ]] && continue
489 "${D}"/$(get_libdir)/ld-*.so \
490 --library-path "${D}"/$(get_libdir) \
491 ${x} > /dev/null \
492 || die "simple run test (${x}) failed"
493 done
494 }
495
496 toolchain-glibc_headers_install() {
497 local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers
498 cd "${GBUILDDIR}"
499 make install_root="${D}/usr/${CTARGET}" install-headers || die "install-headers failed"
500 # Copy over headers that are not part of install-headers ... these
501 # are pretty much taken verbatim from crosstool, see it for more details
502 insinto $(alt_headers)/bits
503 doins misc/syscall-list.h bits/stdio_lim.h || die "doins include bits"
504 insinto $(alt_headers)/gnu
505 doins "${S}"/include/gnu/stubs.h || die "doins include gnu"
506 # Make sure we install the sys-include symlink so that when
507 # we build a 2nd stage cross-compiler, gcc finds the target
508 # system headers correctly. See gcc/doc/gccinstall.info
509 dosym usr/include /usr/${CTARGET}/sys-include
510 }
511
512 toolchain-glibc_pkg_postinst() {
513 # Mixing nptlonly and -nptlonly glibc can prove dangerous if libpthread
514 # isn't removed in unmerge which happens sometimes. See bug #87671
515 if ! is_crosscompile && want_linuxthreads && [[ ${ROOT} == "/" ]] ; then
516 for libdir in $(get_all_libdirs) ; do
517 for f in "${ROOT}"/${libdir}/libpthread-2.* "${ROOT}"/${libdir}/libpthread-0.6* ; do
518 if [[ -f ${f} ]] ; then
519 rm -f ${f}
520 ldconfig
521 fi
522 done
523 done
524 fi
525
526 if ! tc-is-cross-compiler && [[ -x ${ROOT}/usr/sbin/iconvconfig ]] ; then
527 # Generate fastloading iconv module configuration file.
528 "${ROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
529 fi
530
531 if [[ ! -e ${ROOT}/lib/ld.so.1 ]] && use ppc64 && ! has_multilib_profile ; then
532 ## SHOULDN'T THIS BE lib64??
533 ln -s ld64.so.1 "${ROOT}"/lib/ld.so.1
534 fi
535
536 if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
537 # Reload init ...
538 /sbin/telinit U &> /dev/null
539
540 # if the host locales.gen contains no entries, we'll install everything
541 local locale_list="${ROOT}etc/locale.gen"
542 if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
543 ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
544 locale_list="${ROOT}usr/share/i18n/SUPPORTED"
545 fi
546 local x jobs
547 for x in ${MAKEOPTS} ; do [[ ${x} == -j* ]] && jobs=${x#-j} ; done
548 locale-gen -j ${jobs:-1} --config "${locale_list}"
549 fi
550
551 echo
552 einfo "Gentoo's glibc no longer includes mdns."
553 einfo "If you want mdns, emerge the sys-auth/nss-mdns package."
554 echo
555
556 if want_nptl && want_linuxthreads ; then
557 einfo "The default behavior of glibc on your system is to use NPTL. If"
558 einfo "you want to use linuxthreads for a particular program, start it"
559 einfo "by executing 'LD_ASSUME_KERNEL=${LT_KERNEL_VERSION} <program> [<options>]'"
560 echo
561 fi
562 }
563
564 ### SUPPORT FUNCTIONS ###
565 # We need to be able to set alternative headers for
566 # compiling for non-native platform
567 # Will also become useful for testing kernel-headers without screwing up
568 # the whole system.
569 # note: intentionally undocumented.
570 alt_headers() {
571 if [[ -z ${ALT_HEADERS} ]] ; then
572 if is_crosscompile ; then
573 ALT_HEADERS="/usr/${CTARGET}/usr/include"
574 else
575 ALT_HEADERS="/usr/include"
576 fi
577 fi
578 echo "${ALT_HEADERS}"
579 }
580 alt_build_headers() {
581 if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
582 ALT_BUILD_HEADERS=$(alt_headers)
583 tc-is-cross-compiler && ALT_BUILD_HEADERS=${ROOT}$(alt_headers)
584 fi
585 echo "${ALT_BUILD_HEADERS}"
586 }
587
588 alt_libdir() {
589 if is_crosscompile ; then
590 echo /usr/${CTARGET}/$(get_libdir)
591 else
592 echo /$(get_libdir)
593 fi
594 }
595
596 alt_usrlibdir() {
597 if is_crosscompile ; then
598 echo /usr/${CTARGET}/usr/$(get_libdir)
599 else
600 echo /usr/$(get_libdir)
601 fi
602 }
603
604 setup_flags() {
605 # Make sure host make.conf doesn't pollute us
606 if is_crosscompile || tc-is-cross-compiler ; then
607 CHOST=${CTARGET} strip-unsupported-flags
608 fi
609
610 # Store our CFLAGS because it's changed depending on which CTARGET
611 # we are building when pulling glibc on a multilib profile
612 CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
613 CFLAGS=${CFLAGS_BASE}
614 ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
615 ASFLAGS=${ASFLAGS_BASE}
616
617 # Over-zealous CFLAGS can often cause problems. What may work for one
618 # person may not work for another. To avoid a large influx of bugs
619 # relating to failed builds, we strip most CFLAGS out to ensure as few
620 # problems as possible.
621 strip-flags
622 strip-unsupported-flags
623 filter-flags -m32 -m64 -mabi=*
624
625 unset CBUILD_OPT CTARGET_OPT
626 if has_multilib_profile ; then
627 CTARGET_OPT=$(get_abi_CTARGET)
628 [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
629 fi
630
631 case $(tc-arch) in
632 amd64)
633 # Punt this when amd64's 2004.3 is removed
634 CFLAGS_x86="-m32"
635 ;;
636 ppc)
637 append-flags "-freorder-blocks"
638 ;;
639 sparc)
640 # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though.
641 filter-flags "-fcall-used-g7"
642 append-flags "-fcall-used-g6"
643 filter-flags "-mvis"
644
645 if is_crosscompile || [[ ${PROFILE_ARCH} == "sparc64" ]] || { has_multilib_profile && ! tc-is-cross-compiler; } ; then
646 case ${ABI} in
647 sparc64)
648 filter-flags -Wa,-xarch -Wa,-A
649
650 if is-flag "-mcpu=ultrasparc3"; then
651 CTARGET_OPT="sparc64b-unknown-linux-gnu"
652 append-flags "-Wa,-xarch=v9b"
653 export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
654 else
655 CTARGET_OPT="sparc64-unknown-linux-gnu"
656 append-flags "-Wa,-xarch=v9a"
657 export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9a"
658 fi
659 ;;
660 *)
661 if is-flag "-mcpu=ultrasparc3"; then
662 CTARGET_OPT="sparcv9b-unknown-linux-gnu"
663 else
664 CTARGET_OPT="sparcv9-unknown-linux-gnu"
665 fi
666 ;;
667 esac
668 else
669 if is-flag "-mcpu=ultrasparc3"; then
670 CTARGET_OPT="sparcv9b-unknown-linux-gnu"
671 elif { is_crosscompile && want_nptl; } || is-flag "-mcpu=ultrasparc2" || is-flag "-mcpu=ultrasparc"; then
672 CTARGET_OPT="sparcv9-unknown-linux-gnu"
673 fi
674 fi
675 ;;
676 esac
677
678 if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
679 CBUILD_OPT=${CTARGET_OPT}
680 fi
681
682 if $(tc-getCC ${CTARGET}) -v 2>&1 | grep -q 'gcc version 3.[0123]'; then
683 append-flags -finline-limit=2000
684 fi
685
686 # We dont want these flags for glibc
687 filter-ldflags -pie
688
689 # We cannot build glibc with Bdirect support
690 filter-flags -Wl,-Bdirect
691 filter-ldflags -Bdirect
692 filter-ldflags -Wl,-Bdirect
693
694 # Same for hashvals ...
695 filter-flags -Wl,-hashvals
696 filter-ldflags -hashvals
697 filter-ldflags -Wl,-hashvals
698
699 # Lock glibc at -O2 -- linuxthreads needs it and we want to be
700 # conservative here. -fno-strict-aliasing is to work around #155906
701 filter-flags -O?
702 append-flags -O2 -fno-strict-aliasing
703 }
704
705 check_kheader_version() {
706 local header="$(alt_build_headers)/linux/version.h"
707
708 [[ -z $1 ]] && return 1
709
710 if [ -f "${header}" ] ; then
711 local version="`grep 'LINUX_VERSION_CODE' ${header} | \
712 sed -e 's:^.*LINUX_VERSION_CODE[[:space:]]*::'`"
713
714 if [ "${version}" -ge "$1" ] ; then
715 return 0
716 fi
717 fi
718
719 return 1
720 }
721
722 check_nptl_support() {
723 local min_kernel_version=$(KV_to_int "${NPTL_KERNEL_VERSION}")
724
725 echo
726
727 ebegin "Checking gcc for __thread support"
728 if ! eend $(want__thread ; echo $?) ; then
729 echo
730 eerror "Could not find a gcc that supports the __thread directive!"
731 eerror "Please update your binutils/gcc and try again."
732 die "No __thread support in gcc!"
733 fi
734
735 if ! is_crosscompile && ! tc-is-cross-compiler ; then
736 # Building fails on an non-supporting kernel
737 ebegin "Checking kernel version (>=${NPTL_KERNEL_VERSION})"
738 if ! eend $([[ $(get_KV) -ge ${min_kernel_version} ]] ; echo $?) ; then
739 echo
740 eerror "You need a kernel of at least version ${NPTL_KERNEL_VERSION}"
741 eerror "for NPTL support!"
742 die "Kernel version too low!"
743 fi
744 fi
745
746 # Building fails with too low linux-headers
747 ebegin "Checking linux-headers version (>=${NPTL_KERNEL_VERSION})"
748 if ! eend $(check_kheader_version "${min_kernel_version}" ; echo $?) ; then
749 echo
750 eerror "You need linux-headers of at least version ${NPTL_KERNEL_VERSION}"
751 eerror "for NPTL support!"
752 die "linux-headers version too low!"
753 fi
754
755 echo
756 }
757
758 want_nptl() {
759 want_tls || return 1
760 use nptl || return 1
761
762 # Archs that can use NPTL
763 case $(tc-arch) in
764 alpha|amd64|ia64|mips|ppc|ppc64|s390|sh|x86)
765 return 0;
766 ;;
767 sparc)
768 # >= v9 is needed for nptl.
769 [[ "${PROFILE_ARCH}" == "sparc" ]] && return 1
770 return 0;
771 ;;
772 esac
773
774 return 1
775 }
776
777 want_linuxthreads() {
778 ! use nptlonly && return 0
779 want_nptl || return 0
780 return 1
781 }
782
783 want_tls() {
784 # Archs that can use TLS (Thread Local Storage)
785 case $(tc-arch) in
786 alpha|amd64|ia64|mips|ppc|ppc64|s390|sh)
787 return 0;
788 ;;
789 sparc)
790 # 2.3.6 should have tls support on sparc64
791 # when using newer binutils
792 case ${CTARGET/-*} in
793 sparc64*) return 1 ;;
794 *) return 0 ;;
795 esac
796 ;;
797 x86)
798 # requires i486 or better #106556
799 [[ ${CTARGET} == i[4567]86* ]] && return 0
800 ;;
801 esac
802
803 return 1
804 }
805
806 want__thread() {
807 want_tls || return 1
808
809 # For some reason --with-tls --with__thread is causing segfaults on sparc32.
810 [[ ${PROFILE_ARCH} == "sparc" ]] && return 1
811
812 [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD}
813
814 echo 'extern __thread int i;' > "${T}"/test-__thread.c
815 $(tc-getCC ${CTARGET}) -c "${T}"/test-__thread.c -o "${T}"/test-__thread.o &> /dev/null
816 WANT__THREAD=$?
817 rm -f "${T}"/test-__thread.[co]
818
819 return ${WANT__THREAD}
820 }
821
822 glibc_do_configure() {
823 local myconf
824
825 # set addons
826 pushd "${S}" > /dev/null
827 local ADDONS=$(echo */configure | sed \
828 -e 's:/configure::g' \
829 -e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
830 -e 's: \+$::' \
831 -e 's! !,!g' \
832 -e 's!^!,!' \
833 -e '/^,\*$/d')
834 popd > /dev/null
835 use glibc-compat20 && [[ -d glibc-compat ]] && ADDONS="${ADDONS},glibc-compat"
836
837 use nls || myconf="${myconf} --disable-nls"
838 use erandom || myconf="${myconf} --disable-dev-erandom"
839
840 use glibc-omitfp && myconf="${myconf} --enable-omitfp"
841
842 [[ ${CTARGET//_/-} == *-softfloat-* ]] && myconf="${myconf} --without-fp"
843
844 if [ "$1" == "linuxthreads" ] ; then
845 if want_tls ; then
846 myconf="${myconf} --with-tls"
847
848 if want__thread && ! use glibc-compat20 ; then
849 myconf="${myconf} --with-__thread"
850 else
851 myconf="${myconf} --without-__thread"
852 fi
853 else
854 myconf="${myconf} --without-tls --without-__thread"
855 fi
856
857 myconf="${myconf} --enable-add-ons=linuxthreads${ADDONS}"
858 myconf="${myconf} --enable-kernel=${LT_KERNEL_VERSION}"
859 elif [ "$1" == "nptl" ] ; then
860 myconf="${myconf} --with-tls --with-__thread"
861 myconf="${myconf} --enable-add-ons=nptl${ADDONS}"
862 myconf="${myconf} --enable-kernel=${NPTL_KERNEL_VERSION}"
863 else
864 die "invalid pthread option"
865 fi
866
867 # Since SELinux support is only required for nscd, only enable it if:
868 # 1. USE selinux
869 # 2. ! USE build
870 # 3. only for the primary ABI on multilib systems
871 if use selinux && ! use build ; then
872 if use multilib || has_multilib_profile ; then
873 if is_final_abi ; then
874 myconf="${myconf} --with-selinux"
875 else
876 myconf="${myconf} --without-selinux"
877 fi
878 else
879 myconf="${myconf} --with-selinux"
880 fi
881 else
882 myconf="${myconf} --without-selinux"
883 fi
884
885 myconf="${myconf}
886 --without-cvs
887 --enable-bind-now
888 --build=${CBUILD_OPT:-${CBUILD}}
889 --host=${CTARGET_OPT:-${CTARGET}}
890 $(use_enable profile)
891 --without-gd
892 --with-headers=$(alt_build_headers)
893 --prefix=/usr
894 --libdir=/usr/$(get_libdir)
895 --mandir=/usr/share/man
896 --infodir=/usr/share/info
897 --libexecdir=/usr/$(get_libdir)/misc/glibc
898 ${EXTRA_ECONF}"
899
900 # There is no configure option for this and we need to export it
901 # since the glibc build will re-run configure on itself
902 export libc_cv_slibdir=/$(get_libdir)
903
904 has_version app-admin/eselect-compiler || export CC=$(tc-getCC ${CTARGET})
905
906 local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-$1
907 mkdir -p "${GBUILDDIR}"
908 cd "${GBUILDDIR}"
909 einfo "Configuring GLIBC for $1 with: ${myconf// /\n\t\t}"
910 "${S}"/configure ${myconf} || die "failed to configure glibc"
911 }
912
913 fix_lib64_symlinks() {
914 # the original Gentoo/AMD64 devs decided that since 64bit is the native
915 # bitdepth for AMD64, lib should be used for 64bit libraries. however,
916 # this ignores the FHS and breaks multilib horribly... especially
917 # since it wont even work without a lib64 symlink anyways. *rolls eyes*
918 # see bug 59710 for more information.
919 # Travis Tilley <lv@gentoo.org> (08 Aug 2004)
920 if [ -L ${ROOT}/lib64 ] ; then
921 ewarn "removing /lib64 symlink and moving lib to lib64..."
922 ewarn "dont hit ctrl-c until this is done"
923 addwrite ${ROOT}/
924 rm ${ROOT}/lib64
925 # now that lib64 is gone, nothing will run without calling ld.so
926 # directly. luckily the window of brokenness is almost non-existant
927 use amd64 && /lib/ld-linux-x86-64.so.2 /bin/mv ${ROOT}/lib ${ROOT}/lib64
928 use ppc64 && /lib/ld64.so.1 /bin/mv ${ROOT}/lib ${ROOT}/lib64
929 # all better :)
930 ldconfig
931 ln -s lib64 ${ROOT}/lib
932 einfo "done! :-)"
933 einfo "fixed broken lib64/lib symlink in ${ROOT}"
934 fi
935 if [ -L ${ROOT}/usr/lib64 ] ; then
936 addwrite ${ROOT}/usr
937 rm ${ROOT}/usr/lib64
938 mv ${ROOT}/usr/lib ${ROOT}/usr/lib64
939 ln -s lib64 ${ROOT}/usr/lib
940 einfo "fixed broken lib64/lib symlink in ${ROOT}/usr"
941 fi
942 if [ -L ${ROOT}/usr/X11R6/lib64 ] ; then
943 addwrite ${ROOT}/usr/X11R6
944 rm ${ROOT}/usr/X11R6/lib64
945 mv ${ROOT}/usr/X11R6/lib ${ROOT}/usr/X11R6/lib64
946 ln -s lib64 ${ROOT}/usr/X11R6/lib
947 einfo "fixed broken lib64/lib symlink in ${ROOT}/usr/X11R6"
948 fi
949 }
950
951 use_multilib() {
952 case ${CTARGET} in
953 sparc64*|mips64*|x86_64*|powerpc64*|s390x*)
954 has_multilib_profile || use multilib ;;
955 *) false ;;
956 esac
957 }
958
959 # Setup toolchain variables that would be defined in the profiles for these archs.
960 setup_env() {
961 # These should not be set, else the zoneinfo do not always get installed ...
962 unset LANGUAGE LANG LC_ALL
963 # silly users
964 unset LD_RUN_PATH
965
966 if is_crosscompile || tc-is-cross-compiler ; then
967 multilib_env ${CTARGET}
968 if ! use multilib ; then
969 MULTILIB_ABIS=${DEFAULT_ABI}
970 else
971 MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
972 fi
973
974 # If the user has CFLAGS_<CTARGET> in their make.conf, use that,
975 # and fall back on CFLAGS.
976 local VAR=CFLAGS_${CTARGET//[-.]/_}
977 CFLAGS=${!VAR-${CFLAGS}}
978 fi
979
980 setup_flags
981
982 export ABI=${ABI:-${DEFAULT_ABI:-default}}
983
984 if is_crosscompile || tc-is-cross-compiler ; then
985 local VAR=CFLAGS_${ABI}
986 # We need to export CFLAGS with abi information in them because
987 # glibc's configure script checks CFLAGS for some targets (like mips)
988 export CFLAGS="${!VAR} ${CFLAGS}"
989 fi
990 }
991
992 ### /ECLASS PUNTAGE ###
993
994 if is_crosscompile ; then
995 SLOT="${CTARGET}-2.2"
996 else
997 SLOT="2.2"
998 fi
999
1000 # we'll handle stripping ourself #46186
1001 RESTRICT="strip"
1002 EMULTILIB_PKG="true"
1003
1004 # We need a new-enough binutils for as-needed
1005 DEPEND="!ia64? ( >=sys-devel/gcc-3.4 )
1006 nptl? ( >=sys-kernel/linux-headers-${NPTL_KERNEL_VERSION} )
1007 >=sys-devel/binutils-2.15.94
1008 >=sys-devel/gcc-config-1.3.12
1009 >=app-misc/pax-utils-0.1.10
1010 virtual/os-headers
1011 nls? ( sys-devel/gettext )
1012 selinux? ( !build? ( sys-libs/libselinux ) )"
1013 RDEPEND="nls? ( sys-devel/gettext )
1014 selinux? ( !build? ( sys-libs/libselinux ) )"
1015
1016 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
1017 DEPEND="${DEPEND} !crosscompile_opts_headers-only? ( ${CATEGORY}/gcc )"
1018
1019 if [[ ${CATEGORY} == *-linux* ]] ; then
1020 if [[ ${CATEGORY} == cross-mips* ]] ; then
1021 DEPEND="${DEPEND} >=${CATEGORY}/mips-headers-2.6.10"
1022 else
1023 DEPEND="${DEPEND} ${CATEGORY}/linux-headers"
1024 fi
1025 fi
1026 else
1027 DEPEND="${DEPEND} sys-libs/timezone-data"
1028 RDEPEND="${RDEPEND} sys-libs/timezone-data"
1029 fi
1030
1031 pkg_setup() {
1032 # prevent native builds from downgrading ... maybe update to allow people
1033 # to change between diff -r versions ? (2.3.6-r4 -> 2.3.6-r2)
1034 if ! is_crosscompile && ! tc-is-cross-compiler ; then
1035 if has_version '>'${CATEGORY}/${PF} ; then
1036 eerror "Sanity check to keep you from breaking your system:"
1037 eerror " Downgrading glibc is not supported and a sure way to destruction"
1038 die "aborting to save your system"
1039 fi
1040 fi
1041
1042 if use nptlonly && ! use nptl ; then
1043 eerror "If you want nptlonly, add nptl to your USE too ;p"
1044 die "nptlonly without nptl"
1045 fi
1046
1047 if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
1048 ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
1049 ewarn "This will result in a 50% performance penalty, which is probably not what you want."
1050 fi
1051
1052 if ! type -p scanelf > /dev/null ; then
1053 eerror "You do not have pax-utils installed."
1054 die "install pax-utils"
1055 fi
1056
1057 # give some sort of warning about the nptl logic changes...
1058 if want_nptl && want_linuxthreads ; then
1059 ewarn "Warning! Gentoo's GLIBC with NPTL enabled now behaves like the"
1060 ewarn "glibc from almost every other distribution out there. This means"
1061 ewarn "that glibc is compiled -twice-, once with linuxthreads and once"
1062 ewarn "with nptl. The NPTL version is installed to lib/tls and is still"
1063 ewarn "used by default. If you do not need nor want the linuxthreads"
1064 ewarn "fallback, you can disable this behavior by adding nptlonly to"
1065 ewarn "USE to save yourself some compile time."
1066
1067 ebeep
1068 epause 5
1069 fi
1070 }
1071
1072 src_unpack() {
1073 setup_env
1074
1075 # Do not enable -Bdirect support for now.
1076 GLIBC_PATCH_EXCLUDE="${GLIBC_PATCH_EXCLUDE} 2020_all_2.3.6-hashvals.patch"
1077 GLIBC_PATCH_EXCLUDE="${GLIBC_PATCH_EXCLUDE} 2030_all_2.3.6-bdirect.patch"
1078
1079 toolchain-glibc_src_unpack
1080
1081 # XXX: do not package ssp up into tarballs, leave it in FILESDIR
1082 cd "${S}"
1083 cp "${FILESDIR}"/2.3.5/ssp.c sysdeps/unix/sysv/linux/ || die "could not find ssp.c"
1084 rm -f "${WORKDIR}"/patches/2*
1085 epatch "${FILESDIR}"/2.3.6/glibc-2.3.6-propolice-guard-functions.patch
1086 epatch "${FILESDIR}"/2.3.5/glibc-2.3.5-frandom-detect.patch
1087
1088 # Glibc is stupid sometimes, and doesn't realize that with a
1089 # static C-Only gcc, -lgcc_eh doesn't exist.
1090 # http://sources.redhat.com/ml/libc-alpha/2003-09/msg00100.html
1091 # http://sourceware.org/ml/libc-alpha/2005-02/msg00042.html
1092 echo 'int main(){}' > "${T}"/gcc_eh_test.c
1093 if ! $(tc-getCC ${CTARGET}) "${T}"/gcc_eh_test.c -lgcc_eh 2>/dev/null ; then
1094 sed -i -e 's:-lgcc_eh::' Makeconfig || die "sed gcc_eh"
1095 fi
1096
1097 # Some configure checks fail on the first emerge through because they
1098 # try to link. This doesn't work well if we don't have a libc yet.
1099 # http://sourceware.org/ml/libc-alpha/2005-02/msg00042.html
1100 if is_crosscompile && use build; then
1101 rm "${S}"/sysdeps/sparc/sparc64/elf/configure{,.in}
1102 rm "${S}"/nptl/sysdeps/pthread/configure{,.in}
1103 fi
1104
1105 cd "${WORKDIR}"
1106 find . -type f '(' -size 0 -o -name "*.orig" ')' -exec rm -f {} \;
1107 find . -name configure -exec touch {} \;
1108
1109 # Fix permissions on some of the scripts
1110 chmod u+x "${S}"/scripts/*.sh
1111 }
1112
1113 src_compile() {
1114 setup_env
1115
1116 if [[ -z ${OABI} ]] ; then
1117 local abilist=""
1118 if has_multilib_profile ; then
1119 abilist=$(get_install_abis)
1120 einfo "Building multilib glibc for ABIs: ${abilist}"
1121 elif is_crosscompile || tc-is-cross-compiler ; then
1122 abilist=${DEFAULT_ABI}
1123 fi
1124 if [[ -n ${abilist} ]] ; then
1125 OABI=${ABI}
1126 for ABI in ${abilist} ; do
1127 export ABI
1128 src_compile
1129 done
1130 ABI=${OABI}
1131 unset OABI
1132 return 0
1133 fi
1134 fi
1135
1136 if just_headers ; then
1137 toolchain-glibc_headers_compile
1138 else
1139 toolchain-glibc_src_compile
1140 fi
1141 }
1142
1143 src_test() {
1144 setup_env
1145
1146 if [[ -z ${OABI} ]] && has_multilib_profile ; then
1147 OABI=${ABI}
1148 einfo "Testing multilib glibc for ABIs: $(get_install_abis)"
1149 for ABI in $(get_install_abis) ; do
1150 export ABI
1151 einfo " Testing ${ABI} glibc"
1152 src_test
1153 done
1154 ABI=${OABI}
1155 unset OABI
1156 return 0
1157 fi
1158
1159 toolchain-glibc_src_test
1160 }
1161
1162 src_strip() {
1163 # Now, strip everything but the thread libs #46186, as well as the dynamic
1164 # linker, else we cannot set breakpoints in shared libraries due to bugs in
1165 # gdb. Also want to grab stuff in tls subdir. whee.
1166 #when new portage supports this ...
1167 # env \
1168 # -uRESTRICT \
1169 # CHOST=${CTARGET} \
1170 # STRIP_MASK="/*/{,tls/}{ld-,lib{pthread,thread_db}}*" \
1171 # prepallstrip
1172 pushd "${D}" > /dev/null
1173
1174 if ! is_crosscompile ; then
1175 mkdir -p "${T}"/strip-backup
1176 for x in $(find "${D}" -maxdepth 3 \
1177 '(' -name 'ld-*' -o -name 'libpthread*' -o -name 'libthread_db*' ')' \
1178 -a '(' '!' -name '*.a' ')' -type f -printf '%P ')
1179 do
1180 mkdir -p "${T}/strip-backup/${x%/*}"
1181 cp -a -- "${D}/${x}" "${T}/strip-backup/${x}" || die "backing up ${x}"
1182 done
1183 fi
1184 env -uRESTRICT CHOST=${CTARGET} prepallstrip
1185 if ! is_crosscompile ; then
1186 cp -a -- "${T}"/strip-backup/* "${D}"/ || die "restoring non-stripped libs"
1187 fi
1188
1189 popd > /dev/null
1190 }
1191
1192 src_install() {
1193 setup_env
1194
1195 if [[ -z ${OABI} ]] ; then
1196 local abilist=""
1197 if has_multilib_profile ; then
1198 abilist=$(get_install_abis)
1199 einfo "Installing multilib glibc for ABIs: ${abilist}"
1200 elif is_crosscompile || tc-is-cross-compiler ; then
1201 abilist=${DEFAULT_ABI}
1202 fi
1203 if [[ -n ${abilist} ]] ; then
1204 OABI=${ABI}
1205 for ABI in ${abilist} ; do
1206 export ABI
1207 src_install
1208 done
1209 ABI=${OABI}
1210 unset OABI
1211 src_strip
1212 return 0
1213 fi
1214 fi
1215
1216 if just_headers ; then
1217 toolchain-glibc_headers_install
1218 else
1219 toolchain-glibc_src_install
1220 fi
1221 [[ -z ${OABI} ]] && src_strip
1222 }
1223
1224 pkg_preinst() {
1225 toolchain-glibc_pkg_preinst
1226 }
1227
1228 pkg_postinst() {
1229 toolchain-glibc_pkg_postinst
1230 }

  ViewVC Help
Powered by ViewVC 1.1.20