1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils multilib
9 DESCRIPTION="Wrappers for gcc tools to be used on non-native CHOSTs"
10 HOMEPAGE="https://www.gentoo.org"
13 LICENSE="public-domain"
18 RDEPEND="sys-devel/gcc:="
25 cat > "${T}"/wrapper <<-_EOF_
27 exec ${1} $(get_abi_CFLAGS) "\${@}"
30 newbin "${T}"/wrapper "${2}"
34 local host_prefix=${CHOST}
35 # stolen from sys-devel/gcc-config
36 # TODO: check if all of them actually support $(get_ABI_CFLAGS)
38 cpp cc gcc c++ g++ f77 g77 gcj gcjh gdc gdmd gfortran gccgo
41 cd "${EROOT%/}"/usr/bin || die
42 eshopts_push -s nullglob
44 # same as toolchain.eclass
45 : ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
46 : ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
48 for ABI in $(get_all_abis TARGET); do
49 [[ ${ABI} == ${TARGET_DEFAULT_ABI} ]] && continue
51 einfo "Creating wrappers for ${ABI} ..."
52 for t in "${tools[@]}"; do
53 # look for both plain *-gcc and e.g. *-gcc-4.8.3
54 # (but avoid *-gcc-nm)
55 # note: nullglob applied above
56 for e in ${host_prefix}[-]${t}{,-[0-9]*}; do
57 local newname=$(get_abi_CHOST)-${e#${host_prefix}-}
61 cat > "${T}"/wrapper <<-_EOF_
63 exec ${e} $(get_abi_CFLAGS) "\${@}"
66 newbin "${T}"/wrapper "${newname}"