From 60bf91b0760e608f2997d41c0cb59ee658cbeac8 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Fri, 2 Jan 2026 15:27:45 +0200 Subject: [PATCH] Update package version to 9.1.2037 --- pkg.info | 6 +- source-files/fix-building-with-ruby-4.0.patch | 171 +++++++----------- 2 files changed, 67 insertions(+), 110 deletions(-) diff --git a/pkg.info b/pkg.info index 69c288d..58db6c3 100644 --- a/pkg.info +++ b/pkg.info @@ -1,7 +1,7 @@ name: vim description: A highly configurable text editor -version: 9.1.2028 -revision: 4 +version: 9.1.2037 +revision: 1 url: https://www.vim.org/ license: vim architecture: any @@ -35,4 +35,4 @@ downloads: - url: https://github.com/vim/vim/archive/refs/tags/v${BPM_PKG_VERSION}.tar.gz extract_to: ${BPM_SOURCE} extract_strip_components: 1 - checksum: 4a06e3c7823e31f5d161ac660ce6d920b0042c7aa0ba6c6eeb8fae7228d9e99a + checksum: d04ee71b2578a7e33e8294386f698539182707dc1d901752635dda94e6e16e02 diff --git a/source-files/fix-building-with-ruby-4.0.patch b/source-files/fix-building-with-ruby-4.0.patch index 3cdda33..a46d6a2 100644 --- a/source-files/fix-building-with-ruby-4.0.patch +++ b/source-files/fix-building-with-ruby-4.0.patch @@ -1,124 +1,81 @@ -From 293c5e235bf590bca1088e9ce0af71e1c25b3678 Mon Sep 17 00:00:00 2001 -From: EnumDev -Date: Tue, 30 Dec 2025 17:10:53 +0200 -Subject: [PATCH 1/3] Fix building with ruby 4.0 +From 32a8986a1916b672acd6992bd646af0aa409960b Mon Sep 17 00:00:00 2001 +From: Yee Cheng Chin +Date: Thu, 1 Jan 2026 22:42:53 -0800 +Subject: [PATCH] Fix Ruby 4.0 dynamic builds correctly by inlining + rb_check_typeddata -Signed-off-by: EnumDev +Ruby 4.0 broke Vim compilation in dynamic builds. That's because the +function `rb_check_typeddata` is now used in an inline function defined +in Ruby headers, which causes it to link against the lib statically +rather than using the one we load in dynamically +(`dll_rb_check_typeddata`) as we only remap it later (after the Ruby +header include). + +A previous fix (v9.1.2036) did a wrong fix by stubbing in the actual +inline function `rbimpl_check_typeddata` instead. This does not work +because the inline function is not part of the dynamic lib and therefore +it's not possible to load it in dynamically (the patch also did not +actually attempt to load in the stub). With that patch, Vim would +crash when this function is used as the function pointer is null. + +Fix this properly by reverting the previous change, and simply stub +`rb_check_typeddata` using similar mechanisms the file had already set +up for similar situations. + +Fix #18884 --- - src/if_ruby.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) + src/if_ruby.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/if_ruby.c b/src/if_ruby.c -index 6af508beccdc1..a2dc53da8b79f 100644 +index 49fdc34dd5316b..913936174a5e01 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c -@@ -244,7 +244,11 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); +@@ -73,6 +73,11 @@ + # define rb_num2int rb_num2int_stub + # endif + ++# if RUBY_VERSION >= 20 ++// USE_TYPEDDATA is not defined yet. We just check for 2.0. ++# define rb_check_typeddata rb_check_typeddata_stub ++#endif ++ + # if RUBY_VERSION == 21 + // Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses + // rb_gc_writebarrier_unprotect_promoted if USE_RGENGC +@@ -243,12 +248,6 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # if RUBY_VERSION < 30 # define rb_check_type dll_rb_check_type # endif - # ifdef USE_TYPEDDATA +-# ifdef USE_TYPEDDATA +-# if RUBY_VERSION >= 40 +-# define rbimpl_check_typeddata dll_rbimpl_check_typeddata +-# endif -# define rb_check_typeddata dll_rb_check_typeddata -+# if RUBY_VERSION >= 40 -+# define rbimpl_check_typeddata dll_rbimpl_check_typeddata -+# else -+# define define rb_check_typeddata dll_rb_check_typeddata -+# endif - # endif +-# endif # define rb_class_path dll_rb_class_path # ifdef USE_TYPEDDATA -@@ -373,7 +377,11 @@ VALUE *dll_rb_cTrueClass; + # if RUBY_VERSION >= 23 +@@ -376,9 +375,6 @@ VALUE *dll_rb_cTrueClass; static VALUE (*dll_rb_class_new_instance) (int,VALUE*,VALUE); static void (*dll_rb_check_type) (VALUE,int); # ifdef USE_TYPEDDATA -+# if RUBY_VERSION >= 40 -+static void *(*dll_rbimpl_check_typeddata) (VALUE,const rb_data_type_t *); -+# else - static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *); -+# endif - # endif - static VALUE (*dll_rb_class_path) (VALUE); - # ifdef USE_TYPEDDATA -@@ -632,7 +640,11 @@ static struct - {"rb_class_new_instance", (RUBY_PROC*)&dll_rb_class_new_instance}, - {"rb_check_type", (RUBY_PROC*)&dll_rb_check_type}, - # ifdef USE_TYPEDDATA -+# if RUBY_VERSION >= 40 -+ {"rbimpl_check_typeddata", (RUBY_PROC*)&dll_rbimpl_check_typeddata}, -+# else - {"rb_check_typeddata", (RUBY_PROC*)&dll_rb_check_typeddata}, -+# endif - # endif - {"rb_class_path", (RUBY_PROC*)&dll_rb_class_path}, - # ifdef USE_TYPEDDATA - -From 9c7c407a83226bd72541fc3c080245e72d8b23e2 Mon Sep 17 00:00:00 2001 -From: EnumDev -Date: Wed, 31 Dec 2025 14:17:28 +0200 -Subject: [PATCH 2/3] Fix typo in src/if_ruby.c - -Signed-off-by: EnumDev ---- - src/if_ruby.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/if_ruby.c b/src/if_ruby.c -index a2dc53da8b79f..81252102b1d48 100644 ---- a/src/if_ruby.c -+++ b/src/if_ruby.c -@@ -247,7 +247,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); - # if RUBY_VERSION >= 40 - # define rbimpl_check_typeddata dll_rbimpl_check_typeddata - # else --# define define rb_check_typeddata dll_rb_check_typeddata -+# define rb_check_typeddata dll_rb_check_typeddata - # endif - # endif - # define rb_class_path dll_rb_class_path - -From 4cd61636526b710f12ca2d987c1c898502718f2d Mon Sep 17 00:00:00 2001 -From: EnumDev -Date: Wed, 31 Dec 2025 21:05:02 +0200 -Subject: [PATCH 3/3] Always define rb_check_typeddata - -Signed-off-by: EnumDev ---- - src/if_ruby.c | 10 ++-------- - 1 file changed, 2 insertions(+), 8 deletions(-) - -diff --git a/src/if_ruby.c b/src/if_ruby.c -index 81252102b1d48..49fdc34dd5316 100644 ---- a/src/if_ruby.c -+++ b/src/if_ruby.c -@@ -246,9 +246,8 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); - # ifdef USE_TYPEDDATA - # if RUBY_VERSION >= 40 - # define rbimpl_check_typeddata dll_rbimpl_check_typeddata --# else --# define rb_check_typeddata dll_rb_check_typeddata - # endif -+# define rb_check_typeddata dll_rb_check_typeddata - # endif - # define rb_class_path dll_rb_class_path - # ifdef USE_TYPEDDATA -@@ -379,9 +378,8 @@ static void (*dll_rb_check_type) (VALUE,int); - # ifdef USE_TYPEDDATA - # if RUBY_VERSION >= 40 - static void *(*dll_rbimpl_check_typeddata) (VALUE,const rb_data_type_t *); --# else --static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *); - # endif -+static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *); - # endif - static VALUE (*dll_rb_class_path) (VALUE); - # ifdef USE_TYPEDDATA -@@ -640,11 +638,7 @@ static struct - {"rb_class_new_instance", (RUBY_PROC*)&dll_rb_class_new_instance}, - {"rb_check_type", (RUBY_PROC*)&dll_rb_check_type}, - # ifdef USE_TYPEDDATA -# if RUBY_VERSION >= 40 -- {"rbimpl_check_typeddata", (RUBY_PROC*)&dll_rbimpl_check_typeddata}, --# else - {"rb_check_typeddata", (RUBY_PROC*)&dll_rb_check_typeddata}, +-static void *(*dll_rbimpl_check_typeddata) (VALUE,const rb_data_type_t *); -# endif + static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *); # endif - {"rb_class_path", (RUBY_PROC*)&dll_rb_class_path}, - # ifdef USE_TYPEDDATA + static VALUE (*dll_rb_class_path) (VALUE); +@@ -607,6 +603,12 @@ rb_unexpected_type_stub(VALUE self, int t) + dll_rb_unexpected_type(self, t); + } + # endif ++# ifdef USE_TYPEDDATA ++void *rb_check_typeddata_stub(VALUE obj, const rb_data_type_t *data_type) ++{ ++ return dll_rb_check_typeddata(obj, data_type); ++} ++# endif + # endif // ifndef PROTO + + static HINSTANCE hinstRuby = NULL; // Instance of ruby.dll