diff mbox series

[meta-oe,mickledore,19/36] nbdkit: Remove buildpaths from binaries

Message ID 20230531111309.2454603-19-akuster808@gmail.com
State New
Headers show
Series [meta-oe,mickledore,01/36] libencode-perl: Remove buildpaths from generated .exh files | expand

Commit Message

akuster808 May 31, 2023, 11:12 a.m. UTC
From: Khem Raj <raj.khem@gmail.com>

Drop unused patch 0001-server-Fix-build-when-printf-is-a-macro.patch

Fixes
WARNING: nbdkit-1.33.11-r0 do_package_qa: QA Issue: File /usr/lib/nbdkit/plugins/nbdkit-cc-plugin.so in package nbdkit contains reference to TMPDIR [buildpaths]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit da331ae8f1fccf3b542526f1caaa3834261434fa)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
 ...void-absolute-buildpaths-in-binaries.patch | 38 ++++++++++++++++++
 ...ver-Fix-build-when-printf-is-a-macro.patch | 39 -------------------
 .../recipes-support/nbdkit/nbdkit_1.33.11.bb  |  2 +-
 3 files changed, 39 insertions(+), 40 deletions(-)
 create mode 100644 meta-networking/recipes-support/nbdkit/nbdkit/0001-plugins-Avoid-absolute-buildpaths-in-binaries.patch
 delete mode 100644 meta-networking/recipes-support/nbdkit/nbdkit/0001-server-Fix-build-when-printf-is-a-macro.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/nbdkit/nbdkit/0001-plugins-Avoid-absolute-buildpaths-in-binaries.patch b/meta-networking/recipes-support/nbdkit/nbdkit/0001-plugins-Avoid-absolute-buildpaths-in-binaries.patch
new file mode 100644
index 0000000000..75377dfb80
--- /dev/null
+++ b/meta-networking/recipes-support/nbdkit/nbdkit/0001-plugins-Avoid-absolute-buildpaths-in-binaries.patch
@@ -0,0 +1,38 @@ 
+From 1ccbd8fdbd2e367a702e48c8703b2f010d067b23 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 22 May 2023 18:16:24 -0700
+Subject: [PATCH] plugins: Avoid absolute buildpaths in binaries
+
+plugins seems to add CC to the plugins shared objects via compiler
+cmdline which ends up in real code. Therefore scrub buildpaths from CC
+and CFLAGS before passing them to plugin's build.
+
+Upstream-Status: Submitted [https://gitlab.com/nbdkit/nbdkit/-/merge_requests/30]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ plugins/cc/Makefile.am | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/cc/Makefile.am b/plugins/cc/Makefile.am
+index df8b5d15..80586a17 100644
+--- a/plugins/cc/Makefile.am
++++ b/plugins/cc/Makefile.am
+@@ -44,9 +44,12 @@ nbdkit_cc_plugin_la_SOURCES = \
+ 	$(top_srcdir)/include/nbdkit-plugin.h \
+ 	$(NULL)
+ 
++workdir := $(shell dirname $(abs_top_builddir))
++cc_no_sysroot := $(shell echo \"$(CC)\"|sed -e 's#$(workdir)#<WORKDIR>#g')
++cflags_no_sysroot := $(shell echo \"$(CFLAGS)\"|sed -e 's#$(workdir)#<WORKDIR>#g')
+ nbdkit_cc_plugin_la_CPPFLAGS = \
+-	-DCC="\"$(CC)\"" \
+-	-DCFLAGS="\"$(CFLAGS)\"" \
++	-DCC=\"$(cc_no_sysroot)\" \
++	-DCFLAGS=\"$(cflags_no_sysroot)\" \
+ 	-I$(top_srcdir)/include \
+ 	-I$(top_builddir)/include \
+ 	-I$(top_srcdir)/common/include \
+-- 
+2.40.1
+
diff --git a/meta-networking/recipes-support/nbdkit/nbdkit/0001-server-Fix-build-when-printf-is-a-macro.patch b/meta-networking/recipes-support/nbdkit/nbdkit/0001-server-Fix-build-when-printf-is-a-macro.patch
deleted file mode 100644
index c7ec41eb9a..0000000000
--- a/meta-networking/recipes-support/nbdkit/nbdkit/0001-server-Fix-build-when-printf-is-a-macro.patch
+++ /dev/null
@@ -1,39 +0,0 @@ 
-From 28f07715ab4d670ce81e12776bbece043305bd83 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 11 Apr 2020 15:08:39 -0700
-Subject: [PATCH] server: Fix build when printf is a macro
-
-clang complains on x86 when building
-
-main.c:116:2: error: embedding a #include directive within macro arguments is not supported
- ^
-
-convert nesting include into a string assignment, to same effect but
-making it compatible with clang as well
-
-Upstream-Status: Submitted [https://github.com/libguestfs/nbdkit/pull/3]
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- server/main.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/server/main.c b/server/main.c
-index 748122f..c0ac874 100644
---- a/server/main.c
-+++ b/server/main.c
-@@ -112,9 +112,10 @@ static void
- usage (void)
- {
-   /* --{short,long}-options remain undocumented */
--  printf (
-+  char const *opt_list =
- #include "synopsis.c"
--  );
-+	  ;
-+  printf ("%s\n", opt_list);
-   printf ("\n"
-           "Please read the nbdkit(1) manual page for full usage.\n");
- }
--- 
-2.26.0
-
diff --git a/meta-networking/recipes-support/nbdkit/nbdkit_1.33.11.bb b/meta-networking/recipes-support/nbdkit/nbdkit_1.33.11.bb
index 32d4270d18..cdf2677f13 100644
--- a/meta-networking/recipes-support/nbdkit/nbdkit_1.33.11.bb
+++ b/meta-networking/recipes-support/nbdkit/nbdkit_1.33.11.bb
@@ -10,7 +10,7 @@  LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=26250adec854bc317493f6fb98efe049"
 
 SRC_URI = "git://github.com/libguestfs/nbdkit.git;protocol=https;branch=master \
-"
+           file://0001-plugins-Avoid-absolute-buildpaths-in-binaries.patch"
 SRCREV = "6c02c6a469d62a047f230b0ccf03f72328312d2b"
 
 S = "${WORKDIR}/git"