blob: ae65be04e4ce4369f20717b80537adbc4f5d3f37 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001INSTALLpc.txt - Installation of Vim on PC
2
3This file contains instructions for compiling Vim. If you already have an
4executable version of Vim, you don't need this.
5
Bram Moolenaar362e1a32006-03-06 23:29:24 +00006More information can be found here: (Very stale now.)
Bram Moolenaar071d4272004-06-13 20:20:40 +00007
Bram Moolenaar362e1a32006-03-06 23:29:24 +00008 http://mywebpage.netscape.com/sharppeople/vim/howto/
Bram Moolenaar071d4272004-06-13 20:20:40 +00009
10The file "feature.h" can be edited to match your preferences. You can skip
11this, then you will get the default behavior as is documented, which should
12be fine for most people.
13
Bram Moolenaar362e1a32006-03-06 23:29:24 +000014With the exception of the last two sections (Windows 3.1 and MS-DOS),
15this document assumes that you are building Vim for Win32
16(Windows NT/2000/XP/2003/Vista and Windows 95/98/Me)
17
Bram Moolenaar071d4272004-06-13 20:20:40 +000018
19Contents:
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000201. Microsoft Visual C++
212. Using MinGW
223. Cygwin
234. Borland
245. Cross compiling for Win32 from a Linux machine
256. Building with Python support
267. Building with MzScheme support
278. Windows 3.1
289. MS-DOS
29
Bram Moolenaarc236c162008-07-13 17:41:49 +000030The currently preferred method is using the free Visual C++ Toolkit 2008
31|msvc-2008-express|. If you need the executable to run on Windows 98 or ME,
32use the 2003 one |msvc-2003-toolkit|.
Bram Moolenaar071d4272004-06-13 20:20:40 +000033
34
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000351. Microsoft Visual C++
36=======================
37
38Visual Studio
39-------------
40
Bram Moolenaar98385dc2008-06-20 14:52:32 +000041Building with Visual Studio (VS 98, VS .NET, VS .NET 2003, VS 2005, and VS 2008)
Bram Moolenaar362e1a32006-03-06 23:29:24 +000042is straightforward. (These instructions should also work for VS 4 and VS 5.)
43
44To build Vim from the command line with MSVC, use Make_mvc.mak.
45Visual Studio installed a batch file called vcvars32.bat, which you must
46run to set up paths for nmake and MSVC.
47
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000048nmake -f Make_mvc.mak console Win32 SDK or Microsoft Visual C++
49nmake -f Make_mvc.mak GUI=yes GUI Microsoft Visual C++
50nmake -f Make_mvc.mak OLE=yes OLE Microsoft Visual C++
Bram Moolenaar362e1a32006-03-06 23:29:24 +000051nmake -f Make_mvc.mak PERL=C:\Perl PYTHON=C:\Python etc.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000052 Perl, Python, etc.
Bram Moolenaar362e1a32006-03-06 23:29:24 +000053
54Make_mvc.mak allows a Vim to be built with various different features and
55debug support. Debugging with MS Devstudio is provided by Make_dvc.mak.
56For a description of the use of Make_dvc.mak, look in Make_mvc.mak.
57
58For compiling Gvim with IME support on far-east Windows, add IME=yes
59to the parameters you pass to Make_mvc.mak.
60
61To build Vim from within the Visual Studio IDE, open the Make_ivc.mak project.
62(Note: Make_ivc.mak is not as rich as Make_mvc.mak, which allows for
63far more configuration.) Make_ivc.mak can also be built with nmake.
64
65nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim"
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000066 GUI Microsoft Visual C++ 4.x or later
Bram Moolenaar362e1a32006-03-06 23:29:24 +000067nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim OLE"
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000068 OLE Microsoft Visual C++ 4.x or later
Bram Moolenaar362e1a32006-03-06 23:29:24 +000069
70See the specific files for comments and options.
71
72These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and
73Ron Aaron; they have been tested.
74
75
Bram Moolenaarc236c162008-07-13 17:41:49 +000076Visual C++ Toolkit 2003 *msvc-2003-toolkit*
Bram Moolenaar362e1a32006-03-06 23:29:24 +000077-----------------------
78
Bram Moolenaarc236c162008-07-13 17:41:49 +000079You could download the Microsoft Visual C++ Toolkit 2003 from
Bram Moolenaar362e1a32006-03-06 23:29:24 +000080 http://msdn.microsoft.com/visualc/vctoolkit2003/
Bram Moolenaarc236c162008-07-13 17:41:49 +000081Unfortunately this URL is no longer valid. Inofficial downloads appear to be
82available from links mentioned on these pages (use at your own risk):
83 http://www.filewatcher.com/m/VCToolkitSetup.exe.32952488.0.0.html
84 http://feargame.net/wiki/index.php?title=Building_Source_with_the_VC2003_Toolkit
85
Bram Moolenaar362e1a32006-03-06 23:29:24 +000086This contains the command-line tools (compiler, linker, CRT headers,
87and libraries) for Visual Studio .NET 2003, but not the Visual Studio IDE.
88To compile and debug Vim with the VC2003 Toolkit, you will also need
89|ms-platform-sdk|, |dotnet-1.1-redist|, |dotnet-1.1-sdk|,
90and |windbg-download|.
91
Bram Moolenaar0fde2902008-03-16 13:54:13 +000092It's easier to download Visual C++ 2008 Express Edition, |msvc-2008-express|,
93which is freely available in perpetuity.
Bram Moolenaar362e1a32006-03-06 23:29:24 +000094
95The free Code::Blocks IDE works with the VC2003 Toolkit, as described at
96 http://wiki.codeblocks.org/index.php?title=Integrating_Microsoft_Visual_Toolkit_2003_with_Code::Blocks_IDE
97(This site also takes you through configuring a number of other
98free C compilers for Win32.)
99
100To compile Vim using the VC2003 Toolkit and Make_mvc.mak, you must first
101execute the following commands in a cmd.exe window (the msvcsetup.bat batch
102file can be used):
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000103
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000104 set PATH=%SystemRoot%\Microsoft.NET\Framework\v1.1.4322;%PATH%
105 call "%VCToolkitInstallDir%vcvars32.bat"
106 set MSVCVer=7.1
107 call "%ProgramFiles%\Microsoft Platform SDK\SetEnv.Cmd"
108 set LIB=%ProgramFiles%\Microsoft Visual Studio .NET 2003\Vc7\lib;%LIB%
109
110Now you can build Vim with Make_mvc.mak.
111
112
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000113Getting the Windows Platform SDK *ms-platform-sdk*
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000114
115You will also need a copy of the Windows Platform SDK from
116 http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
117Specifically, you need the Windows Core SDK subset of the Platform SDK,
118which contains the Windows headers and libraries.
119
120
121Getting the .NET Framework 1.1 Runtime *dotnet-1.1-redist*
122
123You need the .NET Framework 1.1 Redistributable Package from
124 http://www.microsoft.com/downloads/details.aspx?familyid=262d25e3-f589-4842-8157-034d1e7cf3a3
125or from Windows Update:
126 http://windowsupdate.microsoft.com/
127This is needed to install |dotnet-1.1-sdk|. It also contains cvtres.exe,
128which is needed to link Vim.
129
130
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000131Getting the .NET Framework 1.1 SDK *dotnet-1.1-sdk*
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000132
133You need the .NET Framework 1.1 SDK from
134 http://www.microsoft.com/downloads/details.aspx?familyid=9b3a2ca6-3647-4070-9f41-a333c6b9181d
135This contains some additional libraries needed to compile Vim,
136such as msvcrt.lib. You must install |dotnet-1.1-redist| before
137installing the .NET 1.1 SDK.
138
139
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000140Getting the WinDbg debugger *windbg-download*
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000141
142The Debugging Tools for Windows can be downloaded from
143 http://www.microsoft.com/whdc/devtools/debugging/default.mspx
144This includes the WinDbg debugger, which you will want if you ever need
145to debug Vim itself. An earlier version of the Debugging Tools
146is also available through the Platform SDK, |ms-platform-sdk|.
147
148
Bram Moolenaar98385dc2008-06-20 14:52:32 +0000149Visual C++ 2005 Express Edition *msvc-2005-express*
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000150-------------------------------
151
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000152Visual C++ 2005 Express Edition can be downloaded for free from:
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000153 http://msdn.microsoft.com/vstudio/express/visualC/default.aspx
154This includes the IDE and the debugger. You will also need
155|ms-platform-sdk|. You can build Vim with Make_mvc.mak.
156
157Instructions for integrating the Platform SDK into VC Express:
158 http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
159
160
Bram Moolenaar0fde2902008-03-16 13:54:13 +0000161Visual C++ 2008 Express Edition *msvc-2008-express*
162-------------------------------
163
164Visual C++ 2008 Express Edition can be downloaded for free from:
Bram Moolenaara7241f52008-06-24 20:39:31 +0000165 http://www.microsoft.com/express/vc/Default.aspx
166This includes the IDE and the debugger.
Bram Moolenaar0fde2902008-03-16 13:54:13 +0000167
Bram Moolenaara7241f52008-06-24 20:39:31 +0000168To set the environment execute the msvc2008.bat script. You can then build
169Vim with Make_mvc.mak.
Bram Moolenaar98385dc2008-06-20 14:52:32 +0000170
171
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001722. MinGW
173========
174
175(written by Ron Aaron: <ronaharon@yahoo.com>)
176
177This is about how to produce a Win32 binary of gvim with MinGW.
178
179First, you need to get the 'mingw32' compiler, which is free for the download
180at:
181
182 http://www.mingw.org/
183
184Once you have downloaded the compiler binaries, unpack them on your hard disk
185somewhere, and put them on your PATH. If you are on Win95/98 you can edit
186your AUTOEXEC.BAT file with a line like:
187
188 set PATH=C:\GCC-2.95.2\BIN;%PATH%
189
190or on NT/2000/XP, go to the Control Panel, (Performance and Maintenance),
191System, Advanced, and edit the environment from there.
192
193Test if gcc is on your path. From a CMD (or COMMAND on '95/98) window:
194
195 C:\> gcc --version
196 2.95.2
197
198 C:\> make --version
199 GNU Make version 3.77 (...etc...)
200
201Now you are ready to rock 'n' roll. Unpack the vim sources (look on
202www.vim.org for exactly which version of the vim files you need).
203
204Change directory to 'vim\src':
205
206 C:\> cd vim\src
207 C:\VIM\SRC>
208
209and you type:
210
211 make -f Make_ming.mak gvim.exe
212
213After churning for a while, you will end up with 'gvim.exe' in the 'vim\src'
214directory.
215
216You should not need to do *any* editing of any files to get vim compiled this
217way. If, for some reason, you want the console-mode-only version of vim (this
Bram Moolenaard8e21d32010-01-06 21:16:31 +0100218is NOT recommended on Win32, especially on '95/'98!!!), you need can use:
219
220 make -f Make_ming.mak GUI=no vim.exe
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000221
222If you are dismayed by how big the EXE is, I strongly recommend you get 'UPX'
223(also free!) and compress the file (typical compression is 50%). UPX can be
224found at
225 http://www.upx.org/
226
227ADDITION: NLS support with MinGW
228
229(by Eduardo F. Amatria <eferna1@platea.pntic.mec.es>)
230
231If you want National Language Support, read the file src/po/README_mingw.txt.
232You need to uncomment lines in Make_ming.mak to have NLS defined.
233
234
2353. Cygwin
236=========
237
238Use Make_cyg.mak with Cygwin's GCC. See
239 http://users.skynet.be/antoine.mechelynck/vim/compile.htm
240
241The Cygnus one many not fully work yet.
242With Cygnus gcc you can use the Unix Makefile instead (you need to get the
243Unix archive then). Then you get a Cygwin application (feels like Vim is
244runnin on Unix), while with Make_cyg.mak you get a Windows application (like
245with the other makefiles).
246
247
2484. Borland
249===========
250
251Use Make_bc5.mak with Borland C++ 5.x. See
252 http://users.skynet.be/antoine.mechelynck/vim/compile.htm
253
254
2555. Cross compiling for Win32 from a Linux machine
256=================================================
257
258[Update of 1) needs to be verified]
259
260If you like, you can compile the 'mingw' Win32 version from the comfort of
261your Linux (or other unix) box. To do this, you need to follow a few steps:
262 1) Install the mingw32 cross-compiler. See
Bram Moolenaard8e21d32010-01-06 21:16:31 +0100263 http://www.mingw.org/wiki/LinuxCrossMinGW
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000264 http://www.libsdl.org/extras/win32/cross/README.txt
Bram Moolenaara7241f52008-06-24 20:39:31 +0000265 2) Get and unpack both the Unix sources and the extra archive
266 3) in 'Make_ming.mak', set 'CROSS' to 'yes' instead of 'no'.
267 Make further changes to 'Make_ming.mak' as you wish.
Bram Moolenaard8e21d32010-01-06 21:16:31 +0100268 If your cross-compiler prefix differs from the predefined value,
269 set 'CROSS_COMPILE' corresponding.
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000270 4) make -f Make_ming.mak gvim.exe
271
272Now you have created the Windows binary from your Linux box! Have fun...
273
274
2756. Building with Python support
276===============================
277
278(written by Ron Aaron: <ronaharon@yahoo.com>)
279
280This has been tested with the mingw32 compiler, and the ActiveState
281ActivePython:
282 http://www.ActiveState.com/Products/ActivePython/
283
284After installing the ActivePython, you will have to create a 'mingw32'
285'libpython20.a' to link with:
286 cd $PYTHON/libs
287 pexports python20.dll > python20.def
288 dlltool -d python20.def -l libpython20.a
289
290Once that is done, edit the 'Make_ming.mak' so the PYTHON variable points to
291the root of the Python installation (C:\Python20, for example). If you are
292cross-compiling on Linux with the mingw32 setup, you need to also convert all
293the 'Include' files to *unix* line-endings. This bash command will do it
294easily:
295 for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil
296
297Now just do:
298 make -f Make_ming.mak gvim.exe
299
300and you will end up with a Python-enabled, Win32 version. Enjoy!
301
302
3037. Building with MzScheme support
304=================================
305
306(written by Sergey Khorev <sergey.khorev@gmail.com>)
307
308Vim with MzScheme (http://www.plt-scheme.org/software/mzscheme) support can
309be built with either MSVC, or MinGW, or Cygwin. Supported versions are 205 and
310above (including 299 and 30x series).
311
312The MSVC build is quite straightforward. Simply invoke (in one line)
313nmake -fMake_mvc.mak MZSCHEME=<Path-to-MzScheme>
314 [MZSCHEME_VER=<MzScheme-version>] [DYNAMIC_MZSCHEME=<yes or no>]
315where <MzScheme-version> is the last seven characters from MzScheme dll name
316(libmzschXXXXXXX.dll).
317If DYNAMIC_MZSCHEME=yes, resulting executable will not depend on MzScheme
318DLL's, but will load them in runtime on demand.
319
320Building dynamic MzScheme support on MinGW and Cygwin is similar. Take into
321account that <Path-to-MzScheme> should contain slashes rather than backslashes
322(e.g. d:/Develop/MzScheme)
323
324"Static" MzScheme support (Vim executable will depend on MzScheme DLLs
325explicitly) on MinGW and Cygwin requires additional step.
326
327libmzschXXXXXXX.dll and libmzgcXXXXXXX.dll should be copied from
328%WINDOWS%\System32 to other location (either build directory, some temporary
329dir or even MzScheme home).
330
331Pass that path as MZSCHEME_DLLS parameter for Make. E.g.,
332make -f Make_cyg.mak MZSCHEME=d:/Develop/MzScheme MZSCHEME_VER=209_000
333 MZSCHEME_DLLS=c:/Temp DYNAMIC_MZSCHEME=no
334
335After a successful build, these dlls can be freely removed, leaving them in
336%WINDOWS%\System32 only.
337
338
3398. Windows 3.1x
340===============
341
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000342make -f Make_w16.mak 16 bit, Borland C++ 5.0
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000343
344Warning: Be sure to use the right make.exe. It should be Borland make.
345
346You will almost certainly have to change the paths for libs and include files
347in the Makefile. Look for "D:\BC5" and "ctl3dv2". You will get a number of
348warnings which can be ignored ( _chmod, precompiled header files, and
349"possibly incorrect assignment").
350
351The makefile should also work for BC++ 4.0 and 4.5, but may need tweaking to
352remove unsupported compiler & liker options.
353
354For making the Win32s version, you need Microsoft Visual C++ 4.1 OR EARLIER.
355In MSVC 4.2 support for Win32s was dropped! Use this command:
356 nmake -f Make_mvc.mak GUI=yes
357
358
3599. MS-DOS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000360=========
361
362Summary:
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000363ren Make_bc3.mak Makefile; make 16 bit, Borland C++ and Turbo C++
364ren Make_tcc.mak Makefile; make 16 bit, Turbo C
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000365make -f Make_djg.mak 32 bit, DJGPP 2.0
366make -f Make_bc5.mak 32 bit, Borland C++ 5.x (edit it to
367 define DOS)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000368
369Warning: Be sure to use the right make.exe. Microsoft C make doesn't work;
370Borland make only works with Make_bc3.mak, Make_bc5.mak and Make_tcc.mak;
371DJGPP/GNU make must be used for Make_djg.mak.
372
373The Borland C++ compiler has been used to generate the MS-DOS executable; it
374should work without problems. You will probably have to change the paths for
375LIBPATH and INCLUDEPATH in the start of the Makefile. You will get two
376warnings which can be ignored (one about _chmod and one about precompiled
377header files).
378
379The "spawno" library by Ralf Brown was used in order to free memory when Vim
380starts a shell or other external command. Only about 200 bytes are taken from
381conventional memory. When recompiling get the spawno library from Simtel,
382directory "msdos/c". It is called something like "spwno413.zip". Or follow
383the instructions in the Makefile to remove the library.
384
385The Turbo C Makefile has not been tested much lately. It is included for those
386that don't have C++. You may need to make a few changes to get it to work.
387
388DJGPP needs to be installed properly to compile Vim; you need a lot of things
389before it works. When your setup is OK, Vim should compile with just one
390warning (about an argument to signal()).
391
392Make_bc5.mak is for those that have Borland C++ 5.0 or later. At the top of
393the file, there are some variables you can change to make either a 32-bit
394Windows exe (GUI or console mode), or a 16-bit MS-DOS version.
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000395NOTE: multi-byte support is broken in the Borland libraries, not everything
396will work properly! Esp. handling multi-byte file names.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000397
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000398If you get all kinds of strange error messages when compiling, try adding
399changing the file format from "unix" to "dos".