# Distributed under the terms of the GNU General Public License v2 #inherit flag-o-matic libtool inherit flag-o-matic IUSE="nls" #need to check what gcc version we are running GCC_PV=$(gcc -dumpversion) S="${WORKDIR}/gcc-${GCC_PV}" DESCRIPTION="D GCC Frontend" SRC_URI="http://home.earthlink.net/~dvdfrdmn/d/gdc-20040427.tgz ftp://gcc.gnu.org/pub/gcc/releases/gcc-${GCC_PV}/gcc-${GCC_PV}.tar.bz2" #only need gcc-core (smaller download), but user will likely have this one already HOMEPAGE="http://home.earthlink.net/~dvdfrdmn/d/" SLOT="0" KEYWORDS="~x86" LICENSE="GPL-2" DEPEND="virtual/glibc >=sys-devel/gcc-3.3.3" # Theoretical cross compiler support [ ! -n "${CCHOST}" ] && export CCHOST="${CHOST}" LOC="/usr" #GCC_PVR=$(emerge -s gcc|grep "installed: 3.2"|cut -d ':' -f 2) LIBPATH="${LOC}/lib/gcc-lib/${CCHOST}/${GCC_PV}" #BINPATH="${LOC}/${CCHOST}/gcc-bin/${GCC_PV}" DATAPATH="${LOC}/share" # Dont install in /usr/include/g++-v3/, but in gcc internal directory. # We will handle /usr/include/g++-v3/ with gcc-config ... STDCXX_INCDIR="${LIBPATH}/include/g++-v${MY_PV/\.*/}" src_unpack() { unpack "gcc-${GCC_PV}.tar.bz2" cd "${WORKDIR}/gcc-${GCC_PV}/gcc" unpack "gdc-20040427.tgz" PATCHFILE="d/patch-gcc-${GCC_PV}.tar.bz2" if [ "${GCC_PV}" == "3.3.3" ] then PATCHFILE="d/patch-gcc-3.3.2" fi if [ "${GCC_PV}" == "3.4" ] then PATCHFILE="d/patch-gcc-3.4-20040317" fi patch -p1 < ${PATCHFILE} } src_compile() { local myconf #lets reduce optimisation somewhat replace-flags -O? -O2 if [ -z "`use nls`" ] then myconf="${myconf} --disable-nls" else myconf="${myconf} --enable-nls --without-included-gettext" fi #Makefiles seems to use ${P} internally, need to wrap around SAVEP="${P}" unset P einfo "Configuring GCC for GDC inclusion..." ${S}/configure --prefix=${LOC} \ --mandir=${DATAPATH}/man \ --infodir=${DATAPATH}/info \ --enable-shared \ --host=${CHOST} \ --target=${CCHOST} \ --with-system-zlib \ --enable-languages=d \ --enable-threads=posix \ --enable-long-long \ --disable-checking \ --enable-cstdio=stdio \ --enable-clocale=generic \ --enable-__cxa_atexit \ --enable-version-specific-runtime-libs \ --with-gxx-include-dir=${STDCXX_INCDIR} \ --with-local-prefix=${LOC}/local \ ${myconf} || die einfo "Building GDC..." # Fix for our libtool-portage.patc make LIBPATH="${LIBPATH}" || die "make failed" P="${SAVEP}" einfo "Building Phobos runtime library..." cd "${S}/gcc/d/phobos" sed -i "s:d_config_subdirs=\"boehm-gc\":d_config_subdirs=\"\":g" configure ./configure --prefix=/usr cd boehm-gc ./configure --prefix=/usr make } src_install () { dobin ${S}/gcc/gdc dobin ${S}/gcc/cc1d cd "${S}/gcc/d/phobos" for file in `find | grep "\.o$"` do rm $file; done dolib.a ${S}/gcc/d/phobos/libphobos.a dodir /usr/include/d cp -Rf *.d ${D}/usr/include/d cp -Rf etc gcc internal std ${D}/usr/include/d dodir ${LIBPATH} cp libphobos.spec ${D}/${LIBPATH} }