{% set version = '1.5-5' %}

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

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

source:
  fn: geosphere_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/geosphere_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/geosphere/geosphere_{{ version }}.tar.gz

  sha256: 8b6fe012744fc45b88e0ef6f20e60e103ef013e761e99dcff3f9dceeedbdce6d

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

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

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

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

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

about:
  home: https://CRAN.R-project.org/package=geosphere
  license: GPL (>= 3)
  summary: 'Spherical trigonometry for geographic applications. That is, compute distances and
    related measures for angular (longitude/latitude) locations. '

  license_family: GPL3
extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
    - druvus
