--- /usr/portage/sys-devel/gcc/gcc-3.2.2-r1.ebuild 2003-03-24 21:51:17.000000000 +0000 +++ gcc-3.2.2-r1.ebuild 2003-04-06 01:56:30.000000000 +0000 @@ -1,14 +1,23 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /home/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.2-r1.ebuild,v 1.6 2003/03/24 21:31:26 azarah Exp $ +# $Header: /home/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.2-r1.ebuild,v 1.4 2003/03/09 03:23:08 azarah Exp $ 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 ${MY_PV} + +# 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,27 @@ 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 + + if cross-build + then + gcc_lang="c,c++" + fi + # In general gcc does not like optimization, and add -O2 where # it is safe. export CFLAGS="${CFLAGS//-O?}" @@ -263,12 +321,11 @@ --datadir=${DATAPATH} \ --mandir=${DATAPATH}/man \ --infodir=${DATAPATH}/info \ - --enable-shared \ + --build=${CBUILD} \ --host=${CHOST} \ --target=${CCHOST} \ --with-system-zlib \ --enable-languages=${gcc_lang} \ - --enable-threads=posix \ --enable-long-long \ --disable-checking \ --enable-cstdio=stdio \ @@ -291,21 +348,28 @@ get_number_of_jobs einfo "Building GCC..." - # Only build it static if we are just building the C frontend, else - # a lot of things break because there are not libstdc++.so .... - if [ -n "`use static`" -a "${gcc_lang}" = "c" ] + if [ -z "`use static`" ] then + # So far I have only been able to build a tool + # chain or cross compile with a simple make. + # The build fails with the bootstrap line below. + # Aiken 11/03/2003 + if cross-target || cross-build + then + make + else + # Fix for our libtool-portage.patch S="${WORKDIR}/build" \ - emake LDFLAGS="-static" bootstrap \ + emake bootstrap-lean \ LIBPATH="${LIBPATH}" \ BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die # Above FLAGS optimize and speedup build, thanks # to Jeff Garzik + fi else - # Fix for our libtool-portage.patch S="${WORKDIR}/build" \ - emake bootstrap-lean \ + emake LDFLAGS=-static bootstrap \ LIBPATH="${LIBPATH}" \ BOOT_CFLAGS="${CFLAGS}" STAGE1_CFLAGS="-O" || die fi @@ -334,9 +398,15 @@ infodir=${D}${DATAPATH}/info \ LIBPATH="${LIBPATH}" \ FAKE_ROOT="${D}" \ - install || die + install || die "Install failed." - [ -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 @@ -408,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 @@ -424,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 @@ -440,17 +524,17 @@ docinto ${CCHOST}/gcc dodoc ChangeLog* FSFChangeLog* LANGUAGES NEWS ONEWS README* SERVICE cd ${S}/libf2c - docinto ${CCHOST}/libf2c - dodoc ChangeLog README TODO *.netlib + docinto ${CCHOST}/libf2c + dodoc ChangeLog README TODO *.netlib cd ${S}/libffi - docinto ${CCHOST}/libffi - dodoc ChangeLog* LICENSE README - cd ${S}/libiberty - docinto ${CCHOST}/libiberty - dodoc ChangeLog COPYING.LIB README - cd ${S}/libobjc - docinto ${CCHOST}/libobjc - dodoc ChangeLog README* THREADS* + docinto ${CCHOST}/libffi + dodoc ChangeLog* LICENSE README + cd ${S}/libiberty + docinto ${CCHOST}/libiberty + dodoc ChangeLog COPYING.LIB README + cd ${S}/libobjc + docinto ${CCHOST}/libobjc + dodoc ChangeLog README* THREADS* cd ${S}/libstdc++-v3 docinto ${CCHOST}/libstdc++-v3 dodoc ChangeLog* README @@ -472,15 +556,57 @@ 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 - # Fix ncurses b0rking - find ${D}/ -name '*curses.h' -exec rm -f {} \; + # This is a work around for the cross compiler not being + # able to find libgcc_s.* when compiling a package. + # Creating sym links to a directory that the + # $CCHOST-ld will search. + # 06/04/2003 + if [ -z "`use build`" ] + then + cd ${D} + # should already exist + mkdir -p usr/${CCHOST}/lib + cd usr/${CCHOST}/lib + for x in ../../lib/gcc-lib/${CCHOST}/${PV}/lib* + do + echo ${x} + ln -sf ${x} + done + fi + fi + +# die "This is a debugging die." } pkg_preinst() { @@ -489,11 +615,6 @@ then chk_gcc_version fi - - # Make again sure that the linker "should" be able to locate - # libstdc++.so ... - export LD_LIBRARY_PATH="${LIBPATH}:${LD_LIBRARY_PATH}" - ${ROOT}/sbin/ldconfig } pkg_postinst() {