Skip to content

Commit

Permalink
patch 9.0.0546: supporting Ruby 1.8 makes code complicated
Browse files Browse the repository at this point in the history
Problem:    Supporting Ruby 1.8 makes code complicated.
Solution:   Drop Ruby 1.8 support, it is ancient. (Ken Takata, closes #11195)
  • Loading branch information
k-takata authored and brammool committed Sep 22, 2022
1 parent daaa3d9 commit 236ccbf
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 235 deletions.
28 changes: 7 additions & 21 deletions src/Make_cyg_ming.mak
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ endif
# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
# RUBY_API_VER_LONG=[Ruby API version, eg 1.9.1, 2.2.0]
# (default is 2.2.0)
# You must set RUBY_API_VER_LONG when changing RUBY_VER.
# Note: If you use Ruby 1.9.3, set as follows:
Expand All @@ -466,9 +466,7 @@ RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG))
endif

ifndef RUBY_PLATFORM
ifeq ($(RUBY_VER), 16)
RUBY_PLATFORM = i586-mswin32
else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
RUBY_PLATFORM = i386-mingw32
else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
RUBY_PLATFORM = x64-mingw32
Expand All @@ -480,32 +478,20 @@ RUBY_PLATFORM = i386-mswin32
endif

ifndef RUBY_INSTALL_NAME
ifeq ($(RUBY_VER), 16)
RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
else
ifndef RUBY_MSVCRT_NAME
ifndef RUBY_MSVCRT_NAME
# Base name of msvcrXX.dll which is used by ruby's dll.
RUBY_MSVCRT_NAME = msvcrt
endif
ifeq ($(RUBY_PLATFORM),x64-mingw-ucrt)
endif
ifeq ($(RUBY_PLATFORM),x64-mingw-ucrt)
RUBY_INSTALL_NAME = x64-ucrt-ruby$(RUBY_API_VER)
else ifeq ($(ARCH),x86-64)
else ifeq ($(ARCH),x86-64)
RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
else
else
RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
endif
endif
endif

ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
RUBY_19_OR_LATER = 1
endif

ifdef RUBY_19_OR_LATER
RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
else
RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
endif
ifeq (no, $(DYNAMIC_RUBY))
RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
endif
Expand Down
51 changes: 16 additions & 35 deletions src/Make_mvc.mak
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
# RUBY=[Path to Ruby directory]
# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
# RUBY_API_VER_LONG=[Ruby API version, eg 1.9.1, 2.2.0]
# (default is 2.2.0)
# You must set RUBY_API_VER_LONG when change RUBY_VER.
# Note: If you use Ruby 1.9.3, set as follows:
Expand Down Expand Up @@ -1076,54 +1076,35 @@ RUBY_API_VER_LONG = $(RUBY_VER_LONG)
RUBY_API_VER = $(RUBY_API_VER_LONG:.=)
! endif

! if $(RUBY_VER) >= 18

! ifndef RUBY_PLATFORM
! if "$(CPU)" == "i386"
! ifndef RUBY_PLATFORM
! if "$(CPU)" == "i386"
RUBY_PLATFORM = i386-mswin32
! else # CPU
! else # CPU
RUBY_PLATFORM = x64-mswin64
! endif # CPU
! if $(RUBY_VER) > 19
! endif # CPU
RUBY_PLATFORM = $(RUBY_PLATFORM)_$(MSVCRT_VER)
! endif # RUBY_VER
! endif # RUBY_PLATFORM
! endif # RUBY_PLATFORM

! ifndef RUBY_INSTALL_NAME
! ifndef RUBY_MSVCRT_NAME
! ifndef RUBY_INSTALL_NAME
! ifndef RUBY_MSVCRT_NAME
# Base name of msvcrXX.dll which is used by ruby's dll.
RUBY_MSVCRT_NAME = $(MSVCRT_NAME)
! endif # RUBY_MSVCRT_NAME
! if "$(CPU)" == "i386"
! endif # RUBY_MSVCRT_NAME
! if "$(CPU)" == "i386"
RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
! else # CPU
! if EXIST($(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw-ucrt)
! else # CPU
! if EXIST($(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw-ucrt)
RUBY_INSTALL_NAME = x64-ucrt-ruby$(RUBY_API_VER)
! else
! else
RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
! endif
! endif # CPU
! endif # RUBY_INSTALL_NAME

! else # $(RUBY_VER) >= 18

! ifndef RUBY_PLATFORM
RUBY_PLATFORM = i586-mswin32
! endif
! ifndef RUBY_INSTALL_NAME
RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
! endif

! endif # $(RUBY_VER) >= 18
! endif
! endif # CPU
! endif # RUBY_INSTALL_NAME

! message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)"
CFLAGS = $(CFLAGS) -DFEAT_RUBY
RUBY_OBJ = $(OUTDIR)\if_ruby.obj
! if $(RUBY_VER) >= 19
RUBY_INC = /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
! else
RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
! endif
RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
# Do we want to load Ruby dynamically?
! if "$(DYNAMIC_RUBY)" == "yes"
Expand Down
8 changes: 4 additions & 4 deletions src/auto/configure
Original file line number Diff line number Diff line change
Expand Up @@ -7639,7 +7639,7 @@ fi
if test "X$vi_cv_path_ruby" != "X"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Ruby version" >&5
$as_echo_n "checking Ruby version... " >&6; }
if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
if $vi_cv_path_ruby -e 'RUBY_VERSION >= "1.9.1" or exit 1' >/dev/null 2>/dev/null; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OK" >&5
$as_echo "OK" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Ruby rbconfig" >&5
Expand All @@ -7663,7 +7663,7 @@ $as_echo "$rubyhdrdir" >&6; }
fi
rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['ruby_version'].gsub(/\./, '')[0,2]"`
if test "X$rubyversion" = "X"; then
rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[0,2]"`
rubyversion=`$vi_cv_path_ruby -e "print RUBY_VERSION.gsub(/\./, '')[0,2]"`
fi
RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG['LIBS']"`
Expand Down Expand Up @@ -7715,8 +7715,8 @@ $as_echo "$rubyhdrdir" >&6; }
$as_echo "not found; disabling Ruby" >&6; }
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: too old; need Ruby version 1.6.0 or later" >&5
$as_echo "too old; need Ruby version 1.6.0 or later" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: too old; need Ruby version 1.9.1 or later" >&5
$as_echo "too old; need Ruby version 1.9.1 or later" >&6; }
fi
fi

Expand Down
6 changes: 3 additions & 3 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
if test "X$vi_cv_path_ruby" != "X"; then
AC_MSG_CHECKING(Ruby version)
if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
if $vi_cv_path_ruby -e 'RUBY_VERSION >= "1.9.1" or exit 1' >/dev/null 2>/dev/null; then
AC_MSG_RESULT(OK)
AC_MSG_CHECKING(Ruby rbconfig)
ruby_rbconfig="RbConfig"
Expand All @@ -2009,7 +2009,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
fi
rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
if test "X$rubyversion" = "X"; then
rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"`
rubyversion=`$vi_cv_path_ruby -e "print RUBY_VERSION.gsub(/\./, '')[[0,2]]"`
fi
RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
Expand Down Expand Up @@ -2062,7 +2062,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
AC_MSG_RESULT(not found; disabling Ruby)
fi
else
AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
AC_MSG_RESULT(too old; need Ruby version 1.9.1 or later)
fi
fi

Expand Down

0 comments on commit 236ccbf

Please sign in to comment.