From b742fc0676d1baa00865bd72ef1597daa1d26483 Mon Sep 17 00:00:00 2001 From: shixuantong Date: Thu, 13 Jan 2022 17:18:52 +0800 Subject: [PATCH] fix build fail --- ...rt-Fix-build-failuers-with-perl-5.32.patch | 111 --- ...port-Ruby-missing-function-prototype.patch | 29 + backport-build-failure-with-Perl5.32.patch | 50 ++ ...ld-failure-with-Ruby-3.0-and-32-bits.patch | 32 + ...uild-failure-with-some-Ruby-versions.patch | 294 ++++++++ backport-build-problem-with-Ruby-2.7.patch | 121 ++++ backport-cannot-build-with-Perl-5.34.patch | 61 ++ ...ot-build-with-Strawberry-Perl-5.32.0.patch | 48 ++ ...port-compilation-error-with-Ruby-3.0.patch | 57 ++ ...-macros-for-Ruby-are-too-complicated.patch | 642 ++++++++++++++++++ vim.spec | 18 +- 11 files changed, 1350 insertions(+), 113 deletions(-) delete mode 100644 backport-Fix-build-failuers-with-perl-5.32.patch create mode 100644 backport-Ruby-missing-function-prototype.patch create mode 100644 backport-build-failure-with-Perl5.32.patch create mode 100644 backport-build-failure-with-Ruby-3.0-and-32-bits.patch create mode 100644 backport-build-failure-with-some-Ruby-versions.patch create mode 100644 backport-build-problem-with-Ruby-2.7.patch create mode 100644 backport-cannot-build-with-Perl-5.34.patch create mode 100644 backport-cannot-build-with-Strawberry-Perl-5.32.0.patch create mode 100644 backport-compilation-error-with-Ruby-3.0.patch create mode 100644 backport-macros-for-Ruby-are-too-complicated.patch diff --git a/backport-Fix-build-failuers-with-perl-5.32.patch b/backport-Fix-build-failuers-with-perl-5.32.patch deleted file mode 100644 index 63b2150..0000000 --- a/backport-Fix-build-failuers-with-perl-5.32.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 5d35e2ad1027e394877e096f618536da0ad11ffa Mon Sep 17 00:00:00 2001 -From: Felix Yan -Date: Mon, 22 Jun 2020 00:00:44 +0800 -Subject: [PATCH] Fix build failures with Perl 5.32 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -More functions are needed in latest Perl 5.32. This patch fixes the following build failures: -``` -In file included from /usr/lib/perl5/5.32/core_perl/CORE/perl.h:3909, - from if_perl.xs:61: -if_perl.xs: In function ‘perl_win_free’: -/usr/lib/perl5/5.32/core_perl/CORE/sv.h:351:26: warning: implicit declaration of function ‘Perl_SvREFCNT_dec’; did you mean ‘S_SvREFCNT_dec’? [-Wimplicit-function-declaration] - 351 | #define SvREFCNT_dec(sv) Perl_SvREFCNT_dec(aTHX_ MUTABLE_SV(sv)) - | ^~~~~~~~~~~~~~~~~ -/usr/lib/perl5/5.32/core_perl/CORE/sv.h:351:26: note: in definition of macro ‘SvREFCNT_dec’ - 351 | #define SvREFCNT_dec(sv) Perl_SvREFCNT_dec(aTHX_ MUTABLE_SV(sv)) - | ^~~~~~~~~~~~~~~~~ -if_perl.xs: In function ‘ex_perl’: -/usr/lib/perl5/5.32/core_perl/CORE/sv.h:1842:28: warning: implicit declaration of function ‘Perl_SvTRUE’ [-Wimplicit-function-declaration] - 1842 | #define SvTRUE(sv) Perl_SvTRUE(aTHX_ sv) - | ^~~~~~~~~~~ -/usr/lib/perl5/5.32/core_perl/CORE/sv.h:1842:28: note: in definition of macro ‘SvTRUE’ - 1842 | #define SvTRUE(sv) Perl_SvTRUE(aTHX_ sv) - | ^~~~~~~~~~~ -In file included from /usr/lib/perl5/5.32/core_perl/CORE/perl.h:5544, - from if_perl.xs:61: -if_perl.c: In function ‘XS_VIM_Msg’: -/usr/lib/perl5/5.32/core_perl/CORE/pp.h:71:17: warning: implicit declaration of function ‘Perl_POPMARK’; did you mean ‘S_POPMARK’? [-Wimplicit-function-declaration] - 71 | #define POPMARK Perl_POPMARK(aTHX) - | ^~~~~~~~~~~~ -/usr/lib/perl5/5.32/core_perl/CORE/pp.h:71:17: note: in definition of macro ‘POPMARK’ - 71 | #define POPMARK Perl_POPMARK(aTHX) - | ^~~~~~~~~~~~ -/usr/lib/perl5/5.32/core_perl/CORE/XSUB.h:157:7: note: in expansion of macro ‘dAXMARK’ - 157 | dSP; dAXMARK; dITEMS - | ^~~~~~~ -if_perl.c:1661:11: note: in expansion of macro ‘dXSARGS’ -gcc -c -I. -Iproto -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 version.c -o objects/version.o -link.sh: $LINK_AS_NEEDED set to 'yes': invoking linker directly. - gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim objects/arabic.o objects/arglist.o objects/autocmd.o objects/beval.o objects/buffer.o objects/change.o objects/blob.o objects/blowfish.o objects/cindent.o objects/clientserver.o objects/clipboard.o objects/cmdexpand.o objects/cmdhist.o objects/crypt.o objects/crypt_zip.o objects/debugger.o objects/dict.o objects/diff.o objects/digraph.o objects/drawline.o objects/drawscreen.o objects/edit.o objects/eval.o objects/evalbuffer.o objects/evalfunc.o objects/evalvars.o objects/evalwindow.o objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o objects/ex_getln.o objects/fileio.o objects/filepath.o objects/findfile.o objects/fold.o objects/getchar.o objects/hardcopy.o objects/hashtab.o objects/highlight.o objects/if_cscope.o objects/if_xcmdsrv.o objects/indent.o objects/insexpand.o objects/list.o objects/map.o objects/mark.o objects/mbyte.o objects/memline.o objects/menu.o objects/misc1.o objects/misc2.o objects/mouse.o objects/move.o objects/normal.o objects/ops.o objects/option.o objects/optionstr.o objects/os_unix.o objects/pathdef.o objects/popupmenu.o objects/popupwin.o objects/profiler.o objects/pty.o objects/quickfix.o objects/regexp.o objects/register.o objects/screen.o objects/scriptfile.o objects/search.o objects/session.o objects/sha256.o objects/sign.o objects/sound.o objects/spell.o objects/spellfile.o objects/spellsuggest.o objects/syntax.o objects/tag.o objects/term.o objects/terminal.o objects/testing.o objects/textformat.o objects/textobject.o objects/textprop.o objects/time.o objects/ui.o objects/undo.o objects/usercmd.o objects/userfunc.o objects/version.o objects/vim9compile.o objects/vim9execute.o objects/vim9script.o objects/viminfo.o objects/window.o objects/bufwrite.o objects/vterm_encoding.o objects/vterm_keyboard.o objects/vterm_mouse.o objects/vterm_parser.o objects/vterm_pen.o objects/vterm_screen.o objects/vterm_state.o objects/vterm_unicode.o objects/vterm_vterm.o objects/if_lua.o objects/if_perl.o objects/if_perlsfio.o objects/if_python.o objects/if_python3.o objects/if_tcl.o objects/if_ruby.o objects/netbeans.o objects/channel.o objects/xdiffi.o objects/xemit.o objects/xprepare.o objects/xutils.o objects/xhistogram.o objects/xpatience.o objects/charset.o objects/json.o objects/main.o objects/memfile.o objects/message.o -lm -ltinfo -lelf -lacl -lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm -/usr/bin/ld: objects/if_perl.o: in function `cur_val': -if_perl.c:(.text+0xaee): undefined reference to `Perl_SvREFCNT_dec' -/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_Count': -if_perl.c:(.text+0xc29): undefined reference to `Perl_POPMARK' -/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_Number': -if_perl.c:(.text+0xe89): undefined reference to `Perl_POPMARK' -/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_Name': -if_perl.c:(.text+0x10e9): undefined reference to `Perl_POPMARK' -/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_DESTROY': -if_perl.c:(.text+0x13f5): undefined reference to `Perl_POPMARK' -/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_Append': -if_perl.c:(.text+0x15ea): undefined reference to `Perl_POPMARK' -/usr/bin/ld: objects/if_perl.o:if_perl.c:(.text+0x1a4a): more undefined references to `Perl_POPMARK' follow -/usr/bin/ld: objects/if_perl.o: in function `perl_win_free': -if_perl.c:(.text+0x4bb7): undefined reference to `Perl_SvREFCNT_dec' -/usr/bin/ld: objects/if_perl.o: in function `perl_buf_free': -if_perl.c:(.text+0x4c27): undefined reference to `Perl_SvREFCNT_dec' -/usr/bin/ld: objects/if_perl.o: in function `ex_perl': -if_perl.c:(.text+0x4d58): undefined reference to `Perl_SvTRUE' -/usr/bin/ld: if_perl.c:(.text+0x4d8a): undefined reference to `Perl_SvREFCNT_dec' -/usr/bin/ld: objects/if_perl.o: in function `do_perleval': -if_perl.c:(.text+0x51f7): undefined reference to `Perl_SvTRUE' -/usr/bin/ld: if_perl.c:(.text+0x5433): undefined reference to `Perl_SvREFCNT_dec' -/usr/bin/ld: objects/if_perl.o: in function `ex_perldo': -if_perl.c:(.text+0x577c): undefined reference to `Perl_SvREFCNT_dec' -/usr/bin/ld: if_perl.c:(.text+0x5943): undefined reference to `Perl_SvTRUE' -collect2: error: ld returned 1 exit status -link.sh: Linking failed -``` ---- - src/if_perl.xs | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff -Naur a/src/if_perl.xs b/src/if_perl.xs ---- a/src/if_perl.xs 2019-02-23 22:00:57.000000000 +0800 -+++ b/src/if_perl.xs 2020-08-15 10:43:20.621318684 +0800 -@@ -649,6 +649,10 @@ - Perl_sv_free2(aTHX_ sv, rc); - } - } -+/* perl-5.32 needs Perl_SvREFCNT_dec */ -+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) -+#define Perl_SvREFCNT_dec S_SvREFCNT_dec -+# endif - # endif - - /* perl-5.26 also needs S_TOPMARK and S_POPMARK. */ -@@ -673,6 +677,21 @@ - assert((PL_markstack_ptr > PL_markstack) || !"MARK underflow"); - return *PL_markstack_ptr--; - } -+/* perl-5.32 needs Perl_POPMARK */ -+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) -+#define Perl_POPMARK S_POPMARK -+# endif -+# endif -+ -+/* perl-5.32 needs Perl_SvTRUE */ -+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) -+PERL_STATIC_INLINE bool -+Perl_SvTRUE(pTHX_ SV *sv) { -+ if (!LIKELY(sv)) -+ return FALSE; -+ SvGETMAGIC(sv); -+ return SvTRUE_nomg_NN(sv); -+} - # endif - - /* diff --git a/backport-Ruby-missing-function-prototype.patch b/backport-Ruby-missing-function-prototype.patch new file mode 100644 index 0000000..fd1a44a --- /dev/null +++ b/backport-Ruby-missing-function-prototype.patch @@ -0,0 +1,29 @@ +From 0e12140550a63bb1e45771edb89b941959440cfe Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Thu, 10 Dec 2020 20:50:34 +0100 +Subject: [PATCH] patch 8.2.2126: Ruby: missing function prototype + +Problem: Ruby: missing function prototype. +Solution: Add the prototype. +--- + src/if_ruby.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/if_ruby.c b/src/if_ruby.c +index d0f8acf..906a902 100644 +--- a/src/if_ruby.c ++++ b/src/if_ruby.c +@@ -492,6 +492,10 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj); + # endif + # endif + ++# if RUBY_VERSION >= 26 ++void rb_ary_detransient_stub(VALUE x); ++# endif ++ + # if (RUBY_VERSION >= 19) && !defined(PROTO) + # if RUBY_VERSION >= 22 + long +-- +2.13.7 + diff --git a/backport-build-failure-with-Perl5.32.patch b/backport-build-failure-with-Perl5.32.patch new file mode 100644 index 0000000..7784d61 --- /dev/null +++ b/backport-build-failure-with-Perl5.32.patch @@ -0,0 +1,50 @@ +From f5433fbfe4324fd443664fb924116b5ed675bef5 Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Sun, 21 Jun 2020 20:06:54 +0200 +Subject: [PATCH] patch 8.2.1031: build failure with Perl5.32 + +Problem: Build failure with Perl5.32. +Solution: Define a few more functions. (Felix Yan, closes #6310) +--- + src/if_perl.xs | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/src/if_perl.xs b/src/if_perl.xs +index 099d386..5adccce 100644 +--- a/src/if_perl.xs ++++ b/src/if_perl.xs +@@ -651,6 +651,11 @@ S_SvREFCNT_dec(pTHX_ SV *sv) + } + # endif + ++/* perl-5.32 needs Perl_SvREFCNT_dec */ ++# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) ++# define Perl_SvREFCNT_dec S_SvREFCNT_dec ++# endif ++ + /* perl-5.26 also needs S_TOPMARK and S_POPMARK. */ + # if (PERL_REVISION == 5) && (PERL_VERSION >= 26) + PERL_STATIC_INLINE I32 +@@ -675,6 +680,20 @@ S_POPMARK(pTHX) + } + # endif + ++/* perl-5.32 needs Perl_POPMARK */ ++# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) ++# define Perl_POPMARK S_POPMARK ++ ++/* perl-5.32 needs Perl_SvTRUE */ ++PERL_STATIC_INLINE bool ++Perl_SvTRUE(pTHX_ SV *sv) { ++ if (!LIKELY(sv)) ++ return FALSE; ++ SvGETMAGIC(sv); ++ return SvTRUE_nomg_NN(sv); ++} ++# endif ++ + /* + * Make all runtime-links of perl. + * +-- +2.27.0 \ No newline at end of file diff --git a/backport-build-failure-with-Ruby-3.0-and-32-bits.patch b/backport-build-failure-with-Ruby-3.0-and-32-bits.patch new file mode 100644 index 0000000..e440f64 --- /dev/null +++ b/backport-build-failure-with-Ruby-3.0-and-32-bits.patch @@ -0,0 +1,32 @@ +From 467b59c2eb06f7fe6c2b5b677855cd422adbc45c Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Fri, 8 Jan 2021 19:31:39 +0100 +Subject: [PATCH] patch 8.2.2312: build failure with Ruby 3.0 and 32 bits + +Problem: Build failure with Ruby 3.0 and 32 bits. +Solution: Add #ifdef. (closes #7638) +--- + src/if_ruby.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/if_ruby.c b/src/if_ruby.c +index 6522d07..b29f8be 100644 +--- a/src/if_ruby.c ++++ b/src/if_ruby.c +@@ -596,11 +596,13 @@ rb_check_type_stub(VALUE obj, int t) + { + dll_rb_check_type(obj, t); + } ++# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only + unsigned long + rb_num2uint_stub(VALUE x) + { + return dll_rb_num2uint(x); + } ++# endif + void + ruby_malloc_size_overflow_stub(size_t x, size_t y) + { +-- +2.13.7 + diff --git a/backport-build-failure-with-some-Ruby-versions.patch b/backport-build-failure-with-some-Ruby-versions.patch new file mode 100644 index 0000000..c45e1d8 --- /dev/null +++ b/backport-build-failure-with-some-Ruby-versions.patch @@ -0,0 +1,294 @@ +From dace9f785fca6cc802b2fb7f11a5ee4fab896432 Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Mon, 28 Dec 2020 15:07:45 +0100 +Subject: [PATCH] patch 8.2.2235: build failure with some Ruby versions + +Problem: Build failure with some Ruby versions. +Solution: Adjust the code for Ruby 3.0. (Ozaki Kiichi, closes #7564) +--- + src/if_ruby.c | 143 ++++++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 89 insertions(+), 54 deletions(-) + +diff --git a/src/if_ruby.c b/src/if_ruby.c +index 906a902..d21a655 100644 +--- a/src/if_ruby.c ++++ b/src/if_ruby.c +@@ -32,8 +32,9 @@ + # define RUBYEXTERN extern + #endif + +-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 24 +-# define USE_RUBY_INTEGER ++// suggested by Ariya Mizutani ++#if (_MSC_VER == 1200) ++# undef _WIN32_WINNT + #endif + + #ifdef DYNAMIC_RUBY +@@ -42,6 +43,10 @@ + * definition. This function use these variables. But we want function to + * use dll_* variables. + */ ++# if RUBY_VERSION >= 24 ++# define USE_RUBY_INTEGER ++# endif ++ + # define rb_cFalseClass (*dll_rb_cFalseClass) + # define rb_cFixnum (*dll_rb_cFixnum) + # if defined(USE_RUBY_INTEGER) +@@ -54,6 +59,7 @@ + # define rb_cString (*dll_rb_cString) + # define rb_cSymbol (*dll_rb_cSymbol) + # define rb_cTrueClass (*dll_rb_cTrueClass) ++ + # if RUBY_VERSION >= 18 + /* + * On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)" +@@ -64,40 +70,41 @@ + # define RUBY_EXPORT + # endif + +-#endif // ifdef DYNAMIC_RUBY +- +-// suggested by Ariya Mizutani +-#if (_MSC_VER == 1200) +-# undef _WIN32_WINNT +-#endif +- +-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19 ++# if RUBY_VERSION >= 19 + // Ruby 1.9 defines a number of static functions which use rb_num2long and + // rb_int2big +-# define rb_num2long rb_num2long_stub +-# define rb_int2big rb_int2big_stub +-#endif ++# define rb_num2long rb_num2long_stub ++# define rb_int2big rb_int2big_stub + +-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19 \ +- && VIM_SIZEOF_INT < VIM_SIZEOF_LONG ++# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG + // Ruby 1.9 defines a number of static functions which use rb_fix2int and + // rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit) +-# define rb_fix2int rb_fix2int_stub +-# define rb_num2int rb_num2int_stub +-#endif ++# define rb_fix2int rb_fix2int_stub ++# define rb_num2int rb_num2int_stub ++# endif ++# endif + +-#if defined(DYNAMIC_RUBY) && RUBY_VERSION == 21 ++# if RUBY_VERSION == 21 + // Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses + // rb_gc_writebarrier_unprotect_promoted if USE_RGENGC +-# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub +-#endif +-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 22 +-# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub +-#endif ++# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub ++# endif + +-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 26 +-# define rb_ary_detransient rb_ary_detransient_stub +-#endif ++# if RUBY_VERSION >= 22 ++# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub ++# endif ++ ++# if RUBY_VERSION >= 26 ++# define rb_ary_detransient rb_ary_detransient_stub ++# endif ++ ++# if RUBY_VERSION >= 30 ++# define rb_check_type rb_check_type_stub ++# define rb_num2uint rb_num2uint_stub ++# define ruby_malloc_size_overflow ruby_malloc_size_overflow_stub ++# endif ++ ++#endif // ifdef DYNAMIC_RUBY + + #include + #if RUBY_VERSION >= 19 +@@ -212,7 +219,9 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # define rb_assoc_new dll_rb_assoc_new + # define rb_cObject (*dll_rb_cObject) + # define rb_class_new_instance dll_rb_class_new_instance +-# define rb_check_type dll_rb_check_type ++# if RUBY_VERSION < 30 ++# define rb_check_type dll_rb_check_type ++# endif + # ifdef USE_TYPEDDATA + # define rb_check_typeddata dll_rb_check_typeddata + # endif +@@ -263,7 +272,9 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # define rb_fix2int dll_rb_fix2int + # define rb_num2int dll_rb_num2int + # endif +-# define rb_num2uint dll_rb_num2uint ++# if RUBY_VERSION < 30 ++# define rb_num2uint dll_rb_num2uint ++# endif + # endif + # define rb_num2dbl dll_rb_num2dbl + # define rb_lastline_get dll_rb_lastline_get +@@ -481,7 +492,7 @@ static rb_encoding* (*dll_rb_enc_find) (const char*); + static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*); + static VALUE (*dll_rb_sprintf) (const char*, ...); + static VALUE (*dll_rb_require) (const char*); +-static void* (*ruby_options)(int, char**); ++static void* (*dll_ruby_options)(int, char**); + # endif + + # if defined(USE_RGENGC) && USE_RGENGC +@@ -492,32 +503,38 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj); + # endif + # endif + ++# if RUBY_VERSION >= 30 ++NORETURN(static void (*dll_ruby_malloc_size_overflow)(size_t, size_t)); ++# endif ++ + # if RUBY_VERSION >= 26 + void rb_ary_detransient_stub(VALUE x); + # endif + +-# if (RUBY_VERSION >= 19) && !defined(PROTO) +-# if RUBY_VERSION >= 22 ++// Do not generate a prototype here, VALUE isn't always defined. ++# ifndef PROTO ++# if RUBY_VERSION >= 19 ++# if RUBY_VERSION >= 22 + long + rb_num2long_stub(VALUE x) +-# else ++# else + SIGNED_VALUE + rb_num2long_stub(VALUE x) +-# endif ++# endif + { + return dll_rb_num2long(x); + } +-# if RUBY_VERSION >= 26 ++# if RUBY_VERSION >= 26 + VALUE + rb_int2big_stub(intptr_t x) +-# else ++# else + VALUE + rb_int2big_stub(SIGNED_VALUE x) +-# endif ++# endif + { + return dll_rb_int2big(x); + } +-# if (RUBY_VERSION >= 19) && (VIM_SIZEOF_INT < VIM_SIZEOF_LONG) ++# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG + long + rb_fix2int_stub(VALUE x) + { +@@ -528,50 +545,65 @@ rb_num2int_stub(VALUE x) + { + return dll_rb_num2int(x); + } +-# endif +-# if RUBY_VERSION >= 20 ++# endif ++# if RUBY_VERSION >= 20 + VALUE + rb_float_new_in_heap(double d) + { + return dll_rb_float_new(d); + } +-# if RUBY_VERSION >= 22 ++# if RUBY_VERSION >= 22 + unsigned long + rb_num2ulong(VALUE x) +-# else ++# else + VALUE + rb_num2ulong(VALUE x) +-# endif ++# endif + { + return (long)RSHIFT((SIGNED_VALUE)(x),1); + } ++# endif + # endif +-# endif +- +- // Do not generate a prototype here, VALUE isn't always defined. +-# if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO) +-# if RUBY_VERSION == 21 ++# if defined(USE_RGENGC) && USE_RGENGC ++# if RUBY_VERSION == 21 + void + rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj) + { + dll_rb_gc_writebarrier_unprotect_promoted(obj); + } +-# else ++# else + void + rb_gc_writebarrier_unprotect_stub(VALUE obj) + { + dll_rb_gc_writebarrier_unprotect(obj); + } ++# endif + # endif +-# endif +- +-# if RUBY_VERSION >= 26 ++# if RUBY_VERSION >= 26 + void + rb_ary_detransient_stub(VALUE x) + { + dll_rb_ary_detransient(x); + } +-# endif ++# endif ++# if RUBY_VERSION >= 30 ++ void ++rb_check_type_stub(VALUE obj, int t) ++{ ++ dll_rb_check_type(obj, t); ++} ++ unsigned long ++rb_num2uint_stub(VALUE x) ++{ ++ return dll_rb_num2uint(x); ++} ++ void ++ruby_malloc_size_overflow_stub(size_t x, size_t y) ++{ ++ dll_ruby_malloc_size_overflow(x, y); ++} ++# endif ++# endif // ifndef PROTO + + static HINSTANCE hinstRuby = NULL; // Instance of ruby.dll + +@@ -728,6 +760,9 @@ static struct + {"rb_gc_writebarrier_unprotect", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect}, + # endif + # endif ++# if RUBY_VERSION >= 30 ++ {"ruby_malloc_size_overflow", (RUBY_PROC*)&dll_ruby_malloc_size_overflow}, ++# endif + {"", NULL}, + }; + +@@ -1823,7 +1858,7 @@ convert_hash2dict(VALUE key, VALUE val, VALUE arg) + dict_T *d = (dict_T *)arg; + dictitem_T *di; + +- di = dictitem_alloc((char_u *)RSTRING_PTR(RSTRING(rb_obj_as_string(key)))); ++ di = dictitem_alloc((char_u *)RSTRING_PTR(rb_obj_as_string(key))); + if (di == NULL || ruby_convert_to_vim_value(val, &di->di_tv) != OK + || dict_add(d, di) != OK) + { +-- +2.13.7 + diff --git a/backport-build-problem-with-Ruby-2.7.patch b/backport-build-problem-with-Ruby-2.7.patch new file mode 100644 index 0000000..5331654 --- /dev/null +++ b/backport-build-problem-with-Ruby-2.7.patch @@ -0,0 +1,121 @@ +From d5a986f460019a924627d79350552f446505cffb Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Sun, 6 Dec 2020 21:11:31 +0100 +Subject: [PATCH] patch 8.2.2104: build problem with Ruby 2.7 + +Problem: Build problem with Ruby 2.7. +Solution: Adjust function declarations. (Ozaki Kiichi, closes #7430) +--- + src/auto/configure | 3 +-- + src/configure.ac | 3 +-- + src/if_ruby.c | 28 ++++++++++++++++++++-------- + 3 files changed, 22 insertions(+), 12 deletions(-) + +diff --git a/src/auto/configure b/src/auto/configure +index c50f4bc..9a0c1e6 100755 +--- a/src/auto/configure ++++ b/src/auto/configure +@@ -7590,8 +7590,7 @@ $as_echo "$rubyhdrdir" >&6; } + librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['LIBRUBYARG'])"` + librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['LIBRUBY_A'])"` + rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['libdir'])"` +- if test -f "$rubylibdir/$librubya"; then +- librubyarg="$librubyarg" ++ if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then + RUBY_LIBS="$RUBY_LIBS -L$rubylibdir" + elif test "$librubyarg" = "libruby.a"; then + librubyarg="-lruby" +diff --git a/src/configure.ac b/src/configure.ac +index f0e8371..e796d0e 100644 +--- a/src/configure.ac ++++ b/src/configure.ac +@@ -1932,8 +1932,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then + librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"` + librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"` + rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"` +- if test -f "$rubylibdir/$librubya"; then +- librubyarg="$librubyarg" ++ if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then + RUBY_LIBS="$RUBY_LIBS -L$rubylibdir" + elif test "$librubyarg" = "libruby.a"; then + dnl required on Mac OS 10.3 where libruby.a doesn't exist +diff --git a/src/if_ruby.c b/src/if_ruby.c +index 68d5582..d0f8acf 100644 +--- a/src/if_ruby.c ++++ b/src/if_ruby.c +@@ -1296,13 +1296,19 @@ vim_blob(VALUE self UNUSED, VALUE str) + } + + static VALUE +-buffer_s_current(void) ++buffer_s_current(VALUE self UNUSED) + { + return buffer_new(curbuf); + } + + static VALUE +-buffer_s_count(void) ++buffer_s_current_getter(ID id UNUSED, VALUE *x UNUSED) ++{ ++ return buffer_new(curbuf); ++} ++ ++ static VALUE ++buffer_s_count(VALUE self UNUSED) + { + buf_T *b; + int n = 0; +@@ -1562,7 +1568,13 @@ get_win(VALUE obj) + } + + static VALUE +-window_s_current(void) ++window_s_current(VALUE self UNUSED) ++{ ++ return window_new(curwin); ++} ++ ++ static VALUE ++window_s_current_getter(ID id UNUSED, VALUE *x UNUSED) + { + return window_new(curwin); + } +@@ -1572,7 +1584,7 @@ window_s_current(void) + * SegPhault - 03/07/05 + */ + static VALUE +-line_s_current(void) ++line_s_current(VALUE self UNUSED) + { + return get_buffer_line(curbuf, curwin->w_cursor.lnum); + } +@@ -1584,13 +1596,13 @@ set_current_line(VALUE self UNUSED, VALUE str) + } + + static VALUE +-current_line_number(void) ++current_line_number(VALUE self UNUSED) + { + return INT2FIX((int)curwin->w_cursor.lnum); + } + + static VALUE +-window_s_count(void) ++window_s_count(VALUE self UNUSED) + { + win_T *w; + int n = 0; +@@ -1790,8 +1802,8 @@ ruby_vim_init(void) + rb_define_method(cVimWindow, "cursor", window_cursor, 0); + rb_define_method(cVimWindow, "cursor=", window_set_cursor, 1); + +- rb_define_virtual_variable("$curbuf", buffer_s_current, 0); +- rb_define_virtual_variable("$curwin", window_s_current, 0); ++ rb_define_virtual_variable("$curbuf", buffer_s_current_getter, 0); ++ rb_define_virtual_variable("$curwin", window_s_current_getter, 0); + } + + void +-- +2.13.7 + diff --git a/backport-cannot-build-with-Perl-5.34.patch b/backport-cannot-build-with-Perl-5.34.patch new file mode 100644 index 0000000..6b5f8fa --- /dev/null +++ b/backport-cannot-build-with-Perl-5.34.patch @@ -0,0 +1,61 @@ +From 543467136f001708f4c63376ac5d18adde82db30 Mon Sep 17 00:00:00 2001 +From: ichizok +Date: Thu, 27 May 2021 18:05:14 +0200 +Subject: [PATCH] patch 8.2.2891: cannot build with Perl 5.34 + +Problem: Cannot build with Perl 5.34. +Solution: Add Perl_SvTRUE_common(). (Ozaki Kiichi, closes #8266, + closes #8250) +--- + src/if_perl.xs | 31 ++++++++++++++++++++++++++++++- + 1 file changed, 30 insertions(+), 1 deletion(-) + +diff --git a/src/if_perl.xs b/src/if_perl.xs +index 99fc3cb..39daa8e 100644 +--- a/src/if_perl.xs ++++ b/src/if_perl.xs +@@ -692,12 +692,41 @@ S_POPMARK(pTHX) + /* perl-5.32 needs Perl_POPMARK */ + # if (PERL_REVISION == 5) && (PERL_VERSION >= 32) + # define Perl_POPMARK S_POPMARK ++# endif ++ ++/* perl-5.34 needs Perl_SvTRUE_common; used in SvTRUE_nomg_NN */ ++# if (PERL_REVISION == 5) && (PERL_VERSION >= 34) ++PERL_STATIC_INLINE bool ++Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback) ++{ ++ if (UNLIKELY(SvIMMORTAL_INTERP(sv))) ++ return SvIMMORTAL_TRUE(sv); ++ ++ if (! SvOK(sv)) ++ return FALSE; ++ ++ if (SvPOK(sv)) ++ return SvPVXtrue(sv); ++ ++ if (SvIOK(sv)) ++ return SvIVX(sv) != 0; /* casts to bool */ ++ ++ if (SvROK(sv) && !(SvOBJECT(SvRV(sv)) && HvAMAGIC(SvSTASH(SvRV(sv))))) ++ return TRUE; ++ ++ if (sv_2bool_is_fallback) ++ return sv_2bool_nomg(sv); ++ ++ return isGV_with_GP(sv); ++} ++# endif + + /* perl-5.32 needs Perl_SvTRUE */ ++# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) + PERL_STATIC_INLINE bool + Perl_SvTRUE(pTHX_ SV *sv) { + if (!LIKELY(sv)) +- return FALSE; ++ return FALSE; + SvGETMAGIC(sv); + return SvTRUE_nomg_NN(sv); + } +-- +2.27.0 \ No newline at end of file diff --git a/backport-cannot-build-with-Strawberry-Perl-5.32.0.patch b/backport-cannot-build-with-Strawberry-Perl-5.32.0.patch new file mode 100644 index 0000000..b85d1a8 --- /dev/null +++ b/backport-cannot-build-with-Strawberry-Perl-5.32.0.patch @@ -0,0 +1,48 @@ +From 895a7a472d2eb4413e63cdad3213cb1ef1633458 Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Thu, 10 Sep 2020 21:36:11 +0200 +Subject: [PATCH] patch 8.2.1655: cannot build with Strawberry Perl 5.32.0 + +Problem: Cannot build with Strawberry Perl 5.32.0. +Solution: Use Perl_sv_2pvbyte_flags. (closes #6921) +--- + src/if_perl.xs | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/if_perl.xs b/src/if_perl.xs +index 2049509..9f59d39 100644 +--- a/src/if_perl.xs ++++ b/src/if_perl.xs +@@ -236,6 +236,9 @@ typedef int perl_key; + # else + # define Perl_sv_2pv dll_Perl_sv_2pv + # endif ++# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) ++# define Perl_sv_2pvbyte_flags dll_Perl_sv_2pvbyte_flags ++# endif + # define Perl_sv_2pvbyte dll_Perl_sv_2pvbyte + # define Perl_sv_bless dll_Perl_sv_bless + # if (PERL_REVISION == 5) && (PERL_VERSION >= 8) +@@ -390,6 +393,9 @@ static char* (*Perl_sv_2pv_nolen)(pTHX_ SV*); + static char* (*Perl_sv_2pv)(pTHX_ SV*, STRLEN*); + # endif + static char* (*Perl_sv_2pvbyte)(pTHX_ SV*, STRLEN*); ++# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) ++static char* (*Perl_sv_2pvbyte_flags)(pTHX_ SV*, STRLEN*, I32); ++# endif + static SV* (*Perl_sv_bless)(pTHX_ SV*, HV*); + # if (PERL_REVISION == 5) && (PERL_VERSION >= 8) + static void (*Perl_sv_catpvn_flags)(pTHX_ SV* , const char*, STRLEN, I32); +@@ -546,6 +552,9 @@ static struct { + {"Perl_sv_2pv", (PERL_PROC*)&Perl_sv_2pv}, + # endif + {"Perl_sv_2pvbyte", (PERL_PROC*)&Perl_sv_2pvbyte}, ++# if (PERL_REVISION == 5) && (PERL_VERSION >= 32) ++ {"Perl_sv_2pvbyte_flags", (PERL_PROC*)&Perl_sv_2pvbyte_flags}, ++# endif + # ifdef PERL589_OR_LATER + {"Perl_sv_2iv_flags", (PERL_PROC*)&Perl_sv_2iv_flags}, + {"Perl_newXS_flags", (PERL_PROC*)&Perl_newXS_flags}, +-- +2.13.7 + diff --git a/backport-compilation-error-with-Ruby-3.0.patch b/backport-compilation-error-with-Ruby-3.0.patch new file mode 100644 index 0000000..d3201cf --- /dev/null +++ b/backport-compilation-error-with-Ruby-3.0.patch @@ -0,0 +1,57 @@ +From 9d20daffc296b9eb901fb14bdd83620ea55d440a Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Mon, 1 Feb 2021 19:31:47 +0100 +Subject: [PATCH] patch 8.2.2448: compilation error with Ruby 3.0 + +Problem: Compilation error with Ruby 3.0. +Solution: Adjust #ifdefs and declaration. (Ken Takata, closes #7761) +--- + src/if_ruby.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/if_ruby.c b/src/if_ruby.c +index d21a655..6522d07 100644 +--- a/src/if_ruby.c ++++ b/src/if_ruby.c +@@ -416,7 +416,7 @@ static VALUE (*dll_rb_hash_new) (void); + static VALUE (*dll_rb_inspect) (VALUE); + static VALUE (*dll_rb_int2inum) (long); + static ID (*dll_rb_intern) (const char*); +-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only ++# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG + static long (*dll_rb_fix2int) (VALUE); + static long (*dll_rb_num2int) (VALUE); + static unsigned long (*dll_rb_num2uint) (VALUE); +@@ -504,7 +504,11 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj); + # endif + + # if RUBY_VERSION >= 30 ++# ifdef _MSC_VER ++static void (*dll_ruby_malloc_size_overflow)(size_t, size_t); ++# else + NORETURN(static void (*dll_ruby_malloc_size_overflow)(size_t, size_t)); ++# endif + # endif + + # if RUBY_VERSION >= 26 +@@ -534,7 +538,7 @@ rb_int2big_stub(SIGNED_VALUE x) + { + return dll_rb_int2big(x); + } +-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG ++# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG + long + rb_fix2int_stub(VALUE x) + { +@@ -673,7 +677,7 @@ static struct + {"rb_inspect", (RUBY_PROC*)&dll_rb_inspect}, + {"rb_int2inum", (RUBY_PROC*)&dll_rb_int2inum}, + {"rb_intern", (RUBY_PROC*)&dll_rb_intern}, +-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only ++# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG + {"rb_fix2int", (RUBY_PROC*)&dll_rb_fix2int}, + {"rb_num2int", (RUBY_PROC*)&dll_rb_num2int}, + {"rb_num2uint", (RUBY_PROC*)&dll_rb_num2uint}, +-- +2.13.7 + diff --git a/backport-macros-for-Ruby-are-too-complicated.patch b/backport-macros-for-Ruby-are-too-complicated.patch new file mode 100644 index 0000000..4f854aa --- /dev/null +++ b/backport-macros-for-Ruby-are-too-complicated.patch @@ -0,0 +1,642 @@ +From 41a4141ecb36cd871c6e87f6fbc12fa81653b6be Mon Sep 17 00:00:00 2001 +From: Bram Moolenaar +Date: Tue, 7 Jan 2020 21:32:19 +0100 +Subject: [PATCH] patch 8.2.0100: macros for Ruby are too complicated + +Problem: Macros for Ruby are too complicated. +Solution: Do not use DYNAMIC_RUBY_VER, use RUBY_VERSION. (Ken Takata, + closes #5452) +--- + src/Make_cyg_ming.mak | 3 - + src/Make_mvc.mak | 5 +- + src/auto/configure | 2 +- + src/configure.ac | 2 +- + src/if_ruby.c | 164 +++++++++++++++++++++--------------------- + 5 files changed, 86 insertions(+), 90 deletions(-) + +diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak +index 3c878cbfb..f9c795bfe 100644 +--- a/src/Make_cyg_ming.mak ++++ b/src/Make_cyg_ming.mak +@@ -569,11 +569,8 @@ ifdef RUBY + CFLAGS += -DFEAT_RUBY $(RUBYINC) + ifeq (yes, $(DYNAMIC_RUBY)) + CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" +-CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER) + endif +- ifeq (no, $(DYNAMIC_RUBY)) + CFLAGS += -DRUBY_VERSION=$(RUBY_VER) +- endif + ifneq ($(findstring w64-mingw32,$(CC)),) + # A workaround for MinGW-w64 + CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE +diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak +index 8694f7496..eb7129614 100644 +--- a/src/Make_mvc.mak ++++ b/src/Make_mvc.mak +@@ -1193,10 +1193,11 @@ RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib + # Do we want to load Ruby dynamically? + ! if "$(DYNAMIC_RUBY)" == "yes" + ! message Ruby DLL will be loaded dynamically +-CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=$(RUBY_VER) \ +- -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" ++CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY \ ++ -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" + ! undef RUBY_LIB + ! endif ++CFLAGS = $(CFLAGS) -DRUBY_VERSION=$(RUBY_VER) + !endif # RUBY + + # +diff --git a/src/auto/configure b/src/auto/configure +index 993049573..1b5094e97 100755 +--- a/src/auto/configure ++++ b/src/auto/configure +@@ -7622,7 +7622,7 @@ $as_echo "$rubyhdrdir" >&6; } + fi + $as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h + +- RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS" ++ RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" $RUBY_CFLAGS" + RUBY_LIBS= + fi + else +diff --git a/src/configure.ac b/src/configure.ac +index d440a465c..a098da82e 100644 +--- a/src/configure.ac ++++ b/src/configure.ac +@@ -1966,7 +1966,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then + libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"` + fi + AC_DEFINE(DYNAMIC_RUBY) +- RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS" ++ RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" $RUBY_CFLAGS" + RUBY_LIBS= + fi + else +diff --git a/src/if_ruby.c b/src/if_ruby.c +index 00783c8d7..68d55821f 100644 +--- a/src/if_ruby.c ++++ b/src/if_ruby.c +@@ -20,7 +20,7 @@ + #include + + #ifdef _WIN32 +-# if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18) ++# if !defined(DYNAMIC_RUBY) || (RUBY_VERSION < 18) + # define NT + # endif + # ifndef DYNAMIC_RUBY +@@ -32,7 +32,7 @@ + # define RUBYEXTERN extern + #endif + +-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 24 ++#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 24 + # define USE_RUBY_INTEGER + #endif + +@@ -47,14 +47,14 @@ + # if defined(USE_RUBY_INTEGER) + # define rb_cInteger (*dll_rb_cInteger) + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 ++# if RUBY_VERSION >= 20 + # define rb_cFloat (*dll_rb_cFloat) + # endif + # define rb_cNilClass (*dll_rb_cNilClass) + # define rb_cString (*dll_rb_cString) + # define rb_cSymbol (*dll_rb_cSymbol) + # define rb_cTrueClass (*dll_rb_cTrueClass) +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + /* + * On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)" + * in ruby.h. But it causes trouble for these variables, because it is +@@ -71,29 +71,14 @@ + # undef _WIN32_WINNT + #endif + +-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 19) \ +- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19) +-# define RUBY19_OR_LATER 1 +-#endif +- +-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 20) \ +- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20) +-# define RUBY20_OR_LATER 1 +-#endif +- +-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 21) \ +- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21) +-# define RUBY21_OR_LATER 1 +-#endif +- +-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 ++#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19 + // Ruby 1.9 defines a number of static functions which use rb_num2long and + // rb_int2big + # define rb_num2long rb_num2long_stub + # define rb_int2big rb_int2big_stub + #endif + +-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \ ++#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19 \ + && VIM_SIZEOF_INT < VIM_SIZEOF_LONG + // Ruby 1.9 defines a number of static functions which use rb_fix2int and + // rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit) +@@ -101,24 +86,24 @@ + # define rb_num2int rb_num2int_stub + #endif + +-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21 ++#if defined(DYNAMIC_RUBY) && RUBY_VERSION == 21 + // Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses + // rb_gc_writebarrier_unprotect_promoted if USE_RGENGC + # define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub + #endif +-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22 ++#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 22 + # define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub + #endif + +-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26 ++#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 26 + # define rb_ary_detransient rb_ary_detransient_stub + #endif + + #include +-#ifdef RUBY19_OR_LATER ++#if RUBY_VERSION >= 19 + # include + #endif +-#ifndef RUBY19_OR_LATER ++#if RUBY_VERSION <= 18 + # include // for ST_STOP and ST_CONTINUE + #endif + +@@ -139,7 +124,7 @@ + * The old Data_XXX macro family was deprecated on Ruby 2.2. + * Use TypedData_XXX if available. + */ +-#if defined(TypedData_Wrap_Struct) && defined(RUBY20_OR_LATER) ++#if defined(TypedData_Wrap_Struct) && (RUBY_VERSION >= 20) + # define USE_TYPEDDATA 1 + #endif + +@@ -210,7 +195,7 @@ static void ruby_io_init(void); + static void ruby_vim_init(void); + static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + +-#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) ++#if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK) + # if defined(__ia64) && !defined(ruby_init_stack) + # define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp()) + # endif +@@ -233,7 +218,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # endif + # define rb_class_path dll_rb_class_path + # ifdef USE_TYPEDDATA +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 ++# if RUBY_VERSION >= 23 + # define rb_data_typed_object_wrap dll_rb_data_typed_object_wrap + # else + # define rb_data_typed_object_alloc dll_rb_data_typed_object_alloc +@@ -256,7 +241,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # define rb_eRuntimeError (*dll_rb_eRuntimeError) + # define rb_eStandardError (*dll_rb_eStandardError) + # define rb_eval_string_protect dll_rb_eval_string_protect +-# ifdef RUBY21_OR_LATER ++# if RUBY_VERSION >= 21 + # define rb_funcallv dll_rb_funcallv + # else + # define rb_funcall2 dll_rb_funcall2 +@@ -274,7 +259,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # define rb_intern dll_rb_intern + + # if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER <= 18 ++# if RUBY_VERSION <= 18 + # define rb_fix2int dll_rb_fix2int + # define rb_num2int dll_rb_num2int + # endif +@@ -285,10 +270,10 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # define rb_lastline_set dll_rb_lastline_set + # define rb_protect dll_rb_protect + # define rb_load dll_rb_load +-# ifndef RUBY19_OR_LATER ++# if RUBY_VERSION <= 18 + # define rb_num2long dll_rb_num2long + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER <= 19 ++# if RUBY_VERSION <= 19 + # define rb_num2ulong dll_rb_num2ulong + # endif + # define rb_obj_alloc dll_rb_obj_alloc +@@ -309,7 +294,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # else + # define rb_str_new2 dll_rb_str_new2 + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + # define rb_string_value dll_rb_string_value + # define rb_string_value_ptr dll_rb_string_value_ptr + # define rb_float_new dll_rb_float_new +@@ -320,7 +305,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # endif + # define rb_ary_new4 dll_rb_ary_new4 + # define rb_ary_push dll_rb_ary_push +-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) ++# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK) + # ifdef __ia64 + # define rb_ia64_bsp dll_rb_ia64_bsp + # undef ruby_init_stack +@@ -332,7 +317,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # else + # define rb_str2cstr dll_rb_str2cstr + # endif +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + # define rb_errinfo dll_rb_errinfo + # else + # define ruby_errinfo (*dll_ruby_errinfo) +@@ -340,17 +325,17 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); + # define ruby_init dll_ruby_init + # define ruby_init_loadpath dll_ruby_init_loadpath + # ifdef MSWIN +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + # define ruby_sysinit dll_ruby_sysinit + # else + # define NtInitialize dll_NtInitialize + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + # define rb_w32_snprintf dll_rb_w32_snprintf + # endif + # endif + +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + # define ruby_script dll_ruby_script + # define rb_enc_find_index dll_rb_enc_find_index + # define rb_enc_find dll_rb_enc_find +@@ -370,7 +355,7 @@ VALUE *dll_rb_cFixnum; + # if defined(USE_RUBY_INTEGER) + VALUE *dll_rb_cInteger; + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 ++# if RUBY_VERSION >= 20 + VALUE *dll_rb_cFloat; + # endif + VALUE *dll_rb_cNilClass; +@@ -385,7 +370,7 @@ static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *); + # endif + static VALUE (*dll_rb_class_path) (VALUE); + # ifdef USE_TYPEDDATA +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 ++# if RUBY_VERSION >= 23 + static VALUE (*dll_rb_data_typed_object_wrap) (VALUE, void*, const rb_data_type_t *); + # else + static VALUE (*dll_rb_data_typed_object_alloc) (VALUE, void*, const rb_data_type_t *); +@@ -408,7 +393,7 @@ static VALUE *dll_rb_eIndexError; + static VALUE *dll_rb_eRuntimeError; + static VALUE *dll_rb_eStandardError; + static VALUE (*dll_rb_eval_string_protect) (const char*, int*); +-# ifdef RUBY21_OR_LATER ++# if RUBY_VERSION >= 21 + static VALUE (*dll_rb_funcallv) (VALUE, ID, int, const VALUE*); + # else + static VALUE (*dll_rb_funcall2) (VALUE, ID, int, const VALUE*); +@@ -436,7 +421,7 @@ static VALUE (*dll_rb_obj_alloc) (VALUE); + static VALUE (*dll_rb_obj_as_string) (VALUE); + static VALUE (*dll_rb_obj_id) (VALUE); + static void (*dll_rb_raise) (VALUE, const char*, ...); +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + static VALUE (*dll_rb_string_value) (volatile VALUE*); + # else + static char *(*dll_rb_str2cstr) (VALUE,int*); +@@ -450,7 +435,7 @@ static VALUE (*dll_rb_str_new_cstr) (const char*); + # else + static VALUE (*dll_rb_str_new2) (const char*); + # endif +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + static VALUE (*dll_rb_errinfo) (void); + # else + static VALUE *dll_ruby_errinfo; +@@ -458,25 +443,25 @@ static VALUE *dll_ruby_errinfo; + static void (*dll_ruby_init) (void); + static void (*dll_ruby_init_loadpath) (void); + # ifdef MSWIN +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + static void (*dll_ruby_sysinit) (int*, char***); + # else + static void (*dll_NtInitialize) (int*, char***); + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...); + # endif + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + static char * (*dll_rb_string_value_ptr) (volatile VALUE*); + static VALUE (*dll_rb_float_new) (double); + static VALUE (*dll_rb_ary_new) (void); + static VALUE (*dll_rb_ary_new4) (long n, const VALUE *elts); + static VALUE (*dll_rb_ary_push) (VALUE, VALUE); +-# if DYNAMIC_RUBY_VER >= 26 ++# if RUBY_VERSION >= 26 + static void (*dll_rb_ary_detransient) (VALUE); + # endif +-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) ++# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK) + # ifdef __ia64 + static void * (*dll_rb_ia64_bsp) (void); + static void (*dll_ruby_init_stack)(VALUE*, void*); +@@ -485,11 +470,11 @@ static void (*dll_ruby_init_stack)(VALUE*); + # endif + # endif + # endif +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + static VALUE (*dll_rb_int2big)(SIGNED_VALUE); + # endif + +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + static void (*dll_ruby_script) (const char*); + static int (*dll_rb_enc_find_index) (const char*); + static rb_encoding* (*dll_rb_enc_find) (const char*); +@@ -500,15 +485,15 @@ static void* (*ruby_options)(int, char**); + # endif + + # if defined(USE_RGENGC) && USE_RGENGC +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21 ++# if RUBY_VERSION == 21 + static void (*dll_rb_gc_writebarrier_unprotect_promoted)(VALUE); + # else + static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj); + # endif + # endif + +-# if defined(RUBY19_OR_LATER) && !defined(PROTO) +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22 ++# if (RUBY_VERSION >= 19) && !defined(PROTO) ++# if RUBY_VERSION >= 22 + long + rb_num2long_stub(VALUE x) + # else +@@ -518,7 +503,7 @@ rb_num2long_stub(VALUE x) + { + return dll_rb_num2long(x); + } +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26 ++# if RUBY_VERSION >= 26 + VALUE + rb_int2big_stub(intptr_t x) + # else +@@ -528,8 +513,7 @@ rb_int2big_stub(SIGNED_VALUE x) + { + return dll_rb_int2big(x); + } +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \ +- && VIM_SIZEOF_INT < VIM_SIZEOF_LONG ++# if (RUBY_VERSION >= 19) && (VIM_SIZEOF_INT < VIM_SIZEOF_LONG) + long + rb_fix2int_stub(VALUE x) + { +@@ -541,13 +525,13 @@ rb_num2int_stub(VALUE x) + return dll_rb_num2int(x); + } + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 ++# if RUBY_VERSION >= 20 + VALUE + rb_float_new_in_heap(double d) + { + return dll_rb_float_new(d); + } +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22 ++# if RUBY_VERSION >= 22 + unsigned long + rb_num2ulong(VALUE x) + # else +@@ -562,7 +546,7 @@ rb_num2ulong(VALUE x) + + // Do not generate a prototype here, VALUE isn't always defined. + # if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO) +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21 ++# if RUBY_VERSION == 21 + void + rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj) + { +@@ -577,7 +561,7 @@ rb_gc_writebarrier_unprotect_stub(VALUE obj) + # endif + # endif + +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26 ++# if RUBY_VERSION >= 26 + void + rb_ary_detransient_stub(VALUE x) + { +@@ -603,7 +587,7 @@ static struct + # else + {"rb_cFixnum", (RUBY_PROC*)&dll_rb_cFixnum}, + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 ++# if RUBY_VERSION >= 20 + {"rb_cFloat", (RUBY_PROC*)&dll_rb_cFloat}, + # endif + {"rb_cNilClass", (RUBY_PROC*)&dll_rb_cNilClass}, +@@ -618,7 +602,7 @@ static struct + # endif + {"rb_class_path", (RUBY_PROC*)&dll_rb_class_path}, + # ifdef USE_TYPEDDATA +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23 ++# if RUBY_VERSION >= 23 + {"rb_data_typed_object_wrap", (RUBY_PROC*)&dll_rb_data_typed_object_wrap}, + # else + {"rb_data_typed_object_alloc", (RUBY_PROC*)&dll_rb_data_typed_object_alloc}, +@@ -641,7 +625,7 @@ static struct + {"rb_eRuntimeError", (RUBY_PROC*)&dll_rb_eRuntimeError}, + {"rb_eStandardError", (RUBY_PROC*)&dll_rb_eStandardError}, + {"rb_eval_string_protect", (RUBY_PROC*)&dll_rb_eval_string_protect}, +-# ifdef RUBY21_OR_LATER ++# if RUBY_VERSION >= 21 + {"rb_funcallv", (RUBY_PROC*)&dll_rb_funcallv}, + # else + {"rb_funcall2", (RUBY_PROC*)&dll_rb_funcall2}, +@@ -669,7 +653,7 @@ static struct + {"rb_obj_as_string", (RUBY_PROC*)&dll_rb_obj_as_string}, + {"rb_obj_id", (RUBY_PROC*)&dll_rb_obj_id}, + {"rb_raise", (RUBY_PROC*)&dll_rb_raise}, +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + {"rb_string_value", (RUBY_PROC*)&dll_rb_string_value}, + # else + {"rb_str2cstr", (RUBY_PROC*)&dll_rb_str2cstr}, +@@ -682,7 +666,7 @@ static struct + # else + {"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2}, + # endif +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + {"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo}, + # else + {"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo}, +@@ -690,18 +674,18 @@ static struct + {"ruby_init", (RUBY_PROC*)&dll_ruby_init}, + {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath}, + # ifdef MSWIN +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + {"ruby_sysinit", (RUBY_PROC*)&dll_ruby_sysinit}, + # else + {"NtInitialize", (RUBY_PROC*)&dll_NtInitialize}, + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf}, + # endif + # endif +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18 ++# if RUBY_VERSION >= 18 + {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr}, +-# if DYNAMIC_RUBY_VER <= 19 ++# if RUBY_VERSION <= 19 + {"rb_float_new", (RUBY_PROC*)&dll_rb_float_new}, + # else + {"rb_float_new_in_heap", (RUBY_PROC*)&dll_rb_float_new}, +@@ -713,11 +697,11 @@ static struct + {"rb_ary_new4", (RUBY_PROC*)&dll_rb_ary_new4}, + # endif + {"rb_ary_push", (RUBY_PROC*)&dll_rb_ary_push}, +-# if DYNAMIC_RUBY_VER >= 26 ++# if RUBY_VERSION >= 26 + {"rb_ary_detransient", (RUBY_PROC*)&dll_rb_ary_detransient}, + # endif + # endif +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + {"rb_int2big", (RUBY_PROC*)&dll_rb_int2big}, + {"ruby_script", (RUBY_PROC*)&dll_ruby_script}, + {"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index}, +@@ -727,14 +711,14 @@ static struct + {"rb_require", (RUBY_PROC*)&dll_rb_require}, + {"ruby_options", (RUBY_PROC*)&dll_ruby_options}, + # endif +-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) ++# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK) + # ifdef __ia64 + {"rb_ia64_bsp", (RUBY_PROC*)&dll_rb_ia64_bsp}, + # endif + {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack}, + # endif + # if defined(USE_RGENGC) && USE_RGENGC +-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21 ++# if RUBY_VERSION == 21 + {"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted}, + # else + {"rb_gc_writebarrier_unprotect", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect}, +@@ -837,7 +821,7 @@ ex_ruby(exarg_T *eap) + static VALUE + vim_str2rb_enc_str(const char *s) + { +-#ifdef RUBY19_OR_LATER ++#if RUBY_VERSION >= 19 + int isnum; + long lval; + char_u *sval; +@@ -858,7 +842,7 @@ vim_str2rb_enc_str(const char *s) + static VALUE + eval_enc_string_protect(const char *str, int *state) + { +-#ifdef RUBY19_OR_LATER ++#if RUBY_VERSION >= 19 + int isnum; + long lval; + char_u *sval; +@@ -982,19 +966,19 @@ ensure_ruby_initialized(void) + int argc = 1; + char *argv[] = {"gvim.exe"}; + char **argvp = argv; +-# ifdef RUBY19_OR_LATER ++# if RUBY_VERSION >= 19 + ruby_sysinit(&argc, &argvp); + # else + NtInitialize(&argc, &argvp); + # endif + #endif + { +-#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) ++#if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK) + ruby_init_stack(ruby_stack_start); + #endif + ruby_init(); + } +-#ifdef RUBY19_OR_LATER ++#if RUBY_VERSION >= 19 + { + int dummy_argc = 2; + char *dummy_argv[] = {"vim-ruby", "-e_=0"}; +@@ -1022,7 +1006,7 @@ ensure_ruby_initialized(void) + static void + error_print(int state) + { +-#if !defined(DYNAMIC_RUBY) && !defined(RUBY19_OR_LATER) ++#if !defined(DYNAMIC_RUBY) && (RUBY_VERSION <= 18) + RUBYEXTERN VALUE ruby_errinfo; + #endif + VALUE error; +@@ -1062,7 +1046,7 @@ error_print(int state) + break; + case TAG_RAISE: + case TAG_FATAL: +-#ifdef RUBY19_OR_LATER ++#if RUBY_VERSION >= 19 + error = rb_errinfo(); + #else + error = ruby_errinfo; +@@ -1087,7 +1071,7 @@ error_print(int state) + } + + attr = syn_name2attr((char_u *)"Error"); +-# ifdef RUBY21_OR_LATER ++# if RUBY_VERSION >= 21 + bt = rb_funcallv(error, rb_intern("backtrace"), 0, 0); + for (i = 0; i < RARRAY_LEN(bt); i++) + msg_attr(RSTRING_PTR(RARRAY_AREF(bt, i)), attr); +@@ -1242,7 +1226,13 @@ static size_t buffer_dsize(const void *buf); + + static const rb_data_type_t buffer_type = { + "vim_buffer", +- {0, 0, buffer_dsize, {0, 0}}, ++ {0, 0, buffer_dsize, ++# if RUBY_VERSION >= 27 ++ 0, 0 ++# else ++ {0, 0} ++# endif ++ }, + 0, 0, + # ifdef RUBY_TYPED_FREE_IMMEDIATELY + 0, +@@ -1516,7 +1506,13 @@ static size_t window_dsize(const void *buf); + + static const rb_data_type_t window_type = { + "vim_window", +- {0, 0, window_dsize, {0, 0}}, ++ {0, 0, window_dsize, ++# if RUBY_VERSION >= 27 ++ 0, 0 ++# else ++ {0, 0} ++# endif ++ }, + 0, 0, + # ifdef RUBY_TYPED_FREE_IMMEDIATELY + 0, diff --git a/vim.spec b/vim.spec index 73f9e9b..a367fa3 100644 --- a/vim.spec +++ b/vim.spec @@ -12,7 +12,7 @@ Name: vim Epoch: 2 Version: 8.2 -Release: 19 +Release: 20 Summary: Vim is a highly configurable text editor for efficiently creating and changing any kind of text. License: Vim and MIT URL: http://www.vim.org @@ -33,7 +33,6 @@ Patch0010: vim-7.4-releasestring-1318991.patch Patch0011: vim-8.0-copy-paste.patch Patch0012: vim-python3-tests.patch Patch0013: Fix-vim-lua5.4.0-defines+luaL_typeerror-twice.patch -Patch0014: backport-Fix-build-failuers-with-perl-5.32.patch Patch6000: backport-Configure-does-not-recognize-gcc-10.0-and-later.patch Patch6001: backport-8.2.2550-signal-stack-size-is-wrong-with-lates.patch Patch6002: backport-CVE-2021-3770.patch @@ -57,6 +56,15 @@ Patch6019: backport-no-early-check-if-find-and-sfind-have-an-argument.patch Patch6020: backport-CVE-2021-3984.patch Patch6021: backport-CVE-2021-4019.patch Patch6022: backport-CVE-2021-4069.patch +Patch6023: backport-build-failure-with-Perl5.32.patch +Patch6024: backport-cannot-build-with-Strawberry-Perl-5.32.0.patch +Patch6025: backport-cannot-build-with-Perl-5.34.patch +Patch6026: backport-macros-for-Ruby-are-too-complicated.patch +Patch6027: backport-build-problem-with-Ruby-2.7.patch +Patch6028: backport-Ruby-missing-function-prototype.patch +Patch6029: backport-build-failure-with-some-Ruby-versions.patch +Patch6030: backport-compilation-error-with-Ruby-3.0.patch +Patch6031: backport-build-failure-with-Ruby-3.0-and-32-bits.patch Patch9000: bugfix-rm-modify-info-version.patch @@ -445,6 +453,12 @@ popd %{_mandir}/man1/evim.* %changelog +* Thu Jan 13 2022 shixuantong - 2:8.2-20 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix build fail + * Sat Dec 11 2021 yuanxin - 2:8.2-19 - Type:CVE - ID:CVE-2021-4069 -- Gitee