Use https by default
[gentoo.git] / sys-devel / multilib-gcc-wrapper / multilib-gcc-wrapper-0.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 inherit eutils multilib
8
9 DESCRIPTION="Wrappers for gcc tools to be used on non-native CHOSTs"
10 HOMEPAGE="https://www.gentoo.org"
11 SRC_URI=""
12
13 LICENSE="public-domain"
14 SLOT="0"
15 KEYWORDS="~amd64"
16 IUSE=""
17
18 RDEPEND="sys-devel/gcc:="
19
20 S=${WORKDIR}
21
22 mkwrap() {
23         einfo " ${2}"
24
25         cat > "${T}"/wrapper <<-_EOF_
26                 #!${EPREFIX}/bin/sh
27                 exec ${1} $(get_abi_CFLAGS) "\${@}"
28         _EOF_
29
30         newbin "${T}"/wrapper "${2}"
31 }
32
33 src_install() {
34         local host_prefix=${CHOST}
35         # stolen from sys-devel/gcc-config
36         # TODO: check if all of them actually support $(get_ABI_CFLAGS)
37         local tools=(
38                 cpp cc gcc c++ g++ f77 g77 gcj gcjh gdc gdmd gfortran gccgo
39         )
40
41         cd "${EROOT%/}"/usr/bin || die
42         eshopts_push -s nullglob
43
44         # same as toolchain.eclass
45         : ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
46         : ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
47         local ABI t e
48         for ABI in $(get_all_abis TARGET); do
49                 [[ ${ABI} == ${TARGET_DEFAULT_ABI} ]] && continue
50
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}-}
58
59                                 einfo " ${newname}"
60
61                                 cat > "${T}"/wrapper <<-_EOF_
62                                         #!${EPREFIX}/bin/sh
63                                         exec ${e} $(get_abi_CFLAGS) "\${@}"
64                                 _EOF_
65
66                                 newbin "${T}"/wrapper "${newname}"
67                         done
68                 done
69         done
70
71         eshopts_pop
72 }