From 83aa5dcbf6f7a34988f5553d74bc510503933006 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Tue, 17 May 2022 00:03:39 +0430 Subject: [PATCH] Ports: Update cfunge's patches to use git patches --- ....c-that-we-don-t-have-arc4random_buf.patch | 26 +++++++++++++++++++ ...-inline-instead-of-using-sys-param.h.patch | 25 ++++++++++++++++++ .../0003-define-_POSIX_MAPPED_FILES.patch | 25 ++++++++++++++++++ .../patches/0004-Define-_POSIX_REGEXP.patch | 25 ++++++++++++++++++ Ports/cfunge/patches/ReadMe.md | 25 +++++++++++------- Ports/cfunge/patches/arc4random_buf.patch | 10 ------- Ports/cfunge/patches/define-max.patch | 11 -------- Ports/cfunge/patches/posix-mapped-files.patch | 10 ------- Ports/cfunge/patches/posix-regexp.patch | 10 ------- 9 files changed, 117 insertions(+), 50 deletions(-) create mode 100644 Ports/cfunge/patches/0001-Tell-prng.c-that-we-don-t-have-arc4random_buf.patch create mode 100644 Ports/cfunge/patches/0002-Define-MAX-inline-instead-of-using-sys-param.h.patch create mode 100644 Ports/cfunge/patches/0003-define-_POSIX_MAPPED_FILES.patch create mode 100644 Ports/cfunge/patches/0004-Define-_POSIX_REGEXP.patch delete mode 100644 Ports/cfunge/patches/arc4random_buf.patch delete mode 100644 Ports/cfunge/patches/define-max.patch delete mode 100644 Ports/cfunge/patches/posix-mapped-files.patch delete mode 100644 Ports/cfunge/patches/posix-regexp.patch diff --git a/Ports/cfunge/patches/0001-Tell-prng.c-that-we-don-t-have-arc4random_buf.patch b/Ports/cfunge/patches/0001-Tell-prng.c-that-we-don-t-have-arc4random_buf.patch new file mode 100644 index 00000000000..36ddcaeb767 --- /dev/null +++ b/Ports/cfunge/patches/0001-Tell-prng.c-that-we-don-t-have-arc4random_buf.patch @@ -0,0 +1,26 @@ +From 06224692b112908e3cc13dcdb1b2c2037849d30c Mon Sep 17 00:00:00 2001 +From: Tobias Christiansen +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 + diff --git a/Ports/cfunge/patches/0002-Define-MAX-inline-instead-of-using-sys-param.h.patch b/Ports/cfunge/patches/0002-Define-MAX-inline-instead-of-using-sys-param.h.patch new file mode 100644 index 00000000000..580708bd11e --- /dev/null +++ b/Ports/cfunge/patches/0002-Define-MAX-inline-instead-of-using-sys-param.h.patch @@ -0,0 +1,25 @@ +From 8e430a265acf87063fff9b00b18dff91c4a6f073 Mon Sep 17 00:00:00 2001 +From: Tobias Christiansen +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 + #include +-#include /* 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 + diff --git a/Ports/cfunge/patches/0003-define-_POSIX_MAPPED_FILES.patch b/Ports/cfunge/patches/0003-define-_POSIX_MAPPED_FILES.patch new file mode 100644 index 00000000000..25165208caf --- /dev/null +++ b/Ports/cfunge/patches/0003-define-_POSIX_MAPPED_FILES.patch @@ -0,0 +1,25 @@ +From 2ef179368040355b7a99d3a55c9defdc162baa32 Mon Sep 17 00:00:00 2001 +From: Tobias Christiansen +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 /* fstat, open */ + #include /* 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 + diff --git a/Ports/cfunge/patches/0004-Define-_POSIX_REGEXP.patch b/Ports/cfunge/patches/0004-Define-_POSIX_REGEXP.patch new file mode 100644 index 00000000000..69010b68528 --- /dev/null +++ b/Ports/cfunge/patches/0004-Define-_POSIX_REGEXP.patch @@ -0,0 +1,25 @@ +From 0e1b34946cdc2b4360d9a44f7f44cb5c743a9a78 Mon Sep 17 00:00:00 2001 +From: Tobias Christiansen +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 + #include + ++#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 + diff --git a/Ports/cfunge/patches/ReadMe.md b/Ports/cfunge/patches/ReadMe.md index 0742d937623..b73f7820068 100644 --- a/Ports/cfunge/patches/ReadMe.md +++ b/Ports/cfunge/patches/ReadMe.md @@ -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. diff --git a/Ports/cfunge/patches/arc4random_buf.patch b/Ports/cfunge/patches/arc4random_buf.patch deleted file mode 100644 index b645bc4fc4b..00000000000 --- a/Ports/cfunge/patches/arc4random_buf.patch +++ /dev/null @@ -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 diff --git a/Ports/cfunge/patches/define-max.patch b/Ports/cfunge/patches/define-max.patch deleted file mode 100644 index b764bbc7909..00000000000 --- a/Ports/cfunge/patches/define-max.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../lib/fungestring/funge_str-two-way.h -+++ ../lib/fungestring/funge_str-two-way.h -@@ -53,7 +53,7 @@ - - #include - #include --#include /* 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 diff --git a/Ports/cfunge/patches/posix-mapped-files.patch b/Ports/cfunge/patches/posix-mapped-files.patch deleted file mode 100644 index d771b313903..00000000000 --- a/Ports/cfunge/patches/posix-mapped-files.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src/funge-space/funge-space.c -+++ ../src/funge-space/funge-space.c -@@ -47,6 +47,7 @@ - #include /* fstat, open */ - #include /* 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 diff --git a/Ports/cfunge/patches/posix-regexp.patch b/Ports/cfunge/patches/posix-regexp.patch deleted file mode 100644 index a5bc5d71547..00000000000 --- a/Ports/cfunge/patches/posix-regexp.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src/fingerprints/REXP/REXP.c -+++ ../src/fingerprints/REXP/REXP.c -@@ -28,6 +28,7 @@ - #include - #include - -+#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