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

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

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

source:
  fn: Cairo_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/Cairo_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/Cairo/Cairo_{{ version }}.tar.gz
  sha256: 2a867b6cae96671d6bc3acf9334d6615dc01f6ecf1953a27cde8a43c724a38f4
  patches:
    - configure.win.patch

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

# Suggests: png
requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{native}}toolchain        # [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
    - cairo >=1.2

  run:
    - r-base
    - {{native}}gcc-libs         # [win]
    - cairo >=1.2

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

about:
  home: http://www.rforge.net/Cairo/
  license: GPL-2
  summary: Cairo graphics device that can be use to create high-quality vector (PDF, PostScript
    and SVG) and bitmap output (PNG,JPEG,TIFF), and high-quality rendering in displays
    (X11 and Win32). Since it uses the same back-end for all output, copying across
    formats is WYSIWYG. Files are created without the dependence on X11 or other external
    programs. This device supports alpha channel (semi-transparent drawing) and resulting
    images can contain transparent and semi-transparent regions. It is ideal for use
    in server environments (file output) and as a replacement for other devices that
    don't have Cairo's capabilities such as alpha support or anti-aliasing. Backends
    are modular such that any subset of backends is supported.
  license_family: GPL2

extra:
  recipe-maintainers:
    - dpryan79
    - croth1
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
    - cbrueffer
    - dbast
