more tweaks/generalization to support gcc-2 #124578
authorMike Frysinger <vapier@gentoo.org>
Sat, 30 Dec 2006 09:12:36 +0000 (09:12 +0000)
committerMike Frysinger <vapier@gentoo.org>
Sat, 30 Dec 2006 09:12:36 +0000 (09:12 +0000)
eclass/toolchain.eclass

index e86dd8501bb68bbe1f89785dc86fd4b203e9e203..be2204ba6b28f13fecf5e7455bafa3a86d99ce93 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.319 2006/12/27 06:04:03 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.320 2006/12/30 09:12:36 vapier Exp $
 
 HOMEPAGE="http://gcc.gnu.org/"
 LICENSE="GPL-2 LGPL-2.1"
@@ -102,7 +102,6 @@ if [[ ${GCC_VAR_TYPE} == "versioned" ]] ; then
        else
                LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}}
        fi
-       LIBEXECPATH=${TOOLCHAIN_LIBEXE:-${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}}
        INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include}
        if is_crosscompile ; then
                BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}}
@@ -120,7 +119,6 @@ elif [[ ${GCC_VAR_TYPE} == "non-versioned" ]] ; then
        # specific gcc targets, like libffi. Note that we dont override the value
        # returned by get_libdir here.
        LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/$(get_libdir)}
-       LIBEXECPATH=${TOOLCHAIN_LIBEXE:-${PREFIX}/libexec/gcc}
        INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${PREFIX}/include}
        BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/bin}
        DATAPATH=${TOOLCHAIN_DATAPATH:-${PREFIX}/share}
@@ -1107,11 +1105,13 @@ gcc_src_unpack() {
                eend $?
        done
 
-       einfo "Touching generated files"
-       ./contrib/gcc_update --touch | \
-               while read f ; do
-                       einfo "  ${f%%...}"
-               done
+       if [[ -x contrib/gcc_update ]] ; then
+               einfo "Touching generated files"
+               ./contrib/gcc_update --touch | \
+                       while read f ; do
+                               einfo "  ${f%%...}"
+                       done
+       fi
 
        disable_multilib_libjava || die "failed to disable multilib java"
 }
@@ -1610,9 +1610,9 @@ gcc-compiler_src_install() {
        S=${WORKDIR}/build \
        make DESTDIR="${D}" install || die
        # Punt some tools which are really only useful while building gcc
-       rm -r "${D}${LIBEXECPATH}"/install-tools
+       find "${D}" -name install-tools -type d -exec rm -rf "{}" \;
        # This one comes with binutils
-       find "${D}" -name libiberty.a -exec rm -f {} \;
+       find "${D}" -name libiberty.a -exec rm -f "{}" \;
 
        # Move the libraries to the proper location
        gcc_movelibs
@@ -1647,38 +1647,38 @@ gcc-compiler_src_install() {
        # Make sure we dont have stuff lying around that
        # can nuke multiple versions of gcc
        if ! use build ; then
-               cd ${D}${LIBPATH}
+               cd "${D}"${LIBPATH}
 
                # Move Java headers to compiler-specific dir
-               for x in ${D}${PREFIX}/include/gc*.h ${D}${PREFIX}/include/j*.h ; do
-                       [[ -f ${x} ]] && mv -f "${x}" ${D}${LIBPATH}/include/
+               for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
+                       [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
                done
                for x in gcj gnu java javax org ; do
                        if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
                                dodir /${LIBPATH}/include/${x}
-                               mv -f ${D}${PREFIX}/include/${x}/* ${D}${LIBPATH}/include/${x}/
-                               rm -rf ${D}${PREFIX}/include/${x}
+                               mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
+                               rm -rf "${D}"${PREFIX}/include/${x}
                        fi
                done
 
                if [[ -d ${D}${PREFIX}/lib/security ]] ; then
                        dodir /${LIBPATH}/security
-                       mv -f ${D}${PREFIX}/lib/security/* ${D}${LIBPATH}/security
-                       rm -rf ${D}${PREFIX}/lib/security
+                       mv -f "${D}"${PREFIX}/lib/security/* "${D}"${LIBPATH}/security
+                       rm -rf "${D}"${PREFIX}/lib/security
                fi
 
                # Move libgcj.spec to compiler-specific directories
                [[ -f ${D}${PREFIX}/lib/libgcj.spec ]] && \
-                       mv -f ${D}${PREFIX}/lib/libgcj.spec ${D}${LIBPATH}/libgcj.spec
+                       mv -f "${D}"${PREFIX}/lib/libgcj.spec "${D}"${LIBPATH}/libgcj.spec
 
                # Rename jar because it could clash with Kaffe's jar if this gcc is
                # primary compiler (aka don't have the -<version> extension)
-               cd ${D}${BINPATH}
+               cd "${D}"${BINPATH}
                [[ -f jar ]] && mv -f jar gcj-jar
 
                # Move <cxxabi.h> to compiler-specific directories
                [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
-                       mv -f ${D}${STDCXX_INCDIR}/cxxabi.h ${D}${LIBPATH}/include/
+                       mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
 
                # These should be symlinks
                dodir /usr/bin
@@ -1718,8 +1718,11 @@ gcc-compiler_src_install() {
        fi
 
        # Now do the fun stripping stuff
-       env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}" "${D}${LIBEXECPATH}"
+       env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
        env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+       # gcc used to install helper binaries in lib/ but then moved to libexec/
+       [[ -d ${D}${PREFIX}/libexec/gcc ]] && \
+               env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
 
        cd "${S}"
        if use build || is_crosscompile; then
@@ -1769,6 +1772,9 @@ gcc-compiler_src_install() {
 # when installing gcc, it dumps internal libraries into /usr/lib
 # instead of the private gcc lib path
 gcc_movelibs() {
+       # older versions of gcc did not support --print-multi-os-directory
+       tc_version_is_at_least 3.0 || return 0
+
        local multiarg removedirs=""
        for multiarg in $($(XGCC) -print-multi-lib) ; do
                multiarg=${multiarg#*;}
@@ -1810,7 +1816,7 @@ gcc_movelibs() {
 
        # make sure the libtool archives have libdir set to where they actually
        # -are-, and not where they -used- to be.
-       fix_libtool_libdir_paths "$(find ${D}${LIBPATH} -name *.la)"
+       fix_libtool_libdir_paths $(find "${D}"${LIBPATH} -name *.la)
 }
 
 #----<< src_* >>----