[Buildroot] [git commit] package/nut: replace NUT_FIX_CONFIGURE

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sat Nov 4 17:40:05 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=2a9b47a8dbb1e7b709704239b578474a20d84c89
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Replace NUT_FIX_CONFIGURE by an upstreamable patch

Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 ..._compiler_family.m4-fix-cross-compilation.patch | 55 ++++++++++++++++++++++
 package/nut/nut.mk                                 |  9 +---
 2 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/package/nut/0001-m4-nut_compiler_family.m4-fix-cross-compilation.patch b/package/nut/0001-m4-nut_compiler_family.m4-fix-cross-compilation.patch
new file mode 100644
index 0000000000..6356990749
--- /dev/null
+++ b/package/nut/0001-m4-nut_compiler_family.m4-fix-cross-compilation.patch
@@ -0,0 +1,55 @@
+From a743617099ea50fcce333a8a074751434d25b7ac Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+Date: Fri, 3 Nov 2023 18:29:29 +0100
+Subject: [PATCH] m4/nut_compiler_family.m4: fix cross-compilation
+
+Do not use isystem with host paths when cross-compiling
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
+Upstream: https://github.com/networkupstools/nut/pull/2146
+---
+ m4/nut_compiler_family.m4 | 28 +++++++++++++++-------------
+ 1 file changed, 15 insertions(+), 13 deletions(-)
+
+diff --git a/m4/nut_compiler_family.m4 b/m4/nut_compiler_family.m4
+index f47b1ae9..99608bab 100644
+--- a/m4/nut_compiler_family.m4
++++ b/m4/nut_compiler_family.m4
+@@ -178,19 +178,21 @@ dnl # confuse the compiler assumptions - along with its provided headers)...
+ dnl # ideally; in practice however cppunit, net-snmp and some system include
+ dnl # files do cause grief to picky compiler settings (more so from third
+ dnl # party packages shipped via /usr/local/... namespace):
+-    AS_IF([test "x$CLANGCC" = xyes -o "x$GCC" = xyes], [
+-dnl #        CFLAGS="-isystem /usr/include $CFLAGS"
+-        AS_IF([test -d /usr/local/include],
+-            [CFLAGS="-isystem /usr/local/include $CFLAGS"])
+-        AS_IF([test -d /usr/pkg/include],
+-            [CFLAGS="-isystem /usr/pkg/include $CFLAGS"])
+-    ])
+-    AS_IF([test "x$CLANGXX" = xyes -o "x$GXX" = xyes], [
+-dnl #        CXXFLAGS="-isystem /usr/include $CXXFLAGS"
+-        AS_IF([test -d /usr/local/include],
+-            [CXXFLAGS="-isystem /usr/local/include $CXXFLAGS"])
+-        AS_IF([test -d /usr/pkg/include],
+-            [CXXFLAGS="-isystem /usr/pkg/include $CXXFLAGS"])
++    AS_IF([test "x$cross_compiling" != xyes], [
++        AS_IF([test "x$CLANGCC" = xyes -o "x$GCC" = xyes], [
++dnl #            CFLAGS="-isystem /usr/include $CFLAGS"
++            AS_IF([test -d /usr/local/include],
++                [CFLAGS="-isystem /usr/local/include $CFLAGS"])
++            AS_IF([test -d /usr/pkg/include],
++                [CFLAGS="-isystem /usr/pkg/include $CFLAGS"])
++        ])
++        AS_IF([test "x$CLANGXX" = xyes -o "x$GXX" = xyes], [
++dnl #           CXXFLAGS="-isystem /usr/include $CXXFLAGS"
++            AS_IF([test -d /usr/local/include],
++                [CXXFLAGS="-isystem /usr/local/include $CXXFLAGS"])
++            AS_IF([test -d /usr/pkg/include],
++                [CXXFLAGS="-isystem /usr/pkg/include $CXXFLAGS"])
++        ])
+     ])
+ 
+ dnl # Default to avoid noisy warnings on older compilers
+-- 
+2.42.0
+
diff --git a/package/nut/nut.mk b/package/nut/nut.mk
index c376ffb2e2..ba71319f90 100644
--- a/package/nut/nut.mk
+++ b/package/nut/nut.mk
@@ -11,13 +11,8 @@ NUT_LICENSE_FILES = COPYING LICENSE-GPL2 LICENSE-GPL3
 NUT_SELINUX_MODULES = apache nut
 NUT_INSTALL_STAGING = YES
 NUT_DEPENDENCIES = host-pkgconf
-
-# prevent usage of unsafe paths
-define NUT_FIX_CONFIGURE
-	$(SED) 's%CFLAGS="-isystem /usr/local/include%_UNUSED_CFLAGS="-isystem /usr/local/include%' $(@D)/configure
-	$(SED) 's%CXXFLAGS="-isystem /usr/local/include%_UNUSED_CXXFLAGS="-isystem /usr/local/include%' $(@D)/configure
-endef
-NUT_POST_PATCH_HOOKS += NUT_FIX_CONFIGURE
+# We're patching m4/nut_compiler_family.m4
+NUT_AUTORECONF = YES
 
 # Put the PID files in a read-write place (/var/run is a tmpfs)
 # since the default location (/var/state/ups) maybe readonly.



More information about the buildroot mailing list