summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ports/jq/patches/0001-Teach-config.sub-about-serenity.patch (renamed from Ports/jq/patches/diff.patch)58
-rw-r--r--Ports/jq/patches/0002-Make-configure-assume-all-dependencies-are-okay.patch27
-rw-r--r--Ports/jq/patches/0003-Make-jv_mem_alloc-return-a-dummy-allocation-for-zero.patch42
-rw-r--r--Ports/jq/patches/ReadMe.md18
4 files changed, 101 insertions, 44 deletions
diff --git a/Ports/jq/patches/diff.patch b/Ports/jq/patches/0001-Teach-config.sub-about-serenity.patch
index 8bd805ccc2..e0c7fb7b7b 100644
--- a/Ports/jq/patches/diff.patch
+++ b/Ports/jq/patches/0001-Teach-config.sub-about-serenity.patch
@@ -1,5 +1,15 @@
+From 9c8c438e497732983f053f8a48c33b6a456ddee5 Mon Sep 17 00:00:00 2001
+From: Ali Mohammad Pur <ali.mpfard@gmail.com>
+Date: Mon, 16 May 2022 16:20:45 +0430
+Subject: [PATCH 1/3] Teach config.sub about serenity
+
+---
+ config/config.sub | 9 ++++++++-
+ modules/oniguruma/config.sub | 2 +-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
diff --git a/config/config.sub b/config/config.sub
-index 7ffe373..3c8aae4 100755
+index 7ffe373..fdda758 100755
--- a/config/config.sub
+++ b/config/config.sub
@@ -117,7 +117,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
@@ -32,21 +42,6 @@ index 7ffe373..3c8aae4 100755
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-diff --git a/configure b/configure
-index de9c48a..1ace244 100755
---- a/configure
-+++ b/configure
-@@ -6828,6 +6828,10 @@ bsdi[45]*)
- lt_cv_file_magic_test_file=/shlib/libc.so
- ;;
-
-+*serenity*)
-+ lt_cv_deplibs_check_method=pass_all
-+ ;;
-+
- cygwin*)
- # func_win32_libid is a shell function defined in ltmain.sh
- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
diff --git a/modules/oniguruma/config.sub b/modules/oniguruma/config.sub
index cc69b06..a916f15 100755
--- a/modules/oniguruma/config.sub
@@ -60,31 +55,6 @@ index cc69b06..a916f15 100755
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-diff --git a/src/jv_alloc.c b/src/jv_alloc.c
-index fd7b257..9f5ced8 100644
---- a/src/jv_alloc.c
-+++ b/src/jv_alloc.c
-@@ -130,7 +130,14 @@ void* jv_mem_alloc_unguarded(size_t sz) {
- return malloc(sz);
- }
-
-+static void* jv_mem_calloc_unique_allocd = 0;
- void* jv_mem_calloc(size_t nemb, size_t sz) {
-+ if (!sz || !nemb) {
-+ if (jv_mem_calloc_unique_allocd)
-+ return jv_mem_calloc_unique_allocd;
-+ else
-+ return jv_mem_calloc_unique_allocd = calloc(1,1);
-+ }
- void* p = calloc(nemb, sz);
- if (!p) {
- memory_exhausted();
-@@ -155,6 +162,8 @@ char* jv_mem_strdup_unguarded(const char *s) {
- }
-
- void jv_mem_free(void* p) {
-+ if (p == jv_mem_calloc_unique_allocd)
-+ return;
- free(p);
- }
-
+--
+2.36.1
+
diff --git a/Ports/jq/patches/0002-Make-configure-assume-all-dependencies-are-okay.patch b/Ports/jq/patches/0002-Make-configure-assume-all-dependencies-are-okay.patch
new file mode 100644
index 0000000000..41b396d1f0
--- /dev/null
+++ b/Ports/jq/patches/0002-Make-configure-assume-all-dependencies-are-okay.patch
@@ -0,0 +1,27 @@
+From 286ee7f25aefdd17945ba141bb5684857575119a Mon Sep 17 00:00:00 2001
+From: Ali Mohammad Pur <ali.mpfard@gmail.com>
+Date: Mon, 16 May 2022 16:20:52 +0430
+Subject: [PATCH 2/3] Make configure assume all dependencies are okay
+
+---
+ configure | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/configure b/configure
+index de9c48a..1ace244 100755
+--- a/configure
++++ b/configure
+@@ -6828,6 +6828,10 @@ bsdi[45]*)
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
++*serenity*)
++ lt_cv_deplibs_check_method=pass_all
++ ;;
++
+ cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+--
+2.36.1
+
diff --git a/Ports/jq/patches/0003-Make-jv_mem_alloc-return-a-dummy-allocation-for-zero.patch b/Ports/jq/patches/0003-Make-jv_mem_alloc-return-a-dummy-allocation-for-zero.patch
new file mode 100644
index 0000000000..66f7e4e23b
--- /dev/null
+++ b/Ports/jq/patches/0003-Make-jv_mem_alloc-return-a-dummy-allocation-for-zero.patch
@@ -0,0 +1,42 @@
+From 53246ba7b026c92e42aa4c332007f425d297a4ea Mon Sep 17 00:00:00 2001
+From: Ali Mohammad Pur <ali.mpfard@gmail.com>
+Date: Mon, 16 May 2022 16:21:08 +0430
+Subject: [PATCH 3/3] Make jv_mem_alloc() return a dummy allocation for
+ zero-sized allocs
+
+And make jv_mem_free() accept it.
+---
+ src/jv_alloc.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/jv_alloc.c b/src/jv_alloc.c
+index fd7b257..9f5ced8 100644
+--- a/src/jv_alloc.c
++++ b/src/jv_alloc.c
+@@ -130,7 +130,14 @@ void* jv_mem_alloc_unguarded(size_t sz) {
+ return malloc(sz);
+ }
+
++static void* jv_mem_calloc_unique_allocd = 0;
+ void* jv_mem_calloc(size_t nemb, size_t sz) {
++ if (!sz || !nemb) {
++ if (jv_mem_calloc_unique_allocd)
++ return jv_mem_calloc_unique_allocd;
++ else
++ return jv_mem_calloc_unique_allocd = calloc(1,1);
++ }
+ void* p = calloc(nemb, sz);
+ if (!p) {
+ memory_exhausted();
+@@ -155,6 +162,8 @@ char* jv_mem_strdup_unguarded(const char *s) {
+ }
+
+ void jv_mem_free(void* p) {
++ if (p == jv_mem_calloc_unique_allocd)
++ return;
+ free(p);
+ }
+
+--
+2.36.1
+
diff --git a/Ports/jq/patches/ReadMe.md b/Ports/jq/patches/ReadMe.md
new file mode 100644
index 0000000000..e89cbb100b
--- /dev/null
+++ b/Ports/jq/patches/ReadMe.md
@@ -0,0 +1,18 @@
+# Patches for jq on SerenityOS
+
+## `0001-Teach-config.sub-about-serenity.patch`
+
+Teach config.sub about serenity
+
+
+## `0002-Make-configure-assume-all-dependencies-are-okay.patch`
+
+Make configure assume all dependencies are okay
+
+
+## `0003-Make-jv_mem_alloc-return-a-dummy-allocation-for-zero.patch`
+
+Make jv_mem_alloc() return a dummy allocation for zero-sized allocs
+
+And make jv_mem_free() accept it.
+