{% set version = "1.3-22" %}
{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/terra_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/terra/terra_{{ version }}.tar.gz
  sha256: 70422e52c08d374cbb8421d2558cc6106eb560b350007a190bc8128c0cc5bffc

build:
  merge_build_host: true  # [win]
  number: 0
  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]
    - cross-r-base {{ r_base }}    # [build_platform != target_platform]
  host:
    - r-base
    - r-rcpp
    - r-raster
    - libgdal  # [not win]
    - proj  # [not win]
    - geos  # [not win]
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-rcpp
    - r-raster
    - libgdal  # [not win]
    - proj  # [not win]
    - geos  # [not win]

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

about:
  home: https://rspatial.org/terra
  license: GPL-3.0-or-later
  summary: Methods for spatial data analysis with raster and vector data. Raster methods allow for low-level data manipulation as well as high-level global, local, zonal, and focal computation. The predict and interpolate methods facilitate the use of regression type (interpolation, machine learning) models for spatial prediction,
    including with satellite remote sensing data. Processing of very large files is supported. See the manual and tutorials on <https://rspatial.org/terra/> to get started. 'terra' is very similar to the 'raster' package; but 'terra' can do more, is simpler to use, and it is faster.
  license_family: GPL3
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3

extra:
  recipe-maintainers:
    - conda-forge/r
    - TomAugspurger
