[R] Customizing the package build process

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Nov 23 10:49:53 CET 2005


Ross Boylan wrote:

> I've made a package for which R CMD build isn't producing very
> satisfactory results.  I'll get to the details in a moment.
> 
> I wonder if it would make sense to have my own makefiles (which already
> exist and are doing quite a lot) produce the .tar.gz file ordinarily
> produced by R CMD build.  As far as I can tell, R CMD build basically
> tars up of the project directory after running some checks.  I could run
> R CMD check separately.
> 
> There are two main problems with the results of R CMD build.  First, it
> has lots of files that I don't want included (the input files used to
> generate configure, miscellaneous garbage, other stuff not suitable for
> distribution).  Second, I have data files as both "data.gz" and "data".
> R puts "data" into the .tar.gz file and sensibly ignores the .gz file.
> Unfortunately, my makefiles assume the existence of the "data.gz" files,
> and so may have trouble after the .tar.gz is unpacked and there are no
> "data.gz" files.
> 
> My bias would ordinarily be to piggy back on the R build system as much
> as possible.  In principle, this could get me extra features (binary
> builds, MS Windows builds) and it would track the things R build does
> beyond tarring files.  But in this case using the R build system seems
> quite ugly.  I could in principle use .Rbuildignore, probably generated
> dynamically, to exclude files.  That doesn't solve the 2nd problem
> (data.gz becomes data).
> 
> So does the alternative of doing the tar'ing myself make sense?
> 
> Is there another option that could hook into the R CMD build process
> more deeply than the use of .Rbuildignore?
> 
> I suppose another option would be to do a clean checkout of the sources
> for my package, run a special makefile target that would create the
> necessary files and delete all unwanted files, and then do a regular R
> CMD build.  This might still have trouble with "data.gz".
> 
> P.S. Previous list postings advised that R CMD install was a better way
> to produce binaries than R CMD build --binary.  The former command
> doesn't seem to have any options for making binaries; has that facility
> been removed?

No, you can use:

R CMD INSTALL --build


Uwe Ligges


> 
> Second question: my reading is that .Rbuildignore is only read in the
> package root directory, and will have no effect below that.  Is that
> correct?  Per directory .Rbuildignore's would be convenient..
>




More information about the R-help mailing list