{% set version = '2.15.1' %}

{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

package:
  name: r-rstan
  version: {{ version|replace("-", "_") }}

source:
  fn: rstan_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/rstan_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/rstan/rstan_{{ version }}.tar.gz
  sha256: 2f3f68adbfd364713fb1e8b87ddde03b258abbf0dbb120cdbbbc31fc5bec71eb

build:
  number: 0
  skip: true  # [win32]
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - r-base
    - r-bh >=1.62
    - r-rcpp >=0.12.0
    - r-rcppeigen
    - r-stanheaders >=2.15.0
    - r-ggplot2 >=2.0.0
    - r-gridextra >=2.0.0
    - r-inline
    - posix                # [win]
    - {{native}}toolchain  # [win]
    - gcc                  # [not win]
  run:
    - r-base
    - r-bh >=1.62
    - r-rcpp >=0.12.0
    - r-rcppeigen
    - r-stanheaders >=2.15.0
    - r-ggplot2 >=2.0.0
    - r-gridextra >=2.0.0
    - r-inline
    - libgcc  # [not win]

test:
  commands:
    - $R -e "library('rstan')"  # [not win]
    - "\"%R%\" -e \"library('rstan')\""  # [win]

about:
  home: https://groups.google.com/forum/#!forum/stan-users, http://mc-stan.org
  license: GPL (>= 3)
  summary: User-facing R functions are provided to parse, compile, test,  estimate, and analyze
    Stan models by accessing the header-only Stan library  provided by the 'StanHeaders'
    package. The Stan project develops a probabilistic programming language that implements
    full Bayesian statistical  inference via Markov Chain Monte Carlo, rough Bayesian
    inference via 'variational' approximation, and (optionally penalized) maximum likelihood
    estimation via  optimization. In all three cases, automatic differentiation is used
    to quickly  and accurately evaluate gradients without burdening the user with the
    need  to derive the partial derivatives.
  license_family: GPL3

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
