# Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License, v2 or later # $Header: /home/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.2.5-r6.ebuild,v 1.6 2002/09/22 08:01:31 azarah Exp $ inherit flag-o-matic filter-flags "-fomit-frame-pointer -malign-double" NGPT_VER="2.0.2" S=${WORKDIR}/${P} DESCRIPTION="GNU libc6 (also called glibc2) C library" SRC_URI="ftp://sources.redhat.com/pub/glibc/releases/glibc-${PV}.tar.bz2 ftp://sources.redhat.com/pub/glibc/releases/glibc-linuxthreads-${PV}.tar.bz2 ngpt? ( http://www-124.ibm.com/developerworks/oss/pthreads/download/stable/source/ngpt-${NGPT_VER}.tar.gz )" HOMEPAGE="http://www.gnu.org/software/libc/libc.html" LICENSE="GPL-2" SLOT="2.2" KEYWORDS="x86 ppc sparc sparc64 alpha" # portage-1.8.9 needed for smart library merging feature (avoids segfaults on glibc upgrade) # drobbins, 18 Mar 2002: we now rely on the system profile to select the correct linus-headers DEPEND="sys-kernel/linux-headers nls? ( sys-devel/gettext )" RDEPEND="sys-kernel/linux-headers sys-apps/baselayout build? ( >=sys-apps/portage-1.9.0 )" PROVIDE="virtual/glibc" # Lock glibc at -O2 -- linuxthreads needs it and we want to be conservative here export CFLAGS="${CFLAGS//-O?} -O2" export CXXFLAGS="${CFLAGS}" src_unpack() { unpack glibc-${PV}.tar.bz2 cd ${S} # Extract pre-made man pages. Otherwise we need perl, which is a no-no. mkdir man; cd man tar xjf ${FILESDIR}/glibc-manpages-${PV}.tar.bz2 # Unpack the threading libs. # NOTE: glibc cannot compile without linuxthreads currently, and ngpt # is not a 100% drop in replacement, so we still need the old # pthreads libs present .... cd ${S}; unpack glibc-linuxthreads-${PV}.tar.bz2 if [ "`use ngpt`" ] then cd ${S} unpack ngpt-${NGPT_VER}.tar.gz mv ${S}/ngpt-${NGPT_VER} ${S}/ngpt cd ${S}/ngpt # Inline for now to make things easier with bugzilla... # If bits/pthreadtypes.h is not included, some stuff like # bits/libc-lock.h have missing define issues... # (24 Sep 2002) #patch -p1 < ${FILESDIR}/ngpt-missing-defines.patch || die patch -p1 <<-"ENDPATCH" --- ngpt-2.0.2/pthread.h.in.orig Tue Sep 24 06:54:55 2002 +++ ngpt-2.0.2/pthread.h.in Tue Sep 24 06:55:07 2002 @@ -115,6 +115,13 @@ #endif /* + * We need to include this, as bits/libc-lock.h needs it + */ +#ifndef _PTHREAD_PRIVATE +#include +#endif + +/* * Include essential vendor headers */ #include ENDPATCH fi # This patch apparently eliminates compiler warnings for some versions of gcc. # For information about the string2 patch, see: # http://lists.gentoo.org/pipermail/gentoo-dev/2001-June/001559.html cd ${S}; patch -p0 < ${FILESDIR}/glibc-2.2.4-string2.h.diff || die # This next one is a new patch to fix thread signal handling. See: # http://sources.redhat.com/ml/libc-hacker/2002-02/msg00120.html # (Added by drobbins on 05 Mar 2002) cd ${S}; patch -p0 < ${FILESDIR}/glibc-2.2.5-threadsig.diff || die # This next patch fixes a test that will timeout due to ReiserFS' slow handling of sparse files cd ${S}/io; patch -p0 < ${FILESDIR}/glibc-2.2.2-test-lfs-timeout.patch || die # A buffer overflow vulnerability exists in multiple implementations of DNS # resolver libraries. This affects glibc-2.2.5 and earlier. See bug #4923 # and: # # http://www.cert.org/advisories/CA-2002-19.html cd ${S}; patch -p1 < ${FILESDIR}/${P}-dns-network-overflow.diff || die # Security update for sunrpc # # cd ${S}; patch -p1 < ${FILESDIR}/${P}-sunrpc-overflow.diff || die if [ "${ARCH}" = "x86" ]; then # This patch fixes the nvidia-glx probs, openoffice and vmware probs and such.. # http://sources.redhat.com/ml/libc-hacker/2002-02/msg00152.html cd ${S}; patch -p1 < ${FILESDIR}/glibc-divdi3.diff || die fi # Some gcc-3.1.1 fixes. This works fine for other versions of gcc as well, # and should generally be ok, as it just fixes define order that causes scope # problems with gcc-3.1.1. # (Azarah, 14 Jul 2002) cd ${S}; patch -p1 < ${FILESDIR}/glibc-2.2.5-gcc311.patch || die # Avoid "Error: illegal instruction" when compiling on sparc with gcc 3.1.1 if [ "${ARCH}" = "sparc" -o "${ARCH}" = "sparc64" ]; then cd ${S}; patch -p1 < ${FILESDIR}/glibc-2.2.5-gcc311-sparc.patch || die fi # Some patches to fixup build on alpha if [ "${ARCH}" = "alpha" ]; then cd ${S} patch -p1 < ${FILESDIR}/glibc-2.2.5-alpha-gcc3-fix.diff || die patch -p1 < ${FILESDIR}/glibc-2.2.5-alpha-pcdyn-fix.diff || die fi } src_compile() { local myconf="" # If we build for the build system we use the kernel headers from the target use build && myconf="${myconf} --with-header=${ROOT}usr/include" use nls || myconf="${myconf} --disable-nls" rm -rf ${S}/buildhere mkdir -p ${S}/buildhere cd ${S}/buildhere ../configure --host=${CHOST} \ --with-gd=no \ --without-cvs \ --disable-profile \ --enable-add-ons=linuxthreads \ --prefix=/usr \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --libexecdir=/usr/lib/misc \ ${myconf} || die # This next option breaks the Sun JDK and the IBM JDK # We should really keep compatibility with older kernels, anyway # --enable-kernel=2.4.0 # The theory here is that we compile NGPT, and then change the # config of linuxthreads so that it specify the NGPT libpthread # as lib to link, and not its own... # (24 Sep 2002) if [ "`use ngpt`" ] then cd ${S}/ngpt ./configure --prefix=/usr \ --libdir=/lib || die make || die # Install into temp dir make prefix=${T}/ngpt/usr \ libdir=${T}/ngpt/lib \ install || die # Init NGPT... if [ "$(${T}/ngpt/usr/bin/ngptc 2>&1)" != "Complete" ] then eerror "*************************" eerror " Could not init NGPT!!!!" eerror "*************************" die "Could not init NGPT!" fi # Get glibc to link to NGPT, and not linuxthreads... cat > ${S}/linuxthreads/Makeconfig <<-"ENDCONFIG" # Makeconfig fragment for linuxthreads add-on. # This gets included at the end of the main glibc Makeconfig. have-thread-library = yes shared-thread-library = $(T)/ngpt/lib/libpthread.so static-thread-library = $(T)/ngpt/lib/libpthread.a bounded-thread-library = $(common-objpfx)linuxthreads/libpthread_b.a rpath-dirs += linuxthreads rpath-dirs += ../../../temp/ngpt/lib ENDCONFIG fi cd ${S}/buildhere make PARALLELMFLAGS="${MAKEOPTS}" || die # make check } src_install() { export LC_ALL=C make PARALLELMFLAGS="${MAKEOPTS}" \ install_root=${D} \ install -C buildhere || die if [ -z "`use build`" ] then make PARALLELMFLAGS="${MAKEOPTS}" \ install_root=${D} \ info -C buildhere || die make PARALLELMFLAGS="${MAKEOPTS}" \ install_root=${D} \ localedata/install-locales -C buildhere || die # Install linuxthreads man pages dodir /usr/share/man/man3 doman ${S}/man/*.3thr install -m 644 nscd/nscd.conf ${D}/etc dodoc BUGS ChangeLog* CONFORMANCE COPYING* FAQ INTERFACE \ NEWS NOTES PROJECTS README* else rm -rf ${D}/usr/share ${D}/usr/lib/gconv fi if [ "`use ngpt`" ] then make prefix=${D}/usr \ libdir=${D}/lib \ install -C ${S}/ngpt || die rm -rf ${D}/usr/lib/{libpthread.a,libthread_db.a} # Uncomment to remove support for old linuxthreads # Could be considered if NGPT binary compadibility gets # better somewhere in the future, or if everything was # compiled against NGPT... rm -f ${D}/lib/{libpthread-0.9.so,libpthread.so.0} rm -f ${D}/lib/{libthread_db-1.0.so,libthread_db-1.0.so} dosym libpthread.so.20 /lib/libpthread.so.0 # Breaks things a bit .. #mv ${D}/lib/{libpthread.a,libthread_db.a} ${D}/usr/lib # Create compat symlinks #dosym libpthread-0.9.so /lib/libpthread.so.0 #dosym libthread_db-1.0.so /lib/libthread_db.so.1 dosym ../../lib/libpthread.so /usr/lib/libpthread.so dosym ../../lib/libthread_db.so /usr/lib/libthread_db.so # Remove stale build and backup files rm -rf ${T}/ngpt rm -rf ${D}/usr/include/.ngpt-backup fi if [ "`use pic`" ] then find ${S}/buildhere -name "soinit.os" -exec cp {} ${D}/lib/soinit.o \; find ${S}/buildhere -name "sofini.os" -exec cp {} ${D}/lib/sofini.o \; find ${S}/buildhere -name "*_pic.a" -exec cp {} ${D}/lib \; find ${S}/buildhere -name "*.map" -exec cp {} ${D}/lib \; for i in ${D}/lib/*.map do mv ${i} ${i%.map}_pic.map done fi # Is this next line actually needed or does the makefile get it right? # It previously has 0755 perms which was killing things. chmod 4755 ${D}/usr/lib/misc/pt_chown rm -f ${D}/etc/ld.so.cache # Prevent overwriting of the /etc/localtime symlink. We'll handle the # creation of the "factory" symlink in pkg_postinst(). rm -f ${D}/etc/localtime # Some things want this, notably ash. dosym /usr/lib/libbsd-compat.a /usr/lib/libbsd.a } pkg_postinst() { # Correct me if I am wrong here, but my /etc/localtime is a file # created by zic .... # I am thinking that it should only be recreated if no /etc/localtime # exists, or if it is an invalid symlink. # # For invalid symlink: # -f && -e will fail # -L will succeed # if [ ! -e ${ROOT}/etc/localtime ] then echo "Please remember to set your timezone using the zic command." rm -f ${ROOT}/etc/localtime ln -s ../usr/share/zoneinfo/Factory ${ROOT}/etc/localtime fi if [ "`use ngpt`" -a "${ROOT}" = "/" ] then einfo "Initializing NGPT..." /usr/bin/ngptinit &> /dev/null fi }