Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 1 | From 1ccbd8fdbd2e367a702e48c8703b2f010d067b23 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 22 May 2023 18:16:24 -0700 |
| 4 | Subject: [PATCH] plugins: Avoid absolute buildpaths in binaries |
| 5 | |
| 6 | plugins seems to add CC to the plugins shared objects via compiler |
| 7 | cmdline which ends up in real code. Therefore scrub buildpaths from CC |
| 8 | and CFLAGS before passing them to plugin's build. |
| 9 | |
| 10 | Upstream-Status: Submitted [https://gitlab.com/nbdkit/nbdkit/-/merge_requests/30] |
| 11 | |
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 13 | --- |
| 14 | plugins/cc/Makefile.am | 7 +++++-- |
| 15 | 1 file changed, 5 insertions(+), 2 deletions(-) |
| 16 | |
| 17 | diff --git a/plugins/cc/Makefile.am b/plugins/cc/Makefile.am |
| 18 | index df8b5d15..80586a17 100644 |
| 19 | --- a/plugins/cc/Makefile.am |
| 20 | +++ b/plugins/cc/Makefile.am |
| 21 | @@ -44,9 +44,12 @@ nbdkit_cc_plugin_la_SOURCES = \ |
| 22 | $(top_srcdir)/include/nbdkit-plugin.h \ |
| 23 | $(NULL) |
| 24 | |
| 25 | +workdir := $(shell dirname $(abs_top_builddir)) |
| 26 | +cc_no_sysroot := $(shell echo \"$(CC)\"|sed -e 's#$(workdir)#<WORKDIR>#g') |
| 27 | +cflags_no_sysroot := $(shell echo \"$(CFLAGS)\"|sed -e 's#$(workdir)#<WORKDIR>#g') |
| 28 | nbdkit_cc_plugin_la_CPPFLAGS = \ |
| 29 | - -DCC="\"$(CC)\"" \ |
| 30 | - -DCFLAGS="\"$(CFLAGS)\"" \ |
| 31 | + -DCC=\"$(cc_no_sysroot)\" \ |
| 32 | + -DCFLAGS=\"$(cflags_no_sysroot)\" \ |
| 33 | -I$(top_srcdir)/include \ |
| 34 | -I$(top_builddir)/include \ |
| 35 | -I$(top_srcdir)/common/include \ |
| 36 | -- |
| 37 | 2.40.1 |
| 38 | |