Hi,

2016/1/5 Tue 21:40:45 UTC+9 Ken Takata wrote:
> > > > I tried Ruby 2.2, but it appears it doesn't work with MSVC.
> > > > The config.h include file is in include/ruby-2.2.0/i386-mingw32.
> > > > Trying to change the path for that results in a missing "strings.h"
> > > > include file, I assume that's from MingW.
> > > 
> > > As I wrote in this post, I do some hacks on AppVeyor:
> > > https://groups.google.com/d/msg/vim_dev/dAXpcpHmVw4/zz_NoTUICwAJ
> > > 
> > > 1. Download Ruby 2.2's source code and generate config.h:
> > > 
> > >   cd C:\projects
> > >   git clone https://github.com/ruby/ruby.git -b ruby_2_2
> > >   cd ruby
> > >   call win32\configure.bat
> > >   nmake .config.h.time
> > > 
> > > There is no need to build whole Ruby, just config.h is needed.
> > > The config.h is generated in the .ext\include\i386-mswin32_100 directory.
> > > 
> > > 
> > > 2. Adjust some variables when building Vim
> > > 
> > >   nmake -f Make_mvc.mak ^
> > >   ... ^
> > >   RUBY=C:\projects\ruby DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_VER_LONG=2.2.0 ^
> > >   RUBY_INSTALL_NAME=msvcrt-ruby$(RUBY_API_VER) ^
> > >   RUBY_PLATFORM=i386-mswin32_100 ^
> > >   RUBY_INC="/I $(RUBY)\include /I $(RUBY)\.ext\include\$(RUBY_PLATFORM)" ^
> > >   WINVER=0x500 
> > > 
> > > Normally we need to set only RUBY, DYNAMIC_RUBY, RUBY_VER, RUBY_VER_LONG 
> > > and
> > > WINVER. (WINVER must be set to >=0x500, when building with Ruby 2.1+.)
> > > But when using this trick, we also need to set RUBY_INSTALL_NAME,
> > > RUBY_PLATFORM and RUBY_INC.
> > 
> > Instead of that, can we copy the generated config.h into the installed
> > Ruby directory, next to the MingW one?  Or does that not work?
> 
> If we copy ".ext\include\i386-mswin32_100\config.h" (when using 32-bit VC10)
> to "C:\Ruby22\include\ruby-2.2.0\i386-mswin32_100\config.h", we don't need to
> set RUBY_INC, but we still need to set RUBY_PLATFORM and RUBY_INSTALL_NAME.
> Because:
> 
> 1. The current Make_mvc.mak doesn't set RUBY_PLATFORM properly when using VC7
> or later.
> 
> 2. RUBY_INSTALL_NAME is used for the DLL name, and the name is different when
> using different compiler. E.g.
>   MSVC10 32 bits: msvcr100-ruby220.dll
>   MinGW 32bits:   msvcrt-ruby220.dll
>   MSVC10 64 bits: x64-msvcr100-ruby220.dll
>   MinGW 64bits:   x64-msvcrt-ruby220.dll
> We want to link Vim built by MSVC with RubyInstaller built by MinGW, so
> RUBY_INSTALL_NAME must be set manually.
> 
> Now I'm trying to update Make_mvc.mak to set RUBY_PLATFORM properly,
> but even if I succeeded this, we still need to set RUBY_INSTALL_NAME.

I wrote a patch for this.

After applying this patch, the following command:

  nmake -f Make_mvc.mak ^
        ... ^
        RUBY=C:\projects\ruby DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_VER_LONG=2.2.0 ^
        RUBY_INSTALL_NAME=msvcrt-ruby$(RUBY_API_VER) ^
        RUBY_PLATFORM=i386-mswin32_100 ^
        RUBY_INC="/I $(RUBY)\include /I $(RUBY)\.ext\include\$(RUBY_PLATFORM)" ^
        WINVER=0x500 

becomes simpler as the following:

    nmake -f Make_mvc.mak ^
        ... ^
        RUBY=C:\Ruby22 DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_VER_LONG=2.2.0 ^
        RUBY_MSVCRT_NAME=msvcrt ^
        WINVER=0x500 

(Assuming that the generated config.h has been copied to
"C:\Ruby22\include\ruby-2.2.0\i386-mswin32_100\config.h".)


Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent  05ef94d1a6957d94e963060a3297d1fb2c7b1077

diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak
--- a/src/Make_cyg_ming.mak
+++ b/src/Make_cyg_ming.mak
@@ -319,10 +319,14 @@
 ifeq ($(RUBY_VER), 16)
 RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
 else
+ifndef RUBY_MSVCRT_NAME
+# Base name of msvcrXX.dll which is used by ruby's dll.
+RUBY_MSVCRT_NAME = msvcrt
+endif
 ifeq ($(ARCH),x86-64)
-RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER)
+RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
 else
-RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER)
+RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
 endif
 endif
 endif
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -394,8 +394,24 @@
 
 !if $(MSVCVER) < 1900
 MSVC_MAJOR = ($(MSVCVER) / 100 - 6)
+MSVCRT_VER = ($(MSVCVER) / 10 - 60)
 !else
 MSVC_MAJOR = ($(MSVCVER) / 100 - 5)
+MSVCRT_VER = ($(MSVCVER) / 10 - 50)
+!endif
+
+# Calculate MSVCRT_VER
+!if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0
+!include msvcrtver.~
+!if [del msvcrtver.~]
+!endif
+!endif
+
+# Base name of the msvcrXX.dll
+!if $(MSVCRT_VER) <= 60
+MSVCRT_NAME = msvcrt
+!else
+MSVCRT_NAME = msvcr$(MSVCRT_VER)
 !endif
 
 !if $(MSVC_MAJOR) == 6
@@ -858,19 +874,39 @@
 !endif
 
 !if $(RUBY_VER) >= 18
+
 !ifndef RUBY_PLATFORM
+!if "$(CPU)" == "i386"
 RUBY_PLATFORM = i386-mswin32
-!endif
+!else # CPU
+RUBY_PLATFORM = x64-mswin64
+!endif # CPU
+!if $(MSVCRT_VER) >= 70
+RUBY_PLATFORM = $(RUBY_PLATFORM)_$(MSVCRT_VER)
+!endif # MSVCRT_VER
+!endif # RUBY_PLATFORM
+
 !ifndef RUBY_INSTALL_NAME
-RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER)
-!endif
-!else
+!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"
+RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
+!else # CPU
+RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
+!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
 
 !message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)"

Raspunde prin e-mail lui