Lines 8-14
inherit eutils flag-o-matic gcc
Link Here
|
8 |
# BRANCH_UPDATE= |
8 |
# BRANCH_UPDATE= |
9 |
BRANCH_UPDATE="20040420" |
9 |
BRANCH_UPDATE="20040420" |
10 |
|
10 |
|
11 |
|
|
|
12 |
# Minimum kernel version for --enable-kernel |
11 |
# Minimum kernel version for --enable-kernel |
13 |
export MIN_KV="2.4.1" |
12 |
export MIN_KV="2.4.1" |
14 |
# Minimum kernel version for enabling TLS and NPTL ... |
13 |
# Minimum kernel version for enabling TLS and NPTL ... |
Lines 97-102
get_KHV() {
Link Here
|
97 |
return 1 |
96 |
return 1 |
98 |
} |
97 |
} |
99 |
|
98 |
|
|
|
99 |
want_tls() { |
100 |
# Archs that can use TLS (Thread Local Storage) |
101 |
if use amd64 || use alpha || use ia64 || use ppc || \ |
102 |
use ppc64 || use s390 || use sparc; then |
103 |
return 0 |
104 |
fi |
105 |
|
106 |
# Specific x86 CHOSTS that can use TLS |
107 |
if use x86; then |
108 |
case "${CHOST/-*}" in |
109 |
i486|i586|i686) return 0 ;; |
110 |
esac |
111 |
fi |
112 |
|
113 |
return 1 |
114 |
} |
115 |
|
100 |
use_nptl() { |
116 |
use_nptl() { |
101 |
# Enable NPTL support if: |
117 |
# Enable NPTL support if: |
102 |
# - We have 'nptl' in USE |
118 |
# - We have 'nptl' in USE |
Lines 472-477
src_unpack() {
Link Here
|
472 |
chmod u+x ${S}/scripts/*.sh |
488 |
chmod u+x ${S}/scripts/*.sh |
473 |
} |
489 |
} |
474 |
|
490 |
|
|
|
491 |
pkg_setup() { |
492 |
# give some sort of warning about the nptl logic changes... |
493 |
if use_nptl && use !nptlonly ; then |
494 |
ewarn "Warning! Gentoo's GLIBC with NPTL enabled now behaves like the" |
495 |
ewarn "glibc from almost every other distribution out there. This means" |
496 |
ewarn "that glibc is compiled -twice-, once with linuxthreads and once" |
497 |
ewarn "with nptl. The NPTL version is installed to lib/tls and is still" |
498 |
ewarn "used by default. If you do not need nor want the linuxthreads" |
499 |
ewarn "fallback, you can disable this behavior by adding nptlonly to" |
500 |
ewarn "USE to save yourself some compile time." |
501 |
ebeep |
502 |
epause |
503 |
fi |
504 |
} |
505 |
|
475 |
setup_flags() { |
506 |
setup_flags() { |
476 |
# Over-zealous CFLAGS can often cause problems. What may work for one person may not |
507 |
# Over-zealous CFLAGS can often cause problems. What may work for one person may not |
477 |
# work for another. To avoid a large influx of bugs relating to failed builds, we |
508 |
# work for another. To avoid a large influx of bugs relating to failed builds, we |
Lines 522-530
setup_flags() {
Link Here
|
522 |
export LDFLAGS="${LDFLAGS//-Wl,--relax}" |
553 |
export LDFLAGS="${LDFLAGS//-Wl,--relax}" |
523 |
} |
554 |
} |
524 |
|
555 |
|
525 |
src_compile() { |
556 |
glibc_configure() { |
526 |
local myconf= |
557 |
local myconf= |
527 |
local myconf_nptl= |
|
|
528 |
|
558 |
|
529 |
setup_flags |
559 |
setup_flags |
530 |
|
560 |
|
Lines 532-582
src_compile() {
Link Here
|
532 |
# zoneinfo do not always get installed ... |
562 |
# zoneinfo do not always get installed ... |
533 |
unset LANGUAGE LANG LC_ALL |
563 |
unset LANGUAGE LANG LC_ALL |
534 |
|
564 |
|
535 |
use nls || myconf="${myconf} --disable-nls" |
565 |
# set addons |
|
|
566 |
pushd ${S} > /dev/null |
567 |
ADDONS=$(echo */configure | sed -e 's!/configure!!g;s!\(linuxthreads\|nptl\|rtkaio\)\( \|$\)!!g;s! \+$!!;s! !,!g;s!^!,!;/^,\*$/d') |
568 |
popd > /dev/null |
536 |
|
569 |
|
|
|
570 |
use nls || myconf="${myconf} --disable-nls" |
537 |
use erandom || myconf="${myconf} --disable-dev-erandom" |
571 |
use erandom || myconf="${myconf} --disable-dev-erandom" |
538 |
|
572 |
|
539 |
if use_nptl |
573 |
if [ "$1" == "linuxthreads" ] ; then |
540 |
then |
574 |
want_tls && myconf="${myconf} --with-tls --without-__thread" |
541 |
local kernelheaders="$(get_KHV "`KV_to_int ${MIN_NPTL_KV}`")" |
575 |
want_tls || myconf="${myconf} --without-tls --without-__thread" |
542 |
|
576 |
myconf="${myconf} --enable-add-ons=linuxthreads${ADDONS}" |
543 |
# NTPL and Thread Local Storage support. |
577 |
myconf="${myconf} --enable-kernel=2.4.1" |
544 |
myconf="${myconf} --with-tls --with-__thread \ |
578 |
elif [ "$1" == "nptl" ] ; then |
545 |
--enable-add-ons=nptl \ |
579 |
use_nptl && myconf="${myconf} --with-tls --with-__thread" |
546 |
--enable-kernel=${MIN_NPTL_KV} \ |
580 |
myconf="${myconf} --enable-add-ons=nptl${ADDONS}" |
547 |
--with-headers=${kernelheaders}" |
581 |
myconf="${myconf} --enable-kernel=${MIN_NPTL_KV}" |
548 |
else |
582 |
else |
549 |
myconf="${myconf} --without-__thread \ |
583 |
die "invalid pthread option" |
550 |
--enable-add-ons=linuxthreads" |
|
|
551 |
|
552 |
# If we build for the build system we use the kernel headers from the target |
553 |
# We also now set it without "build" as well, else it might use the |
554 |
# current kernel's headers, which might just fail (the linux-headers |
555 |
# package is usually well tested...) |
556 |
# ( use build || use sparc ) \ |
557 |
# && myconf="${myconf} --with-headers=${ROOT}usr/include" |
558 |
myconf="${myconf} --with-headers=${ROOT}usr/include" |
559 |
|
560 |
# If kernel version and headers in ${ROOT}/usr/include are ok, |
561 |
# then enable --enable-kernel=${MIN_KV} ... |
562 |
if [ "`get_KV`" -ge "`KV_to_int ${MIN_KV}`" -a \ |
563 |
-n "$(get_KHV "`KV_to_int ${MIN_KV}`" "${ROOT}/usr/include")" ] |
564 |
then |
565 |
myconf="${myconf} --enable-kernel=${MIN_KV}" |
566 |
else |
567 |
myconf="${myconf} --enable-kernel=2.2.5" |
568 |
fi |
569 |
fi |
584 |
fi |
570 |
|
585 |
|
571 |
# some silly people set LD_RUN_PATH and that breaks things. |
586 |
# some silly people set LD_RUN_PATH and that breaks things. |
572 |
# see bug 19043 |
587 |
# see bug 19043 |
573 |
unset LD_RUN_PATH |
588 |
unset LD_RUN_PATH |
574 |
|
589 |
|
575 |
einfo "Configuring GLIBC..." |
590 |
GBUILDDIR="${WORKDIR}/build-$1" |
576 |
rm -rf ${S}/buildhere |
591 |
rm -rf ${GBUILDDIR} |
577 |
mkdir -p ${S}/buildhere |
592 |
mkdir -p ${GBUILDDIR} |
578 |
cd ${S}/buildhere |
593 |
cd ${GBUILDDIR} |
579 |
../configure --build=${CHOST} \ |
594 |
|
|
|
595 |
myconf=$"${myconf} --build=${CHOST} \ |
580 |
--host=${CHOST} \ |
596 |
--host=${CHOST} \ |
581 |
--with-gd=no \ |
597 |
--with-gd=no \ |
582 |
--without-cvs \ |
598 |
--without-cvs \ |
Lines 584-612
src_compile() {
Link Here
|
584 |
--prefix=/usr \ |
600 |
--prefix=/usr \ |
585 |
--mandir=/usr/share/man \ |
601 |
--mandir=/usr/share/man \ |
586 |
--infodir=/usr/share/info \ |
602 |
--infodir=/usr/share/info \ |
587 |
--libexecdir=/usr/lib/misc \ |
603 |
--libexecdir=/usr/lib/misc" |
588 |
${myconf} || die |
|
|
589 |
|
604 |
|
590 |
einfo "Building GLIBC..." |
605 |
einfo "Configuring GLIBC for $1 with: ${myconf}" |
591 |
cd ${S}/buildhere |
606 |
${S}/configure ${myconf} || die "failed to configure glibc" |
592 |
make PARALLELMFLAGS="${MAKEOPTS}" || die |
|
|
593 |
# einfo "Doing GLIBC checks..." |
594 |
# make check |
595 |
} |
607 |
} |
596 |
|
608 |
|
597 |
src_install() { |
609 |
src_compile() { |
598 |
local buildtarget="buildhere" |
610 |
# do the linuxthreads build unless we're using nptlonly |
|
|
611 |
if use !nptlonly; then |
612 |
glibc_configure linuxthreads |
613 |
einfo "Building GLIBC with linuxthreads..." |
614 |
cd ${S}/build-linuxthreads |
615 |
make PARALLELMFLAGS="${MAKEOPTS}" || die |
616 |
fi |
617 |
if use_nptl; then |
618 |
unset LD_ASSUME_KERNEL || : |
619 |
glibc_configure nptl |
620 |
einfo "Building GLIBC with NPTL..." |
621 |
cd ${S}/build-nptl |
622 |
make PARALLELMFLAGS="${MAKEOPTS}" || die |
623 |
fi |
624 |
} |
599 |
|
625 |
|
|
|
626 |
src_install() { |
600 |
setup_flags |
627 |
setup_flags |
601 |
|
628 |
|
602 |
# These should not be set, else the |
629 |
# These should not be set, else the |
603 |
# zoneinfo do not always get installed ... |
630 |
# zoneinfo do not always get installed ... |
604 |
unset LANGUAGE LANG LC_ALL |
631 |
unset LANGUAGE LANG LC_ALL |
605 |
|
632 |
|
606 |
einfo "Installing GLIBC..." |
633 |
if use !nptlonly ; then |
607 |
make PARALLELMFLAGS="${MAKEOPTS}" \ |
634 |
local buildtarget="build-linuxthreads" |
608 |
install_root=${D} \ |
635 |
cd ${WORKDIR}/${buildtarget} |
609 |
install -C ${buildtarget} || die |
636 |
einfo "Installing GLIBC with linuxthreads..." |
|
|
637 |
make PARALLELMFLAGS="${MAKEOPTS}" \ |
638 |
install_root=${D} \ |
639 |
install || die |
640 |
elif use nptlonly ; then |
641 |
local buildtarget="build-nptl" |
642 |
cd ${WORKDIR}/${buildtarget} |
643 |
einfo "Installing GLIBC with NPTL..." |
644 |
make PARALLELMFLAGS="${MAKEOPTS}" \ |
645 |
install_root=${D} \ |
646 |
install || die |
647 |
fi |
648 |
|
649 |
if use !nptlonly && use_nptl ; then |
650 |
einfo "Installing NPTL to $(get_libdir)/tls/..." |
651 |
cd ${WORKDIR}/build-nptl |
652 |
mkdir -p ${D}/$(get_libdir)/tls/ |
653 |
|
654 |
libcsofile=$(basename ${D}/$(get_libdir)/libc-*.so) |
655 |
cp -a libc.so ${D}/$(get_libdir)/tls/${libcsofile} || die |
656 |
dosym ${libcsofile} /$(get_libdir)/tls/$(ls libc.so.*) |
657 |
|
658 |
libmsofile=$(basename ${D}/$(get_libdir)/libm-*.so) |
659 |
pushd math > /dev/null |
660 |
cp -a libm.so ${D}/$(get_libdir)/tls/${libmsofile} || die |
661 |
dosym ${libmsofile} /$(get_libdir)/tls/$(ls libm.so.*) |
662 |
popd > /dev/null |
663 |
|
664 |
librtsofile=$(basename ${D}/$(get_libdir)/librt-*.so) |
665 |
pushd rt > /dev/null |
666 |
cp -a librt.so ${D}/$(get_libdir)/tls/${librtsofile} || die |
667 |
dosym ${librtsofile} /$(get_libdir)/tls/$(ls librt.so.*) |
668 |
popd > /dev/null |
669 |
|
670 |
libthreaddbsofile=$(basename ${D}/$(get_libdir)/libthread_db-*.so) |
671 |
pushd nptl_db > /dev/null |
672 |
cp -a libthread_db.so ${D}/$(get_libdir)/tls/${libthreaddbsofile} || die |
673 |
dosym ${libthreaddbsofile} /$(get_libdir)/tls/$(ls libthread_db.so.*) |
674 |
popd > /dev/null |
675 |
|
676 |
libpthreadsofile=libpthread-${NEW_PV}.so |
677 |
cp -a nptl/libpthread.so ${D}/$(get_libdir)/tls/${libpthreadsofile} || die |
678 |
dosym ${libpthreadsofile} /$(get_libdir)/tls/libpthread.so.0 |
679 |
|
680 |
# and now for the static libs |
681 |
mkdir -p ${D}/usr/$(get_libdir)/nptl |
682 |
cp -a libc.a nptl/libpthread.a nptl/libpthread_nonshared.a rt/librt.a \ |
683 |
${D}/usr/$(get_libdir)/nptl |
684 |
# linker script stuff |
685 |
sed "s~/$(get_libdir)/~/$(get_libdir)/tls/~" ${D}/usr/$(get_libdir)/libc.so \ |
686 |
> ${D}/usr/$(get_libdir)/nptl/libc.so |
687 |
|
688 |
sed "s~/$(get_libdir)/~/$(get_libdir)/tls/~" ${D}/usr/$(get_libdir)/libpthread.so \ |
689 |
> ${D}/usr/$(get_libdir)/nptl/libpthread.so |
690 |
sed -i -e "s~/usr/lib64/~/usr/lib64/nptl/~" ${D}/usr/$(get_libdir)/nptl/libpthread.so |
691 |
|
692 |
dosym ../${librtsofile} /usr/$(get_libdir)/nptl/librt.so |
693 |
|
694 |
# last but not least... headers. |
695 |
mkdir -p ${D}/nptl ${D}/usr/include/nptl |
696 |
make install_root=${D}/nptl install-headers PARALLELMFLAGS="${MAKEOPTS}" |
697 |
pushd ${D}/nptl/usr/include > /dev/null |
698 |
for i in `find . -type f`; do |
699 |
if ! [ -f ${D}/usr/include/$i ] \ |
700 |
|| ! cmp -s $i ${D}/usr/include/$i; then |
701 |
mkdir -p ${D}/usr/include/nptl/`dirname $i` |
702 |
cp -a $i ${D}/usr/include/nptl/$i |
703 |
fi |
704 |
done |
705 |
rm -rf ${D}/nptl |
706 |
cd ${WORKDIR} |
707 |
fi |
610 |
|
708 |
|
611 |
# If librt.so is a symlink, change it into linker script (Redhat) |
709 |
# If librt.so is a symlink, change it into linker script (Redhat) |
612 |
if [ -L "${D}/usr/lib/librt.so" -a "${LIBRT_LINKERSCRIPT}" = "yes" ] |
710 |
if [ -L "${D}/usr/lib/librt.so" -a "${LIBRT_LINKERSCRIPT}" = "yes" ] |
Lines 647-657
EOF
Link Here
|
647 |
keepdir /usr/lib/locale/ru_RU/LC_MESSAGES |
745 |
keepdir /usr/lib/locale/ru_RU/LC_MESSAGES |
648 |
|
746 |
|
649 |
einfo "Installing man pages and docs..." |
747 |
einfo "Installing man pages and docs..." |
650 |
# Install linuxthreads man pages |
748 |
# Install linuxthreads man pages even if nptl is enabled |
651 |
use_nptl || { |
749 |
dodir /usr/share/man/man3 |
652 |
dodir /usr/share/man/man3 |
750 |
doman ${S}/man/*.3thr |
653 |
doman ${S}/man/*.3thr |
|
|
654 |
} |
655 |
|
751 |
|
656 |
# Install nscd config file |
752 |
# Install nscd config file |
657 |
insinto /etc ; doins ${FILESDIR}/nscd.conf |
753 |
insinto /etc ; doins ${FILESDIR}/nscd.conf |