{% set version = '1.7.11' %}

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

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

source:
  fn: TMB_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/TMB_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/TMB/TMB_{{ version }}.tar.gz
  sha256: 38ffc616154741a81ebadc52efc27f0b9de63254aa03960bb690ce7a098fe4ec

build:
  number: 0
  skip: true  # [win32]

  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - r-base
    - r-matrix
    - r-rcppeigen
    - posix                # [win]
    - {{native}}toolchain  # [win]
    - gcc                  # [not win]

  run:
    - r-base
    - r-matrix
    - r-rcppeigen
    - libgcc  # [not win]

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

about:
  home: http://tmb-project.org
  license: GPL-2
  summary: 'With this tool, a user should be able to quickly implement complex random effect
    models through simple C++ templates. The package combines ''CppAD'' (C++ automatic
    differentiation), ''Eigen'' (templated matrix-vector library) and ''CHOLMOD'' (sparse
    matrix routines available from R) to obtain an efficient implementation of the applied
    Laplace approximation with exact derivatives. Key features are: Automatic sparseness
    detection, parallelism through ''BLAS'' and parallel user templates.'

  license_family: GPL2
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2'  # [unix]
  license_file: '{{ environ["PREFIX"] }}\R\share\licenses\GPL-2'  # [win]

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
