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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/V8_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/V8/V8_{{ version }}.tar.gz
  sha256: 09d9d1166c8e3cc407c8153ad115fb24a60739dcb970c6584a6a4d483bfbd497

build:
  merge_build_host: true  # [win]
  number: 0
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - cross-r-base {{ r_base }}  # [build_platform != target_platform]
    - r-rcpp                     # [build_platform != target_platform]
    - r-curl                     # [build_platform != target_platform]
    - r-jsonlite                 # [build_platform != target_platform]    
    - {{ 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]
  host:
    - r-base
    - r-rcpp >=0.12.12
    - r-curl >=1.0
    - r-jsonlite >=1.0
    - libv8  # [not win]
    - icu
  run:
    - r-base
    - {{ native }}gcc-libs  # [win]
    - r-rcpp >=0.12.12
    - r-curl >=1.0
    - r-jsonlite >=1.0

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

about:
  home: https://github.com/jeroen/v8 (devel) https://v8.dev (upstream)
  license: MIT
  summary: An R interface to V8, Google's open source JavaScript and WebAssembly engine. This package can be compiled either with V8 version 6 and up, a NodeJS shared library, or the legacy 3.14/3.15 branch of V8.
  license_family: MIT
  license_file: LICENSE

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

# Package: V8
# Type: Package
# Title: Embedded JavaScript and WebAssembly Engine for R
# Version: 3.4.2
# Authors@R: person("Jeroen", "Ooms", role = c("aut", "cre"), email = "jeroen@berkeley.edu", comment = c(ORCID = "0000-0002-4035-0289"))
# Description: An R interface to V8: Google's open source JavaScript and WebAssembly engine. This package can be compiled either with V8 version 6 and up, a NodeJS shared library, or the legacy 3.14/3.15 branch of V8.
# License: MIT + file LICENSE
# URL: https://github.com/jeroen/v8 (devel) https://v8.dev (upstream)
# BugReports: https://github.com/jeroen/v8/issues
# SystemRequirements: V8 engine version 6+ is needed for modern JS and WASM support. On Debian / Ubuntu install either libv8-dev or libnode-dev, on Fedora use v8-devel. The readme has instructions for installing backports on Ubuntu Xenial and Bionic. It is still possible to build this package against the legacy libv8 version 3.14 branch, but these engines only support traditional JavaScript (ES5).
# NeedsCompilation: yes
# VignetteBuilder: knitr
# Imports: Rcpp (>= 0.12.12), jsonlite (>= 1.0), curl (>= 1.0), utils
# LinkingTo: Rcpp
# Suggests: testthat, knitr, rmarkdown
# RoxygenNote: 7.1.1
# Language: en-US
# Encoding: UTF-8
# Packaged: 2021-04-30 21:55:59 UTC; jeroen
# Author: Jeroen Ooms [aut, cre] (<https://orcid.org/0000-0002-4035-0289>)
# Maintainer: Jeroen Ooms <jeroen@berkeley.edu>
# Repository: CRAN
# Date/Publication: 2021-05-01 04:40:02 UTC
