commit:     b93cb824b45fa00daa1535296ebbde64cc70417f
Author:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Sun Mar 20 13:31:08 2022 +0000
Commit:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
CommitDate: Sun Mar 20 13:31:08 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=b93cb824

dev-util/annobin: initial import

Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>

 dev-util/annobin/Manifest                          |  1 +
 dev-util/annobin/annobin-10.58.ebuild              | 83 ++++++++++++++++++++++
 .../files/annobin-10.58-demangle.h-path.patch      | 12 ++++
 .../annobin/files/annobin-10.58-fix-bashism.patch  | 28 ++++++++
 dev-util/annobin/metadata.xml                      | 18 +++++
 5 files changed, 142 insertions(+)

diff --git a/dev-util/annobin/Manifest b/dev-util/annobin/Manifest
new file mode 100644
index 000000000..65bf6bb5a
--- /dev/null
+++ b/dev-util/annobin/Manifest
@@ -0,0 +1 @@
+DIST annobin-10.58.tar.xz 846744 BLAKE2B 
86a7beb46d7fce153f44d2a42e538ff99d40de239655f001580e34c8e0f40fe4309b908681047d012dc315977a93889f9e4e05f00a97145c5c04663d5f239fb8
 SHA512 
7d40fe9ddbee788db3331ec138aa588936d726ec50e0286b23be3792f20c2fc111c635b70598e0d8b6ba24a92de514fc637d5cea6b9d7781de781fbf244dfbd8

diff --git a/dev-util/annobin/annobin-10.58.ebuild 
b/dev-util/annobin/annobin-10.58.ebuild
new file mode 100644
index 000000000..0b10a8cac
--- /dev/null
+++ b/dev-util/annobin/annobin-10.58.ebuild
@@ -0,0 +1,83 @@
+# Copyright 2018-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools llvm toolchain-funcs
+
+DESCRIPTION="Binary annotation compiler plugin and tools"
+HOMEPAGE="https://nickc.fedorapeople.org";
+SRC_URI="https://nickc.fedorapeople.org/${P}.tar.xz";
+
+KEYWORDS="~amd64"
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="clang doc llvm test"
+
+RDEPEND="
+       app-arch/rpm
+       dev-libs/elfutils
+       sys-libs/binutils-libs
+
+       clang? ( <sys-devel/clang-13:= )
+       !clang? ( llvm? ( <sys-devel/llvm-13:= ) )
+       llvm? (
+               || (
+                       sys-devel/llvm:11
+                       sys-devel/llvm:12
+                       sys-devel/llvm:13
+               )
+       )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/${P}-fix-bashism.patch"
+       "${FILESDIR}/${P}-demangle.h-path.patch"
+)
+REQUIRED_USE="clang? ( llvm )"
+RESTRICT="!test? ( test )"
+
+pkg_pretend() {
+       if [[ ${MERGE_TYPE} != binary ]]; then
+               if ! tc-is-gcc ; then
+                       eerror "${PN} is a gcc plugin. Please emerge using gcc 
as CC"
+                       die "use gcc"
+               fi
+       fi
+}
+
+src_prepare() {
+       default
+       sed -i 's|2.69|2.71|g' config/override.m4 || die
+
+       if use llvm; then
+               local llvmdir="$(get_llvm_prefix -d)"
+               local llvm_plugindir
+               llvm_plugindir="$(
+                       clang --print-search-dirs | gawk -e\
+                       'BEGIN { FS = ":" } /libraries/ { print gensub(" 
=","",1,$2) } END { }'
+               )"
+               einfo $llvm_plugindir
+
+               sed -i "/^INCDIR.*/ s|$| -I${llvmdir}/include|" 
{llvm,clang}-plugin/Makefile.in || die
+               sed -i "/^CLANG_LIBS.*/ s|$| -L${llvmdir}/$(get_libdir)|" 
clang-plugin/Makefile.in || die
+               sed -i 's/print-seach-dirs/print-search-dirs/g' 
{llvm,clang}-plugin/Makefile.in || die
+               sed -i "s|^PLUGIN_INSTALL_DIR =.*|PLUGIN_INSTALL_DIR = 
\$\{DESTDIR\}/$(realpath ${llvm_plugindir})|" {llvm,clang}-plugin/Makefile.in 
|| die
+       fi
+
+       eautoreconf
+}
+
+src_configure() {
+       local myconf=(
+               --with-libelf
+               --with-gcc-plugin-dir=$($(tc-getCC) -print-file-name=plugin)
+               --without-debuginfod # we don't have it enabled, comes with 
elfutils
+               $(use_with clang)
+               $(use_with llvm)
+               $(use_with test tests)
+               $(use_with doc docs)
+       )
+       econf "${myconf[@]}"
+}

