The R Project SVN R

Rev

Rev 4605 | Blame | Last modification | View Log | Download | RSS feed

Building from a source-code library under Windows
=================================================

First collect the tools that you need.

EITHER

The cygwin-B20.x set of tools available from
http://sourceware.cygnus.com/cygwin and several mirrors, the Fortran
additions ecgs-1.1-f77.tar.gz from that page or directly from
http://www.xraylith.wisc.edu/~khan/software/gnu-win32/ and the Fortran
library libg2c.mingw32.a.bz2 from CRAN/bin/windows/windows-NT/base/etc.
You can also use the egcs-1.1.2 compilers upgrade from Mumit Khan's
site.

Do remember to set MAKE_MODE to UNIX.

OR

The mingw32 port of egcs-1.1 (or 1.1.2) from
ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32, the
ld.exe and cygwin1.dll from the B20 set in your path ahead of the
mingw32 binaries (if you don't want to download all the B20 distribution,
you can find the two files in
CRAN/bin/windows/windows-NT/base/etc/ld.cygwin.zip).


Suitable versions of rm, sed, mkdir, echo, cp and cat, for example
(Win 9x) from the djtools set at CRAN/bin/windows/windows-NT/base/etc
or (Win 9x or NT) a cygwin set.

perl5, available via http://www.perl.com/CPAN/ports.

groff, available at http://www.itribe.net/virtunix/groff-1.10nt.zip.

All of these need to be installed and in your path, and the
appropriate environment variables set.  Then

    cd RHOME\src\gnuwin32

and run

    make libR.a

which may take several minutes. (We have seen times from 30 secs to 20
minutes depending on processor speed, RAM, disk speed and mingw32 /
cygwin. Using a network file system is likely to take longer.)  This
only needs to be done once.


For each package you want to install, unpack it to a directory, say
mypkg, in RHOME\src\library,

    cd RHOME\src\gnuwin32
    make pkg-mypkg

The makefiles can be customized: in particular the name of the DLL can
be set (see the line integrate-DLLNM=adapt) and the compile flags can
be set (see the examples in MakeDll).


Using zipped help files
=======================

You will need zip installed, of course. Just run

    make ziponly-mypkg

after building it.  Target `ziphelp-mypkg' will make the zip files
but not remove the separate files: this can be used for testing.


Checking packages
=================

The equivalent of `R CMD check mypkg' on Unix is

    make pkgcheck-mypkg

This runs all the examples in the help files.


Using Visual C++
================

You may if you prefer use Visual C++ to make the DLLs. First build the
import library R.lib by

    lib /def:R.exp

Then you can compile the objects and build the DLL by

    cl /MT /Ox /D "WIN32"  /c *.c
    link /dll /out:mypkg.dll *.obj R.lib

(at least under VC++ 4.2).  If the C sources use R header files you
will need to arrange for these to be searched, perhaps by

    /I ../../../include