blob: 0fb7ac67f79eb914cdfaa77fcd4b74bf02aa984d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit toolchain-funcs prefix
DESCRIPTION="Utility to change the binutils version being used"
HOMEPAGE="https://www.gentoo.org/"
WRAPPER_REV="${PV%%.*}.3.4"
#SRC_URI="https://gitweb.gentoo.org/repo/proj/prefix.git/plain/sys-devel/binutils-config/files/ldwrapper.c?id=${GIT_REV} -> ${PN}-ldwrapper-${WRAPPER_REV}.c"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE=""
# We also RDEPEND on sys-apps/findutils which is in base @system
RDEPEND="sys-apps/gentoo-functions
!<app-admin/eselect-1.4.5"
S=${WORKDIR}
# NOTE: the ld wrapper is only enabled on rpath versions of prefix.
src_prepare() {
cp "${FILESDIR}"/${PN}-${PV} ./${PN} || die
cp "${FILESDIR}"/ldwrapper.c ./${PN}-ldwrapper-${WRAPPER_REV}.c || die
if use prefix-guest; then
eapply "${FILESDIR}/${PN}-5-ldwrapper.patch" || die
fi
eprefixify ${PN}
eapply_user
}
src_configure() {
:
}
src_compile() {
use prefix-guest || return
local extraargs=( )
if [[ ${CHOST} == *-darwin* ]] ; then
extraargs+=(
-DDARWIN_LD_DEFAULT_TARGET='"'${MACOSX_DEPLOYMENT_TARGET}'"'
)
fi
local args=(
$(tc-getCC)
${CPPFLAGS}
${CFLAGS}
-Wall
-o ldwrapper ${PN}-ldwrapper-${WRAPPER_REV}.c
-DEPREFIX=\"${EPREFIX}\"
-DCHOST=\"${CHOST}\"
"${extraargs[@]}"
${LDFLAGS}
)
echo ${args[*]}
"${args[@]}" || die
}
src_install() {
dobin ${PN}
use prefix && eprefixify "${ED}"/usr/bin/${PN}
sed -i "s:@PV@:${PVR}:g" "${ED}"/usr/bin/${PN} || die
doman "${FILESDIR}"/${PN}.8
dodir /usr/$(get_libdir)/misc/binutils-config
mv "${S}"/ldwrapper "${ED}"/usr/$(get_libdir)/misc/binutils-config/
insinto /usr/share/eselect/modules
doins "${FILESDIR}"/binutils.eselect
}
pkg_preinst() {
# Force a refresh when upgrading from an older version that symlinked
# in all the libs & includes that binutils-libs handles. #528088
if has_version "<${CATEGORY}/${PN}-5" ; then
local bc current
bc="${ED}/usr/bin/binutils-config"
if current=$("${bc}" -c) ; then
"${bc}" "${current}"
fi
fi
}
|