{% set version = "1.3.3" %}
{% set posix = 'm2-' if win else '' %}

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/ragg_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/ragg/ragg_{{ version }}.tar.gz
  sha256: 42db845ff18d67cae6d291833c76a136c1ef02b5b246d4d90c1f1ae8cc1bb2af

build:
  number: 0
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - cross-r-base {{ r_base }}  # [build_platform != target_platform]
    - r-textshaping              # [build_platform != target_platform]
    - r-systemfonts              # [build_platform != target_platform]
    - {{ compiler('c') }}              # [not win]
    - {{ stdlib("c") }}                # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ stdlib("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-systemfonts >=1.0.3
    - r-textshaping >=0.3.0
    - freetype
    - libpng
    - libjpeg-turbo
    - libtiff
  run:
    - r-base
    - r-systemfonts >=1.0.3
    - r-textshaping >=0.3.0

test:
  requires:
    - r-testthat
  source_files:
    - tests/
  commands:
    - $R -e "library('ragg')"                                                         # [not win]
    - $R -e "testthat::test_file('tests/testthat.R', stop_on_failure=TRUE)"           # [not win]
    - "\"%R%\" -e \"library('ragg')\""                                                # [win]
    - "\"%R%\" -e \"testthat::test_file('tests/testthat.R', stop_on_failure=TRUE)\""  # [win]

about:
  home: https://ragg.r-lib.org
  dev_url: https://github.com/r-lib/ragg
  license: MIT
  summary: Anti-Grain Geometry (AGG) is a high-quality and high-performance 2D drawing library. The 'ragg' package provides a set of graphic devices based on AGG to use as alternative to the raster devices provided through the 'grDevices' package.
  license_family: MIT
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/MIT
    - LICENSE

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