62349abc564cff3a7425313405cc49c2b0b85291
[gentoo.git] / sys-devel / gcc-config / gcc-config-2.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit toolchain-funcs
7
8 if [[ ${PV} == 9999 ]]; then
9         EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/gcc-config.git"
10         inherit git-r3
11 else
12         SRC_URI="mirror://gentoo/${P}.tar.xz
13                 https://dev.gentoo.org/~slyfox/distfiles/${P}.tar.xz"
14         KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
15 fi
16
17 DESCRIPTION="Utility to manage compilers"
18 HOMEPAGE="https://gitweb.gentoo.org/proj/gcc-config.git/"
19 LICENSE="GPL-2"
20 SLOT="0"
21 IUSE=""
22
23 RDEPEND=">=sys-apps/gentoo-functions-0.10"
24
25 src_compile() {
26         emake CC="$(tc-getCC)" \
27                 PV="${PV}" \
28                 SUBLIBDIR="$(get_libdir)"
29 }
30
31 src_install() {
32         emake \
33                 DESTDIR="${D}" \
34                 PV="${PV}" \
35                 SUBLIBDIR="$(get_libdir)" \
36                 install
37 }
38
39 pkg_postinst() {
40         # Scrub eselect-compiler remains
41         rm -f "${ROOT}"/etc/env.d/05compiler &
42
43         # We not longer use the /usr/include/g++-v3 hacks, as
44         # it is not needed ...
45         rm -f "${ROOT}"/usr/include/g++{,-v3} &
46
47         # Do we have a valid multi ver setup ?
48         local x
49         for x in $(gcc-config -C -l 2>/dev/null | awk '$NF == "*" { print $2 }') ; do
50                 gcc-config ${x}
51         done
52
53         wait
54 }