# $Id: gcc-4.3.4-r4.smage2 5620 2010-07-15 17:04:00Z niro $ PNAME="gcc" PVER="4.5.1" PBUILD="r2" PCATEGORIE="sys-dev" STATE="unstable" HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html" SDEPEND="== sys-libs/libstdc++-${PVER} >= sys-dev/binutils-2.20 >= virtual/glibc >= dev-libs/gmp-5.0.1 >= dev-libs/mpfr-3.0.0 >= dev-libs/mpc-0.8.2 >= dev-libs/ppl-0.10.2 >= dev-libs/cloog-ppl-0.15.9 >= virtual/kernel-headers" SPLIT_PACKAGES="libstdc++ gcc" SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" # languages to build into gcc MyLanguages=c,c++ sminclude mtools cleanutils libtool mcore SRC_URI=( gnu://${PNAME}/${PNAME}-${PVER}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-${PVER}-no-fixincludes.patch ) UP2DATE="updatecmd \"http://ftp.gnu.org/gnu/${PNAME}/?C=M;O=A\" | sed -n 's/.*${PNAME}-\(.*\)\//\1/;$ p'" # gcc don't like strong CFLAGS export CFLAGS="${CFLAGS//-O?} -O2" export CXXFLAGS="${CFLAGS}" # 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 split_info_gcc() { DESCRIPTION="Modern C/C++ compiler written by the GNU people." DEPEND="== sys-libs/libstdc++-${PVER} >= sys-dev/binutils-2.20 >= virtual/glibc >= dev-libs/gmp-5.0.1 >= dev-libs/mpfr-3.0.0 >= dev-libs/mpc-0.8.2 >= dev-libs/ppl-0.10.2 >= dev-libs/cloog-ppl-0.15.9" } split_info_libstdc++() { DESCRIPTION="Standard GNU C and C++ libraries." DEPEND=">= sys-apps/base-files-0.1" PCATEGORIE="sys-libs" } src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # generic fixes mpatch ${PNAME}-${PVER}-no-fixincludes.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 local myconf # you better off when not using distcc to compile # your new compiler :) maybe not all are the same export SMAGE_USE_DISTCC=false # Straight from the GCC install doc: # "GCC has code to correctly determine the correct value for target # for nearly all native systems. Therefore, we highly recommend you # not provide a configure target when configuring a native compiler." if [[ ${CHOST} != ${CCHOST} ]] then myconf+=" --target=${CCHOST}" fi # gcc >= 4.3 has now configure flags for uri and version - yeah! AR=ar \ ../configure \ --with-bugurl="http://bugs.magellan-linux.de/" \ --with-pkgversion="Magellan-Linux" \ --build=${CHOST} \ --host=${CHOST} \ --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 \ --with-system-zlib \ --enable-long-long \ --enable-cstdio=stdio \ --enable-languages=${MyLanguages} \ --disable-libstdcxx-pch \ ${myconf} \ || die # parallel builds seems to break sometimes on x86_64 local myopts [[ ${ARCH} = x86_64 ]] && myopts=-j1 mmake ${myopts} bootstrap-lean || die } src_install_gcc() { cd ${SRCDIR}/build minstalldir /$(mlibdir) || die # install all targets make DESTDIR=${BINDIR} install || die # versionize all bins and symlink them for bin in $(find ${BINDIR}/usr/bin -type f) do echo ${bin} mv ${bin} ${bin}-${PVER} || die ln -snf $(basename ${bin}-${PVER}) ${bin} || die done mlink ../usr/bin/cpp-${PVER} /$(mlibdir)/cpp || die # this one is needed on multilib systems. # rpcgen may not find the cpp compiler correctly if not in /lib/cpp if [[ $(mlibdir) != lib ]] then minstalldir /lib || die mlink ../usr/bin/cpp-${PVER} /lib/cpp || die fi mlink gcc-${PVER} /usr/bin/cc || die # deletes libstdc++ && libgcc_s && libssp && libgomp rm ${BINDIR}/usr/$(mlibdir)/{libgcc_s*.*,libstdc++*.*,libssp*.*,libgomp*.*} || die if [[ $(mlibdir) != lib ]] && [[ -d ${BINDIR}/usr/lib ]] then rm ${BINDIR}/usr/lib/{libgcc_s*.*,libstdc++*.*,libssp*.*,libgomp*.*} || die fi # fix all .la files # they may contain invalid libpathes which are not needed local la for la in $(find ${BINDIR} -name \*.la) do fix_la_file ${la} || die ${la} done } src_install_libstdc++() { cd ${SRCDIR}/build minstalldir /$(mlibdir) || die local target for target in libstdc++-v3 libgcc libssp libgomp do make DESTDIR=${BINDIR} install-target-${target} || die done # move gdb scripts to a proper location and to pretty-print ldconfig minstalldir /usr/share/gdb/autoload/usr/$(mlibdir) || die mv ${BINDIR}/usr/$(mlibdir)/libstdc++*gdb.py* ${BINDIR}/usr/share/gdb/autoload/usr/$(mlibdir)/ || die # multilib as well if [[ $(mlibdir) != lib ]] && [[ -d ${BINDIR}/usr/lib ]] then minstalldir /usr/share/gdb/autoload/usr/lib || die mv ${BINDIR}/usr/lib/libstdc++*gdb.py* ${BINDIR}/usr/share/gdb/autoload/usr/lib/ || die fi # cleanup, only keep the libs, everything else get provided by the gcc-package zapmost ${BINDIR}/usr/$(mlibdir) libgcc_s*.* libstdc++*.* libssp*.* libgomp*.* || die # multilib as well if [[ $(mlibdir) != lib ]] && [[ -d ${BINDIR}/usr/lib ]] then zapmost ${BINDIR}/usr/lib libgcc_s*.* libstdc++*.* libssp*.* libgomp*.* || die fi # clean up everything else zapmost ${BINDIR} usr/$(mlibdir) $([[ $(mlibdir) != lib ]] && echo "usr/lib") || die }