Skip to content

Building packages

6 messages · Barry Rowlingson, Gabor Grothendieck, Oleg Sklyar +1 more

#
I've started a new package and I'm trying to work out the best way to do 
it. I'm managing my package source directory with SVN, but "R CMD build" 
likes to dump things in the inst/doc directory when making vignette PDF 
files. I don't want to keep these in SVN (they aren't strictly 
'source'), so it set me thinking.

One of the other projects I work with has an out-of-source build system. 
You make a 'build' directory, run a config system (cmake-based) and then 
'make' does everything in the build directory without touching the 
source tree. Very nice and neat. How much work would it take to have 
something similar for building R packages? At present I've just got some 
svn:ignore settings to stop SVN bothering me.

  I also hit the problem of vignettes needing the package to be 
installed before being able to build them, but not being able to install 
the package because the vignettes wouldn't build without the package 
already being installed. The fix is to build with --no-vignettes, then 
install the package, then build with the vignettes enabled. Seems 
kludgy, plus it means that vignettes are always built with the currently 
installed package and not the currently-being-installed package. So I 
install and do a second pass to get it all right again.

  Or am I doing it wrong?

  Once I get smooth running of R package development and SVN I might 
write it up for R-newsletter - there's a couple of other tricks I've had 
to employ...

Barry
#
An svn checkout directory can contain a mix of files that
are mirrored in the svn and not mirrored.  In particular, if you
add a new file into your checkout directory it will not automatically
go into the repository on your next commit unless you specifically
place that file under svn control so junk files remain local.

You can exclude files from R CMD build using the .Rbuildignore file.
See the Writing Extensions manual.
On Dec 7, 2007 11:07 AM, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> wrote:
#
These files in the SVN tree does not harm the things that are checked
in. However it is indeed reasonable to keep the rubbish out, so:
Solution 1: copy the package SVN dir elsewhere and build/install from
there
Solution 2: a better one, make a 2-liner shell script that runs solution
1 (what I do)

This will also prevent gcc from populating your svn src directory
with .o, .so, .d, .dll files.
R does understand 'configure' which is more reasonable then to require
cmake to be installed. Think of multiplatform builds etc.
If I am not mistaken R CMD build builds the package temporarily and uses
that build to build the vignette, so where is the problem? All my
vignettes build fine on both Linux and Windows and on Windows you
actually see that running R CMD build --binary builds the source code
two times - exactly for the above purposes.
What exactly?
#
Gabor Grothendieck wrote:
True, but 'svn status' will keep annoying you with:

? inst/doc/foo.eps

  until you tell it to ignore it ["svn propedit svn:ignore ." and then 
enter some expressions].

Barry
#
Oleg Sklyar wrote:

            
Ah ha. I'm building as a user and so I've been installing into a 
private library: ~/Rlibs. Hence my vignette has had 
library(foo,lib="~/Rlibs"). I was unaware that it would get the 
currently-being-built package in a library of its own! Thanks!

  www.doingitwrong.com

Barry
#
On 12/7/07, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> wrote:
Yes, but that's completely normal svn operation - you ignore the non
source files so that they don't interfere with your view of the source
files.  You particularly need this when working with latex.

I have

alias svnignore='svn pe svn:ignore'

in my .profile to save a little typing.

Hadley