# 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} use ngpt \ && ( unpack ngpt-${NGPT_VER}.tar.gz ; mv ngpt-${NGPT_VER} ngpt ) unpack glibc-linuxthreads-${PV}.tar.bz2 # 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 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) 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 if [ "`use ngpt`" ] then cd ${S}/ngpt ./configure --prefix=/usr \ --libdir=/lib || die fi cd ${S}/buildhere make PARALLELMFLAGS="${MAKEOPTS}" || die make check if [ "`use ngpt`" ] then cd ${S}/ngpt make || die fi } 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} # Breaks things a bit .. #mv ${D}/lib/{libpthread.a,libthread_db.a} ${D}/usr/lib cp -f ${D}/lib/libthread_db.so ${D}/lib/libthread_db-1.0.so 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 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 /usr/bin/ngptinit }