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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/scs_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/scs/scs_{{ version }}.tar.gz
  sha256: d6881eeec7282f8bfbf60847327786e7f90299e4b8c0b084d8bd11fec7705913

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

requirements:
  build:
    - {{ compiler('c') }}              # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}make
    - {{ posix }}sed               # [win]
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]
    - cross-r-base {{ r_base }}    # [build_platform != target_platform]
  host:
    - r-base
    - libblas
    - liblapack
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - libblas
    - liblapack

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

about:
  home: https://github.com/FlorianSchwendinger/scs
  license: GPL-3.0-only
  summary: "Solves convex cone programs via operator splitting. Can solve: linear programs ('LPs'), second-order cone programs ('SOCPs'), semidefinite programs ('SDPs'), exponential cone programs ('ECPs'), and power cone programs ('PCPs'), or problems with any combination of those cones. 'SCS' uses 'AMD' (a set of routines\
    \ for permuting sparse matrices prior to factorization) and 'LDL' (a sparse 'LDL' factorization and solve package) from 'SuiteSparse' (<https://people.engr.tamu.edu/davis/suitesparse.html>)."
  license_family: GPL3
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3

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