diff --git a/Ports/ruby/patches/0001-Teach-configure-about-serenity.patch b/Ports/ruby/patches/0001-Teach-configure-about-serenity.patch new file mode 100644 index 0000000000..86a6872718 --- /dev/null +++ b/Ports/ruby/patches/0001-Teach-configure-about-serenity.patch @@ -0,0 +1,26 @@ +From 9714ad7325f578cb41f8f90496d64888eda8a268 Mon Sep 17 00:00:00 2001 +From: Ali Mohammad Pur +Date: Sat, 8 Jan 2022 17:02:29 +0330 +Subject: [PATCH 1/4] Teach configure about serenity + +Co-Authored-By: Eric Seifert +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index a0d9a6c..44ebf54 100755 +--- a/configure ++++ b/configure +@@ -28610,7 +28610,7 @@ fi + *) : + ;; + esac ;; #( +- linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | haiku*) : ++ linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | serenity* | haiku*) : + + : ${LDSHARED='$(CC) -shared'} + if test "$rb_cv_binary_elf" = yes; then : +-- +2.36.1 + diff --git a/Ports/ruby/patches/0002-Remove-locale-defines.patch b/Ports/ruby/patches/0002-Remove-locale-defines.patch new file mode 100644 index 0000000000..3f4c60c3eb --- /dev/null +++ b/Ports/ruby/patches/0002-Remove-locale-defines.patch @@ -0,0 +1,32 @@ +From 30fafa059b5793c3f3638564e00465a4f514f25a Mon Sep 17 00:00:00 2001 +From: Eric Seifert +Date: Tue, 21 Sep 2021 23:09:21 -0700 +Subject: [PATCH 2/4] Remove locale defines + +Serenity does not have any of that. +--- + ext/nkf/nkf-utf8/nkf.h | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/ext/nkf/nkf-utf8/nkf.h b/ext/nkf/nkf-utf8/nkf.h +index cd30376..7bafe73 100644 +--- a/ext/nkf/nkf-utf8/nkf.h ++++ b/ext/nkf/nkf-utf8/nkf.h +@@ -152,14 +152,6 @@ void setbinmode(FILE *fp) + # ifndef HAVE_LOCALE_H + # define HAVE_LOCALE_H + # endif +-#elif defined(__BIONIC__) /* bionic doesn't have locale */ +-#else +-# ifndef HAVE_LANGINFO_H +-# define HAVE_LANGINFO_H +-# endif +-# ifndef HAVE_LOCALE_H +-# define HAVE_LOCALE_H +-# endif + #endif + + #ifdef HAVE_LANGINFO_H +-- +2.36.1 + diff --git a/Ports/ruby/patches/0003-Remove-the-inline-definitions-of-labs-and-llabs.patch b/Ports/ruby/patches/0003-Remove-the-inline-definitions-of-labs-and-llabs.patch new file mode 100644 index 0000000000..ffa317c5fc --- /dev/null +++ b/Ports/ruby/patches/0003-Remove-the-inline-definitions-of-labs-and-llabs.patch @@ -0,0 +1,40 @@ +From 4c770bb497775cfe017df53b002c6dbfda02c5f2 Mon Sep 17 00:00:00 2001 +From: Eric Seifert +Date: Tue, 21 Sep 2021 23:09:21 -0700 +Subject: [PATCH 3/4] Remove the inline definitions of labs and llabs + +--- + ext/bigdecimal/bigdecimal.h | 17 ----------------- + 1 file changed, 17 deletions(-) + +diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h +index 28f3363..a2c8c7e 100644 +--- a/ext/bigdecimal/bigdecimal.h ++++ b/ext/bigdecimal/bigdecimal.h +@@ -74,23 +74,6 @@ extern "C" { + #endif + #endif + +-#ifndef HAVE_LABS +-static inline long +-labs(long const x) +-{ +- if (x < 0) return -x; +- return x; +-} +-#endif +- +-#ifndef HAVE_LLABS +-static inline LONG_LONG +-llabs(LONG_LONG const x) +-{ +- if (x < 0) return -x; +- return x; +-} +-#endif + + #ifndef HAVE_FINITE + static int +-- +2.36.1 + diff --git a/Ports/ruby/patches/rusage.patch b/Ports/ruby/patches/0004-Remove-uses-of-rusage.patch similarity index 77% rename from Ports/ruby/patches/rusage.patch rename to Ports/ruby/patches/0004-Remove-uses-of-rusage.patch index 5566c34781..7106257506 100644 --- a/Ports/ruby/patches/rusage.patch +++ b/Ports/ruby/patches/0004-Remove-uses-of-rusage.patch @@ -1,6 +1,59 @@ ---- ruby-3.2.0/process.c 2021-09-16 13:10:16.001908642 -0700 -+++ ruby-3.2.0/process.c 2021-09-16 14:21:00.080586664 -0700 -@@ -324,9 +324,6 @@ +From de170f190353bb28d0eefacca5087de155948270 Mon Sep 17 00:00:00 2001 +From: Eric Seifert +Date: Tue, 21 Sep 2021 23:09:21 -0700 +Subject: [PATCH 4/4] Remove uses of rusage + +--- + gc.c | 23 ----------------------- + process.c | 37 ------------------------------------- + 2 files changed, 60 deletions(-) + +diff --git a/gc.c b/gc.c +index 5d0c342..332340e 100644 +--- a/gc.c ++++ b/gc.c +@@ -11544,17 +11544,6 @@ getrusage_time(void) + } + #endif + +-#ifdef RUSAGE_SELF +- { +- struct rusage usage; +- struct timeval time; +- if (getrusage(RUSAGE_SELF, &usage) == 0) { +- time = usage.ru_utime; +- return time.tv_sec + time.tv_usec * 1e-6; +- } +- } +-#endif +- + #ifdef _WIN32 + { + FILETIME creation_time, exit_time, kernel_time, user_time; +@@ -11613,18 +11602,6 @@ gc_prof_setup_new_record(rb_objspace_t *objspace, int reason) + record->flags = reason | (ruby_gc_stressful ? GPR_FLAG_STRESS : 0); + #if MALLOC_ALLOCATED_SIZE + record->allocated_size = malloc_allocated_size; +-#endif +-#if GC_PROFILE_MORE_DETAIL && GC_PROFILE_DETAIL_MEMORY +-#ifdef RUSAGE_SELF +- { +- struct rusage usage; +- if (getrusage(RUSAGE_SELF, &usage) == 0) { +- record->maxrss = usage.ru_maxrss; +- record->minflt = usage.ru_minflt; +- record->majflt = usage.ru_majflt; +- } +- } +-#endif + #endif + } + } +diff --git a/process.c b/process.c +index 674f05d..b7941aa 100644 +--- a/process.c ++++ b/process.c +@@ -324,9 +324,6 @@ static ID id_GETTIMEOFDAY_BASED_CLOCK_REALTIME, id_TIME_BASED_CLOCK_REALTIME; static ID id_TIMES_BASED_CLOCK_MONOTONIC; static ID id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID; #endif @@ -10,7 +63,7 @@ static ID id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID; #ifdef __APPLE__ static ID id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC; -@@ -7878,16 +7875,6 @@ +@@ -7878,16 +7875,6 @@ VALUE rb_proc_times(VALUE obj) { VALUE utime, stime, cutime, cstime, ret; @@ -27,7 +80,7 @@ const double hertz = (double)get_clk_tck(); struct tms buf; -@@ -7896,7 +7883,6 @@ +@@ -7896,7 +7883,6 @@ rb_proc_times(VALUE obj) stime = DBL2NUM(buf.tms_stime / hertz); cutime = DBL2NUM(buf.tms_cutime / hertz); cstime = DBL2NUM(buf.tms_cstime / hertz); @@ -35,7 +88,7 @@ ret = rb_struct_new(rb_cProcessTms, utime, stime, cutime, cstime); RB_GC_GUARD(utime); RB_GC_GUARD(stime); -@@ -8312,26 +8298,6 @@ +@@ -8312,26 +8298,6 @@ rb_clock_gettime(int argc, VALUE *argv, VALUE _) } #endif @@ -62,52 +115,16 @@ #ifdef HAVE_TIMES #define RUBY_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID \ -@@ -9082,9 +9048,6 @@ +@@ -9081,9 +9047,6 @@ Init_process(void) + #ifdef HAVE_TIMES id_TIMES_BASED_CLOCK_MONOTONIC = rb_intern_const("TIMES_BASED_CLOCK_MONOTONIC"); id_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID"); - #endif +-#endif -#ifdef RUSAGE_SELF - id_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID"); --#endif + #endif id_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID = rb_intern_const("CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID"); #ifdef __APPLE__ - id_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC = rb_intern_const("MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC"); ---- ruby-3.2.0/gc.c 2021-09-16 13:10:15.953909370 -0700 -+++ ruby-3.2.0/gc.c 2021-09-16 14:21:52.135786845 -0700 -@@ -11530,17 +11530,6 @@ - } - #endif - --#ifdef RUSAGE_SELF -- { -- struct rusage usage; -- struct timeval time; -- if (getrusage(RUSAGE_SELF, &usage) == 0) { -- time = usage.ru_utime; -- return time.tv_sec + time.tv_usec * 1e-6; -- } -- } --#endif -- - #ifdef _WIN32 - { - FILETIME creation_time, exit_time, kernel_time, user_time; -@@ -11600,18 +11589,6 @@ - #if MALLOC_ALLOCATED_SIZE - record->allocated_size = malloc_allocated_size; - #endif --#if GC_PROFILE_MORE_DETAIL && GC_PROFILE_DETAIL_MEMORY --#ifdef RUSAGE_SELF -- { -- struct rusage usage; -- if (getrusage(RUSAGE_SELF, &usage) == 0) { -- record->maxrss = usage.ru_maxrss; -- record->minflt = usage.ru_minflt; -- record->majflt = usage.ru_majflt; -- } -- } --#endif --#endif - } - } - +-- +2.36.1 + diff --git a/Ports/ruby/patches/ReadMe.md b/Ports/ruby/patches/ReadMe.md new file mode 100644 index 0000000000..bd08c395bc --- /dev/null +++ b/Ports/ruby/patches/ReadMe.md @@ -0,0 +1,24 @@ +# Patches for ruby on SerenityOS + +## `0001-Teach-configure-about-serenity.patch` + +Teach configure about serenity + + + +## `0002-Remove-locale-defines.patch` + +Remove locale defines + +Serenity does not have any of that. + +## `0003-Remove-the-inline-definitions-of-labs-and-llabs.patch` + +Remove the inline definitions of labs and llabs + + +## `0004-Remove-uses-of-rusage.patch` + +Remove uses of rusage + + diff --git a/Ports/ruby/patches/config.patch b/Ports/ruby/patches/config.patch deleted file mode 100644 index 40afa61d20..0000000000 --- a/Ports/ruby/patches/config.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ruby-3.0.2/configure 2021-09-16 14:10:42.314091669 -0700 -+++ ruby-3.0.2/configure 2021-09-18 19:14:21.633876942 -0700 -@@ -28610,7 +28610,7 @@ - *) : - ;; - esac ;; #( -- linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | haiku*) : -+ linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | serenity* | haiku*) : - - : ${LDSHARED='$(CC) -shared'} - if test "$rb_cv_binary_elf" = yes; then : - diff --git a/Ports/ruby/patches/locale.patch b/Ports/ruby/patches/locale.patch deleted file mode 100644 index b6f49f2250..0000000000 --- a/Ports/ruby/patches/locale.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ruby-3.0.2/ext/nkf/nkf-utf8/nkf.h 2021-07-07 03:08:35.000000000 -0700 -+++ ruby-3.0.2/ext/nkf/nkf-utf8/nkf.h 2021-09-16 11:43:53.021002630 -0700 -@@ -152,14 +152,6 @@ - # ifndef HAVE_LOCALE_H - # define HAVE_LOCALE_H - # endif --#elif defined(__BIONIC__) /* bionic doesn't have locale */ --#else --# ifndef HAVE_LANGINFO_H --# define HAVE_LANGINFO_H --# endif --# ifndef HAVE_LOCALE_H --# define HAVE_LOCALE_H --# endif - #endif - - #ifdef HAVE_LANGINFO_H - diff --git a/Ports/ruby/patches/math.patch b/Ports/ruby/patches/math.patch deleted file mode 100644 index 219894cca7..0000000000 --- a/Ports/ruby/patches/math.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ruby-3.0.2/ext/bigdecimal/bigdecimal.h 2021-09-15 10:18:47.365241873 -0700 -+++ ruby-3.0.2/ext/bigdecimal/bigdecimal.h 2021-09-16 11:56:52.989171237 -0700 -@@ -74,23 +74,6 @@ - #endif - #endif - --#ifndef HAVE_LABS --static inline long --labs(long const x) --{ -- if (x < 0) return -x; -- return x; --} --#endif -- --#ifndef HAVE_LLABS --static inline LONG_LONG --llabs(LONG_LONG const x) --{ -- if (x < 0) return -x; -- return x; --} --#endif - - #ifndef HAVE_FINITE - static int - diff --git a/Ports/ruby/patches/posix.patch b/Ports/ruby/patches/posix.patch deleted file mode 100644 index 53cd1fbe69..0000000000 --- a/Ports/ruby/patches/posix.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ruby-3.0.2/include/ruby/internal/intern/select/posix.h -+++ ruby-3.0.2/include/ruby/internal/intern/select/posix.h -@@ -55,7 +55,7 @@ rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int n) - } - - static inline void --rb_fd_dup(rb_fdset_t *dst, const fd_set *src, int n) -+rb_fd_dup(rb_fdset_t *dst, const fd_set *src) - { - *dst = *src; - } -