community/tinyfugue: fix build

Selectively apply _GNU_SOURCE to fix implicit function declaration
errors.

```
In file included from command.c:14:
command.c: In function 'handle_localecho_command':
port.h:115:20: error: implicit declaration of function 'strcasecmp'; did
you mean 'wcscasecmp'? [-Wimplicit-function-declaration]
  115 | # define cstrcmp   strcasecmp
      |                    ^~~~~~~~~~
command.c:182:14: note: in expansion of macro 'cstrcmp'
  182 |     else if (cstrcmp(args->data + offset, "on") == 0) local_echo(1);
      |              ^~~~~~~
command.c: In function 'do_file_load':
command.c:551:29: error: implicit declaration of function 'strdup'; did
you mean 'strcmp'? [-Wimplicit-function-declaration]
  551 |                 *savename = strdup( file->name );
      |                             ^~~~~~
      |                             strcmp
command.c:551:27: error: assignment to 'char *' from 'int' makes pointer
from integer without a cast [-Wint-conversion]
  551 |                 *savename = strdup( file->name );
      |                           ^
```
This commit is contained in:
mio 2025-03-28 02:57:23 +00:00 committed by Kevin Daudt
parent 2ea47d6e69
commit 26537a435c
2 changed files with 103 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Síle Ekaterin Liszka <sheila@vulpine.house>
pkgname=tinyfugue
pkgver=5.1.4
pkgrel=3
pkgrel=4
pkgdesc="Powerful curses-based MUD client"
url="https://github.com/ingwarsw/tinyfugue"
arch="all"
@ -10,7 +10,9 @@ options="!check" # no testsuite
license="GPL-2.0-or-later"
makedepends="openssl-dev ncurses-dev pcre-dev icu-dev python3-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/ingwarsw/tinyfugue/archive/refs/tags/$pkgver.tar.gz
gcc14.patch"
gcc14.patch
gnu-source.patch
"
build() {
./configure \
@ -34,4 +36,5 @@ package() {
sha512sums="
5732b3f96bc5e09e1eadd89994a25161d765ecaa0c72e5fd1d546b12028eb873faeb178fefbe3262aa790660a509fbf5de6dc74a50c23040005ab42d4a46ae14 tinyfugue-5.1.4.tar.gz
fa5bbbcb236aeff6095a9bbac2975d78e72e73abd88260c41fccddd0e7b33e5cb50a77cf5661e9efab952e2076e76792a616c59552c25d8dce9e0bb21372ad46 gcc14.patch
81f5c100b67e9147c4ff2cd01374b046da02bc039b1310ea9b31f381b6052a8a15d1cdfc31a5b915680508dca1e5431e4db9f1593bbff751a1afaabea8f1fa66 gnu-source.patch
"

View File

@ -0,0 +1,98 @@
Define macros to fix implicit function declaration errors.
---
--- a/src/expr.c
+++ b/src/expr.c
@@ -13,6 +13,8 @@
* Parses and evaluates expressions.
********************************************************************/
+#define _GNU_SOURCE
+
#include "tfconfig.h"
#include <math.h>
#include <limits.h>
--- a/src/history.c
+++ b/src/history.c
@@ -13,6 +13,8 @@
* Handles text queuing and file I/O for logs. *
****************************************************************/
+#define _GNU_SOURCE
+
#include <limits.h>
#include "tfconfig.h"
#include "port.h"
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -10,6 +10,8 @@
* Regexp wrappers and glob pattern matching.
*/
+#define _GNU_SOURCE
+
#include "tfconfig.h"
#if HAVE_LOCALE_H
# include <locale.h>
--- a/src/port.h
+++ b/src/port.h
@@ -6,6 +6,8 @@
* General Public License. See the file "COPYING" for details.
************************************************************************/
+#define _GNU_SOURCE
+
#ifndef PORT_H
#define PORT_H
@@ -86,6 +88,7 @@
#if STDC_HEADERS
# include <stdlib.h>
# include <string.h>
+# include <strings.h> /* strcasecmp() */
#else
extern void free();
# if HAVE_MEMORY_H
--- a/src/signals.c
+++ b/src/signals.c
@@ -8,6 +8,8 @@
/* Signal handling, core dumps, job control, and interactive shells */
+#define _POSIX_C_SOURCE 199309L /* for siginfo_t */
+
#include "tfconfig.h"
#include <signal.h>
#include <setjmp.h>
--- a/src/socket.c
+++ b/src/socket.c
@@ -16,6 +16,8 @@
* Autologin handled here.
***************************************************************/
+#define _POSIX_C_SOURCE 199309L /* for siginfo_t */
+
#include "tfconfig.h"
#include <sys/types.h>
#if HAVE_SYS_SELECT_H
--- a/src/util.c
+++ b/src/util.c
@@ -15,6 +15,8 @@
* Mail checker
*/
+#define _GNU_SOURCE
+
#include "tfconfig.h"
#if HAVE_LOCALE_H
# include <locale.h>
--- a/src/variable.c
+++ b/src/variable.c
@@ -10,6 +10,8 @@
* Internal and environment variables *
**************************************/
+#define _GNU_SOURCE /* timercmp() */
+
#include "tfconfig.h"
#include "port.h"
#include "tf.h"