10

I'm trying to develop an R package that will include some previously compiled executable programs and their supporting libraries. (I know this is bad form, but it is for internal use).

My question: Does the special exec and tools directories have any special functionality within R?

The documentation seems to be sparse. Here is what I've figured out so far:

From here

  • files contained in exec are marked as executable on install
  • subdirectories in exec are ignored
  • exec is rarely used (my survey of CRAN says tools is just as rarely used)
  • tools is around for configuration purposes?

Do these directories offer any that I couldn't get from creating an inst/programs directory?

lawinslow
  • 961
  • 6
  • 12
  • Ok, by playing around, I have figured out that `tools` is *not* included once the package has been built or installed. It must only be used in the build process and then is dropped. – lawinslow Sep 29 '14 at 17:25
  • 1
    Would creating an `inst/programs` directory automatically mark the files stored in it executable on install? If not, then *there* is some special functionality of `exec`... – Josh O'Brien Sep 29 '14 at 17:31
  • Yeah, that is definitely functionality you get with using `exec` – lawinslow Sep 29 '14 at 17:45

2 Answers2

6

[R-exts] has this to say:

Subdirectory exec could contain additional executable scripts the package needs, typically scripts for interpreters such as the shell, Perl, or Tcl. This mechanism is currently used only by a very few packages. NB: only files (and not directories) under exec are installed (and those with names starting with a dot are ignored), and they are all marked as executable (mode 755, moderated by ‘umask’) on POSIX platforms. Note too that this is not suitable for executable programs since some platforms (including Windows) support multiple architectures using the same installed package directory.

It's quite possible the last note won't apply to you if it's only for internal use.

Nevertheless, I'd suggest avoiding abusing any existing convention that might not apply precisely to your situation, and instead use inst/tools or inst/bin.

hadley
  • 102,019
  • 32
  • 183
  • 245
  • Thanks Hadley. It's good to know that there isn't a special, baked-in way to do this. I'm going to summarize the functionality of both `tools` and `exec` in a follow-up post. – lawinslow Sep 30 '14 at 16:10
5

As far as I can tell, here is the functionality offered by the exec and tools directories.

exec

From R-exts by way of hadley:

Subdirectory exec could contain additional executable scripts the package needs, typically scripts for interpreters such as the shell, Perl, or Tcl. This mechanism is currently used only by a very few packages. NB: only files (and not directories) under exec are installed (and those with names starting with a dot are ignored), and they are all marked as executable (mode 755, moderated by ‘umask’) on POSIX platforms. Note too that this is not suitable for executable programs since some platforms (including Windows) support multiple architectures using the same installed package directory.

exec features I have figured out

  • On POSIX platforms (*nix, os x), the files within exec will be marked as executable.
  • No subdirectories of exec are included in the package, only files in exec root
  • (note, it could contain binary executables, but there is no architecture/platform handling

tools

From R-exts:

Subdirectory tools is the preferred place for auxiliary files needed during configuration, and also for sources need to re-create scripts (e.g. M4 files for autoconf).

tools features I have figured out

  • tools is to hold files used at package compile time
  • All files contained are copied recursively into the source *.tar.gz package (including subdirs)
  • tools is not included in the final, compiled form of the package. All contents are dropped
Community
  • 1
  • 1
lawinslow
  • 961
  • 6
  • 12