R 1.2.0 for Windows
====================

This distribution contains the sources to build a port of R-1.2.0 to
run on Windows 95, 98, NT4 and 2000 on Intel/clone chips. See the file
readme for fuller details, including how to install the binary
versions.


Building From Source on Windows
===============================

[Some further details, including how to debug, are given in the rw-FAQ.]

First collect the tools that you need.  There is a `portal' with
current links at http://www.stats.ox.ac.uk/pub/Rtools/.


Collect the tools
-----------------

We recommend that you use the mingw32 port of gcc-2.95.2 by Mumit Khan
from http://www.mingw.org/ or
ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32.  You will also
need suitable versions of at least make, sh, cat, cp, cut, diff, echo,
egrep, expr, g(awk), grep, ls, mkdir, mv, rm, sed, touch; we use those
from the cygwin distribution
(http://sources.redhat.com/cygwin/mirrors.html) or (gzip, tar,
makeinfo, texindex) compiled from the sources.  We have packaged a set
at http://www.stats.ox.ac.uk/pub/Rtools/tools.zip.

BEWARE: `Native' ports of make are not suitable (including that at the
mingw32 site), nor is the make dated 18-Jan-2000 in the Cygwin 1.1 net
release.  There have been problems with earlier versions of the
cygwin1.dll and we have used 1.1.3. To avoid frustration, please use
our tool set.

It may also be possible to use the compilers from the cygwin 1.1
release with the -mno-cygwin flag.  (You will need the cygwin*, gcc*
and binutils* bundles.)  As of R 1.1.0 it is no longer possible to
build R with the cygwin-b20.1 release, but you will probably be able
to use that to build packages.  You will need to ensure that you have
only one version of cygwin1.dll in your path (and there is one in our
tools distribution).

We have also successfully used the variant of mingw32 that uses the
MSVCRT run-time system.  Be aware that many Windows 95 machines do not
have MSVCRT.DLL installed.

perl5, available via http://www.activestate.com/Products/ActivePerl/

zip and unzip from the Info-ZIP project (http://www.info-zip.org and
mirrors).

If you want to make compiled html (.chm) files you will need the
Microsoft HTML Help Workshop, available for download at 
http://msdn.microsoft.com/workshop/author/htmlhelp.

If you want to make Windows (.hlp) files you will need a Windows help
compiler, preferably hcrtf.exe. This has been available for download at
ftp://ftp.microsoft.com/softlib/mslfiles/hcwsetup.exe.

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


Building
--------

You also need: the R source (R-1.2.0.tgz), and to build the
installer, unzip541.zip from any Info-ZIP mirror.

Then: untar R-1.2.0.tgz somewhere (with no spaces in the path names),

	cd /somewhere/R-1.2.0/src/gnuwin32

IMPORTANT: edit MkRules to set the appropriate paths as needed.  If
you have Mingw32/cross-compiler and gcc-2.95.2.1 or later you can set
HAVE_SHARED=YES which will speed up the process considerably.

Edit Makefile to set the type(s) of help that you want built.

and run

	make BUILD=MINGW32 or CYGWIN


Note 1: the file rw1020\unzip\unzip32static.dll is not in the source
distribution. It can be found in file unz541dN.zip at any Info-ZIP
mirror, or you can copy it from a binary distribution.

The file rw1020\bin\Rchtml.dll is only built if CHM help is specifed
in the main Makefile. Its source is the help directory, and you need
the HTML Help Workshop files to build it. It contains instructions
to build it under VC++6, and it is preferable to use that as the 
VC++ library will check versions of the components needed. You can just
copy this from a binary distribution.

Note 2: we are aware that because of limitations in line length or in
the shell used that the Makefiles do not work unchanged on all the
possible combinations of tools, compilers and OSes.  We have tested
the tools in tools.zip under NT with the mingw32 and cygwin 1.1
compilers, and cross-building (see below).

Note 3: building libR.a is highly disk intensive and can take several
minutes even on a local disc. We have seen times from 30 secs to 20
minutes. Using a network file system is likely to take longer.  It is
done in memory and is *much* faster with gcc-2.95.2.1 or later on
mingw32.


You can test a build by `make check': expect some differences in the
tests of the print routines.


Building bitmap device support
------------------------------

The file rw1020\bin\Rbitmap.dll is not built automatically:
instructions on how to build it are in the file bitmap\INSTALL.  You
can just copy this from a binary distribution.


Building Tcl/Tk support
-----------------------

The TclTk support package is not built automatically.  To use this you
need to install tcl831.exe from dev.scriptics.com, and set TCL_HOME in
MkRules to where you installed it (perhaps c:/Program Files/Tcl).
Then

	make tcl

will make the library.


Cross-building on ix86 Linux
============================

You will need i386-mingw32 cross-compilers installed and in your path.
There is currently a complete set of tools at

    http://www.stats.ox.ac.uk/pub/Rtools/i386cross.tar.bz2

(Just unpack this somewhere and put its bin directory in your path.)

Instructions for building a cross-compiler are given at

    http://www.nanotech.wisc.edu/~khan/software/gnu-win32/mingw-cross-howto.txt

At the time of writing these were somewhat outdated.  Apart from the
compiler, you need the mingw32 runtime system and a cross-built
version of binutils 2.9.4.

You will need Perl, zip and unzip installed.

You also need: the R source (R-1.2.0.tgz), and to build the installer,
unzip541.zip from any Info-ZIP mirror.

Then: untar R-1.2.0.tgz somewhere, and

	cd /somewhere/R-1.2.0/src/gnuwin32

Edit MkRules to set BUILD=CROSS and the appropriate paths (including
HEADER) as needed.

Edit Makefile to set the type(s) of help that you want built. (You
will not be able to cross-build .chm or .hlp files, nor Rchtml.dll,
so set WINHELP to NO.)

Packages can be made in the same way as natively: see the file
readme.packages.


Building the Manuals
====================

To make the PDF versions of the manuals you will need pdftex installed
and configured to work with a large file: see doc/manual/README.  You
also need texindex (included in our tool set).  Then the pdf manuals
can be made by

	make docs

If you want to make the info versions, you will need a version of
makeinfo 4.0 (included in our tool set). Then

	cd ../../doc/manuals
	make -f Makefile.win info

will make the info files.

There is no provision to make DVI versions of the manuals, although
../../doc/manuals/Makefile.win could easily be edited to do so.

The fptex distribution of TeX (from
ftp://ftp.ese-metz.fr/pub/tex/win32-beta/fptex-0.4alpha3/ at present)
includes pdftex and makeinfo 4.0 and texindex (in texinfo.zip).  (The
cygwin makeinfo, even in release 1.1, is 3.12, but the fptex version
is supplied in our tools.zip.)



Feedback
========

Please send comments and bug reports to (preferably both of)

    Guido Masarotto <guido@hal.stat.unipd.it>
    Brian Ripley <ripley@stats.ox.ac.uk>