{% set version = "0.7.1" %}

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

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

source:
  fn: RNifti_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/RNifti_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/RNifti/RNifti_{{ version }}.tar.gz
  sha256: dcfc06fc6dfaba5d712a9dc57a492b215e4c0b017f046ce026a8458c8f49597b

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

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

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

  run:
    - r-base
    - r-rcpp
    - {{native}}gcc-libs   # [win]
    - libgcc               # [not win]

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

about:
  home: https://github.com/jonclayden/RNifti
  license: GPL-2
  summary: Provides very fast access to images stored in the NIfTI-1 file format <http://www.nitrc.org/docman/view.php/26/64/nifti1.h>,
    with seamless synchronisation between compiled C and interpreted R code. Not to
    be confused with 'RNiftyReg', which provides tools for image registration.
  license_family: GPL2

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