The R Project SVN R

Rev

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 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/etc.
You can also use the egcs-1.1.x update (which contains Fortran) from the
link on the Cygwin 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 will take several minutes (13 minutes on a 133MHz laptop with
32Mb RAM, 1 minute on a 300MHz PII with 64Mb and a fast local disc).
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.def

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