# $Header: /home/cvsd/magellan-cvs/magellan-src/toolchain/toolchain-libstdc++/toolchain-libstdc++-3.4.3-r3.smage2,v 1.2 2005-07-29 13:44:31 niro Exp $ PNAME="toolchain-libstdc++" PVER="3.4.3" PBUILD="r3" SRCFILE="gcc-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/gcc-${PVER}" # languages to build into gcc MyLanguages=c,c++ SRC_URI=( mirror://gcc/${SRCFILE} mirror://gcc/gcc-${PVER}-no_fixincludes-1.patch mirror://gcc/gcc-${PVER}-linkonce-1.patch mirror://gcc/gcc-${PVER}-fix_configure_for_target_native-1.patch mirror://gcc/gcc-${PVER}-magellan-version.patch ) # need: libstdc++ to run, tcsh to compile ada # compile time: unkown (Athlon XP 1900+, 512mb DDR400) ## 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} } src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} mpatch -Np1 gcc-${PVER}-no_fixincludes-1.patch || die mpatch -Np1 gcc-${PVER}-linkonce-1.patch || die mpatch -Np1 gcc-${PVER}-fix_configure_for_target_native-1.patch || die mpatch -Np0 gcc-${PVER}-magellan-version.patch || die # suppress installation of libiberty, as we will be # using the one from binutils sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in || die mkdir ${SRCDIR}/build || die cd ${SRCDIR}/build } src_compile() { cd ${SRCDIR}/build ../configure \ --host=${CHOST} \ --prefix=${TOOLCHAIN_PREFIX} \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --enable-clocale=gnu \ --disable-checking \ --disable-libunwind-exceptions \ --with-system-zlib \ --enable-long-long \ --enable-cstdio=stdio \ --enable-languages=${MyLanguages} \ --disable-libstdcxx-pch \ || die # bootstrap-lean seems to be broken # gcc does not like MAKEOPTS >= -j1 make bootstrap || die } src_install() { cd ${SRCDIR}/build install -d ${BINDIR}/lib || die make DESTDIR=${BINDIR} install || die # deletes everything excluding libgcc_s and libstdc++ zapmost ${BINDIR}${TOOLCHAIN_PREFIX}/lib libgcc_s*.* libstdc++*.* || die # other not needed rm -rf ${BINDIR}${TOOLCHAIN_PREFIX}/lib || die rm -rf ${BINDIR}${TOOLCHAIN_PREFIX}/{bin,include,share} || die rm -rf ${BINDIR}${TOOLCHAIN_PREFIX}/{info,man,libexec} || die }