diff --git a/kBuild-c99-2.patch b/kBuild-c99-2.patch new file mode 100644 index 0000000..f4b291a --- /dev/null +++ b/kBuild-c99-2.patch @@ -0,0 +1,16 @@ +The eval_buffer function expects the end of the string as the +(optional) last argument, not its length. + +Index: src/kmk/loadapi.c +=================================================================== +--- src/kmk/loadapi.c (revision 3600) ++++ src/kmk/loadapi.c (working copy) +@@ -59,7 +59,7 @@ + install_variable_buffer (&pbuf, &plen); + + s = xstrdup (buffer); +- eval_buffer (s, flp IF_WITH_VALUE_LENGTH_PARAM (strlen (s) /** @todo suboptimal */)); ++ eval_buffer (s, flp IF_WITH_VALUE_LENGTH_PARAM (s + strlen (s) /** @todo suboptimal */)); + free (s); + + restore_variable_buffer (pbuf, plen); diff --git a/kBuild-c99.patch b/kBuild-c99.patch new file mode 100644 index 0000000..bf35300 --- /dev/null +++ b/kBuild-c99.patch @@ -0,0 +1,158 @@ +Do not treat as an umbrella header for +The two are distinct on GNU/Linux. + +Also add missing #include in some files. + +Index: kbuild-0.1.9998svn3427/src/sed/lib/getline.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/lib/getline.c ++++ kbuild-0.1.9998svn3427/src/sed/lib/getline.c +@@ -9,10 +9,10 @@ + #include + #undef getline /* bird */ + ++#include ++ + #ifdef HAVE_STRINGS_H + # include +-#else +-# include + #endif /* HAVE_STRINGS_H */ + + #ifdef HAVE_STDLIB_H +Index: kbuild-0.1.9998svn3427/src/sed/lib/mkstemp.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/lib/mkstemp.c ++++ kbuild-0.1.9998svn3427/src/sed/lib/mkstemp.c +@@ -2,10 +2,10 @@ + #include "config.h" + #endif + ++#include ++ + #ifdef HAVE_STRINGS_H + # include +-#else +-# include + #endif /* HAVE_STRINGS_H */ + + #ifdef HAVE_STDLIB_H +Index: kbuild-0.1.9998svn3427/src/sed/lib/utils.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/lib/utils.c ++++ kbuild-0.1.9998svn3427/src/sed/lib/utils.c +@@ -19,16 +19,17 @@ + #include "config.h" + + #include ++#include + + #include + #ifndef errno + extern int errno; + #endif + ++#include ++ + #ifdef HAVE_STRINGS_H + # include +-#else +-# include + #endif /* HAVE_STRINGS_H */ + + #ifdef HAVE_STDLIB_H +Index: kbuild-0.1.9998svn3427/src/sed/sed/compile.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/sed/compile.c ++++ kbuild-0.1.9998svn3427/src/sed/sed/compile.c +@@ -22,14 +22,13 @@ + #include "strverscmp.h" + #include + #include ++#include + + #ifdef HAVE_STRINGS_H + # include + # ifdef HAVE_MEMORY_H + # include + # endif +-#else +-# include + #endif /* HAVE_STRINGS_H */ + + #ifdef HAVE_STDLIB_H +Index: kbuild-0.1.9998svn3427/src/sed/sed/execute.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/sed/execute.c ++++ kbuild-0.1.9998svn3427/src/sed/sed/execute.c +@@ -24,6 +24,7 @@ + + #include + #include ++#include + + #include + #ifndef errno +@@ -46,8 +47,6 @@ extern int errno; + + #ifdef HAVE_STRINGS_H + # include +-#else +-# include + #endif /*HAVE_STRINGS_H*/ + #ifdef HAVE_MEMORY_H + # include +Index: kbuild-0.1.9998svn3427/src/sed/sed/fmt.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/sed/fmt.c ++++ kbuild-0.1.9998svn3427/src/sed/sed/fmt.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #if HAVE_LIMITS_H + # include +Index: kbuild-0.1.9998svn3427/src/sed/sed/mbcs.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/sed/mbcs.c ++++ kbuild-0.1.9998svn3427/src/sed/sed/mbcs.c +@@ -17,6 +17,7 @@ + + #include "sed.h" + #include ++#include + + int mb_cur_max; + +Index: kbuild-0.1.9998svn3427/src/sed/sed/regexp.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/sed/regexp.c ++++ kbuild-0.1.9998svn3427/src/sed/sed/regexp.c +@@ -19,6 +19,7 @@ + + #include + #include ++#include + #ifdef HAVE_STDLIB_H + # include + #endif +Index: kbuild-0.1.9998svn3427/src/sed/sed/sed.c +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/sed/sed/sed.c ++++ kbuild-0.1.9998svn3427/src/sed/sed/sed.c +@@ -22,12 +22,10 @@ + + #include "sed.h" + +- + #include ++#include + #ifdef HAVE_STRINGS_H + # include +-#else +-# include + #endif /*HAVE_STRINGS_H*/ + #ifdef HAVE_MEMORY_H + # include diff --git a/kBuild-configure-c99-2.patch b/kBuild-configure-c99-2.patch new file mode 100644 index 0000000..722c457 --- /dev/null +++ b/kBuild-configure-c99-2.patch @@ -0,0 +1,12 @@ +Index: kbuild-0.1.9998svn3427/src/kmk/configure.ac +=================================================================== +--- kbuild-0.1.9998svn3427.orig/src/kmk/configure.ac ++++ kbuild-0.1.9998svn3427/src/kmk/configure.ac +@@ -121,6 +121,7 @@ pds_AC_DOS_PATHS + AC_CACHE_CHECK([for standard gettimeofday], [ac_cv_func_gettimeofday], + [ac_cv_func_gettimeofday=no + AC_RUN_IFELSE([AC_LANG_SOURCE([[#include ++ #include + int main () + { + struct timeval t; t.tv_sec = -1; t.tv_usec = -1; diff --git a/kBuild-configure-c99.patch b/kBuild-configure-c99.patch new file mode 100644 index 0000000..36d3f9d --- /dev/null +++ b/kBuild-configure-c99.patch @@ -0,0 +1,48 @@ +Fix some typical C99 compatibility issues in old configure scripts. + +diff --git a/src/sed/config/getline.m4 b/src/sed/config/getline.m4 +index ff8b5f4b..52d2e3e7 100644 +--- a/src/sed/config/getline.m4 ++++ b/src/sed/config/getline.m4 +@@ -27,7 +27,7 @@ AC_DEFUN([AM_FUNC_GETLINE], + if (!in) + return 1; + len = getline (&line, &siz, in); +- exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); ++ return (len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1; + } + ], am_cv_func_working_getline=yes dnl The library version works. + , am_cv_func_working_getline=no dnl The library version does NOT work. +diff --git a/src/sed/configure b/src/sed/configure +index 0b01618f..b1172113 100755 +--- a/src/sed/configure ++++ b/src/sed/configure +@@ -2593,7 +2593,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ +- '' \ ++ '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ +@@ -3378,8 +3378,8 @@ main () + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) +- exit(2); +- exit (0); ++ return 2; ++ return 0; + } + _ACEOF + rm -f conftest$ac_exeext +@@ -5747,7 +5747,7 @@ cat >>conftest.$ac_ext <<_ACEOF + if (!in) + return 1; + len = getline (&line, &siz, in); +- exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); ++ return (len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1; + } + + _ACEOF diff --git a/kbuild.changes b/kbuild.changes index 8d947c5..2bbd6fd 100644 --- a/kbuild.changes +++ b/kbuild.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Fri Jun 7 11:04:30 UTC 2024 - Martin Jambor + +- Make kbuild buildable with GCC 14 (boo#1225792) + * Changes to configure machinery so that it does not fail and detect + what it has detected with previous GCC versions. + (kBuild-configure-c99.patch, kBuild-configure-c99-2.patch) + * Add many missing includes (kBuild-c99.patch). + * Fix an actual bug in a call to eval_buffer that also manifests as + a C99 violation (kBuild-c99-2.patch). + ------------------------------------------------------------------- Thu Feb 22 12:41:22 UTC 2024 - Dominique Leuenberger diff --git a/kbuild.spec b/kbuild.spec index 8a8192f..4156006 100644 --- a/kbuild.spec +++ b/kbuild.spec @@ -1,7 +1,7 @@ # # spec file for package kbuild # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -34,6 +34,17 @@ Patch8: kbuild-wrong-memset.patch Patch9: ppc64le.patch Patch10: aarch64.patch Patch13: glob-lstat.patch + +# C99 compatibility patches to resolve boo#1225792: +# From from https://bugzilla.redhat.com/show_bug.cgi?id=2154544 +Patch14: kBuild-configure-c99.patch +# Somehow RedHat did not need this one: +Patch15: kBuild-configure-c99-2.patch +# From from https://bugzilla.redhat.com/show_bug.cgi?id=2154544 +Patch16: kBuild-c99.patch +# From from https://bugzilla.redhat.com/show_bug.cgi?id=2154544 +Patch17: kBuild-c99-2.patch + BuildRequires: automake BuildRequires: bison BuildRequires: byacc @@ -66,6 +77,10 @@ The goals of the kBuild framework: %patch -P 9 -p1 %patch -P 10 -p1 %patch -P 13 -p1 +%patch -P 14 -p1 +%patch -P 15 -p1 +%patch -P 16 -p1 +%patch -P 17 -p0 %build export CFLAGS="%{optflags} -fno-strict-aliasing"