{% set version = '1.0.0' %}

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

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

source:
  fn: haven_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/haven_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/haven/haven_{{ version }}.tar.gz
  sha256: b499df0fe8b5921970812e96749699aa8b25391c3d304a9e35353d527198d697

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

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

requirements:
  build:
    - r-base
    - r-bh
    - r-rcpp >=0.11.4
    - r-hms
    - r-readr >=0.1.0
    - r-tibble
    - posix                # [win]
    - {{native}}toolchain  # [win]
    - gcc                  # [not win]

  run:
    - r-base
    - r-bh
    - r-rcpp >=0.11.4
    - r-hms
    - r-readr >=0.1.0
    - r-tibble
    - libgcc  # [not win]

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

about:
  home: https://github.com/hadley/haven, https://github.com/WizardMac/ReadStat
  license: MIT
  summary: Import foreign statistical formats into R via the embedded 'ReadStat' C library (https://github.com/WizardMac/ReadStat).
  license_family: MIT

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
