{% set version = "1.0.1" %}

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

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

source:
  fn: openssl_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/openssl_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/openssl/openssl_{{ version }}.tar.gz
  sha256: 605c05868e26c5d3cbea9748d400371612bcf082322b1cea5c08397e5fa1d8e3

build:
  number: 0
  skip: true  # [win32]

  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - r-base
    - posix                # [win]
    - {{native}}toolchain  # [win]
    - gcc                  # [not win]
    - openssl 1.0.*

  run:
    - r-base
    - {{native}}gcc-libs   # [win]
    - libgcc               # [not win]
    - openssl 1.0.*

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

about:
  home: https://github.com/jeroen/openssl#readme
  license: MIT
  summary: Bindings to OpenSSL libssl and libcrypto, plus custom SSH pubkey parsers. Supports
    RSA, DSA and EC curves P-256, P-384 and P-521. Cryptographic signatures can either
    be created and verified manually or via x509 certificates. AES can be used in cbc,
    ctr or gcm mode for symmetric encryption; RSA for asymmetric (public key) encryption
    or EC for Diffie Hellman. High-level envelope functions combine RSA and AES for
    encrypting arbitrary sized data. Other utilities include key generators, hash functions
    (md5, sha1, sha256, etc), base64 encoder, a secure random number generator, and
    'bignum' math methods for manually performing crypto calculations on large multibyte
    integers.
  license_family: MIT

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
