/[gentoo-alt]/trunk/prefix/sys-libs/glibc/glibc-2.4-r3.ebuild
Gentoo

Contents of /trunk/prefix/sys-libs/glibc/glibc-2.4-r3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1337 - (show annotations) (download)
Wed Sep 6 11:03:13 2006 UTC (7 years, 10 months ago) by grobian
File size: 38712 byte(s)
Use real prefix


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

  ViewVC Help
Powered by ViewVC 1.1.20