[R-pkg-devel] About a need for hooks from R CMD ... commands, and a question
Duncan Murdoch
murdoch@dunc@n @ending from gm@il@com
Fri Jan 4 20:13:52 CET 2019
On 04/01/2019 1:42 p.m., Dirk Eddelbuettel wrote:
>
> On 4 January 2019 at 19:24, Iñaki Ucar wrote:
> | On Fri, 4 Jan 2019 at 16:43, Dirk Eddelbuettel <edd using debian.org> wrote:
> | >
> | >
> | > For a few years now I had mused about how nice it would be to have other
> | > scripts triggered like `cleanup`. For Rcpp, it would be nice to run
> | > compileAttributes(). For roxygen2, it would be nice to run roxygenize()
> | > (especially if that continued to work the way it did, but I digress).
> | > That was mostly a "wouldn't it be nice" question and not that urgent as I
> | > wrote myself littler scripts for most tasks anyway.
> | >
> | > But I now have a related problem at work. We are authoring C++ libraries and
> | > R packages 'mono-repo' style. And I need to reference builds of the R
> | > packages back to the repo branches / repo directories used where R CMD build
> | > ran in a branch -- in order to at R CMD INSTALL time access the matching
> | > header files and libraries from that branch. I do not see an obvious way of
> | > encoding this in the .tar.gz created by the R CMD build step. The best I can
> | > think of is creating binaries via R CMD INSTALL --build instead of creating
> | > source tarballs.
> | >
> | > Is there something better I am missing? Any hacks, hints, or ideas?
> |
> | I'm not sure whether I understand correctly what you are trying to
> | achieve. Isn't generating a custom configure script enough for your
> | needs?
>
> That is what I thought yesterday when I wrote / updated and tested those.
> They work great when you install from source as they have access to shell's
> ${PWD} and R's getwd().
>
> But when you run R CMD build, (essentially) just cleanup and a tar are
> running. No other code. Hence my Subject: here -- a need for a hook.
>
> Once you have built a .tar.gz and run R CMD INSTALL on it, R goes off to
> _another temporary directory_ and while configure may be running ... you are
> no longer in the directory you called it from. So I have now lost the
> connection to the particular variant of headers and libraries I may have had
> in that branch.
>
> Doing R CMD INSTALL --build ... is a workaround. But it still would be nice
> to have an explicit hook.
>
> Hope this explains it better, and thanks for the follow-up.
If you want a total hack, the help system can run R code during a build,
e.g. \Sexpr[stage=build]{paste("Built at", Sys.time())}. Certainly it
could embed some information in a help page; perhaps it could do more.
Similarly, vignettes are typically built during R CMD build, so they
might be able to have useful side effects.
But it seems likely that something less of a kludge would be desirable.
Duncan Murdoch
More information about the R-package-devel
mailing list