git: e5c98e356920 - main - archivers/rpm4: re-enable the build of the bundled elfdeps utility

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 23 Jan 2023 16:04:44 UTC
The branch main has been updated by markj (src committer):

URL: https://cgit.FreeBSD.org/ports/commit/?id=e5c98e35692008f9633e768e2875d93b9dc93a25

commit e5c98e35692008f9633e768e2875d93b9dc93a25
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-01-16 21:47:03 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-01-23 16:04:36 +0000

    archivers/rpm4: re-enable the build of the bundled elfdeps utility
    
    Commit 5ff99a4c9df9 disabled libelf detection to work around the build
    failure, but rpmbuild expects to be able to find the elfdeps utility and
    misbehaves when it's not present.  Since the build failure is easy to
    address (different names for an ELF machine type constant for the rather
    obsolescent DEC Alpha), let's just do that.
    
    As a part of this, elfutils must be listed as a runtime dependency.
    Note that we cannot list it in LIB_DEPENDS since the ports framework
    ends up finding the base system libelf.so and decides that the
    dependency is satisifed without installing elfutils.  But the base
    system libelf is missing a symbol (gelf_getvernaux) required by elfdeps.
    Work around this by listing elfutils as both build and runtime
    dependencies.
    
    Approved by:    rodrigo
    Reviewed by:    rodrigo
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D38092
---
 archivers/rpm4/Makefile                    | 12 +++++++-----
 archivers/rpm4/files/patch-tools_elfdeps.c | 11 +++++++++++
 archivers/rpm4/pkg-plist                   |  1 +
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/archivers/rpm4/Makefile b/archivers/rpm4/Makefile
index 716ac758cda1..adbe2a427321 100644
--- a/archivers/rpm4/Makefile
+++ b/archivers/rpm4/Makefile
@@ -11,13 +11,16 @@ WWW=		https://rpm.org/
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-BUILD_DEPENDS=	gsed:textproc/gsed
+BUILD_DEPENDS=	gsed:textproc/gsed \
+		${LOCALBASE}/lib/libelf.so:devel/elfutils
 LIB_DEPENDS=	libpopt.so:devel/popt \
 		libnss3.so:security/nss \
 		libzstd.so:archivers/zstd \
-		libgcrypt.so:security/libgcrypt
+		libgcrypt.so:security/libgcrypt \
+		libelf.so:devel/elfutils
 RUN_DEPENDS=	bash:shells/bash \
-		gxargs:misc/findutils
+		gxargs:misc/findutils \
+		${LOCALBASE}/lib/libelf.so:devel/elfutils
 
 USES=		alias bdb sqlite cpe gmake iconv libarchive libtool \
 		lua pathfix pkgconfig shebangfix tar:bzip2
@@ -35,8 +38,7 @@ CONFIGURE_ARGS=	--enable-sqlite=yes\
 		--sysconfdir=${PREFIX}/etc \
 		--localstatedir=/var \
 		--without-javaglue \
-		am_cv_python_version=${PYTHON_VER}${PYTHON_ABIVER} \
-		ac_cv_lib_elf_gelf_getvernaux=no  # otherwise fails to build in presence of devel/elfutils
+		am_cv_python_version=${PYTHON_VER}${PYTHON_ABIVER}
 CONFIGURE_ENV=	LUA_CFLAGS=-I${LUA_INCDIR} \
 		LUA_LIBS="-L${LUA_LIBDIR} -llua-${LUA_VER} -lm"
 INSTALL_TARGET=	install-strip
diff --git a/archivers/rpm4/files/patch-tools_elfdeps.c b/archivers/rpm4/files/patch-tools_elfdeps.c
new file mode 100644
index 000000000000..6f71f12f4c9e
--- /dev/null
+++ b/archivers/rpm4/files/patch-tools_elfdeps.c
@@ -0,0 +1,11 @@
+--- tools/elfdeps.c.orig	2023-01-16 16:44:45.666870000 -0500
++++ tools/elfdeps.c	2023-01-16 16:44:57.548011000 -0500
+@@ -84,7 +84,7 @@
+     if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) {
+ 	switch (ehdr->e_machine) {
+ 	case EM_ALPHA:
+-	case EM_FAKE_ALPHA:
++	case EM_ALPHA_STD:
+ 	    /* alpha doesn't traditionally have 64bit markers */
+ 	    break;
+ 	default:
diff --git a/archivers/rpm4/pkg-plist b/archivers/rpm4/pkg-plist
index 44b26c0610da..091cc43e8a86 100644
--- a/archivers/rpm4/pkg-plist
+++ b/archivers/rpm4/pkg-plist
@@ -79,6 +79,7 @@ lib/rpm/check-files
 lib/rpm/check-prereqs
 lib/rpm/check-rpaths
 lib/rpm/check-rpaths-worker
+lib/rpm/elfdeps
 lib/rpm/fileattrs/debuginfo.attr
 lib/rpm/fileattrs/desktop.attr
 lib/rpm/fileattrs/elf.attr