sys-devel/binutils-config: add live ebuild
authorSergei Trofimovich <slyfox@gentoo.org>
Thu, 21 May 2020 22:05:32 +0000 (23:05 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Thu, 21 May 2020 22:05:47 +0000 (23:05 +0100)
To ease live testing of changes like bug #724454
let's have a live ebuild. Should also be a good hint
where default repository hides.

Add USE=+native-symlinks flag to install 'as', 'ar' and friends.

Bug: https://bugs.gentoo.org/724454
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
sys-devel/binutils-config/binutils-config-9999.ebuild [new file with mode: 0644]
sys-devel/binutils-config/metadata.xml

diff --git a/sys-devel/binutils-config/binutils-config-9999.ebuild b/sys-devel/binutils-config/binutils-config-9999.ebuild
new file mode 100644 (file)
index 0000000..fdc0870
--- /dev/null
@@ -0,0 +1,46 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit prefix
+
+if [[ ${PV} == 9999 ]]; then
+       EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/binutils-config.git"
+       inherit git-r3
+else
+       SRC_URI="https://dev.gentoo.org/~slyfox/distfiles/${P}.tar.xz"
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
+fi
+
+DESCRIPTION="Utility to change the binutils version being used"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Toolchain"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="+native-symlinks"
+
+# We also RDEPEND on sys-apps/findutils which is in base @system
+RDEPEND="sys-apps/gentoo-functions"
+
+src_compile() {
+       emake DESTDIR="${D}" PV="${PV}" USE_NATIVE_LINKS="$(usex native-symlinks)"
+}
+
+src_install() {
+       emake DESTDIR="${D}" PV="${PV}" install
+
+       use prefix && eprefixify "${ED}"/usr/bin/${PN}
+}
+
+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
+}
index e396f37559777302603f6c6ba6e0275d3a5c847b..3c7c5c4c8e9b1036592c773890300ee12a1e92e3 100644 (file)
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-<maintainer type="project">
-       <email>toolchain@gentoo.org</email>
-       <name>Gentoo Toolchain Project</name>
-</maintainer>
+       <maintainer type="project">
+               <email>toolchain@gentoo.org</email>
+               <name>Gentoo Toolchain Project</name>
+       </maintainer>
+       <use>
+               <flag name="native-symlinks">Install native symlinks like 'as' or 'ar' to /usr/bin. Otherwise keep only ${CHOST}-as and friends.</flag>
+       </use>
 </pkgmetadata>