1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
|
INSTALLpc.txt - Installation of Vim on PC
This file contains instructions for compiling Vim. If you already have an
executable version of Vim, you don't need this.
More information can be found here: (Very stale now.)
http://mywebpage.netscape.com/sharppeople/vim/howto/
The file "feature.h" can be edited to match your preferences. You can skip
this, then you will get the default behavior as is documented, which should
be fine for most people.
This document assumes that you are building Vim for Win32 or later (Windows
XP/2003/Vista/7/8/10). There are also instructions for pre-XP systems, but
they might no longer work.
Contents:
1. Microsoft Visual C++
2. Using MinGW
3. Cygwin
4. Borland
5. Cross compiling for Win32 from a Linux machine
6. Building with Python support
7. Building with Python3 support
8. Building with MzScheme/Racket support
9. Building with Lua support
10. Building with Perl support
11. Building with Ruby support
12. Building with Tcl support
13. Windows 3.1
14. MS-DOS
15. Installing after building from sources
The currently preferred method is using the free Visual C++ Toolkit 2008
|msvc-2008-express|, the produced binary runs on most MS-Windows systems.
1. Microsoft Visual C++
=======================
Visual Studio
-------------
Building with Visual Studio (VS 98, VS .NET, VS .NET 2003, VS 2005, VS 2008,
VS2010, VS2012, VS2013 and VS2015) is straightforward. (These instructions
should also work for VS 4 and VS 5.)
Using VS C++ 2008 Express is recommended, the binaries build with that run on
nearly all platforms. Binaries from later versions may not run on Windows 95
or XP.
To build Vim from the command line with MSVC, use Make_mvc.mak.
Visual Studio installed a batch file called vcvars32.bat, which you must
run to set up paths for nmake and MSVC.
nmake -f Make_mvc.mak console Win32 SDK or Microsoft Visual C++
nmake -f Make_mvc.mak GUI=yes GUI Microsoft Visual C++
nmake -f Make_mvc.mak OLE=yes OLE Microsoft Visual C++
nmake -f Make_mvc.mak PERL=C:\Perl PYTHON=C:\Python etc.
Perl, Python, etc.
Make_mvc.mak allows a Vim to be built with various different features and
debug support. Debugging with MS Devstudio is provided by Make_dvc.mak.
For a description of the use of Make_dvc.mak, look in Make_mvc.mak.
For compiling Gvim with IME support on far-east Windows, add IME=yes
to the parameters you pass to Make_mvc.mak.
To build Vim from within the Visual Studio IDE, open the Make_ivc.mak project.
(Note: Make_ivc.mak is not as rich as Make_mvc.mak, which allows for
far more configuration.) Make_ivc.mak can also be built with nmake.
nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim"
GUI Microsoft Visual C++ 4.x or later
nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim OLE"
OLE Microsoft Visual C++ 4.x or later
See the specific files for comments and options.
These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and
Ron Aaron; they have been tested.
Visual C++ 2008 Express Edition *msvc-2008-express*
-------------------------------
Visual C++ 2008 Express Edition can be downloaded for free from:
http://www.microsoft.com/express/downloads/
This includes the IDE and the debugger.
To set the environment execute the msvc2008.bat script. You can then build
Vim with Make_mvc.mak.
For building 64 bit binaries you also need to install the SDK:
"Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1"
You don't need the examples and documentation.
If you get an error that Win32.mak can't be found, you have to set the
variable SDK_INCLUDE_DIR. For example, on Windows 10, installation of MSVC
puts include files in the following directory:
set SDK_INCLUDE_DIR=C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
Visual C++ 2010 Express Edition *msvc-2010-express*
-------------------------------
Visual C++ 2010 Express Edition can be downloaded for free from:
http://www.microsoft.com/express/vc/Default.aspx
This includes the IDE and the debugger.
To set the environment execute the msvc2010.bat script. You can then build
Vim with Make_mvc.mak.
Targeting Windows XP with new MSVC *new-msvc-windows-xp*
----------------------------------
Beginning with Visual C++ 2012, Microsoft changed the behavior of LINK.EXE
so that it targets Windows 6.0 (Vista) by default. In order to override
this, the target Windows version number needs to be passed to LINK like
follows:
LINK ... /subsystem:console,5.01
Make_mvc.mak now supports a macro SUBSYSTEM_VER to pass the Windows version.
Use lines like follows to target Windows XP (assuming using Visual C++ 2012
under 64-bit Windows):
set WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A
set SDK_INCLUDE_DIR=%WinSdk71%\Include
set INCLUDE=%WinSdk71%\Include;%INCLUDE%
set LIB=%WinSdk71%\Lib;%LIB%
set PATH=%WinSdk71%\Bin;%PATH%
set CL=/D_USING_V110_SDK71_
nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01
The following Visual C++ team blog can serve as a reference page:
http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx
OLDER VERSIONS
The minimal supported version is Windows XP. Building with older compilers
might still work, but these instructions might be outdated.
If you need the executable to run on Windows 98 or ME, use the 2003 one
|msvc-2003-toolkit|.
Visual C++ Toolkit 2003 *msvc-2003-toolkit*
-----------------------
You could download the Microsoft Visual C++ Toolkit 2003 from
http://msdn.microsoft.com/visualc/vctoolkit2003/
Unfortunately this URL is no longer valid. Inofficial downloads appear to be
available from links mentioned on these pages (use at your own risk):
http://www.filewatcher.com/m/VCToolkitSetup.exe.32952488.0.0.html
http://feargame.net/wiki/index.php?title=Building_Source_with_the_VC2003_Toolkit
This contains the command-line tools (compiler, linker, CRT headers,
and libraries) for Visual Studio .NET 2003, but not the Visual Studio IDE.
To compile and debug Vim with the VC2003 Toolkit, you will also need
|ms-platform-sdk|, |dotnet-1.1-redist|, |dotnet-1.1-sdk|,
and |windbg-download|.
It's easier to download Visual C++ 2008 Express Edition, |msvc-2008-express|,
which is freely available in perpetuity.
The free Code::Blocks IDE works with the VC2003 Toolkit, as described at
http://wiki.codeblocks.org/index.php?title=Integrating_Microsoft_Visual_Toolkit_2003_with_Code::Blocks_IDE
(This site also takes you through configuring a number of other
free C compilers for Win32.)
To compile Vim using the VC2003 Toolkit and Make_mvc.mak, you must first
execute the following commands in a cmd.exe window (the msvcsetup.bat batch
file can be used):
set PATH=%SystemRoot%\Microsoft.NET\Framework\v1.1.4322;%PATH%
call "%VCToolkitInstallDir%vcvars32.bat"
set MSVCVer=7.1
call "%ProgramFiles%\Microsoft Platform SDK\SetEnv.Cmd"
set LIB=%ProgramFiles%\Microsoft Visual Studio .NET 2003\Vc7\lib;%LIB%
Now you can build Vim with Make_mvc.mak.
Getting the Windows Platform SDK *ms-platform-sdk*
You will also need a copy of the Windows Platform SDK from
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
Specifically, you need the Windows Core SDK subset of the Platform SDK,
which contains the Windows headers and libraries.
Getting the .NET Framework 1.1 Runtime *dotnet-1.1-redist*
You need the .NET Framework 1.1 Redistributable Package from
http://www.microsoft.com/downloads/details.aspx?familyid=262d25e3-f589-4842-8157-034d1e7cf3a3
or from Windows Update:
http://windowsupdate.microsoft.com/
This is needed to install |dotnet-1.1-sdk|. It also contains cvtres.exe,
which is needed to link Vim.
Getting the .NET Framework 1.1 SDK *dotnet-1.1-sdk*
You need the .NET Framework 1.1 SDK from
http://www.microsoft.com/downloads/details.aspx?familyid=9b3a2ca6-3647-4070-9f41-a333c6b9181d
This contains some additional libraries needed to compile Vim,
such as msvcrt.lib. You must install |dotnet-1.1-redist| before
installing the .NET 1.1 SDK.
Getting the WinDbg debugger *windbg-download*
The Debugging Tools for Windows can be downloaded from
http://www.microsoft.com/whdc/devtools/debugging/default.mspx
This includes the WinDbg debugger, which you will want if you ever need
to debug Vim itself. An earlier version of the Debugging Tools
is also available through the Platform SDK, |ms-platform-sdk|.
Visual C++ 2005 Express Edition *msvc-2005-express*
-------------------------------
Visual C++ 2005 Express Edition can be downloaded for free from:
http://msdn.microsoft.com/vstudio/express/visualC/default.aspx
This includes the IDE and the debugger. You will also need
|ms-platform-sdk|. You can build Vim with Make_mvc.mak.
Instructions for integrating the Platform SDK into VC Express:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
2. MinGW
========
(written by Ron Aaron: <ronaharon@yahoo.com>)
This is about how to produce a Win32 binary of gvim with MinGW.
First, you need to get the 'mingw32' compiler, which is free for the download
at:
http://www.mingw.org/
or you can use 'MinGW-w64' compiler.
http://mingw-w64.sourceforge.net/
Or a compiler provided on msys2:
https://msys2.github.io/
Once you have downloaded the compiler binaries, unpack them on your hard disk
somewhere, and put them on your PATH. If you are on Win95/98 you can edit
your AUTOEXEC.BAT file with a line like:
set PATH=C:\MinGW\bin;%PATH%
or on NT/2000/XP, go to the Control Panel, (Performance and Maintenance),
System, Advanced, and edit the environment from there. If you use msys2
compilers, set your installed paths:
C:\msys2\mingw32\bin
or
C:\msys64\mingw32\bin
for 32bit. And 64bit:
C:\msys2\mingw64\bin
or
C:\msys64\mingw64\bin
Test if gcc is on your path. From a CMD (or COMMAND on '95/98) window:
C:\> gcc --version
gcc (GCC) 4.8.1
C:\> mingw32-make --version
GNU Make 3.82.90 (...etc...)
Now you are ready to rock 'n' roll. Unpack the vim sources (look on
www.vim.org for exactly which version of the vim files you need).
Change directory to 'vim\src':
C:\> cd vim\src
C:\VIM\SRC>
and you type:
mingw32-make -f Make_ming.mak gvim.exe
After churning for a while, you will end up with 'gvim.exe' in the 'vim\src'
directory.
You should not need to do *any* editing of any files to get vim compiled this
way. If, for some reason, you want the console-mode-only version of vim (this
is NOT recommended on Win32, especially on '95/'98!!!), you can use:
mingw32-make -f Make_ming.mak GUI=no vim.exe
If you are dismayed by how big the EXE is, I strongly recommend you get 'UPX'
(also free!) and compress the file (typical compression is 50%). UPX can be
found at
http://www.upx.org/
As of 2011, UPX still does not support compressing 64-bit EXE's; if you have
built a 64-bit vim then an alternative to UPX is 'MPRESS'. MPRESS can be found
at:
http://www.matcode.com/mpress.htm
ADDITION: NLS support with MinGW
(by Eduardo F. Amatria <eferna1@platea.pntic.mec.es>)
If you want National Language Support, read the file src/po/README_mingw.txt.
You need to uncomment lines in Make_ming.mak to have NLS defined.
3. Cygwin
=========
Use Make_cyg.mak with Cygwin's GCC. See
http://users.skynet.be/antoine.mechelynck/vim/compile.htm
With Cygnus gcc you should use the Unix Makefile instead (you need to get the
Unix archive then). Then you get a Cygwin application (feels like Vim is
running on Unix), while with Make_cyg.mak you get a Windows application (like
with the other makefiles).
4. Borland
===========
Use Make_bc5.mak with Borland C++ 5.x. See
http://users.skynet.be/antoine.mechelynck/vim/compile.htm
5. Cross compiling for Win32 from a Linux machine
=================================================
[Update of 1) needs to be verified]
If you like, you can compile the 'mingw' Win32 version from the comfort of
your Linux (or other unix) box. To do this, you need to follow a few steps:
1) Install the mingw32 cross-compiler. See
http://www.mingw.org/wiki/LinuxCrossMinGW
http://www.libsdl.org/extras/win32/cross/README.txt
2) Get and unpack both the Unix sources and the extra archive
3) in 'Make_cyg_ming.mak', set 'CROSS' to 'yes' instead of 'no'.
Make further changes to 'Make_cyg_ming.mak' and 'Make_ming.mak' as you
wish. If your cross-compiler prefix differs from the predefined value,
set 'CROSS_COMPILE' corresponding.
4) make -f Make_ming.mak gvim.exe
Now you have created the Windows binary from your Linux box! Have fun...
6. Building with Python support
===============================
For building with MSVC 2008 the "Windows Installer" from www.python.org
works fine.
When building, you need to set the following variables at least:
PYTHON: Where Python is installed. E.g. C:\Python27
DYNAMIC_PYTHON: Whether dynamic linking is used. Usually, set to yes.
PYTHON_VER: Python version. E.g. 27 for Python 2.7.X.
E.g. When using MSVC (as one line):
nmake -f Make_mvc.mak
PYTHON=C:\Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27
(rest written by Ron Aaron: <ronaharon@yahoo.com>)
Building with the mingw32 compiler, and the ActiveState ActivePython:
http://www.ActiveState.com/Products/ActivePython/
After installing the ActivePython, you will have to create a 'mingw32'
'libpython20.a' to link with:
cd $PYTHON/libs
pexports python20.dll > python20.def
dlltool -d python20.def -l libpython20.a
Once that is done, edit the 'Make_ming.mak' so the PYTHON variable points to
the root of the Python installation (C:\Python20, for example). If you are
cross-compiling on Linux with the mingw32 setup, you need to also convert all
the 'Include' files to *unix* line-endings. This bash command will do it
easily:
for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil
Now just do:
make -f Make_ming.mak gvim.exe
And if you use msys2 to build python support (as one line):
mingw32-make -f Make_ming.mak PYTHON=c:/msys64/mingw64
PYTHON_HOME=c:/msys64/mingw64
PYTHONINC=-Ic:/msys64/mingw64/include/python2.7
DYNAMIC_PYTHON=yes
PYTHON_VER=27
DYNAMIC_PYTHON_DLL=libpython2.7.dll
ARCH=x86-64
STATIC_STDCPLUS=yes
You will end up with a Python-enabled, Win32 version. Enjoy!
7. Building with Python3 support
================================
For building with MSVC 2008 the "Windows Installer" from www.python.org
works fine. Python 3.4 is recommended.
When building, you need to set the following variables at least:
PYTHON3: Where Python3 is installed. E.g. C:\Python34
DYNAMIC_PYTHON3: Whether dynamic linking is used. Usually, set to yes.
PYTHON3_VER: Python3 version. E.g. 34 for Python 3.4.X.
E.g. When using MSVC (as one line):
nmake -f Make_mvc.mak
PYTHON3=C:\Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34
8. Building with MzScheme/Racket support
========================================
1) Building with MzScheme support
(written by Sergey Khorev <sergey.khorev@gmail.com>)
Vim with MzScheme (http://www.plt-scheme.org/software/mzscheme) support can
be built with either MSVC, or MinGW, or Cygwin. Supported versions are 205 and
above (including 299 and 30x series).
The MSVC build is quite straightforward. Simply invoke (in one line)
nmake -fMake_mvc.mak MZSCHEME=<Path-to-MzScheme>
[MZSCHEME_VER=<MzScheme-version>] [DYNAMIC_MZSCHEME=<yes or no>]
where <MzScheme-version> is the last seven characters from MzScheme dll name
(libmzschXXXXXXX.dll).
If DYNAMIC_MZSCHEME=yes, resulting executable will not depend on MzScheme
DLL's, but will load them in runtime on demand.
Building dynamic MzScheme support on MinGW and Cygwin is similar. Take into
account that <Path-to-MzScheme> should contain slashes rather than backslashes
(e.g. d:/Develop/MzScheme)
"Static" MzScheme support (Vim executable will depend on MzScheme DLLs
explicitly) on MinGW and Cygwin requires additional step.
libmzschXXXXXXX.dll and libmzgcXXXXXXX.dll should be copied from
%WINDOWS%\System32 to other location (either build directory, some temporary
dir or even MzScheme home).
Pass that path as MZSCHEME_DLLS parameter for Make. E.g.,
make -f Make_cyg.mak MZSCHEME=d:/Develop/MzScheme MZSCHEME_VER=209_000
MZSCHEME_DLLS=c:/Temp DYNAMIC_MZSCHEME=no
After a successful build, these dlls can be freely removed, leaving them in
%WINDOWS%\System32 only.
2) Building with Racket support
MzScheme and PLT Scheme names have been rebranded as Racket. Vim with Racket
(https://racket-lang.org/) support can be built with either MSVC or MinGW (or
Cygwin).
You need to set the following variables:
MZSCHEME: Where Racket is installed.
E.g. C:\Program Files (x86)\Racket
DYNAMIC_MZSCHEME: Whether dynamic linking is used. Usually, set to yes.
MZSCHEME_VER: Racket DLL version. E.g. 3m_9z0ds0 for Racket 6.3.
MZSCHEME_COLLECTS: (Optional) Path of the collects directory used at
runtime. Default: $(MZSCHEME)\collects
User can override this with the PLTCOLLECTS environment
variable.
E.g. When using MSVC (as one line):
nmake -f Make_mvc.mak
MZSCHEME="C:\Program Files (x86)\Racket" DYNAMIC_MZSCHEME=yes
MZSCHEME_VER=3m_9z0ds0
Or when using MinGW (as one line):
mingw32-make -f Make_ming.mak
MZSCHEME='C:/Program\ Files\ (x86)/Racket' DYNAMIC_MZSCHEME=yes
MZSCHEME_VER=3m_9z0ds0
Spaces should be escaped with '\'.
9. Building with Lua support
============================
Vim with Lua support can be built with either MSVC or MinGW (or maybe Cygwin).
You can use binaries from LuaBinaries: http://luabinaries.sourceforge.net/
This also applies to when you get a Vim executable and don't build yourself,
do the part up to "Build".
1) Download and install LuaBinaries
Go to the Download page of LuaBinaries:
http://luabinaries.sourceforge.net/download.html
Download lua-X.Y.Z_Win32_dllw4_lib.zip for x86 or
lua-X.Y.Z_Win64_dllw4_lib.zip for x64. You can use them both for MSVC and
MinGW.
Unpack it to a working directory. E.g. C:\projects\lua53.
Lua's header files will be installed under the include directory.
Copy luaXY.dll to your Windows system directory. The system directory depends
on your Windows bitness and Vim bitness:
32-bit Vim on 32-bit Windows: C:\Windows\System32
32-bit Vim on 64-bit Windows: C:\Windows\SysWOW64
64-bit Vim on 64-bit Windows: C:\Windows\System32
Or another option is copying luaXY.dll to the directory where gvim.exe
(or vim.exe) is.
2) Build
You need to set LUA, DYNAMIC_LUA and LUA_VER.
LUA: Where Lua's header files are installed. E.g. C:\projects\lua53.
DYNAMIC_LUA: Whether dynamic linking is used. Set to yes.
LUA_VER: Lua version. E.g. 53 for Lua 5.3.X.
E.g. When using MSVC (as one line):
nmake -f Make_mvc.mak
LUA=C:\projects\lua53 DYNAMIC_LUA=yes LUA_VER=53
Or when using MinGW (as one line):
mingw32-make -f Make_mingw.mak
LUA=C:\projects\lua53 DYNAMIC_LUA=yes LUA_VER=53
Or when using Cygwin (as one line) (untested):
make -f Make_cyg.mak
LUA=/cygdrive/c/projects/lua53 DYNAMIC_LUA=yes LUA_VER=53
10. Building with Perl support
==============================
Vim with Perl support can be built with either MSVC or MinGW (or Cygwin).
You can use binaries from ActiveState (ActivePerl) or Strawberry Perl.
http://www.activestate.com/activeperl
http://strawberryperl.com/
When building, you need to set the following variables:
PERL: Where perl is installed. E.g. C:\Perl, C:\Strawberry\perl
DYNAMIC_PERL: Whether dynamic linking is used. Usually, set to yes.
PERL_VER: Perl version. E.g. 522 for Perl 5.22.X.
E.g. When using MSVC (as one line):
nmake -f Make_mvc.mak
PERL=C:\Perl DYNAMIC_PERL=yes PERL_VER=522
Or when using MinGW (as one line):
mingw32-make -f Make_mingw.mak
PERL=C:\Perl DYNAMIC_PERL=yes PERL_VER=522
11. Building with Ruby support
==============================
Vim with Ruby support can be built with either MSVC or MinGW (or Cygwin).
Ruby doesn't provide the official Windows binaries. The most widely used
Windows binaries might be RubyInstaller.
http://rubyinstaller.org/
If you use MinGW you can easily build with RubyInstaller, but if you use MSVC
you need some tricks described below.
(Another binary distribution is ActiveScriptRuby:
http://www.artonx.org/data/asr/)
When building, you need to set the following variables at least:
RUBY: Where ruby is installed. E.g. C:\Ruby22
DYNAMIC_RUBY: Whether dynamic linking is used. Usually, set to yes.
RUBY_VER: Ruby version. E.g. 22 for Ruby 2.2.X.
RUBY_VER_LONG: Ruby API version in a long format.
E.g. 2.2.0 for Ruby 2.2.X.
Ruby version vs. Ruby API version:
Ruby ver. | Ruby API ver.
=========================
1.8.X | 1.8
1.9.[1-3] | 1.9.1
2.0.0 | 2.0.0
2.X.Y | 2.X.0
(Ruby 1.9.0 is excluded from the table because it is an unstable version.)
A) Using MSVC
If you want to link with ruby, normally you must use the same compiler as
which was used to build the ruby binary. RubyInstaller is built with MinGW,
so normally you cannot use MSVC for building Vim if you want to link with
RubyInstaller. If you use a different compiler, there are mainly two problems:
config.h and Ruby's DLL name. Here are the steps for working around them:
1) Download and Install RubyInstaller.
You can install RubyInstaller with the default options and directory.
E.g.:
C:\Ruby22 (32-bit) or C:\Ruby22-x64 (64-bit)
Ruby 2.2.X is used in this example.
2) Download Ruby 2.2.X's source code and generate config.h:
cd C:\projects
git clone https://github.com/ruby/ruby.git -b ruby_2_2
cd ruby
win32\configure.bat
nmake .config.h.time
Note that ruby_2_2 is the branch name for Ruby 2.2.X's source code.
There is no need to build whole Ruby, just config.h is needed.
If you use 32-bit MSVC10, the config.h is generated in the
.ext\include\i386-mswin32_100 directory.
3) Install the generated config.h.
xcopy /s .ext\include C:\Ruby22\include\ruby-2.2.0
Note that 2.2.0 is Ruby API version of Ruby 2.2.X.
4) Build Vim. Note that you need to adjust some variables (as one line):
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=0x501
If you set WINVER explicitly, it must be set to >=0x500, when building
with Ruby 2.1 or later. (Default is 0x501.)
When using this trick, you also need to set RUBY_MSVCRT_NAME to msvcrt
which is used for the Ruby's DLL name.
B) Using MinGW
Using MinGW is easier than using MSVC when linking with RubyInstaller.
After you install RubyInstaller, just type this (as one line):
mingw32-make -f Make_ming.mak
RUBY=C:/Ruby22 DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_VER_LONG=2.2.0
WINVER=0x501
If you set WINVER explicitly, it must be set to >=0x500, when building with
Ruby 2.1 or later. (Default is 0x501.)
12. Building with Tcl support
=============================
Vim with Tcl support can be built with either MSVC or MinGW (or Cygwin).
You can use binaries from ActiveState (ActiveTcl).
http://www.activestate.com/activetcl
When building, you need to set the following variables:
TCL: Where tcl is installed. E.g. C:\Tcl86
DYNAMIC_TCL: Whether dynamic linking is used. Usually, set to yes.
TCL_VER: Tcl version in a short format. E.g. 86 for Tcl 8.6.X.
TCL_VER_LONG: Tcl version in a long format. E.g. 8.6 for Tcl 8.6.X.
E.g. When using MSVC (as one line):
nmake -f Make_mvc.mak
TCL=C:\Tcl86 DYNAMIC_TCL=yes TCL_VER=86 TCL_VER_LONG=8.6
Or when using MinGW (as one line):
mingw32-make -f Make_mingw.mak
TCL=C:\Tcl86 DYNAMIC_TCL=yes TCL_VER=86 TCL_VER_LONG=8.6
13. Windows 3.1x
================
The Windows 3.1x support was removed in patch 7.4.1364.
14. MS-DOS
==========
The MS-DOS support was removed in patch 7.4.1399.
15. Installing after building from sources
==========================================
[provided by Michael Soyka]
After you've built the Vim binaries as described above, you're ready to
install Vim on your system. However, if you've obtained the Vim sources
using Git, Mercurial or by downloading them as a unix tar file, you must
first create a "vim74" directory. If you instead downloaded the sources as
zip files, you can skip this setup as the zip archives already have the
correct directory structure.
A. Create a Vim "runtime" subdirectory named "vim74"
-----------------------------------------------------
If you obtained your Vim sources as zip files, you can skip this step.
Otherwise, continue reading.
Go to the directory that contains the Vim "src" and "runtime"
directories and create a new subdirectory named "vim74".
Copy the "runtime" files into "vim74":
copy runtime\* vim74
B. Copy the new binaries into the "vim74" directory
----------------------------------------------------
Regardless of how you installed the Vim sources, you need to copy the
new binaries you created above into "vim74":
copy src\*.exe vim74
copy src\GvimExt\gvimext.dll vim74
copy src\xxd\xxd.exe vim74
C. Move the "vim74" directory into the Vim installation subdirectory
---------------------------------------------------------------------
Move the "vim74" subdirectory into the subdirectory where you want Vim
to be installed. Typically, this subdirectory will be named "vim".
If you already have a "vim74" subdirectory in "vim", delete it first
by running its uninstal.exe program.
D. Install Vim
---------------
"cd" to your Vim installation subdirectory "vim\vim74" and run the
"install.exe" program. It will ask you a number of questions about
how you would like to have your Vim setup. Among these are:
- You can tell it to write a "_vimrc" file with your preferences in the
parent directory.
- It can also install an "Edit with Vim" entry in the Windows Explorer
popup menu.
- You can have it create batch files, so that you can run Vim from the
console or in a shell. You can select one of the directories in your
PATH or add the directory to PATH using the Windows Control Panel.
- Create entries for Vim on the desktop and in the Start menu.
Happy Vimming!
|