-
-
Notifications
You must be signed in to change notification settings - Fork 269
How to build rstan package?
The files for rstan package is in folder rstan/
under the root folder of the repository. StanHeaders/
houses the folders which include the math library and Stan folder, which are git submodules of the repos 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
, file rstan#.##.##.gz_ should be created. This file 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.
$ make install
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.
$ make check
R --vanilla CMD check --as-cran rstan_1.3.0.tar.gz
Besides some tests included in rstan package, some external tests are in folder rstan/tests/
, which is also shown above. The tests defined there can be run after rstan is installed:
$ cd tests/
$ Rscript runRunitTests.R
Currently, the source package for rstan is at rstan.org. 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.