{% set version = '1.6-1' %}

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

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

source:
  fn: polyclip_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/polyclip_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/polyclip/polyclip_{{ version }}.tar.gz
  sha256: c33aac743f1a4c35d37791486a6628838f5fbff51001b4270aba813163e1bd1f

build:
  number: 0
  script: R CMD INSTALL --build .
  skip: True  # [win32]
  rpaths:
    - lib/R/lib/
    - lib/

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

  run:
    - r-base
    - libgcc  # [linux]
    - libgfortran  # [osx]

test:
  commands:
    # You can put additional test commands to be run here.
    - $R -e "library('polyclip')"  # [not win]
    - "\"%R%\" -e \"library('polyclip')\""  # [win]
    - conda inspect linkages -p $PREFIX r-polyclip  # [not win]
    - conda inspect objects -p $PREFIX r-polyclip  # [osx]

about:
  home: http://www.angusj.com/delphi/clipper.php, https://sourceforge.net/projects/polyclipping,
    https://github.com/baddstats/polyclip
  license: BSL
  summary: R port of Angus Johnson's open source library Clipper. Performs polygon clipping operations
    (intersection, union, set minus, set difference) for polygonal regions of arbitrary
    complexity, including holes. Computes offset polygons (spatial buffer zones, morphological
    dilations, Minkowski dilations) for polygonal regions and polygonal lines. Computes
    Minkowski Sum of general polygons. There is a function for removing self-intersections
    from polygon data.
  license_family: OTHER

extra:
  recipe-maintainers:
    - jsignell
