Rev 8929 | Blame | Last modification | View Log | Download | RSS feed
Building from a source-code library under Windows=================================================If your package has neither C nor Fortran source, see `Simple ports'at the bottom of this file.First collect the tools that you need.We recommend that you use the mingw32 port of gcc-2.95.2 by Mumit Khanfrom http://www.mingw.org/ orftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32. You will alsoneed suitable versions of make, sh, rm, sed, (g)awk, mkdir, echo, cpand cat; we have packaged a set atCRAN/bin/windows/windows-NT/base/etc/tools.zip extracted from thecygwin distribution (http://sourceware.cygnus.com/cygwin and severalmirrors) or (make) compiled from the GNU sources ourselves. BEWARE:`Native' ports of make are _not_ suitable, and the 18 Jan 2000 cygwinport crashes when building packages.It is also possible to use the compilers from the cygwin 1.1 releasewith the -mno-cygwin flag. (You will need the cygwin*, gcc* andbinutils* bundles.) We have also successfully used the variant ofmingw32 that uses the MSVCRT run-time system (under gcc-2.95.x but notearlier versions), and in the case of the mclust library found thismore successful that the standard version. Be aware that manyWindows 95 machines do have MSVCRT.DLL installed.perl5, available via http://www.perl.com/CPAN/ports.If you want to make compiled html (.chm) files you will need theMicrosoft HTML Help Workshop, available for download athttp://msdn.microsoft.com/workshop/author/htmlhelp.If you want to make Window help files you will need hcrtf.exe from aWindows compiler installation (this has been available for download atftp://ftp.microsoft.com/softlib/mslfiles/hcwsetup.exe), or hcp505.exe.For large packages it is helpful to make zipped help files: for thatyou need zip and unzip from the Info-ZIP project (www.info-zip.org andmirrors).All of these need to be installed and in your path, and theappropriate environment variables set. Edit MkRules to set BUILD andthe appropriate paths as needed. (IMPORTANT: if you use cygwin youmust edit MkRules and set BUILD=CYGWIN.) Do remember to set MAKE_MODEto UNIX (set MAKE_MODE=UNIX at the Windows command-line).Thencd RHOME\src\gnuwin32make libR.awhich may take several minutes. (We have seen times from 30 secs to 20minutes depending on processor speed, RAM, disk speed andcompiler. Using a network file system is likely to take longer.) Thisonly needs to be done once for each R release.For each package you want to install, unpack it to a directory, saymypkg, in RHOME\src\library, and runcd RHOME\src\gnuwin32make pkg-mypkgThe Makefiles can be customized: in particular the name of the DLL canbe set (for example we once needed integrate-DLLNM=adapt), the compileflags can be set (see the examples in MakeDll) and the types of help(if any) to be generated can be chosen (variables HELP and WINHELP).The simplest way to customize the compilation steps is to set variables ina file src/Makevars, which will automatically be included by MakeDLL.For example, for RODBC src/Makevars could include the lineDLLLIBS+=-lodbc32or, equivalently,RODBC-DLLLIBS=-lodbc32Using zipped help files=======================You will need zip installed, of course. Just runmake ziponly-mypkgafter building mypkg. Target `ziphelp-mypkg' will make the zip filesbut not remove the separate files: this can be used for testing.Using zipped data files=======================You will need zip installed, of course. Just runmake zipdata-mypkgafter building mypkg. This is recommended if you have either many smalldata files (as in package Devore5) or a few large data files.Checking packages=================The equivalent of `R CMD check mypkg' on Unix ismake pkgcheck-mypkgThis runs all the examples in the help files. If you need to increasethe heap size or the number of cons cells (e.g. for nlme) useenvironmental variables to do so.Debugging=========See the RW-FAQ.Using Visual C++================You may if you prefer use Visual C++ to make the DLLs (unless they useFortran source!). First build the import library R.lib bylib /def:R.exp /out:Rdll.libThen you can compile the objects and build the DLL bycl /MT /Ox /D "WIN32" /c *.clink /dll /def:mypkg.def /out:mypkg.dll *.obj Rdll.libwhere you will need to create the .def file by hand listing the entrypoints to be exported. If the C sources use R header files you willneed to arrange for these to be searched, perhaps by/I ..\..\..\includeIf you build a debug version of the DLL in the developmentenvironment, you can debug the DLL code there just by setting theexecutable to be debugged to the full path to the R front-end.Simple Ports============If your package has neither C nor Fortran source, several steps canbe omitted.You will needsuitable versions of make, sh, rm, sed, awk, mkdir, echo, cp and cat;we have packaged a set at bin/windows/windows-NT/etc/tools.zipperl5, available via http://www.perl.com/CPAN/ports.All of these need to be installed and in your path, and theappropriate environment variables set.For each package you want to install, unpack it to a directory, saymypkg, in RHOME\src\library, and runcd RHOME\src\gnuwin32make pkg-mypkgIf you have a Unix/Linux box, it will suffice to zip up the Unix installationof the package. Install the package, thencd `R RHOME`/libraryzip -rl /dest/mypkg.zip mypkg(the -l flag converts to CRLF line endings: it is not absolutely necessarybut users may want to read the information files in a Windows editor).zip is often installed on Linux machines, and sources and binaries forUnix boxes are available via the Info-Zip site given above.Non-standard locations======================You can specify the location of the package source by PKGDIR and thelibrary in which to install the package by RLIB, as inmake PKGDIR=/mysources RLIB=/R/library pkg-mypkgmake PKGDIR=/mysources RLIB=/R/library pkgcheck-mypkgwhich installs the package in \mysources\mypkg as \R\library\mypkg andchecks its examples.Cross-building packages on Linux================================It is straightforward to build a package on a i386-linux system,although it is not possible (as far as we know) to cross-build .chm or.hlp files. For a package without compiled code you can just zip upthe Linux installation of the package.First you need to set up the cross-compilers and tools (see INSTALL)and have them in your path. We will assume that your Linuxinstallation has Perl5, unzip and zip.Edit MkRules to set BUILD=CROSS and the appropriate paths as needed,and check that Makefile has WINHELP set to NO.Then packages can be made as natively, for example bycd .../src/gnuwin32make PKGDIR=/mysources RLIB=/R/win/library pkg-mypkgmake PKGDIR=/mysources RLIB=/R/win/library pkgcheck-mypkgcd /R/win/libraryzip -rl /dest/mypkg.zip mypkgFeedback========Please send comments and bug reports to (preferably both of)Guido Masarotto <guido@hal.stat.unipd.it>Brian Ripley <ripley@stats.ox.ac.uk>