# $Header: /home/cvsd/magellan-cvs/magellan-src/toolchain/toolchain-glibc/toolchain-glibc-2.3.5-r3.smage2,v 1.1 2005-07-04 00:41:38 niro Exp $ PNAME="toolchain-glibc" PVER="2.3.5" PBUILD="r3" SRCFILE="glibc-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/glibc-${PVER}" LINUXTHREADS="glibc-linuxthreads-${PVER}.tar.bz2" SRC_URI=( mirror://glibc/${SRCFILE} mirror://glibc/${LINUXTHREADS} mirror://glibc/glibc-2.3.5-fix_test-1.patch ) ## global toolchain var ## # export CFLAGS, CHOST, TOOLCHAIN_PREFIX export CFLAGS="-mtune=i486 -Os -pipe" export CXXFLAGS="${CFLAGS}" export TOOLCHAIN_PREFIX="/tools" zapmost() { local rootdir rootdir="${1}/" [ ! -e "$rootdir" ] && echo "zapmost: $rootdir not found; skipping..." && return 1 install -d ${BUILDDIR}/zap local dirs shift local x for x in ${*} do if [ "${x##*/}" = "${x}" ] then #one deep mv ${rootdir}${x} ${BUILDDIR}/zap else #more than one deep; create intermediate directories dirs=${x%/*} install -d ${BUILDDIR}/zap/${dirs} mv ${rootdir}${x} ${BUILDDIR}/zap/${x} fi done rm -rf ${rootdir}* mv ${BUILDDIR}/zap/* ${rootdir} } # glibc -> nptl thread don't like striping NOSTRIP=true # gcc 3.0 - 3.3 needs this: export CFLAGS="${CFLAGS} -finline-limit=2000" export CXXFLAGS="${CFLAGS}" export LDFLAGS="${LDFLAGS//-Wl,--relax}" # use other linux-headers [ -z "${ALT_HEADERS}" ] && export ALT_HEADERS="/usr/include" # needs: # compile time: 54m16.506s (Athlon XP 1600+, 256mb DDR333) src_prepare() { munpack ${SRCFILE} || die munpack ${LINUXTHREADS} ${SRCDIR} || die cd ${SRCDIR} # disable binutils -as-needed sed -e 's/^have-as-needed.*/have-as-needed = no/' -i ${SRCDIR}/config.make.in || die # fix some tests which will fail with a kernel-2.6.11.x mpatch -Np1 glibc-2.3.5-fix_test-1.patch || die # fix permissions on some of the scripts chmod u+x ${SRCDIR}/scripts/*.sh || die mkdir ${SRCDIR}/build || die cd ${SRCDIR}/build touch /etc/ld.so.conf || die } src_compile() { cd ${SRCDIR}/build # linuxthreads kernel-2.4 enabled glibc ../configure \ --build=${CHOST} \ --host=${CHOST} \ --prefix=${TOOLCHAIN_PREFIX} \ --disable-profile \ --enable-add-ons=linuxthreads \ --without-__thread \ --enable-kernel=2.4.1 \ --without-cvs \ --with-headers=${ALT_HEADERS} \ --without-gd \ --without-selinux \ --disable-nls \ || die make PARALLELMFLAGS="-j2" || die } src_install() { cd ${SRCDIR}/build make PARALLELMFLAGS="-j2" install_root=${BINDIR} install || die # strip all binaries find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die # strip all libraries # want to be safe here; --strip-unneeded seems to cause pthread problems # strip all but libpthread install -d ${BUILDDIR}/thread-backup || die mv ${BINDIR}${TOOLCHAIN_PREFIX}/lib/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die # now strip find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}${TOOLCHAIN_PREFIX}/lib/ || die # remove stale directory rm -rf ${BUILDDIR}/thread-backup || die # remove unwanted stuff KEEPFILES="bin/ldd bin/getent lib sbin/ldconfig" zapmost ${BINDIR}${TOOLCHAIN_PREFIX} ${KEEPFILES} || die # remove static libs and other stale stuff rm ${BINDIR}/${TOOLCHAIN_PREFIX}/lib/*.a || die rm ${BINDIR}/${TOOLCHAIN_PREFIX}/lib/*crt*.o || die rm -rf ${BINDIR}/${TOOLCHAIN_PREFIX}/lib/gconv || die }