Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/multilib-gcc-wrapper/
Date: Fri, 22 Jun 2018 12:10:22
Message-Id: 1529669408.ffe933033442c27d5e99788f82f958f03ee0b7d0.mgorny@gentoo
1 commit: ffe933033442c27d5e99788f82f958f03ee0b7d0
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 22 12:07:29 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 22 12:10:08 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ffe93303
7
8 sys-devel/multilib-gcc-wrapper: Bump to EAPI=7
9
10 .../multilib-gcc-wrapper-0-r2.ebuild | 83 ++++++++++++++++++++++
11 1 file changed, 83 insertions(+)
12
13 diff --git a/sys-devel/multilib-gcc-wrapper/multilib-gcc-wrapper-0-r2.ebuild b/sys-devel/multilib-gcc-wrapper/multilib-gcc-wrapper-0-r2.ebuild
14 new file mode 100644
15 index 00000000000..f670a006b51
16 --- /dev/null
17 +++ b/sys-devel/multilib-gcc-wrapper/multilib-gcc-wrapper-0-r2.ebuild
18 @@ -0,0 +1,83 @@
19 +# Copyright 1999-2018 Gentoo Foundation
20 +# Distributed under the terms of the GNU General Public License v2
21 +
22 +EAPI=7
23 +
24 +inherit multilib
25 +
26 +DESCRIPTION="Wrappers for gcc tools to be used on non-native CHOSTs"
27 +HOMEPAGE="https://www.gentoo.org"
28 +SRC_URI=""
29 +
30 +LICENSE="public-domain"
31 +SLOT="0"
32 +KEYWORDS="~amd64"
33 +IUSE=""
34 +
35 +RDEPEND="sys-devel/gcc:="
36 +
37 +S=${WORKDIR}
38 +
39 +mkwrap() {
40 + einfo " ${2}"
41 +
42 + cat > "${T}"/wrapper <<-_EOF_
43 + #!${EPREFIX}/bin/sh
44 + exec ${1} $(get_abi_CFLAGS) "\${@}"
45 + _EOF_
46 +
47 + newbin "${T}"/wrapper "${2}"
48 +}
49 +
50 +src_install() {
51 + local host_prefix=${CHOST}
52 + # stolen from sys-devel/gcc-config
53 + # TODO: check if all of them actually support $(get_ABI_CFLAGS)
54 + local tools=(
55 + cpp cc gcc c++ g++ f77 g77 gcj gcjh gdc gdmd gfortran gccgo
56 + )
57 +
58 + cd "${EROOT%/}"/usr/bin || die
59 + shopt -s nullglob
60 +
61 + # same as toolchain.eclass
62 + : ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
63 + : ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
64 + local ABI t e
65 + for ABI in $(get_all_abis TARGET); do
66 + [[ ${ABI} == ${TARGET_DEFAULT_ABI} ]] && continue
67 +
68 + einfo "Creating wrappers for ${ABI} ..."
69 + for t in "${tools[@]}"; do
70 + # look for both plain *-gcc and e.g. *-gcc-4.8.3
71 + # (but avoid *-gcc-nm)
72 + # note: nullglob applied above
73 + for e in ${host_prefix}[-]${t}{,-[0-9]*}; do
74 + local newname=$(get_abi_CHOST)-${e#${host_prefix}-}
75 +
76 + einfo " ${newname}"
77 +
78 + cat > "${T}"/wrapper <<-_EOF_
79 + #!${EPREFIX}/bin/sh
80 + exec ${e} $(get_abi_CFLAGS) "\${@}"
81 + _EOF_
82 +
83 + newbin "${T}"/wrapper "${newname}"
84 + done
85 + done
86 + done
87 +
88 + shopt -u nullglob
89 +}
90 +
91 +pkg_postinst() {
92 + if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
93 + eselect compiler-shadow update all
94 + fi
95 +}
96 +
97 +pkg_postrm() {
98 + if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
99 + eselect compiler-shadow clean all
100 + fi
101 +}