Skip to content

[R-pkg-devel] src/install.libs.R

4 messages · Facundo Muñoz, Duncan Murdoch

#
Dear all,

I need to make use of the |src/install.libs.R| file, in order to perform
certain tasks at installation time.
I followed the R-exts doc
<http://cran.univ-paris1.fr/doc/manuals/r-release/R-exts.html#Package-subdirectories>.
However, R CMD INSTALL seems to never run the script.

Here is a minimal reproducible example.
It makes use of |devtools| to simplify the example, but I have tried the
installation manually as well.

|## Create a minimal buildable package library(devtools)
create('testpkg') ## Write src/install.libs.R dir.create('testpkg/src')
test.file <- path.expand('~/testfile.txt') diag.lines <- c(
deparse(quote(stop('This should break the installation'))),
deparse(quote(file.create(test.file))) ) writeLines(diag.lines,
'testpkg/src/install.libs.R') ## Install package ## also tried manually
with R CMD INSTALL install('testpkg') ## The installation did not break
## nor the file has been created file.exists('~/testfile.txt') # FALSE
## Cleanup remove.packages('testpkg') unlink('testpkg', recursive = TRUE) |

Am I missing something?

thanks in advance
?acu.-

PS: by the way?

|> sessionInfo() R version 3.2.2 (2015-08-14) Platform:
x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.2 LTS locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES=en_US.UTF-8 LC_PAPER=fr_FR.UTF-8 LC_NAME=C [9] LC_ADDRESS=C
LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C attached
base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] devtools_1.8.0.9000 loaded via a namespace
(and not attached): [1] tools_3.2.2 memoise_0.2.1 digest_0.6.8 |

?
10 days later
#
I relaunch this question for which I had no answers.
Just in case someone who can give some insight missed it before.

Thanks in advance
        ?acu.-



-------- Mensaje reenviado --------
Asunto: 	src/install.libs.R
Fecha: 	Tue, 6 Oct 2015 11:41:23 +0200
De: 	Facundo Mu?oz <famuvie at gmail.com>
Para: 	r-package-devel at r-project.org



Dear all,

I need to make use of the |src/install.libs.R| file, in order to perform
certain tasks at installation time.
I followed the R-exts doc
<http://cran.univ-paris1.fr/doc/manuals/r-release/R-exts.html#Package-subdirectories>.
However, R CMD INSTALL seems to never run the script.

Here is a minimal reproducible example.
It makes use of |devtools| to simplify the example, but I have tried the
installation manually as well.

|## Create a minimal buildable package library(devtools)
create('testpkg') ## Write src/install.libs.R dir.create('testpkg/src')
test.file <- path.expand('~/testfile.txt') diag.lines <- c(
deparse(quote(stop('This should break the installation'))),
deparse(quote(file.create(test.file))) ) writeLines(diag.lines,
'testpkg/src/install.libs.R') ## Install package ## also tried manually
with R CMD INSTALL install('testpkg') ## The installation did not break
## nor the file has been created file.exists('~/testfile.txt') # FALSE
## Cleanup remove.packages('testpkg') unlink('testpkg', recursive = TRUE) |

Am I missing something?

thanks in advance
?acu.-

PS: by the way?

|> sessionInfo() R version 3.2.2 (2015-08-14) Platform:
x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.2 LTS locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES=en_US.UTF-8 LC_PAPER=fr_FR.UTF-8 LC_NAME=C [9] LC_ADDRESS=C
LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C attached
base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] devtools_1.8.0.9000 loaded via a namespace
(and not attached): [1] tools_3.2.2 memoise_0.2.1 digest_0.6.8 |

?
#
I can't really read your code (HTML?), but there are several CRAN
packages which make use of this, for example tth, rJava, etc. I just
tried installing tth and it ran the script.  So you might want to see
how your package differs from that one.

Duncan Murdoch
On 16/10/2015 1:18 PM, Facundo Mu?oz wrote:
#
On 16/10/2015 1:18 PM, Facundo Mu?oz wrote:
We corresponded offline.  The problem with the sample is that it has no
files in src that trigger processing:  those would be Makefile,
Makefile.win, Makevars, or source files in supported languages.

If the real example doesn't have any of these (e.g. because it is just
copying a pre-compiled file from somewhere; not something you should do
in a CRAN package, but maybe reasonable in a local one), then the
easiest workaround is just to add an empty Makevars file.

Duncan Murdoch