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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/websocket_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/websocket/websocket_{{ version }}.tar.gz
  sha256: 281fa0e5d8739ef90626117c8d5ca9e30c7aeb642346d16706cbca34a46749cf

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-asioheaders
    - r-r6
    - r-cpp11
    - r-later >=1.2.0
    - openssl >=1.0.2
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-asioheaders
    - r-r6
    - r-cpp11
    - r-later >=1.2.0
    - openssl >=1.0.2

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

about:
  home: https://CRAN.R-project.org/package=websocket
  license: GPL-2.0-only
  summary: 'Provides a ''WebSocket'' client interface for R. ''WebSocket'' is a protocol for
    low-overhead real-time communication: <https://en.wikipedia.org/wiki/WebSocket>.'
  license_family: GPL2
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2

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