mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
Ports: Update jq's patches to use git patches
This commit is contained in:
parent
8a610b1bb9
commit
e99a1b5b64
4 changed files with 101 additions and 44 deletions
|
@ -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
|
diff --git a/config/config.sub b/config/config.sub
|
||||||
index 7ffe373..3c8aae4 100755
|
index 7ffe373..fdda758 100755
|
||||||
--- a/config/config.sub
|
--- a/config/config.sub
|
||||||
+++ b/config/config.sub
|
+++ b/config/config.sub
|
||||||
@@ -117,7 +117,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
@@ -117,7 +117,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||||
|
@ -32,21 +42,6 @@ index 7ffe373..3c8aae4 100755
|
||||||
-sunos5*)
|
-sunos5*)
|
||||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
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
|
diff --git a/modules/oniguruma/config.sub b/modules/oniguruma/config.sub
|
||||||
index cc69b06..a916f15 100755
|
index cc69b06..a916f15 100755
|
||||||
--- a/modules/oniguruma/config.sub
|
--- a/modules/oniguruma/config.sub
|
||||||
|
@ -60,31 +55,6 @@ index cc69b06..a916f15 100755
|
||||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||||
diff --git a/src/jv_alloc.c b/src/jv_alloc.c
|
--
|
||||||
index fd7b257..9f5ced8 100644
|
2.36.1
|
||||||
--- 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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
18
Ports/jq/patches/ReadMe.md
Normal file
18
Ports/jq/patches/ReadMe.md
Normal file
|
@ -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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue