René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Installing MinGW, compiling Perl and vim | ||
I am working on a new laptop. The first thing I need to
have installed is MinGW, Perl and vim.
Note, the Laptop in question is a Windows Laptop. So, this page is probably less than
useless for Unix/Linux users, but they will know that already.
Getting MinGW
MinGW (as of version 3.1.0) consists of the following 7 packages
Although these packages can be downloaded seperatly, for first time users, I recommend to
download the entire package from
http://www.mingw.org/download.shtml.
It is found in the section labeled Current (and is named MinGW)
Note, however, that MinGW can not be downloaded directly from
the download page, instead, by clicking on
the link you're brought to the download server
of sourceforge where you have to choose a mirror.
The downloaded .exe is a traditional setup program that leads you through the setup process.
This site [at archive.org as the
original site is now defunct] points out that MinGW should not be installed into c:\Program Files. I have never tried, so I don't know
if this advice is still valid.
After installing MinGW, the PATH environment variable should be set
to the MinGW-dir\bin directory.
MinGW's make utility is called mingw32-make.exe. Because I am too lazy to enter that word when
I want to make a project, I create a .bat file called make.bat that calls mingw32-make.exe:
make.bat
mingw32-make %* Compiling Perldmake
Unfortunately, MinGW's make cannot handle the makefiles that come with the source for Perl.
dmake is needed.
The unzipped dmake.exe should go into a place where %PATH% points at.
Downloading
The sources for Perl can be downloaded from http://www.cpan.org/src/README.html. They're
called stable.tar.gz.
Adapting the makefile
In order to compile Perl, one must open the command prompt (cmd.exe) and go to
the perl-unzipped-dir\win32 directory.
This directory has a makefile named makefile.mk which will be used. This makefile
allows to define some settings. I find the following useful or mandatory:
INST_DRV and INST_TOP. These variables define where Perl's root will be installed.
I want Perl to be under c:\perl, so I set these variable like so:
INST_DRV *= c: INST_TOP *= $(INST_DRV)\perl
I am compiling with gcc, so I have to set CCTYPE to GCC:
# MinGW with gcc-2.95.2 or later CCTYPE *= GCC
I also need to tell where gcc had been installed through CCHOME. My MinGW's root is
c:\rene\MinGW, so I change the (bold) line:
.IF "$(CCTYPE)" == "BORLAND" CCHOME *= C:\borland\bcc55 .ELIF "$(CCTYPE)" == "GCC" CCHOME *= C:\Rene\MinGW .ELSE CCHOME *= $(MSVCDIR) .ENDIF CCINCDIR *= $(CCHOME)\include CCLIBDIR *= $(CCHOME)\lib Compiling
Now, that a c compiler and dmake is installed, and the makefile had been changed,
the system is ready to compile Perl. dmake.exe is invoked. The -f flags tells
which makefile has to be used.
dmake -f makefile.mk
This should build everything. Specifically, it will create perl.exe,
perl58.dll at the perl toplevel, and various other extension dll's
under the lib\auto directory.
Testing the compilation
After perl had been compiled, it should be tested. This can also be done with the makefile
and its special target test.
dmake -f makefile.mk test
This will perform some tests of which each should be successful. The test will report this
with something like:
All tests successful, 56 tests and 684 subtests skipped. Files=884, Tests=86048, 484 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 CPU) Installing Perl
If all tests had been successful, Perl can be installed with the makefile's special target
install.
dmake -f makefile.mk install Setting %PATH%
Setting the path to the bin directory in which Perl was installed ($INST_TOP\bin), in my
case, that would be c:\perl\bin
Changing the registry
Optionally, some settings can be entered in the registry under HKEY_LOCAL_MACHINE\Software\Perl
Compiling VIMDownloading
Vim can be downloaded from http://www.vim.org/sources.php.
Although I am compiling Vim for Windows, I had to choose the All Unix (sic!) files.
This .tar.gz file contains the two important directories src for the sources and runtime
for the runtime files. The runtime files are used for syntax highlighting and the like.
Features
Vim comes with a few features that can be enabled or
disabled when VIM is compiled. These features can be enabled and disabled through
the feature.h file. However, there are five predifined classes of features which can be chosen
through the makefile. These classes are: TINY, SMALL, NORMAL, BIG and HUGE. In the makefile,
one of these classes can be choses through the FEATURES definition. The according line must
be searched and edited.
FEATURES=BIG
I want Perl support with my vim, so I have to uncomment the following line and set the value
to the installation directory of Perl.
# uncomment 'PERL' if you want a perl-enabled version PERL=C:/perl Compiling vimmake -f make_ming.mak
This creates gvim.exe.
gvim.exe can now be copied into a directory that %PATH% points at. In order to fine tune
gvim, one can create a .vimrc file which should be
at the same location wher gvim.exe is. My .vimrc file contains a
set backupdir=/temp/vim . This directory must actually
exist, otherwise, vim will say E510: Can't make backup file (add! to overwrite).
|