blob: 75377dfb805a70e1c774b80bcd42dc81c1ace7d6 [file] [log] [blame]
Patrick Williamse760df82023-05-26 11:10:49 -05001From 1ccbd8fdbd2e367a702e48c8703b2f010d067b23 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 22 May 2023 18:16:24 -0700
4Subject: [PATCH] plugins: Avoid absolute buildpaths in binaries
5
6plugins seems to add CC to the plugins shared objects via compiler
7cmdline which ends up in real code. Therefore scrub buildpaths from CC
8and CFLAGS before passing them to plugin's build.
9
10Upstream-Status: Submitted [https://gitlab.com/nbdkit/nbdkit/-/merge_requests/30]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 plugins/cc/Makefile.am | 7 +++++--
15 1 file changed, 5 insertions(+), 2 deletions(-)
16
17diff --git a/plugins/cc/Makefile.am b/plugins/cc/Makefile.am
18index 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--
372.40.1
38