{% set version = "0.2-7" %}

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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/lwgeom_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/lwgeom/lwgeom_{{ version }}.tar.gz
  sha256: b34c155f3d7c4535ef3d02e3381b05a57990d19b3b1ec09a7458c101f8fafae1

build:
  merge_build_host: true  # [win]
  number: 2
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}              # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ compiler('cxx') }}            # [not win]
    - {{ compiler('m2w64_cxx') }}      # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}sed               # [win]
    - {{ posix }}grep              # [win]
    - {{ posix }}autoconf
    - {{ posix }}automake          # [not win]
    - {{ posix }}automake-wrapper  # [win]
    - {{ posix }}pkg-config
    - {{ posix }}make
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]

  host:
    - r-base
    - r-rcpp
    - r-sf >=0.9_3
    - r-units
    - proj  # [not win]
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-rcpp
    - r-sf >=0.9_3
    - r-units

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

about:
  home: https://github.com/r-spatial/lwgeom/
  license: GPL-2.0-only
  summary: Access to selected functions found in 'liblwgeom' <https://github.com/postgis/postgis/tree/svn-trunk/liblwgeom>, the light-weight geometry library used by 'PostGIS' <http://postgis.net/>.
  license_family: GPL2
  license_file: {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2
  description: Access to selected functions found in liblwgeom, the light-weight geometry library used by PostGIS
  doc_url: https://cran.r-project.org/web/packages/lwgeom/lwgeom.pdf
  dev_url: https://github.com/r-spatial/lwgeom/
extra:
  recipe-maintainers:
    - agcopenhaver
    - conda-forge/r
