From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Subject: [PATCH 2/3] libtraceevent: Update libtraceevent.pc if prefix is different
Date: Tue, 15 Dec 2020 23:36:39 -0500 [thread overview]
Message-ID: <20201216043717.009188125@goodmis.org> (raw)
In-Reply-To: 20201216043637.453360298@goodmis.org
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
If a build is done with different DESTDIR and the prefix is changed, the
the libtraceevent.pc is not updated with the new prefix, and the one used may
not work with the installation being performed.
Add a "build_prefix" dependency, that creates a file "build_prefix" that has
the last prefix used to build the library. And if a new prefix is used, then
that file gets updated and so does libtraceevent.pc.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Makefile | 17 ++++++++++++++++-
scripts/Makefile.include | 1 +
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index c85114beef96..f795e05d22a7 100644
--- a/Makefile
+++ b/Makefile
@@ -213,6 +213,21 @@ TAGS: force
find . -name '*.[ch]' | xargs etags \
--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
+define build_prefix
+ (echo $1 > $@.tmp; \
+ if [ -r $@ ] && cmp -s $@ $@.tmp; then \
+ rm -f $@.tmp; \
+ else \
+ $(PRINT_GEN) \
+ mv -f $@.tmp $@; \
+ fi);
+endef
+
+BUILD_PREFIX := $(OUTPUT)build_prefix
+
+$(BUILD_PREFIX): force
+ $(Q)$(call build_prefix,$(prefix))
+
define do_install_mkdir
if [ ! -d '$(DESTDIR_SQ)$1' ]; then \
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \
@@ -232,7 +247,7 @@ define do_make_pkgconfig_file
sed -i "s|HEADER_DIR|$(includedir)|g" ${PKG_CONFIG_FILE};
endef
-$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template
+$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template $(BUILD_PREFIX)
$(QUIET_GEN) $(call do_make_pkgconfig_file,$(prefix))
define do_install_pkgconfig_file
diff --git a/scripts/Makefile.include b/scripts/Makefile.include
index d505b2f20b92..1c9266c34d2a 100644
--- a/scripts/Makefile.include
+++ b/scripts/Makefile.include
@@ -110,6 +110,7 @@ ifneq ($(silent),1)
QUIET_AR = @echo ' AR '$@;
QUIET_LINK = @echo ' LINK '$@;
QUIET_MKDIR = @echo ' MKDIR '$@;
+ PRINT_GEN = echo ' GEN '$@;
QUIET_GEN = @echo ' GEN '$@;
QUIET_SUBDIR0 = +@subdir=
QUIET_SUBDIR1 = ;$(NO_SUBDIR) \
--
2.29.2
next prev parent reply other threads:[~2020-12-16 4:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-16 4:36 [PATCH 0/3] libtraceevent: Add uninstall and fix build dependency of libtraceevent.pc Steven Rostedt
2020-12-16 4:36 ` [PATCH 1/3] libtraceevent: Add a way to uninstall Steven Rostedt
2020-12-16 4:36 ` Steven Rostedt [this message]
2020-12-16 4:36 ` [PATCH 3/3] libtraceevent: Keep build_install file around Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201216043717.009188125@goodmis.org \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.