Ports: Update cfunge's patches to use git patches

This commit is contained in:
Ali Mohammad Pur 2022-05-17 00:03:39 +04:30 committed by Ali Mohammad Pur
parent b321d2b563
commit 83aa5dcbf6
Notes: sideshowbarker 2024-07-17 10:46:38 +09:00
9 changed files with 117 additions and 50 deletions

View file

@ -0,0 +1,26 @@
From 06224692b112908e3cc13dcdb1b2c2037849d30c Mon Sep 17 00:00:00 2001
From: Tobias Christiansen <tobyase@serenityos.org>
Date: Thu, 24 Mar 2022 15:41:48 +0100
Subject: [PATCH 1/4] Tell prng.c that we don't have arc4random_buf
FIXME: This function does exist, perhaps outdated or some issue -
explain the issue here if so.
---
src/prng.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/prng.c b/src/prng.c
index 004906d..d73b05c 100644
--- a/src/prng.c
+++ b/src/prng.c
@@ -29,6 +29,7 @@
# undef HAVE_arc4random_buf
#endif
+#undef HAVE_arc4random_buf
#ifdef HAVE_arc4random_buf
# define HAVE_ARC4RANDOM
# ifndef ARC4RANDOM_IN_BSD
--
2.36.1

View file

@ -0,0 +1,25 @@
From 8e430a265acf87063fff9b00b18dff91c4a6f073 Mon Sep 17 00:00:00 2001
From: Tobias Christiansen <tobyase@serenityos.org>
Date: Thu, 24 Mar 2022 15:41:48 +0100
Subject: [PATCH 2/4] Define MAX inline instead of using sys/param.h
---
lib/fungestring/funge_str-two-way.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/fungestring/funge_str-two-way.h b/lib/fungestring/funge_str-two-way.h
index 70295f4..a3e0888 100644
--- a/lib/fungestring/funge_str-two-way.h
+++ b/lib/fungestring/funge_str-two-way.h
@@ -53,7 +53,7 @@
#include <limits.h>
#include <stdint.h>
-#include <sys/param.h> /* Defines MAX. */
+#define MAX(a,b) (((a)>(b))?(a):(b))
/* We use the Two-Way string matching algorithm, which guarantees
linear complexity with constant space. Additionally, for long
--
2.36.1

View file

@ -0,0 +1,25 @@
From 2ef179368040355b7a99d3a55c9defdc162baa32 Mon Sep 17 00:00:00 2001
From: Tobias Christiansen <tobyase@serenityos.org>
Date: Thu, 24 Mar 2022 15:41:48 +0100
Subject: [PATCH 3/4] define _POSIX_MAPPED_FILES
Serenity has a working mmap().
---
src/funge-space/funge-space.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/funge-space/funge-space.c b/src/funge-space/funge-space.c
index 0b78647..dc1f830 100644
--- a/src/funge-space/funge-space.c
+++ b/src/funge-space/funge-space.c
@@ -47,6 +47,7 @@
#include <sys/stat.h> /* fstat, open */
#include <fcntl.h> /* open, posix_fallocate */
+#define _POSIX_MAPPED_FILES 1
#if !defined(_POSIX_MAPPED_FILES) || (_POSIX_MAPPED_FILES < 1)
# error "cfunge needs a working mmap(), which this system claims it lacks."
#endif
--
2.36.1

View file

@ -0,0 +1,25 @@
From 0e1b34946cdc2b4360d9a44f7f44cb5c743a9a78 Mon Sep 17 00:00:00 2001
From: Tobias Christiansen <tobyase@serenityos.org>
Date: Thu, 24 Mar 2022 15:41:48 +0100
Subject: [PATCH 4/4] Define _POSIX_REGEXP
Serenity's libc does have regex.
---
src/fingerprints/REXP/REXP.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/fingerprints/REXP/REXP.c b/src/fingerprints/REXP/REXP.c
index c208078..88616b2 100644
--- a/src/fingerprints/REXP/REXP.c
+++ b/src/fingerprints/REXP/REXP.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <string.h>
+#define _POSIX_REGEXP 1
#if !defined(_POSIX_REGEXP) || (_POSIX_REGEXP < 1)
# error "cfunge needs POSIX regular expressions, which this system claims it doesn't have."
#endif
--
2.36.1

View file

@ -1,19 +1,26 @@
# Patches for cfunge on SerenityOS
## `arc4random_buf.patch`
Somewhere on the way of configuring the variable `HAVE_arc4random_buf` was set which lead to the linker complaining about not knowing a certain `arc4random_stir()` function.
This patch just negates the define and the linker is happy.
## `0001-Tell-prng.c-that-we-don-t-have-arc4random_buf.patch`
Tell prng.c that we don't have arc4random_buf
FIXME: This function does exist, perhaps outdated or some issue -
explain the issue here if so.
## `0002-Define-MAX-inline-instead-of-using-sys-param.h.patch`
Define MAX inline instead of using sys/param.h
## `define-max.patch`
It is expected that `sys/param.h` defines a `MAX` macro. We don't. So here the needed macro is just inserted instead of the include.
## `0003-define-_POSIX_MAPPED_FILES.patch`
define _POSIX_MAPPED_FILES
## `posix-mapped-files.patch`
It is expected that `_POSIX_MAPPED_FILES` is defined as at least `1`, so we do that here.
Serenity has a working mmap().
## `0004-Define-_POSIX_REGEXP.patch`
## `posix-regexp.patch`
Same as before, just for `_POSIX_REGEXP`
Define _POSIX_REGEXP
Serenity's libc does have regex.

View file

@ -1,10 +0,0 @@
--- ../src/prng.c
+++ ../src/prng.c
@@ -29,6 +29,7 @@
# undef HAVE_arc4random_buf
#endif
+#undef HAVE_arc4random_buf
#ifdef HAVE_arc4random_buf
# define HAVE_ARC4RANDOM
# ifndef ARC4RANDOM_IN_BSD

View file

@ -1,11 +0,0 @@
--- ../lib/fungestring/funge_str-two-way.h
+++ ../lib/fungestring/funge_str-two-way.h
@@ -53,7 +53,7 @@
#include <limits.h>
#include <stdint.h>
-#include <sys/param.h> /* Defines MAX. */
+#define MAX(a,b) (((a)>(b))?(a):(b))
/* We use the Two-Way string matching algorithm, which guarantees
linear complexity with constant space. Additionally, for long

View file

@ -1,10 +0,0 @@
--- ../src/funge-space/funge-space.c
+++ ../src/funge-space/funge-space.c
@@ -47,6 +47,7 @@
#include <sys/stat.h> /* fstat, open */
#include <fcntl.h> /* open, posix_fallocate */
+#define _POSIX_MAPPED_FILES 1
#if !defined(_POSIX_MAPPED_FILES) || (_POSIX_MAPPED_FILES < 1)
# error "cfunge needs a working mmap(), which this system claims it lacks."
#endif

View file

@ -1,10 +0,0 @@
--- ../src/fingerprints/REXP/REXP.c
+++ ../src/fingerprints/REXP/REXP.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <string.h>
+#define _POSIX_REGEXP 1
#if !defined(_POSIX_REGEXP) || (_POSIX_REGEXP < 1)
# error "cfunge needs POSIX regular expressions, which this system claims it doesn't have."
#endif