Version bump to add a lot of cross-compile fixes. Also perform sanity checking on...
authorMike Frysinger <vapier@gentoo.org>
Fri, 3 Dec 2004 02:43:33 +0000 (02:43 +0000)
committerMike Frysinger <vapier@gentoo.org>
Fri, 3 Dec 2004 02:43:33 +0000 (02:43 +0000)
sys-devel/gcc-config/ChangeLog
sys-devel/gcc-config/Manifest
sys-devel/gcc-config/files/digest-gcc-config-1.3.7-r3 [moved from sys-devel/gcc-config/files/digest-gcc-config-1.3.7-r2 with 100% similarity]
sys-devel/gcc-config/files/gcc-config-1.3.7
sys-devel/gcc-config/gcc-config-1.3.7-r2.ebuild [deleted file]
sys-devel/gcc-config/gcc-config-1.3.7-r3.ebuild [new file with mode: 0644]

index beb3a0ccdee5090069615780b588122b3dea5528..c274396820954580780e41c625feebc5e0ad9c48 100644 (file)
@@ -1,6 +1,14 @@
 # ChangeLog for sys-devel/gcc-config
 # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.65 2004/11/28 16:39:49 lv Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/ChangeLog,v 1.66 2004/12/03 02:43:33 vapier Exp $
+
+*gcc-config-1.3.7-r3 (02 Dec 2004)
+
+  02 Dec 2004; Mike Frysinger <vapier@gentoo.org> files/gcc-config-1.3.7,
+  -gcc-config-1.3.7-r2.ebuild, +gcc-config-1.3.7-r3.ebuild:
+  Version bump to add a lot of cross-compile fixes. Also perform sanity
+  checking on GCC_SPECS #68799, dont create wrappers in the ebuild #72745, and
+  dont install /lib/cpp unless the system supports C++.
 
 *gcc-config-1.3.7-r2 (28 Nov 2004)
 
index 82de2f4983b121f61adf489a43988eecf506ea7e..3f87a4520f077a8f6165ce80c250ac1d12de9523 100644 (file)
@@ -1,10 +1,20 @@
-MD5 fb92a87e88e95710087422ef18122a62 ChangeLog 12390
-MD5 567094e03359ffc1c95af7356395228d metadata.xml 162
-MD5 5e7e8f8d7232831caffe9be66ae6e6cc gcc-config-1.3.7-r2.ebuild 2237
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+MD5 b6cf159c7fc6998244095afffd1c87c1 gcc-config-1.3.7-r3.ebuild 1426
+MD5 7d2fe90bde1fc09514181aafbcd340db ChangeLog 12772
 MD5 0a250a07d02f1343f64fe7f7bbdbd820 gcc-config-1.3.6-r4.ebuild 2636
-MD5 e64a89abafa7f6f7d16c2540fb0edcf4 files/wrapper-1.4.2.c 7381
+MD5 567094e03359ffc1c95af7356395228d metadata.xml 162
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.6-r4 0
 MD5 2902e905147ff6ba0703f0f72660aa9a files/wrapper-1.4.3.c 8434
-MD5 9e12dace91fe2992fd43427b5f686a49 files/gcc-config-1.3.7 11339
 MD5 5f5ba2d67203ed8386ae76352f15000d files/gcc-config-1.3.6 10285
-MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.6-r4 0
-MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.7-r2 0
+MD5 124a5e345bbd70ad6cd9ca2b8e8d4e6d files/gcc-config-1.3.7 11797
+MD5 e64a89abafa7f6f7d16c2540fb0edcf4 files/wrapper-1.4.2.c 7381
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.7-r3 0
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.9.10 (GNU/Linux)
+
+iD8DBQFBr9LmroRuSHgZdywRAkE8AJ93tys8ySdf5h7i6NzIDvS5RTBiKQCfVcFi
+fIWIuB0dg0WwsGneimtClq0=
+=O/nb
+-----END PGP SIGNATURE-----
index 99c7aad4e52458c789b5c766161d329d07737d0a..11fa5d1cfb58fb43d704a53f97537dad855b816a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.7,v 1.5 2004/11/28 16:39:49 lv Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.7,v 1.6 2004/12/03 02:43:33 vapier Exp $
 # Author:  Martin Schlemmer <azarah@gentoo.org>
 
 trap ":" INT QUIT TSTP
