{% set version = '0.23-1' %}

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

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

source:
  fn: TTR_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/TTR_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/TTR/TTR_{{ version }}.tar.gz
  sha256: 699798f06ceae9663da47b67d1bc8679fc1c0776d12afd054d6ac4d19e05b2ae

build:
  number: 0
  skip: true  # [win32]
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - r-base
    - r-xts >=0.9_3
    - r-zoo
    - posix                # [win]
    - {{native}}toolchain  # [win]
    - gcc                  # [not win]

  run:
    - r-base
    - r-xts >=0.9_3
    - r-zoo
    - libgcc  # [not win]

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

about:
  home: https://github.com/joshuaulrich/TTR
  license: GPL-2
  summary: Functions and data to construct technical trading rules with R.
  license_family: GPL2

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
