package/libkcapi: disable -Werror

Fix the following musl build failure (disabling -Werror seems to be the
only "solution": https://github.com/smuellerDD/libkcapi/issues/136):

lib/kcapi-kernel-if.c: In function '_kcapi_common_send_meta':
lib/kcapi-kernel-if.c:212:12: error: unsigned conversion from 'long int' to 'long unsigned int' changes value from '-4' to '4294967292' [-Werror=sign-conversion]
  212 |   header = CMSG_NXTHDR(&msg, header);
      |            ^~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/c789d43e71e6075e297bef58d888228a89055bbc

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Fabrice Fontaine 2022-11-07 23:41:05 +01:00 committed by Thomas Petazzoni
parent 2d3c06435b
commit 9f6c257638
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,46 @@
From c27b154f03ad7e94447c7114d73aee60f0098093 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Mon, 7 Nov 2022 13:38:06 +0100
Subject: [PATCH] Add --disable-werror
Allow the user to disable -Werror through --disable-werror
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
[Retrieved from:
https://github.com/smuellerDD/libkcapi/commit/c27b154f03ad7e94447c7114d73aee60f0098093]
---
Makefile.am | 5 ++++-
configure.ac | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 1c95d3d..cddedac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,10 @@ ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = subdir-objects
lib_LTLIBRARIES = libkcapi.la
-COMMON_CPPFLAGS = -Wextra -Wall -pedantic -fwrapv --param ssp-buffer-size=4 -O2 -Werror -std=gnu99 -Wconversion
+COMMON_CPPFLAGS = -Wextra -Wall -pedantic -fwrapv --param ssp-buffer-size=4 -O2 -std=gnu99 -Wconversion
+if ENABLE_WERROR
+COMMON_CPPFLAGS += -Werror
+endif
COMMON_LDFLAGS = -Wl,-z,relro,-z,now
libtool: $(LIBTOOL_DEPS)
diff --git a/configure.ac b/configure.ac
index cb910e2..e230577 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,9 @@ AX_ADD_FORTIFY_SOURCE
AC_CHECK_API_VERSION
+AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror], [Disable -Werror])], [with_werror=$enableval], [with_werror=yes])
+AM_CONDITIONAL([ENABLE_WERROR], [test "x$with_werror" = "xyes"])
+
AC_ARG_ENABLE([kcapi-test], [AS_HELP_STRING([--enable-kcapi-test], [Compile kcapi test program])], [with_kcapi_test=$enableval])
AM_CONDITIONAL([ENABLE_KCAPI_TEST], [test "x$with_kcapi_test" = "xyes"])

View File

@ -15,6 +15,7 @@ LIBKCAPI_CONF_ENV = \
ac_cv_path_DB2PDF="" \
ac_cv_path_DB2PS="" \
ac_cv_path_XMLTO=""
LIBKCAPI_CONF_OPTS = --disable-werror
LIBKCAPI_MAKE_OPTS = CPPFLAGS="$(TARGET_CPPFLAGS)"
ifeq ($(BR2_PACKAGE_LIBKCAPI_ASYM),y)