diff --git a/dev-util/annobin/files/annobin-10.58-demangle.h-path.patch 
b/dev-util/annobin/files/annobin-10.58-demangle.h-path.patch
new file mode 100644
index 000000000..989a5e0f4
--- /dev/null
+++ b/dev-util/annobin/files/annobin-10.58-demangle.h-path.patch
@@ -0,0 +1,12 @@
+diff '--color=auto' -ru 
/var/tmp/portage/dev-util/annobin-10.58/work/annobin-10.58/annocheck/annocheck.h
 annobin-10.58/annocheck/annocheck.h
+--- 
/var/tmp/portage/dev-util/annobin-10.58/work/annobin-10.58/annocheck/annocheck.h
   2022-03-14 12:43:07.000000000 +0100
++++ annobin-10.58/annocheck/annocheck.h        2022-03-20 08:36:28.373389297 
+0100
+@@ -38,7 +38,7 @@
+ #include <elfutils/libdw.h>
+ 
+ #include <libiberty.h>
+-#include <demangle.h>
++#include <libiberty/demangle.h>
+ 
+ #define PACKAGE                         "annocheck"
+ 

diff --git a/dev-util/annobin/files/annobin-10.58-fix-bashism.patch 
b/dev-util/annobin/files/annobin-10.58-fix-bashism.patch
new file mode 100644
index 000000000..dd0417246
--- /dev/null
+++ b/dev-util/annobin/files/annobin-10.58-fix-bashism.patch
@@ -0,0 +1,28 @@
+--- a/config/debuginfod.m4
++++ b/config/debuginfod.m4
+@@ -34,5 +34,5 @@
+   fi
+ fi
+ AM_CONDITIONAL([HAVE_DEBUGINFOD],
+-               [test x"$have_debuginfod_lib" == xyes -a x"$have_debuginfod_h" 
== xyes])
++               [test x"$have_debuginfod_lib" = xyes && x"$have_debuginfod_h" 
= xyes])
+ ])
+--- a/configure.ac
++++ b/configure.ac
+@@ -149,13 +149,13 @@
+ AM_CONDITIONAL([COND_DOCS],       [test "$with_docs" != no])
+ AM_CONDITIONAL([COND_TESTS],      [test "$with_tests" != no])
+ AM_CONDITIONAL([COND_ANNOCHECK],  [test "$with_annocheck" != no])
+-AM_CONDITIONAL([COND_CLANG],      [test "$with_clang_plugin" == yes])
++AM_CONDITIONAL([COND_CLANG],      [test "$with_clang_plugin" = yes])
+ AM_CONDITIONAL([COND_GCC_PLUGIN], [test "$with_gcc_plugin" != no])
+-AM_CONDITIONAL([COND_LLVM],       [test "$with_llvm_plugin" == yes])
++AM_CONDITIONAL([COND_LLVM],       [test "$with_llvm_plugin" = yes])
+ 
+ AC_CONFIG_FILES(Makefile)
+ 
+-if test "$with_annocheck" != no -o test "$with_gcc_plugin" != no; then
++if test "$with_annocheck" != no || test "$with_gcc_plugin" != no; then
+   AC_CONFIG_HEADERS(gcc-plugin/config.h)
+ fi
+ if test "$with_docs" != no; then

diff --git a/dev-util/annobin/metadata.xml b/dev-util/annobin/metadata.xml
new file mode 100644
index 000000000..f04b58c06
--- /dev/null
+++ b/dev-util/annobin/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <description>co-maintainers welcome</description>
+               <email>lssndrbarbi...@gmail.com</email>
+               <name>Alessandro Barbieri</name>
+       </maintainer>   
+       <longdescription lang="en">
+               A plugin for GCC that records extra information in the files 
that it compiles.
+               This information can be used to analyze the files, and provide 
the loader
+               with extra information about the requirements of the loaded 
file.
+       </longdescription>
+       <use>
+               <flag name="clang">Build the clang plugin</flag>
+               <flag name="llvm">Build the LLVM plugin</flag>
+       </use>
+</pkgmetadata>

Reply via email to