{% set version = '1.1.2' %}

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

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

source:
  fn: backports_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/backports_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/backports/backports_{{ version }}.tar.gz
  sha256: e85b93675c6703e1da790dce1f8fb61f27b87e92722c7f0909273ed5074cb456

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

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

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

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

about:
  home: https://github.com/mllg/backports
  license: GPL-2
  summary: |
    Implementations of functions which have been introduced in R since version 3.0.0.
    The backports are conditionally exported which results in R resolving the function
    names to the version shipped with R (if available) and uses the implemented backports
    as fallback. This way package developers can make use of the new functions without
    worrying about the minimum required R version.
  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
    - cbrueffer
