commit: 20dd62e309682ded6d146ff31f59dac7905145ab
parent 4e301204578cc6a2b31053fe79530f95527d7232
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 12 Aug 2021 14:15:59 +0200
dev-libs/elfutils: Bump to 0.186_pre9999 for clang support
Related: https://bugs.gentoo.org/685688
Diffstat:
3 files changed, 159 insertions(+), 0 deletions(-)
diff --git a/dev-libs/elfutils/elfutils-0.186_pre9999.ebuild b/dev-libs/elfutils/elfutils-0.186_pre9999.ebuild
@@ -0,0 +1,85 @@
+# Copyright 2003-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic multilib-minimal autotools git-r3
+
+DESCRIPTION="Libraries/utilities to handle ELF objects (drop in replacement for libelf)"
+HOMEPAGE="http://elfutils.org/"
+EGIT_REPO_URI="git://sourceware.org/git/elfutils.git"
+
+LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )"
+SLOT="0"
+IUSE="bzip2 lzma nls static-libs test +threads +utils valgrind zstd"
+
+RDEPEND=">=sys-libs/zlib-1.2.8-r1[static-libs?,${MULTILIB_USEDEP}]
+ bzip2? ( >=app-arch/bzip2-1.0.6-r4[static-libs?,${MULTILIB_USEDEP}] )
+ lzma? ( >=app-arch/xz-utils-5.0.5-r1[static-libs?,${MULTILIB_USEDEP}] )
+ zstd? ( app-arch/zstd:=[static-libs?,${MULTILIB_USEDEP}] )
+ !dev-libs/libelf
+"
+DEPEND="${RDEPEND}
+ valgrind? ( dev-util/valgrind )
+"
+BDEPEND="nls? ( sys-devel/gettext )
+ >=sys-devel/flex-2.5.4a
+ sys-devel/m4
+"
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.186-gnu99-cleanup.patch
+)
+
+src_prepare() {
+ default
+ eautoreconf
+
+ if ! use static-libs; then
+ sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in || die
+ fi
+ # https://sourceware.org/PR23914
+ sed -i 's:-Werror::' */Makefile.in || die
+}
+
+src_configure() {
+ use test && append-flags -g #407135
+
+ # Symbol aliases are implemented as asm statements.
+ # Will require porting: https://gcc.gnu.org/PR48200
+ filter-flags '-flto*'
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ ECONF_SOURCE="${S}" econf \
+ $(use_enable nls) \
+ $(use_enable threads thread-safety) \
+ $(use_enable valgrind) \
+ --disable-debuginfod \
+ --disable-libdebuginfod \
+ --program-prefix="eu-" \
+ --with-zlib \
+ --enable-maintainer-mode \
+ $(use_with bzip2 bzlib) \
+ $(use_with lzma) \
+ $(use_with zstd)
+}
+
+multilib_src_test() {
+ env LD_LIBRARY_PATH="${BUILD_DIR}/libelf:${BUILD_DIR}/libebl:${BUILD_DIR}/libdw:${BUILD_DIR}/libasm" \
+ LC_ALL="C" \
+ emake check VERBOSE=1
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc NOTES
+ # These build quick, and are needed for most tests, so don't
+ # disable their building when the USE flag is disabled.
+ if ! use utils; then
+ rm -rf "${ED}"/usr/bin || die
+ fi
+}
diff --git a/dev-libs/elfutils/files/elfutils-0.186-gnu99-cleanup.patch b/dev-libs/elfutils/files/elfutils-0.186-gnu99-cleanup.patch
@@ -0,0 +1,61 @@
+From 14294f0502851c125cf4e0e7d8b2889836e986e5 Mon Sep 17 00:00:00 2001
+From: Adrian Ratiu <adrian.ratiu@collabora.com>
+Date: Tue, 10 Aug 2021 12:48:41 +0300
+Subject: [PATCH] configure.ac: drop unnecessary gnu99 extension checks
+
+It is true that Clang does not support all gnu99 extensions [1],
+but not all of them are used in the codebase and over time there
+have been code cleanup efforts to improve Clang support.
+
+For example after commit 779c57ea ("readelf: Pull advance_pc()
+in file scope") there are no more nested function declarations
+and elfutils now builds fine with Clang.
+
+So in the interest of enabling Clang builds we remove the only
+remaining blocker: the configure checks for nested functions and
+variable length arrays which are also unused.
+
+[1] https://sourceware.org/bugzilla/show_bug.cgi?id=24964
+Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
+---
+ ChangeLog | 4 ++++
+ configure.ac | 11 -----------
+ 2 files changed, 4 insertions(+), 11 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 12b8f403..32f5b68d 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2021-08-10 Adrian Ratiu <adrian.ratiu@collabora.com>
++
++ * configure.ac (AC_CACHE_CHECK): Drop unnecessary std=gnu99 checks
++
+ 2021-07-28 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac (AC_CHECK_DECLS): Add reallocarray check.
+diff --git a/configure.ac b/configure.ac
+index 7caff2c5..c14eb9f6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -112,17 +112,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
+ int foo (int a)
+ {
+ for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; return s;
+-}
+-
+-double bar (double a, double b)
+-{
+- double square (double z) { return z * z; }
+- return square (a) + square (b);
+-}
+-
+-void baz (int n)
+-{
+- struct S { int x[[n]]; };
+ }])],
+ ac_cv_c99=yes, ac_cv_c99=no)
+ CFLAGS="$old_CFLAGS"])
+--
+2.32.0
+
diff --git a/dev-libs/elfutils/metadata.xml b/dev-libs/elfutils/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <use>
+ <flag name="lzma">Support automatic decompression of LZMA-compressed files and kernel images</flag>
+ <flag name="threads">Build the libraries with thread safe support</flag>
+ <flag name="utils">Install command-line utilities (all the eu-* programs)</flag>
+ <flag name="valgrind">Add support for memory debugging using <pkg>dev-util/valgrind</pkg></flag>
+ </use>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:elfutils_project:elfutils</remote-id>
+ </upstream>
+</pkgmetadata>