ae14aaa4c5c35dbff10694fb405790fa2530c476
[gentoo.git] / sys-devel / binutils-config / binutils-config-5.1-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit prefix
7
8 DESCRIPTION="Utility to change the binutils version being used"
9 HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Toolchain"
10 SRC_URI=""
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
15 IUSE=""
16
17 # We also RDEPEND on sys-apps/findutils which is in base @system
18 RDEPEND="sys-apps/gentoo-functions"
19
20 S=${WORKDIR}
21
22 src_install() {
23         newbin "${FILESDIR}"/${PN}-${PV} ${PN}
24         use prefix && eprefixify "${ED}"/usr/bin/${PN}
25         sed -i "s:@PV@:${PVR}:g" "${ED}"/usr/bin/${PN} || die
26         doman "${FILESDIR}"/${PN}.8
27
28         insinto /usr/share/eselect/modules
29         doins "${FILESDIR}"/binutils.eselect
30 }
31
32 pkg_preinst() {
33         # Force a refresh when upgrading from an older version that symlinked
34         # in all the libs & includes that binutils-libs handles. #528088
35         if has_version "<${CATEGORY}/${PN}-5" ; then
36                 local bc current
37                 bc="${ED}/usr/bin/binutils-config"
38                 if current=$("${bc}" -c) ; then
39                         "${bc}" "${current}"
40                 fi
41         fi
42 }