Hi Dmitry,

On Mon, 2020-11-02 at 08:00 +0000, Dmitry V. Levin wrote:
> When elfutils is configured using --enable-libdebuginfod
> --disable-debuginfod, that is, when the library is built and installed
> but the server is not, it makes sense to install libdebuginfod.pc
> because the latter complements the library rather than the server.

Agreed.

> Likewise, it makes sense to install profile.d/debuginfod.*sh files
> along with libdebuginfod because the library can use DEBUGINFOD_URLS
> environment variable as well as the server.

While packaging I noticed that we install the profiles.d files even
when the DEBUGINFOD_URLS is empty. I think we should avoid that.

So what do you think if the attached revised patch?

Thanks,

Mark
From 4c121eeda370f192c0ed35ba35bc6482c02fdac0 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <l...@altlinux.org>
Date: Mon, 2 Nov 2020 08:00:00 +0000
Subject: [PATCH] config: Conditionalize on LIBDEBUGINFOD and
 DEFAULT_DEBUGINFOD_URLS

When elfutils is configured using --enable-libdebuginfod
--disable-debuginfod, that is, when the library is built and installed
but the server is not, it makes sense to install libdebuginfod.pc
because the latter complements the library rather than the server.

Likewise, it makes sense to install profile.d/debuginfod.*sh files
only when --enable-debuginfod-urls has been given because otherwise
the environment variables will just be empty.

This change does not affect --enable-debuginfod mode as the latter
requires --enable-libdebuginfod.

Fixes: fed3c3ceeaa6 ("Do not install libdebuginfod.pc unless debuginfod is enabled")
Fixes: b503c358dde8 ("Do not install profile.d/debuginfod.*sh files unless debuginfod is enabled")
Signed-off-by: Dmitry V. Levin <l...@altlinux.org>
Signed-off-by: Mark Wielaard <m...@klomp.org>
---
 ChangeLog          | 4 ++++
 config/ChangeLog   | 8 ++++++++
 config/Makefile.am | 4 +++-
 configure.ac       | 2 ++
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 565d021c..d8cbd9b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-11-03  Mark Wielaard  <m...@klomp.org>
+
+	* configure.ac (DEFAULT_DEBUGINFOD_URLS): New AM_CONDITIONAL.
+
 2020-11-01  Érico N. Rolim  <erico....@gmail.com>
 
 	* configure.ac: Check for fts and obstack from outside libc.
diff --git a/config/ChangeLog b/config/ChangeLog
index c532f7e6..8c25f17d 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,11 @@
+2020-11-02  Dmitry V. Levin  <l...@altlinux.org>
+	    Mark Wielaard  <m...@klomp.org>
+
+	* Makefile.am (pkgconfig_DATA): Conditionalize on LIBDEBUGINFOD
+	instead of DEBUGINFOD.
+	(install-data-local, uninstall-local): Conditionalize on
+	DEFAULT_DEBUGINFOD_URLS.
+
 2020-10-31  Dmitry V. Levin  <l...@altlinux.org>
 
 	* Makefile.am (install-data-local, uninstall-local): Conditionalize
diff --git a/config/Makefile.am b/config/Makefile.am
index ef28dab6..1a43dec6 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -34,9 +34,11 @@ EXTRA_DIST = elfutils.spec.in known-dwarf.awk 10-default-yama-scope.conf \
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libelf.pc libdw.pc
-if DEBUGINFOD
+if LIBDEBUGINFOD
 pkgconfig_DATA += libdebuginfod.pc
+endif
 
+if DEFAULT_DEBUGINFOD_URLS
 install-data-local:
 	$(INSTALL_DATA) profile.sh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh
 	$(INSTALL_DATA) profile.csh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh
diff --git a/configure.ac b/configure.ac
index c1a6954d..a258daa2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -763,6 +763,8 @@ AC_ARG_ENABLE(debuginfod-urls,
             [default_debuginfod_urls=""])
 AC_SUBST(DEBUGINFOD_URLS, $default_debuginfod_urls)                
 AC_CONFIG_FILES([config/profile.sh config/profile.csh])
+AM_CONDITIONAL([DEFAULT_DEBUGINFOD_URLS],
+               [test "x$default_debuginfod_urls" != "x"])
 
 AC_OUTPUT
 
-- 
2.18.4

Reply via email to