{% set version = "1.0-5" %}

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

package:
  name: r-gsw
  version: {{ version.replace("-", "_") }}

source:
  fn: gsw_{{ version }}.tar.gz
  url:
    - http://cran.r-project.org/src/contrib/gsw_{{ version }}.tar.gz
    - http://cran.r-project.org/src/contrib/Archive/gsw/gsw_{{ version }}.tar.gz
  sha256: eb468918ee91e429b47fbcac43269eca627b7f64b61520de5bbe8fa223e96453

build:
  number: 0
  merge_build_host: True  # [win]
  script: R CMD INSTALL --build .
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{native}}toolchain        # [win]
    - {{posix}}filesystem        # [win]
    - {{posix}}make
    - {{posix}}sed               # [win]
    - {{posix}}coreutils         # [win]
    - {{posix}}zip               # [win]
  host:
    - r-base
    - r-testthat
  run:
    - r-base
    - {{native}}gcc-libs         # [win]
    - r-testthat

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

about:
  home: http://teos-10.github.io/GSW-R/index.html
  license: GPL-3.0
  license_file: LICENSE
  summary: 'Provides an interface to the Gibbs SeaWater (TEOS-10) C library, which
    derives from Matlab and other code written by WG127 (Working Group 127) of
    SCOR/IAPSO (Scientific Committee on Oceanic Research / International Association
    for the Physical Sciences of the Oceans).'

extra:
  recipe-maintainers:
    - ocefpaf
