blob: a13dce0596a76b115ea9bcc376acc1bce17ff31f [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
30The currently preferred method is using the free Visual C++ Toolkit 2003.
Bram Moolenaar071d4272004-06-13 20:20:40 +000031
32
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000331. Microsoft Visual C++
34=======================
35
36Visual Studio
37-------------
38
39Building with Visual Studio (VS 98, VS .NET, VS .NET 2003, and VS .NET 2005)
40is straightforward. (These instructions should also work for VS 4 and VS 5.)
41
42To build Vim from the command line with MSVC, use Make_mvc.mak.
43Visual Studio installed a batch file called vcvars32.bat, which you must
44run to set up paths for nmake and MSVC.
45
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000046nmake -f Make_mvc.mak console Win32 SDK or Microsoft Visual C++
47nmake -f Make_mvc.mak GUI=yes GUI Microsoft Visual C++
48nmake -f Make_mvc.mak OLE=yes OLE Microsoft Visual C++
Bram Moolenaar362e1a32006-03-06 23:29:24 +000049nmake -f Make_mvc.mak PERL=C:\Perl PYTHON=C:\Python etc.
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000050 Perl, Python, etc.
Bram Moolenaar362e1a32006-03-06 23:29:24 +000051
52Make_mvc.mak allows a Vim to be built with various different features and
53debug support. Debugging with MS Devstudio is provided by Make_dvc.mak.
54For a description of the use of Make_dvc.mak, look in Make_mvc.mak.
55
56For compiling Gvim with IME support on far-east Windows, add IME=yes
57to the parameters you pass to Make_mvc.mak.
58
59To build Vim from within the Visual Studio IDE, open the Make_ivc.mak project.
60(Note: Make_ivc.mak is not as rich as Make_mvc.mak, which allows for
61far more configuration.) Make_ivc.mak can also be built with nmake.
62
63nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim"
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000064 GUI Microsoft Visual C++ 4.x or later
Bram Moolenaar362e1a32006-03-06 23:29:24 +000065nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim OLE"
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000066 OLE Microsoft Visual C++ 4.x or later
Bram Moolenaar362e1a32006-03-06 23:29:24 +000067
68See the specific files for comments and options.
69
70These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and
71Ron Aaron; they have been tested.
72
73
74Visual C++ Toolkit 2003
75-----------------------
76
77You can download the Microsoft Visual C++ Toolkit 2003 from
78 http://msdn.microsoft.com/visualc/vctoolkit2003/
79This contains the command-line tools (compiler, linker, CRT headers,
80and libraries) for Visual Studio .NET 2003, but not the Visual Studio IDE.
81To compile and debug Vim with the VC2003 Toolkit, you will also need
82|ms-platform-sdk|, |dotnet-1.1-redist|, |dotnet-1.1-sdk|,
83and |windbg-download|.
84
85It's easier to download Visual C++ 2005 Express Edition, |msvc-2005-express|.
86The advantage of the VC 2003 Toolkit is that it will be freely available
87long after VC 2005 Express Edition stops being free in November 2006.
88
89The free Code::Blocks IDE works with the VC2003 Toolkit, as described at
90 http://wiki.codeblocks.org/index.php?title=Integrating_Microsoft_Visual_Toolkit_2003_with_Code::Blocks_IDE
91(This site also takes you through configuring a number of other
92free C compilers for Win32.)
93
94To compile Vim using the VC2003 Toolkit and Make_mvc.mak, you must first
95execute the following commands in a cmd.exe window (the msvcsetup.bat batch
96file can be used):
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000097
Bram Moolenaar362e1a32006-03-06 23:29:24 +000098 set PATH=%SystemRoot%\Microsoft.NET\Framework\v1.1.4322;%PATH%
99 call "%VCToolkitInstallDir%vcvars32.bat"
100 set MSVCVer=7.1
101 call "%ProgramFiles%\Microsoft Platform SDK\SetEnv.Cmd"
102 set LIB=%ProgramFiles%\Microsoft Visual Studio .NET 2003\Vc7\lib;%LIB%
103
104Now you can build Vim with Make_mvc.mak.
105
106
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000107Getting the Windows Platform SDK *ms-platform-sdk*
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000108
109You will also need a copy of the Windows Platform SDK from
110 http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
111Specifically, you need the Windows Core SDK subset of the Platform SDK,
112which contains the Windows headers and libraries.
113
114
115Getting the .NET Framework 1.1 Runtime *dotnet-1.1-redist*
116
117You need the .NET Framework 1.1 Redistributable Package from
118 http://www.microsoft.com/downloads/details.aspx?familyid=262d25e3-f589-4842-8157-034d1e7cf3a3
119or from Windows Update:
120 http://windowsupdate.microsoft.com/
121This is needed to install |dotnet-1.1-sdk|. It also contains cvtres.exe,
122which is needed to link Vim.
123
124
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000125Getting the .NET Framework 1.1 SDK *dotnet-1.1-sdk*
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000126
127You need the .NET Framework 1.1 SDK from
128 http://www.microsoft.com/downloads/details.aspx?familyid=9b3a2ca6-3647-4070-9f41-a333c6b9181d
129This contains some additional libraries needed to compile Vim,
130such as msvcrt.lib. You must install |dotnet-1.1-redist| before
131installing the .NET 1.1 SDK.
132
133
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000134Getting the WinDbg debugger *windbg-download*
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000135
136The Debugging Tools for Windows can be downloaded from
137 http://www.microsoft.com/whdc/devtools/debugging/default.mspx
138This includes the WinDbg debugger, which you will want if you ever need
139to debug Vim itself. An earlier version of the Debugging Tools
140is also available through the Platform SDK, |ms-platform-sdk|.
141
142
143Visual C++ 2005 Express Edition
144-------------------------------
145
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000146Visual C++ 2005 Express Edition can be downloaded for free from:
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000147 http://msdn.microsoft.com/vstudio/express/visualC/default.aspx
148This includes the IDE and the debugger. You will also need
149|ms-platform-sdk|. You can build Vim with Make_mvc.mak.
150
151Instructions for integrating the Platform SDK into VC Express:
152 http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
153
154
1552. MinGW
156========
157
158(written by Ron Aaron: <ronaharon@yahoo.com>)
159
160This is about how to produce a Win32 binary of gvim with MinGW.
161
162First, you need to get the 'mingw32' compiler, which is free for the download
163at:
164
165 http://www.mingw.org/
166
167Once you have downloaded the compiler binaries, unpack them on your hard disk
168somewhere, and put them on your PATH. If you are on Win95/98 you can edit
169your AUTOEXEC.BAT file with a line like:
170
171 set PATH=C:\GCC-2.95.2\BIN;%PATH%
172
173or on NT/2000/XP, go to the Control Panel, (Performance and Maintenance),
174System, Advanced, and edit the environment from there.
175
176Test if gcc is on your path. From a CMD (or COMMAND on '95/98) window:
177
178 C:\> gcc --version
179 2.95.2
180
181 C:\> make --version
182 GNU Make version 3.77 (...etc...)
183
184Now you are ready to rock 'n' roll. Unpack the vim sources (look on
185www.vim.org for exactly which version of the vim files you need).
186
187Change directory to 'vim\src':
188
189 C:\> cd vim\src
190 C:\VIM\SRC>
191
192and you type:
193
194 make -f Make_ming.mak gvim.exe
195
196After churning for a while, you will end up with 'gvim.exe' in the 'vim\src'
197directory.
198
199You should not need to do *any* editing of any files to get vim compiled this
200way. If, for some reason, you want the console-mode-only version of vim (this
201is NOT recommended on Win32, especially on '95/'98!!!), you need only change
202the 'gvim.exe' to 'vim.exe' in the 'make' commands given above.
203
204If you are dismayed by how big the EXE is, I strongly recommend you get 'UPX'
205(also free!) and compress the file (typical compression is 50%). UPX can be
206found at
207 http://www.upx.org/
208
209ADDITION: NLS support with MinGW
210
211(by Eduardo F. Amatria <eferna1@platea.pntic.mec.es>)
212
213If you want National Language Support, read the file src/po/README_mingw.txt.
214You need to uncomment lines in Make_ming.mak to have NLS defined.
215
216
2173. Cygwin
218=========
219
220Use Make_cyg.mak with Cygwin's GCC. See
221 http://users.skynet.be/antoine.mechelynck/vim/compile.htm
222
223The Cygnus one many not fully work yet.
224With Cygnus gcc you can use the Unix Makefile instead (you need to get the
225Unix archive then). Then you get a Cygwin application (feels like Vim is
226runnin on Unix), while with Make_cyg.mak you get a Windows application (like
227with the other makefiles).
228
229
2304. Borland
231===========
232
233Use Make_bc5.mak with Borland C++ 5.x. See
234 http://users.skynet.be/antoine.mechelynck/vim/compile.htm
235
236
2375. Cross compiling for Win32 from a Linux machine
238=================================================
239
240[Update of 1) needs to be verified]
241
242If you like, you can compile the 'mingw' Win32 version from the comfort of
243your Linux (or other unix) box. To do this, you need to follow a few steps:
244 1) Install the mingw32 cross-compiler. See
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000245 http://www.libsdl.org/extras/win32/cross/README.txt
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000246 2) get the *unix* version of the vim sources
247 3) in 'Make_ming.mak', set 'CROSS' to '1' instead of '0'.
248 4) make -f Make_ming.mak gvim.exe
249
250Now you have created the Windows binary from your Linux box! Have fun...
251
252
2536. Building with Python support
254===============================
255
256(written by Ron Aaron: <ronaharon@yahoo.com>)
257
258This has been tested with the mingw32 compiler, and the ActiveState
259ActivePython:
260 http://www.ActiveState.com/Products/ActivePython/
261
262After installing the ActivePython, you will have to create a 'mingw32'
263'libpython20.a' to link with:
264 cd $PYTHON/libs
265 pexports python20.dll > python20.def
266 dlltool -d python20.def -l libpython20.a
267
268Once that is done, edit the 'Make_ming.mak' so the PYTHON variable points to
269the root of the Python installation (C:\Python20, for example). If you are
270cross-compiling on Linux with the mingw32 setup, you need to also convert all
271the 'Include' files to *unix* line-endings. This bash command will do it
272easily:
273 for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil
274
275Now just do:
276 make -f Make_ming.mak gvim.exe
277
278and you will end up with a Python-enabled, Win32 version. Enjoy!
279
280
2817. Building with MzScheme support
282=================================
283
284(written by Sergey Khorev <sergey.khorev@gmail.com>)
285
286Vim with MzScheme (http://www.plt-scheme.org/software/mzscheme) support can
287be built with either MSVC, or MinGW, or Cygwin. Supported versions are 205 and
288above (including 299 and 30x series).
289
290The MSVC build is quite straightforward. Simply invoke (in one line)
291nmake -fMake_mvc.mak MZSCHEME=<Path-to-MzScheme>
292 [MZSCHEME_VER=<MzScheme-version>] [DYNAMIC_MZSCHEME=<yes or no>]
293where <MzScheme-version> is the last seven characters from MzScheme dll name
294(libmzschXXXXXXX.dll).
295If DYNAMIC_MZSCHEME=yes, resulting executable will not depend on MzScheme
296DLL's, but will load them in runtime on demand.
297
298Building dynamic MzScheme support on MinGW and Cygwin is similar. Take into
299account that <Path-to-MzScheme> should contain slashes rather than backslashes
300(e.g. d:/Develop/MzScheme)
301
302"Static" MzScheme support (Vim executable will depend on MzScheme DLLs
303explicitly) on MinGW and Cygwin requires additional step.
304
305libmzschXXXXXXX.dll and libmzgcXXXXXXX.dll should be copied from
306%WINDOWS%\System32 to other location (either build directory, some temporary
307dir or even MzScheme home).
308
309Pass that path as MZSCHEME_DLLS parameter for Make. E.g.,
310make -f Make_cyg.mak MZSCHEME=d:/Develop/MzScheme MZSCHEME_VER=209_000
311 MZSCHEME_DLLS=c:/Temp DYNAMIC_MZSCHEME=no
312
313After a successful build, these dlls can be freely removed, leaving them in
314%WINDOWS%\System32 only.
315
316
3178. Windows 3.1x
318===============
319
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000320make -f Make_w16.mak 16 bit, Borland C++ 5.0
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000321
322Warning: Be sure to use the right make.exe. It should be Borland make.
323
324You will almost certainly have to change the paths for libs and include files
325in the Makefile. Look for "D:\BC5" and "ctl3dv2". You will get a number of
326warnings which can be ignored ( _chmod, precompiled header files, and
327"possibly incorrect assignment").
328
329The makefile should also work for BC++ 4.0 and 4.5, but may need tweaking to
330remove unsupported compiler & liker options.
331
332For making the Win32s version, you need Microsoft Visual C++ 4.1 OR EARLIER.
333In MSVC 4.2 support for Win32s was dropped! Use this command:
334 nmake -f Make_mvc.mak GUI=yes
335
336
3379. MS-DOS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000338=========
339
340Summary:
Bram Moolenaar362e1a32006-03-06 23:29:24 +0000341ren Make_bc3.mak Makefile; make 16 bit, Borland C++ and Turbo C++
342ren Make_tcc.mak Makefile; make 16 bit, Turbo C
Bram Moolenaarc9b4b052006-04-30 18:54:39 +0000343make -f Make_djg.mak 32 bit, DJGPP 2.0
344make -f Make_bc5.mak 32 bit, Borland C++ 5.x (edit it to
345 define DOS)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000346
347Warning: Be sure to use the right make.exe. Microsoft C make doesn't work;
348Borland make only works with Make_bc3.mak, Make_bc5.mak and Make_tcc.mak;
349DJGPP/GNU make must be used for Make_djg.mak.
350
351The Borland C++ compiler has been used to generate the MS-DOS executable; it
352should work without problems. You will probably have to change the paths for
353LIBPATH and INCLUDEPATH in the start of the Makefile. You will get two
354warnings which can be ignored (one about _chmod and one about precompiled
355header files).
356
357The "spawno" library by Ralf Brown was used in order to free memory when Vim
358starts a shell or other external command. Only about 200 bytes are taken from
359conventional memory. When recompiling get the spawno library from Simtel,
360directory "msdos/c". It is called something like "spwno413.zip". Or follow
361the instructions in the Makefile to remove the library.
362
363The Turbo C Makefile has not been tested much lately. It is included for those
364that don't have C++. You may need to make a few changes to get it to work.
365
366DJGPP needs to be installed properly to compile Vim; you need a lot of things
367before it works. When your setup is OK, Vim should compile with just one
368warning (about an argument to signal()).
369
370Make_bc5.mak is for those that have Borland C++ 5.0 or later. At the top of
371the file, there are some variables you can change to make either a 32-bit
372Windows exe (GUI or console mode), or a 16-bit MS-DOS version.
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000373NOTE: multi-byte support is broken in the Borland libraries, not everything
374will work properly! Esp. handling multi-byte file names.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000375
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000376If you get all kinds of strange error messages when compiling, try adding
377changing the file format from "unix" to "dos".