@@ -87,8 +87,7 @@ cmd_setup() {
 get_real_chost() {
        [ -n "${REAL_CHOST}" ] && return 0
 
-       # Use absolute path until all protage versions have portageq in /usr/bin
-       export REAL_CHOST="$(/usr/lib/portage/bin/portageq envvar CHOST)"
+       export REAL_CHOST="$(env -u CHOST portageq envvar CHOST)"
 
        if [ -z "${REAL_CHOST}" ]
        then
@@ -97,6 +96,11 @@ get_real_chost() {
        fi
 }
 
+is_cross_compiler() {
+       get_real_chost
+       [ "${CC_COMP/${REAL_CHOST}}" = "${CC_COMP}" ]
+}
+
 switch_profile() {
        local MY_LDPATH=
        local GCC_PROFILES=
@@ -109,75 +113,78 @@ switch_profile() {
                exit 1
        fi
 
-       if [ -r "${GCC_ENV_D}/config" ]
-       then
-               source "${GCC_ENV_D}/config"
-
-               if [ -n "${CURRENT}" ]
-               then
-                       OLD_CC_COMP="${CURRENT}"
-               fi
-       fi
-
        ebegin "Switching to ${CC_COMP} compiler"
 
        # Sourcing /etc/env.d/gcc/${CC_COMP} is going to mess up
        # PATH among things...
        cmd_setup
 
-       # Order our profiles to have the default first ...
-       # We do this so that we can have them ordered with default
-       # first in /etc/ld.so.conf, as the logical is that all
-       # compilers for default CHOST will be used to compile stuff,
-       # and thus we want all their lib paths in /etc/ld.so.conf ...
-       get_real_chost
-       GCC_PROFILES="$(${FIND} "${GCC_ENV_D}" -name "${REAL_CHOST}-*" -a ! -name "${CC_COMP}")"
-       GCC_PROFILES="${GCC_ENV_D}/${CC_COMP} ${GCC_PROFILES}"
+       if ! is_cross_compiler
+       then
+               # Order our profiles to have the default first ...
+               # We do this so that we can have them ordered with default
+               # first in /etc/ld.so.conf, as the logical is that all
+               # compilers for default CHOST will be used to compile stuff,
+               # and thus we want all their lib paths in /etc/ld.so.conf ...
+               get_real_chost
+               GCC_PROFILES="$(${FIND} "${GCC_ENV_D}" -name "${REAL_CHOST}-*" -a ! -name "${CC_COMP}")"
+               GCC_PROFILES="${GCC_ENV_D}/${CC_COMP} ${GCC_PROFILES}"
+
+               # Extract all LDPATH's for our CHOST
+               for x in ${GCC_PROFILES}
+               do
+                       if [ -f "${x}" ]
+                       then
+                               source "${x}"
 
-       # Extract all LDPATH's for our CHOST
-       for x in ${GCC_PROFILES}
-       do
-               if [ -f "${x}" ]
-               then
-                       source "${x}"
-
-                       # Handle LDPATH's that have multiple directories
-                       local old_IFS="${IFS}"
-                       export IFS=":"
-                       local sub_ldpath=
-                       for sub_ldpath in ${LDPATH}
-                       do
-                               if [ -z "${MY_LDPATH}" ]
-                               then
-                                       if [ -d "${sub_ldpath}" ]
-                                       then
-                                               MY_LDPATH="${sub_ldpath}"
-                                       fi
-                               else
-                                       if [ -d "${sub_ldpath}" ]
+                               # Handle LDPATH's that have multiple directories
+                               local old_IFS="${IFS}"
+                               export IFS=":"
+                               local sub_ldpath=
+                               for sub_ldpath in ${LDPATH}
+                               do
+                                       if [ -z "${MY_LDPATH}" ]
                                        then
-                                               MY_LDPATH="${MY_LDPATH}:${sub_ldpath}"
+                                               if [ -d "${sub_ldpath}" ]
+                                               then
+                                                       MY_LDPATH="${sub_ldpath}"
+                                               fi
+                                       else
+                                               if [ -d "${sub_ldpath}" ]
+                                               then
+                                                       MY_LDPATH="${MY_LDPATH}:${sub_ldpath}"
+                                               fi
                                        fi
-                               fi
-                       done
-                       export IFS="${old_IFS}"
-               fi
-       done
+                               done
+                               export IFS="${old_IFS}"
+                       fi
+               done
+       fi
 
        # Setup things properly again for this profile
        source "${GCC_ENV_D}/${CC_COMP}"
+       OLD_CC_COMP=$(get_current_profile)
 
-       # Setup /etc/env.d/05gcc
-       ${AWK} '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|GCCBITS)=/ {print $0}' \
-               "${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc"
-
-       # Add our custom LDPATH
-       echo "LDPATH=\"${MY_LDPATH}\"" >> "${ENV_D}/05gcc"
+       # What kind of env.d entry are we going to generate ?
+       if is_cross_compiler
+       then
+               # Only keep PATH/ROOTPATH
+               ${AWK} '/^(PATH|ROOTPATH)=/ {print $0}' \
+                       "${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc-${CTARGET}"
 
-       # Make sure we do not recreate /lib/cpp and /usr/bin/cc ...
-#      echo "DISABLE_GEN_GCC_WRAPPERS=\"yes\"" >> "${ENV_D}/05gcc"
+               echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config-${CTARGET}"
+       else
+               # Pass all by default
+               ${AWK} '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS)=/ {print $0}' \
+                       "${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc"
+               echo "LDPATH=\"${MY_LDPATH}\"" >> "${ENV_D}/05gcc"
+               if [[ -n ${GCC_SPECS} ]] && [[ -e ${ROOT}/${GCC_SPECS} ]]
+               then
+                       echo "GCC_SPECS=\"${GCC_SPECS}\"" >> "${ENV_D}/05gcc"
+               fi
 
-       echo "CURRENT=${CC_COMP}" > ${GCC_ENV_D}/config
+               echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config"
+       fi
 
        # Save PATH
        GCC_BIN_PATH="${PATH}"
@@ -185,32 +192,26 @@ switch_profile() {
        source /etc/profile
        umask 022
 
-       # These might not be installed, and we want to update the mtime
-       # for ccache and distcc anyhow ...
-       ${RM} -f "${ROOT}/lib/cpp"
-       ${CP} -f "${ROOT}/usr/lib/gcc-config/wrapper" "${ROOT}/lib/cpp"
-       for x in gcc cpp cc c++ g++ f77 g77 gcj \
-                ${REAL_CHOST}-gcc ${REAL_CHOST}-c++ ${REAL_CHOST}-g++ \
-                ${REAL_CHOST}-f77 ${REAL_CHOST}-g77 ${REAL_CHOST}-gcj
+       # Update the wrappers for this profile
+       local native="gcc cpp cc c++ g++ f77 g77 gcj"
+       is_cross_compiler && native=""
+       for x in ${native} ${CTARGET}-{gcc,c++,g++,f77,g77,gcj}
        do
                # Make sure we have no stale wrappers
                ${RM} -f "${ROOT}/usr/bin/${x}"
                [ "${x:${#x}-3}" = "gcc" -o "${x:${#x}-3}" = "g++" ] \
                        && ${RM} -f "${ROOT}/usr/bin/${x}"{32,64}
 
-               if [ -x "${ROOT}/${GCC_BIN_PATH}/${x}" -o \
-                    "${x}" = "c++" -o "${x}" = "${REAL_CHOST}-c++" -o \
-                    "${x}" = "cpp" -o "${x}" = "cc" ]
+               # Only install a wrapper if the binary exists ...
+               # If installing one of the C++ binaries, check to see
+               # if g++ exists so we don't install crappy wrappers
+               if [ -x "${ROOT}/${GCC_BIN_PATH}/${x}" -o "${x}" = "cc" ] || \
+                  ([ "${x}" = "c++" -o "${x}" = "${CTARGET}-c++" -o "${x}" = "cpp" ] && \
+                   [ -x "${ROOT}/${GCC_BIN_PATH}/${CTARGET}-g++" ])
                then
-                       # Only install a wrapper if the binary exists ...
                        ${CP} -f "${ROOT}/usr/lib/gcc-config/wrapper" \
                                 "${ROOT}/usr/bin/${x}"
 
-                       if [ "${OLD_CC_COMP}" != "${CC_COMP}" ]
-                       then
-                               ${TOUCH} -m "${ROOT}/usr/bin/${x}"
-                       fi
-
                        # Install 32bit and 64bit wrappers if need be
                        # This should probably get folded back into the wrapper ...
                        if [ "${x:${#x}-3}" = "gcc" -o "${x:${#x}-3}" = "g++" ]
@@ -224,15 +225,21 @@ switch_profile() {
                        fi
                fi
        done
+       # Only install cpp if the toolchain supports C++
+       if ! is_cross_compiler && [ -x "${ROOT}/usr/bin/${REAL_CHOST}-g++" ]
+       then
+               ${RM} -f "${ROOT}/lib/cpp"
+               ${CP} -f "${ROOT}/usr/lib/gcc-config/wrapper" "${ROOT}/lib/cpp"
+       fi
 
-       if [ "${ROOT}" == "/" ]
+       if [ "${ROOT}" = "/" ] && [ "${OLD_CC_COMP}" != "${CC_COMP}" ]
        then
                ${ENV_UPDATE} &> /dev/null
        fi
 
        eend 0
 
-       if [ "${ROOT}" == "/" ] && [ "${OLD_CC_COMP}" != "${CC_COMP}" ]
+       if [ "${ROOT}" = "/" ] && [ "${OLD_CC_COMP}" != "${CC_COMP}" ]
        then
                echo
                ewarn "If you intend to use the gcc from the new profile in an already"
@@ -246,13 +253,16 @@ switch_profile() {
 }
 
 get_current_profile() {
-       if [ ! -f "${GCC_ENV_D}/config" ]
+       local conf="${GCC_ENV_D}/config"
+       [ -n "${CTARGET}" ] && conf="${GCC_ENV_D}/config-${CTARGET}"
+
+       if [[ ! -f ${conf} ]]
        then
                eerror "$0: No gcc profile is active!"
                return 1
        fi
 
-       source "${GCC_ENV_D}/config"
+       source "${conf}"
 
        if [ -z "${CURRENT}" ]
        then
@@ -281,10 +291,10 @@ list_profiles() {
        fi
        for x in "${GCC_ENV_D}"/*
        do
-               if [ -f "${x}" -a "${x}" != "${GCC_ENV_D}/config" ]
+               if [ -f "${x}" -a "${x/\/config}" = "${x}" ]
                then
                        x="${x##*/}"
-                       [ "${x}" == "${CURRENT}" ] && x="${x} *"
+                       [ "${x}" = "${CURRENT}" ] && x="${x} *"
                        echo "[${i}] ${x}"
                        i=$((i + 1))
                fi
@@ -441,7 +451,7 @@ do
                                        i=1
                                        for y in "${GCC_ENV_D}"/*
                                        do
-                                               [ "${y}" == "${GCC_ENV_D}/config" ] && continue
+                                               [ "${y/\/config}" != "${y}" ] && continue
 
                                                if [ -f "${y}" ] && [ "${x}" -eq "${i}" ]
                                                then
diff --git a/sys-devel/gcc-config/gcc-config-1.3.7-r2.ebuild b/sys-devel/gcc-config/gcc-config-1.3.7-r2.ebuild
deleted file mode 100644 (file)
index 29f7334..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/gcc-config-1.3.7-r2.ebuild,v 1.1 2004/11/28 16:39:49 lv Exp $
-
-inherit toolchain-funcs
-
-# Version of .c wrapper to use
-W_VER="1.4.2"
-
-DISABLE_GEN_GCC_WRAPPERS="yes"
-
-DESCRIPTION="Utility to change the gcc compiler being used."
-HOMEPAGE="http://www.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-IUSE=""
-
-DEPEND="virtual/libc
-       >=sys-apps/portage-2.0.47-r10" # We need portageq ...
-
-src_install() {
-       einfo "Installing gcc-config..."
-       newbin ${FILESDIR}/${PN}-${PV} ${PN}
-       dosed "s:PORTAGE-VERSION:${PV}:" /usr/bin/${PN}
-
-       # Make sure we use the new version of gcc-config
-       export PATH="${D}/usr/bin:${PATH}"
-
-       einfo "Compiling wrapper..."
-       $(tc-getCC) -O2 -Wall -o ${WORKDIR}/wrapper \
-               ${FILESDIR}/wrapper-${W_VER}.c || die
-
-       exeinto /usr/lib/gcc-config
-       doexe ${WORKDIR}/wrapper || die
-
-       # Only setup this if we have a proper gcc version installed, else
-       # we will nuke the non gcc-config versions ...
-       if gcc-config --get-current-profile &> /dev/null
-       then
-               einfo "Creating wrappers for compiler tools..."
-               exeinto /lib
-               newexe ${WORKDIR}/wrapper cpp
-
-               local gcc_bin_path="$(gcc-config --get-bin-path)"
-               exeinto /usr/bin
-               for x in gcc cpp cc c++ g++ f77 g77 gcj \
-                        ${CHOST}-gcc ${CHOST}-c++ ${CHOST}-g++ \
-                        ${CHOST}-f77 ${CHOST}-g77 ${CHOST}-gcj
-               do
-                       # Make sure we only install wrappers for those present ...
-                       [ -x "${gcc_bin_path}/${x}" -o \
-                         "${x}" = "c++" -o "${x}" = "${REAL_CHOST}-c++" -o \
-                         "${x}" = "cpp" -o "${x}" = "cc" ] && \
-                               newexe ${WORKDIR}/wrapper ${x}
-               done
-       fi
-}
-
-pkg_postinst() {
-       # Do we have a valid multi ver setup ?
-       if gcc-config --get-current-profile &> /dev/null
-       then
-               # We not longer use the /usr/include/g++-v3 hacks, as
-               # it is not needed ...
-               if [ -L ${ROOT}/usr/include/g++ ]
-               then
-                       rm -f ${ROOT}/usr/include/g++
-               fi
-               if [ -L ${ROOT}/usr/include/g++-v3 ]
-               then
-                       rm -f ${ROOT}/usr/include/g++-v3
-               fi
-
-               if [ ${ROOT} = "/" ]
-               then
-                       gcc-config $(/usr/bin/gcc-config --get-current-profile)
-               fi
-       fi
-}
diff --git a/sys-devel/gcc-config/gcc-config-1.3.7-r3.ebuild b/sys-devel/gcc-config/gcc-config-1.3.7-r3.ebuild
new file mode 100644 (file)
index 0000000..13cec19
--- /dev/null
@@ -0,0 +1,59 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/gcc-config-1.3.7-r3.ebuild,v 1.1 2004/12/03 02:43:33 vapier Exp $
+
+inherit toolchain-funcs
+
+# Version of .c wrapper to use
+W_VER="1.4.2"
+
+DISABLE_GEN_GCC_WRAPPERS="yes"
+
+DESCRIPTION="Utility to change the gcc compiler being used"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE=""
+
+DEPEND="virtual/libc
+       >=sys-apps/portage-2.0.47-r10" # We need portageq ...
+
+S=${WORKDIR}
+
+src_compile() {
+       $(tc-getCC) -O2 -Wall -o wrapper \
+               ${FILESDIR}/wrapper-${W_VER}.c || die "compile wrapper"
+}
+
+src_install() {
+       newbin ${FILESDIR}/${PN}-${PV} ${PN} || die "install gcc-config"
+       dosed "s:PORTAGE-VERSION:${PV}:" /usr/bin/${PN}
+
+       exeinto /usr/lib/gcc-config
+       doexe wrapper || die "install wrapper"
+}
+
+pkg_postinst() {
+       # Do we have a valid multi ver setup ?
+       if gcc-config --get-current-profile &> /dev/null
+       then
+               # We not longer use the /usr/include/g++-v3 hacks, as
+               # it is not needed ...
+               if [ -L ${ROOT}/usr/include/g++ ]
+               then
+                       rm -f ${ROOT}/usr/include/g++
+               fi
+               if [ -L ${ROOT}/usr/include/g++-v3 ]
+               then
+                       rm -f ${ROOT}/usr/include/g++-v3
+               fi
+
+               if [ ${ROOT} = "/" ]
+               then
+                       gcc-config $(/usr/bin/gcc-config --get-current-profile)
+               fi
+       fi
+}