--- /usr/portage/sys-devel/gcc/gcc-3.2.2-r1.ebuild 2003-03-09 03:51:14.000000000 +0000 +++ gcc-3.2.2-r4.ebuild 2003-03-23 03:14:12.000000000 +0000 @@ -4,11 +4,20 @@ IUSE="static nls bootstrap java build" -inherit eutils flag-o-matic libtool +inherit eutils flag-o-matic libtool crosscompile # Compile problems with these (bug #6641 among others)... filter-flags "-fno-exceptions -fomit-frame-pointer" +# Having these set for the local machine will/can fail +# during the build process because part of the build +# is for the target machine. +# Aiken 11/03/2003 +if cross-target +then + filter-flags "-march -mcpu" +fi + # Recently there has been a lot of stability problem in Gentoo-land. Many # things can be the cause to this, but I believe that it is due to gcc3 # still having issues with optimizations, or with it not filtering bad @@ -85,24 +94,41 @@ HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html" LICENSE="GPL-2 LGPL-2.1" -KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~arm ~mips" +KEYWORDS="x86 ~ppc ~sparc ~alpha ~hppa ~arm ~mips" + +# Removed the following because SLOT if done in +# crosscompile eclass. +# Aiken 11/03/2003 # Ok, this is a hairy one again, but lets assume that we # are not cross compiling, than we want SLOT to only contain # $PV, as people upgrading to new gcc layout will not have # their old gcc unmerged ... -if [ "${CHOST}" == "${CCHOST}" ] +#if [ "${CHOST}" == "${CCHOST}" ] +#then +# SLOT="${MY_PV}" +#else +# SLOT="${CCHOST}-${MY_PV}" +#fi + +cross-check 3.2.2 + +# I am changing the DEPEND depending on whether we are doing a tool chain +# or not. If I am building a cross compile too chain I DON'T want it +# changing software versions of the host. I already have the host setup +# how I want. By the time I get to here I also have the cross binutils I +# want. +# Aiken 12/03/2003 +if ! cross-target then - SLOT="${MY_PV}" -else - SLOT="${CCHOST}-${MY_PV}" -fi - DEPEND="virtual/glibc mips? >=sys-devel/binutils-2.13.90.0.16 : >=sys-devel/binutils-2.13.90.0.18 >=sys-devel/gcc-config-1.3.1 !build? ( >=sys-libs/ncurses-5.2-r2 nls? ( sys-devel/gettext ) )" +else + DEPEND="" +fi RDEPEND="virtual/glibc >=sys-devel/gcc-config-1.3.1 @@ -222,6 +248,17 @@ rm -f ${x}.orig done + + # Apply patches only when creating a cross compiler and + # only when building the 1st stage. + # Aiken 12/03/2003 + if cross-target && [ "`use build`" ] + then + cd ${S} + patch -p0 < ${FILESDIR}/gcc-3.2-crossppc.diff || die + patch -p0 < ${FILESDIR}/gcc-3.2.2-cross-x86.diff || die + patch -p0 < ${FILESDIR}/gcc-3.2.2-cross-alpha.diff || die + fi } src_compile() { @@ -246,6 +283,31 @@ gcc_lang="${gcc_lang},java" fi + # Aiken 11/03/2003 + if cross-target && [ "`use build`" ] + then + # cross 1st stage + myconf="${myconf} --disable-shared --disable-threads" + else + myconf="${myconf} --enable-shared --enable-threads=posix" + fi + + # At the moment only do c and c++ for the cross tool chain + # Aiken 12/03/2003 + if cross-target && [ -z "`use build`" ] + then + gcc_lang="c,c++" + fi + + echo gcc_lang = ${gcc_lang} + echo myconf = ${myconf} + echo CBUILD = ${CBUILD} + echo CHOST = ${CHOST} + echo CCHOST = ${CCHOST} + echo CFLAGS = ${CFLAGS} + echo CXXFLAGS = ${CXXFLAGS} +# die + # In general gcc does not like optimization, and add -O2 where # it is safe. export CFLAGS="${CFLAGS//-O?}" @@ -263,12 +325,10 @@ --datadir=${DATAPATH} \ --mandir=${DATAPATH}/man \ --infodir=${DATAPATH}/info \ - --enable-shared \ --host=${CHOST} \ --target=${CCHOST} \ --with-system-zlib \ --enable-languages=${gcc_lang} \ - --enable-threads=posix \ --enable-long-long \ --disable-checking \ --enable-cstdio=stdio \ @@ -293,6 +353,12 @@ einfo "Building GCC..." if [ -z "`use static`" ] then + # Aiken 11/03/2003 + if cross-target + then + make + else + # Fix for our libtool-portage.patch S="${WORKDIR}/build" \ emake bootstrap-lean \ @@ -300,6 +366,7 @@ BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die # Above FLAGS optimize and speedup build, thanks # to Jeff Garzik + fi else S="${WORKDIR}/build" \ emake LDFLAGS=-static bootstrap \ @@ -333,7 +400,13 @@ FAKE_ROOT="${D}" \ install || die - [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}" + # Aiken 11/03/2003 + if cross-target + then + [ -r ${D}${BINPATH}/${CCHOST}-gcc ] || die "${CCHOST}-gcc not found in ${D}" + else + [ -r ${D}${BINPATH}/gcc ] || die "gcc not found in ${D}" + fi dodir /lib /usr/bin dodir /etc/env.d/gcc @@ -405,13 +478,27 @@ [ -f ${D}${STDCXX_INCDIR}/cxxabi.h ] && \ mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/ - # These should be symlinks - cd ${D}${BINPATH} - rm -f ${CCHOST}-{gcc,g++,c++,g77} - [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc - [ -f g++ ] && ln -sf g++ ${CCHOST}-g++ - [ -f g++ ] && ln -sf g++ ${CCHOST}-c++ - [ -f g77 ] && ln -sf g77 ${CCHOST}-g77 + # Aiken 14/03/2003 + if ! cross-target + then + # These should be symlinks + cd ${D}${BINPATH} + rm -f ${CCHOST}-{gcc,g++,c++,g77} + [ -f gcc ] && ln -sf gcc ${CCHOST}-gcc + [ -f g++ ] && ln -sf g++ ${CCHOST}-g++ + [ -f g++ ] && ln -sf g++ ${CCHOST}-c++ + [ -f g77 ] && ln -sf g77 ${CCHOST}-g77 + else + # A cross compiler will be called ${CCHOST}-xxx + # Create sym links so the short names also exist. + # This allows gcc-config to change the compiler. + cd ${D}${BINPATH} + for x in ${CCHOST}* + do + NAME=`echo $x | awk -F '-' '{print $5}'` + ln -sf $x $NAME + done + fi fi # This one comes with binutils @@ -421,8 +508,8 @@ fi cd ${S} - if [ -z "`use build`" ] - then + if [ -z "`use build`" ] + then cd ${S} docinto /${CCHOST} dodoc COPYING COPYING.LIB ChangeLog FAQ GNATS MAINTAINERS README @@ -469,15 +556,39 @@ rm -rf ${D}/usr/share/{man,info} fi - # Rather install the script, else portage with changing $FILESDIR - # between binary and source package borks things .... - insinto /lib/rcscripts/awk - doins ${FILESDIR}/awk/fixlafiles.awk - exeinto /sbin - doexe ${FILESDIR}/fix_libtool_files.sh + # I don't think we need these when installing a cross compiler. + # We are installing a new compiler not upgrading an existing one. + # They will still get installed if the system gcc is upgraded. + # Aiken 11/03/2003 + if ! cross-target + then + # Rather install the script, else portage with changing $FILESDIR + # between binary and source package borks things .... + insinto /lib/rcscripts/awk + doins ${FILESDIR}/awk/fixlafiles.awk + exeinto /sbin + doexe ${FILESDIR}/fix_libtool_files.sh + fi + + # Fix ncurses b0rking + find ${D}/ -name '*curses.h' -exec rm -f {} \; + + if cross-target + then + # I like having a cross compiler available at any time. + # Create sym links in /usr/bin so this happens. + # + # Aiken 11/03/2003 + cd ${D} + mkdir -p usr/bin + cd usr/bin + for x in ../${CCHOST}/gcc-bin/${MY_PV}/${CCHOST}* + do + ln -sf ${x} + done + fi - # Fix ncurses b0rking - find ${D}/ -name '*curses.h' -exec rm -f {} \; +# die "This is a debugging die." } pkg_preinst() {