{% set version = "0.40" %}

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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/L1pack_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/L1pack/L1pack_{{ version }}.tar.gz
  sha256: 2f0a363b696e110a60ce6a617e805801dfbc775b38dc75efe48790755e9d6030

build:
  merge_build_host: true  # [win]
  number: 0

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

requirements:
  build:
    - {{ compiler('c') }}              # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ compiler('fortran') }}        # [not win]
    - {{ compiler('m2w64_fortran') }}  # [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
    - r-fastmatrix

  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-fastmatrix

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

about:
  home: http://l1pack.mat.utfsm.cl/
  license: GPL-3.0-only
  summary: L1 estimation for linear regression, density, distribution function, quantile function and random number generation for univariate and multivariate Laplace distribution.
  license_family: GPL3
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3

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