community/enscript: fix build with gcc 15

Fix getenv/getopt and other function prototypes with gcc 15.

```
getopt.c:366:21: error: too many arguments to function 'getenv'; expected 0, have 1
  366 |   posixly_correct = getenv ("POSIXLY_CORRECT");
      |                     ^~~~~~  ~~~~~~~~~~~~~~~~~
getopt.c:214:7: note: declared here
  214 | char *getenv ();
      |       ^~~~~~
```

```
getopt.c:922:1: error: number of arguments doesn't match prototype
  922 | {
      | ^
In file included from getopt.c:113:
getopt.h:108:12: error: prototype declaration
  108 | extern int getopt ();
      |            ^~~~~~
```

```
regex.c:3565:13: error: too many arguments to function 're_match_2_internal'; expected 0, have 8
 3565 |       val = re_match_2_internal (bufp, string1, size1, string2, size2,
      |             ^~~~~~~~~~~~~~~~~~~  ~~~~
regex.c:339:12: note: declared here
  339 | static int re_match_2_internal ();
      |            ^~~~~~~~~~~~~~~~~~~
```
This commit is contained in:
mio 2025-09-10 01:29:38 +00:00 committed by A. Klitzing
parent e123ccc329
commit 6d60517853
3 changed files with 44 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=enscript
pkgver=1.6.6
pkgrel=6
pkgrel=7
pkgdesc="GNU Enscript converts ASCII files to PostScript, HTML, or RTF"
url="https://www.gnu.org/software/enscript/"
arch="all"
@ -9,6 +9,8 @@ license="GPL-3.0-only"
subpackages="$pkgname-doc"
source="https://ftp.gnu.org/gnu/enscript/enscript-$pkgver.tar.gz
gcc14-implicit-function-declaration.patch
gcc15-getopt.patch
gcc15-regex.patch
"
prepare() {
@ -38,4 +40,6 @@ package() {
sha512sums="
bf1c2b9ea7723518a1ef312145ddcd6ffdef0c6e8b5795ea84cb55d76fccc02f441d0c2dc6897e970368186e6a829ab74a090716624e0f7a8f575653fa495ebc enscript-1.6.6.tar.gz
8534bd60a6f0a2b066fa52ad734c84ff6b9abae859c88550be4a9e93400f25d4520a5b39c0e0995d21d1bb661716806e6d8c2dd04d1391a97b012c7ad1cb58ac gcc14-implicit-function-declaration.patch
ed2542d145d54e1139b5e5e456c9cebcfbf7a0255828d1ba70ccbee0641d0c7ce36d2fa7795dedcd242e4fa4b5ec27bf48bee927fe75ed6281e560f87137e8c9 gcc15-getopt.patch
f5b5ef2716c617be16e58868ea4f547103b47eef0428555bea8db023f1675a0bf37c38eb6cb694a46a481baa02a32417c014eb33ab3c76fd6a6b8e9f40cd1354 gcc15-regex.patch
"

View File

@ -0,0 +1,24 @@
diff -ruN a/compat/getopt.c b/compat/getopt.c
--- a/compat/getopt.c 2025-09-10 00:44:17.560000000 +0000
+++ b/compat/getopt.c 2025-09-10 01:22:33.360000000 +0000
@@ -211,7 +211,7 @@
/* Avoid depending on library functions or files
whose names are inconsistent. */
-char *getenv ();
+char *getenv (const char *);
static char *
my_index (str, chr)
diff -ruN a/compat/getopt.h b/compat/getopt.h
--- a/compat/getopt.h 2011-10-30 16:48:42.000000000 +0000
+++ b/compat/getopt.h 2025-09-10 01:21:26.450000000 +0000
@@ -105,7 +105,7 @@
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
+extern int getopt(int, char * const [], const char *);
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);

View File

@ -0,0 +1,15 @@
Patch-Source: https://src.fedoraproject.org/rpms/enscript/blob/9c673cf1082e06e133c14e9896b78a317b93359e/f/enscript-c23.patch
---
diff --git a/compat/regex.c b/compat/regex.c
index c6907f3..87f2840 100644
--- a/compat/regex.c
+++ b/compat/regex.c
@@ -336,7 +336,7 @@ typedef char boolean;
#define false 0
#define true 1
-static int re_match_2_internal ();
+static int re_match_2_internal (struct re_pattern_buffer*, const char*, int, const char*, int, int, struct re_registers*, int);
/* These are the command codes that appear in compiled regular
expressions. Some opcodes are followed by argument bytes. A