# $Id$ PNAME="libstdc++-v3" PVER="3.3.6" PBUILD="r8" PCATEGORIE="sys-libs" STATE="unstable" DESCRIPTION="Compat GNU C++ version 3 library." HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html" DEPEND=">= sys-apps/base-files-0.1" SDEPEND=">= sys-dev/binutils-2.20 >= virtual/kernel-headers" SRCFILE="gcc-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/gcc-${PVER}" sminclude cleanutils mtools SRC_URI=( gnu://gcc/${SRCFILE} mirror://gcc/${SRCFILE} mirror://gcc/gcc-${PVER}-no_fixincludes-1.patch mirror://gcc/gcc-${PVER}-magellan-version.patch ) # stripping is not allowed export NOSTRIP=true # prevent issues with gcc-3.4.x export CFLAGS="-O" export CXXFLAGS="-O" # check for crosscompile or export default CHOST if [[ -z ${CCHOST} ]] then # no crosscompile defined export CCHOST=${CHOST} else # use crosscompile host export CCHOST=${CCHOST} fi src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} mpatch gcc-${PVER}-no_fixincludes-1.patch || die mpatch 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 install -d ${SRCDIR}/build || die cd ${SRCDIR}/build } src_compile() { cd ${SRCDIR}/build # configure only with c++ ../configure \ --host=${CHOST} \ --target=${CCHOST} \ --prefix=/usr \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --libdir=/usr/$(mlibdir) \ --libexecdir=/usr/$(mlibdir) \ --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=c++ \ || die touch ${SRCDIR}/gcc/c-gperf.h || die # build only libstdc++ mmake all-target-libstdc++-v3 || die } src_install() { cd ${SRCDIR}/build minstalldir /etc/env.d || die minstalldir /usr/$(mlibdir)/libstdc++-v3 || die make prefix=/usr \ bindir=/usr/bin \ includedir=/usr/include \ datadir=/usr/share \ mandir=/usr/share/man \ infodir=/usr/share/info \ DESTDIR=${BINDIR} \ LIBPATH=/usr/$(mlibdir) \ install-target-libstdc++-v3 || die # deletes everything excluding libstdc++*.* zapmost ${BINDIR}/usr/$(mlibdir) libstdc++.so.* libstdc++-v3 || die # clean up the other stuff rm -rf ${BINDIR}/$(mlibdir) || die rm -rf ${BINDIR}/usr/{include,share} || die # now move the libs to a proper location mv ${BINDIR}/usr/$(mlibdir)/libstdc++.so.* ${BINDIR}/usr/$(mlibdir)/libstdc++-v3 || die # for x86_64 doing the same for /usr/lib as well (-m32 libs) if [[ ${ARCH} = x86_64 ]] then minstalldir /usr/lib/libstdc++-v3 || die zapmost ${BINDIR}/usr/lib libstdc++.so.* libstdc++-v3 || die mv ${BINDIR}/usr/lib/libstdc++.so.* ${BINDIR}/usr/lib/libstdc++-v3 || die fi # strip the libraries find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die # environment echo "LDPATH=\"/usr/$(mlibdir)/libstdc++-v3\"" > ${BINDIR}/etc/env.d/99libstdc++-v3 || die if [[ ${ARCH} = x86_64 ]] then echo 'LDPATH="/usr/lib/libstdc++-v3"' >> ${BINDIR}/etc/env.d/99libstdc++-v3 || die fi }