Ports: Update make's patches to use git patches

This commit is contained in:
Ali Mohammad Pur 2022-05-16 19:21:52 +04:30 committed by Ali Mohammad Pur
parent 2ec53fd9c0
commit 490e97233d
Notes: sideshowbarker 2024-07-17 23:07:41 +09:00
5 changed files with 127 additions and 71 deletions

View file

@ -0,0 +1,25 @@
From 19fb459471d6242aca08bfc25465eccf05ea767e Mon Sep 17 00:00:00 2001
From: Andreas Kling <kling@serenityos.org>
Date: Tue, 15 Dec 2020 01:06:18 +0100
Subject: [PATCH 1/3] Include ar.h for serenity as well
---
src/arscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/arscan.c b/src/arscan.c
index 3ce21db..c48a569 100644
--- a/src/arscan.c
+++ b/src/arscan.c
@@ -331,7 +331,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
#endif
#ifndef WINDOWS32
-# if !defined (__ANDROID__) && !defined (__BEOS__)
+# if !defined (__ANDROID__) && !defined (__BEOS__) && !defined(__serenity__)
# include <ar.h>
# else
/* These platforms don't have <ar.h> but have archives in the same format
--
2.36.1

View file

@ -0,0 +1,45 @@
From d38968ada9bb551330a127ac37d6d3432f2b4700 Mon Sep 17 00:00:00 2001
From: Andreas Kling <kling@serenityos.org>
Date: Tue, 15 Dec 2020 01:06:18 +0100
Subject: [PATCH 2/3] Stub getdtablesize() for serenity
---
lib/getdtablesize.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 0fe7092..a14d697 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -20,6 +20,10 @@
/* Specification. */
#include <unistd.h>
+#ifdef __serenity__
+# include <sys/select.h>
+#endif
+
#if defined _WIN32 && ! defined __CYGWIN__
# include <stdio.h>
@@ -109,6 +113,9 @@ getdtablesize (void)
int
getdtablesize (void)
{
+#ifdef __serenity__
+ return FD_SETSIZE;
+#else
struct rlimit lim;
if (getrlimit (RLIMIT_NOFILE, &lim) == 0
@@ -119,6 +126,7 @@ getdtablesize (void)
return lim.rlim_cur;
return INT_MAX;
+#endif
}
#endif
--
2.36.1

View file

@ -0,0 +1,40 @@
From 0cb7ee17c3177ca168c7bbd91650fba6616a3f1b Mon Sep 17 00:00:00 2001
From: Andreas Kling <kling@serenityos.org>
Date: Tue, 15 Dec 2020 01:06:18 +0100
Subject: [PATCH 3/3] Implement getprogname()
---
lib/getprogname.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/getprogname.c b/lib/getprogname.c
index 9f69f5a..e5adb23 100644
--- a/lib/getprogname.c
+++ b/lib/getprogname.c
@@ -51,6 +51,10 @@
# include <sys/procfs.h>
#endif
+#ifdef __serenity__
+# include <unistd.h>
+#endif
+
#include "dirname.h"
#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */
@@ -245,6 +249,12 @@ getprogname (void)
}
}
return NULL;
+# elif defined __serenity__
+ char* buffer = malloc(1024);
+ if (get_process_name(buffer, 1024) < 0)
+ return NULL;
+ return buffer;
+
# else
# error "getprogname module not ported to this OS"
# endif
--
2.36.1

View file

@ -0,0 +1,17 @@
# Patches for make on SerenityOS
## `0001-Include-ar.h-for-serenity-as-well.patch`
Include ar.h for serenity as well
## `0002-Stub-getdtablesize-for-serenity.patch`
Stub getdtablesize() for serenity
## `0003-Implement-getprogname.patch`
Implement getprogname()

View file

@ -1,71 +0,0 @@
diff -ru make-4.3-clean/lib/getdtablesize.c make-4.3/lib/getdtablesize.c
--- make-4.3-clean/lib/getdtablesize.c 2020-01-19 21:34:01.000000000 +0100
+++ make-4.3/lib/getdtablesize.c 2020-12-15 00:53:49.661168383 +0100
@@ -20,6 +20,10 @@
/* Specification. */
#include <unistd.h>
+#ifdef __serenity__
+# include <sys/select.h>
+#endif
+
#if defined _WIN32 && ! defined __CYGWIN__
# include <stdio.h>
@@ -109,6 +113,9 @@
int
getdtablesize (void)
{
+#ifdef __serenity__
+ return FD_SETSIZE;
+#else
struct rlimit lim;
if (getrlimit (RLIMIT_NOFILE, &lim) == 0
@@ -119,6 +126,7 @@
return lim.rlim_cur;
return INT_MAX;
+#endif
}
#endif
diff -ru make-4.3-clean/lib/getprogname.c make-4.3/lib/getprogname.c
--- make-4.3-clean/lib/getprogname.c 2020-01-19 21:34:01.000000000 +0100
+++ make-4.3/lib/getprogname.c 2020-12-15 00:51:50.738132015 +0100
@@ -51,6 +51,10 @@
# include <sys/procfs.h>
#endif
+#ifdef __serenity__
+# include <unistd.h>
+#endif
+
#include "dirname.h"
#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */
@@ -245,6 +249,12 @@
}
}
return NULL;
+# elif defined __serenity__
+ char* buffer = malloc(1024);
+ if (get_process_name(buffer, 1024) < 0)
+ return NULL;
+ return buffer;
+
# else
# error "getprogname module not ported to this OS"
# endif
diff -ru make-4.3-clean/src/arscan.c make-4.3/src/arscan.c
--- make-4.3-clean/src/arscan.c 2020-01-03 08:11:27.000000000 +0100
+++ make-4.3/src/arscan.c 2020-12-15 00:51:50.738132015 +0100
@@ -331,7 +331,7 @@
#endif
#ifndef WINDOWS32
-# if !defined (__ANDROID__) && !defined (__BEOS__)
+# if !defined (__ANDROID__) && !defined (__BEOS__) && !defined(__serenity__)
# include <ar.h>
# else
/* These platforms don't have <ar.h> but have archives in the same format