r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
331 stars 152 forks source link

Feature Request: Save the first compilation of a package for later use #681

Closed billdenney closed 2 years ago

billdenney commented 2 years ago

I'm working on the rxode2 package, and it takes notable time to install from source (about 5 minutes to compile). When installing it from GitHub, it appears that it is compiled twice: once to build the documentation, and once to build the package. (Or, it may end up being 3 or 4 times in Windows to cover both i386 and x64 compilation.)

Is it possible to save the results of the first compilation step or somehow otherwise prevent the need for multiple recompilation of the same code?

To see the time it takes:

remotes::install_github("nlmixr2/lotri")
remotes::install_github("nlmixr2/rxode2")
gaborcsardi commented 2 years ago

You can set INSTALL_opts = "--build" and then you'll get a binary package that you can reuse:

❯ remotes::install_github("nlmixr2/lotri", INSTALL_opts = "--build")
Downloading GitHub repo nlmixr2/lotri@HEAD
...
* creating tarball
packaged installation of ‘lotri’ as ‘lotri_0.4.0.tgz’
* DONE (lotri)