SHA256
1
0
forked from pool/kbuild

Accepting request 1179187 from devel:tools:building

OBS-URL: https://build.opensuse.org/request/show/1179187
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kbuild?expand=0&rev=42
This commit is contained in:
Ana Guerrero 2024-06-09 18:18:56 +00:00 committed by Git OBS Bridge
commit e69a2fdbc6
6 changed files with 261 additions and 1 deletions

16
kBuild-c99-2.patch Normal file
View File

@ -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);

158
kBuild-c99.patch Normal file
View File

@ -0,0 +1,158 @@
Do not treat <strings.h> as an umbrella header for <string.h>
The two are distinct on GNU/Linux.
Also add missing #include <string.h> 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 <stdio.h>
#undef getline /* bird */
+#include <string.h>
+
#ifdef HAVE_STRINGS_H
# include <strings.h>
-#else
-# include <string.h>
#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 <string.h>
+
#ifdef HAVE_STRINGS_H
# include <strings.h>
-#else
-# include <string.h>
#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 <stdio.h>
+#include <unistd.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
+#include <string.h>
+
#ifdef HAVE_STRINGS_H
# include <strings.h>
-#else
-# include <string.h>
#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 <stdio.h>
#include <ctype.h>
+#include <string.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
# ifdef HAVE_MEMORY_H
# include <memory.h>
# endif
-#else
-# include <string.h>
#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 <stdio.h>
#include <ctype.h>
+#include <string.h>
#include <errno.h>
#ifndef errno
@@ -46,8 +47,6 @@ extern int errno;
#ifdef HAVE_STRINGS_H
# include <strings.h>
-#else
-# include <string.h>
#endif /*HAVE_STRINGS_H*/
#ifdef HAVE_MEMORY_H
# include <memory.h>
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 <stdio.h>
#include <ctype.h>
#include <sys/types.h>
+#include <string.h>
#if HAVE_LIMITS_H
# include <limits.h>
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 <stdlib.h>
+#include <string.h>
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 <ctype.h>
#include <stdio.h>
+#include <string.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#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 <stdio.h>
+#include <string.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
-#else
-# include <string.h>
#endif /*HAVE_STRINGS_H*/
#ifdef HAVE_MEMORY_H
# include <memory.h>

View File

@ -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 <sys/time.h>
+ #include <stdlib.h>
int main ()
{
struct timeval t; t.tv_sec = -1; t.tv_usec = -1;

View File

@ -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 <stdlib.h>' \
'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

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Jun 7 11:04:30 UTC 2024 - Martin Jambor <mjambor@suse.com>
- 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 <dimstar@opensuse.org>

View File

@ -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"