-
-
Notifications
You must be signed in to change notification settings - Fork 269
How to build rstan package?
*** Build and install package rstan
The files for rstan package is in folder rstan under the root folder of rstan repo. Under the root folder of rstan repo, folder stan is the git submodule of the repo for Stan. When the present working directory is rstan, rstan can be built (and installed) using GNU make. For example, to build rstan package:
$ cd rstan
$ ls
example INSTALL.txt makefile R_Makevars rstan tests
$ make build
if test -d tmpstanlib; then ln -s ../../../tmpstanlib/ ./rstan/inst/include/stanlib; else ln -s ../../../../stan/lib ./rstan/inst/include/stanlib; fi
ln -s ../../../../stan/src ./rstan/inst/include/stansrc
R --vanilla CMD build rstan --md5 # --no-vignettes --no-manual
* checking for file ‘rstan/DESCRIPTION’ ... OK
* preparing ‘rstan’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to process help pages
* saving partial Rd database
* creating vignettes ...OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory ‘rstan/inst/include/stanlib/eigen_3.2.0/unsupported/doc/snippets’
Removed empty directory ‘rstan/inst/include/stansrc/models/bugs_examples/vol2/biopsies’
Removed empty directory ‘rstan/inst/include/stansrc/models/bugs_examples/vol3/jama’
* adding MD5 file
* building ‘rstan_1.3.0.tar.gz’
After executing make build
, there would be file rstan#.##.##.gz_, which is the rstan source package that can be installed using R's package installation approaches such as R CMD INSTALL
. In addition, make install
can be used here to directly install rstan.
Now we have the rstan package in gzip form.
$ ls
example INSTALL.txt makefile R_Makevars rstan rstan_1.3.0.tar.gz tests
We can also use make check
to call R CMD check
on the newly created package.
*** rstan unit tests Besides part the tests included in rstan package, some external tests are in folder tests, which is also shown above. The tests defined there can be run after rstan is installed:
$ cd tests/
$ Rscript runRunitTests.R
*** Release rstan (for rstan maintainers/developers)
Currently, the source package for rstan is at google stan wiki repo. So to release a new version of rstan, we need to do the following:
- upload the gzip package of the new version
- update file PACKAGES and PACKAGES.gz with the new version number.