Hi Sebastien,

Sebastien Durand wrote:
> Hello to all,
> 
> I am a package developper and I would like to 
> know what is the best way to build package 
> binaries for both Windows and Mac installation of 
> R, using a macbook pro?
> 
> The command I am presently using to create and build my packages binaries is :
> 
> "R CMD BUILD ~/foo"  -> This produce foo.tar.gz 

You probably mean you are using 'R CMD build' ("BUILD" in upper case doesn't 
work
on my system) don't you?

I can only give a partial answer...

'R CMD build' by default is not intended to build a binary package but a source
package (yes, having called this "build" doesn't help but you will get used to 
it ;-)).

As you've found out, 'R CMD build ~/foo' produces something like 
foo_0.9.5.tar.gz
which is a _source_ package (source packages are always suffixed with 
_X.Y.Z.tar.gz).
This command ('R CMD build') is platform independent: it will produced the same 
tarball
(except maybe for the vignette, more on this below) on Unix/Linux, Windows and 
Mac OS X.
But in order to use 'R CMD build' you need to have the R development tools on 
your system
(compilers, make, Perl, etc...). Note that the exact requirements _are_ 
platform dependent
(they can be tricky to install on Windows).

So now you might wonder why those development tools are required if the 
resulting tarball
(foo_0.9.5.tar.gz) is more or less the result of packaging the source directory 
with 'tar zcf'.
Strangely, and as you might have already noticed, for some packages, it seems 
that 'R CMD build'
is invoking the C, C++ or Fortran compilers! This happens when a package 
contains a Sweave
vignette (.Rnw file): in order to create the PDF version of the vignette (so it 
can be included
in the packaging), 'R CMD build' needs to temporarily install the package. 
Hence the compilation
when the package contains native code.

Binary packages are of course platform dependent. They have the .zip suffix on 
Windows and
the .tgz suffix on Mac OS X. Note that Unix/Linux users are always expected to 
install a
package from source (from the source tarball) so you only need to get into the 
trouble of
building binary packages if you want to make your packages available to the Mac 
OS X and
Windows users that don't have the R development tools installed (those who have 
them can
always install from source with R CMD INSTALL foo_0.9.5.tar.gz).

There are different methods to build them:

  (1) Recommended on Windows: 'R CMD INSTALL --build foo_0.9.5.tar.gz' will
      produce foo_0.9.5.zip on Windows

  (2) 'R CMD INSTALL --library=LIB foo_0.9.5.tar.gz', then manually zip (on 
Windows)
      or tar the LIB/foo directory. When you use this method, it is your 
responsability
      to properly name the resulting file.

  (3) R CMD build --binary ~/foo

See
  o R CMD build --help
  o R CMD INSTALL --help
  o "Checking and building packages" in the "Writing R Extensions" manual
    
http://cran.r-project.org/doc/manuals/R-exts.html#Checking-and-building-packages
for more information.

Also, it's a good practice to always 'R CMD check' (see R CMD check --help) 
your packages
before building and distributing the binary versions.

Hopefully someone on this list will be able to tell you what's the recommended 
way to build
binary packages on Mac OS X (they use some modify version of (2) AFAIK).

Cheers,
H.


> which cannot be used in a windows installation of 
> R.
> 
> I would be very pleased if you could enligthen me
> 
> Sebastien

_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to