# Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ IUSE="" W_VER="1.4.3" DISABLE_GEN_GCC_WRAPPERS="yes" S="${WORKDIR}/${P}" DESCRIPTION="Utility to change the gcc compiler being used." SRC_URI="" HOMEPAGE="http://www.gentoo.org/" KEYWORDS="~x86 ~ppc ~sparc ~alpha ~mips ~arm ~hppa" SLOT="0" LICENSE="GPL-2" # we need portageq DEPEND="virtual/glibc >=sys-apps/portage-2.0.37-r10" src_compile() { einfo "Processing script..." sed -e "s,@VERSION@,${PV}," \ "${FILESDIR}/${PN}-${PV}" > "${WORKDIR}/${PN}-${PV}" einfo "Compiling wrapper..." ${CC:-gcc} -O2 -Wall -o "${WORKDIR}/wrapper" \ "${FILESDIR}/wrapper-${W_VER}.c" || die } src_install() { exeinto /usr/lib/gcc-config doexe "${WORKDIR}/wrapper" || die einfo "Adding compat symlinks..." into /usr || die dodir /usr/sbin || die newbin "${WORKDIR}/${PN}-${PV}" "${PN}" || die dosym "../bin/${PN}" "/usr/sbin/${PN}" || die # Only setup this if we have a proper gcc version installed, else # we will nuke the non gcc-config versions ... if /usr/bin/gcc-config --get-current-profile &> /dev/null || \ /usr/sbin/gcc-config --get-current-profile &> /dev/null then einfo "Creating wrappers for compiler tools..." exeinto /lib newexe "${WORKDIR}/wrapper" cpp || die fi } pkg_preinst() { local GCCC_CMD # Setup PATH just in case (of what!?) if /usr/bin/gcc-config --get-current-profile &> /dev/null || \ /usr/sbin/gcc-config --get-current-profile &> /dev/null then [ -x ${ROOT}usr/bin/gcc-config ] && \ GCCC_CMD="/usr/bin/gcc-config" || \ GCCC_CMD="/usr/sbin/gcc-config" export PATH="$(${GCCC_CMD} --get-bin-path):${PATH}" fi } pkg_postinst() { # Do we have a valid multi ver setup ? if /usr/bin/gcc-config --get-current-profile &> /dev/null then /usr/bin/gcc-config --install-wrappers ${CHOST} # We not longer use the /usr/include/g++-v3 hacks, as # it is not needed ... [ -L /usr/include/g++ ] && rm -f /usr/include/g++ [ -L /usr/include/g++-v3 ] && rm -f /usr/include/g++-v3 # now set too /usr/bin/gcc-config $(/usr/bin/gcc-config --get-current-profile) fi }