{% set version = '1.1-5' %}

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

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

source:
  fn: TSP_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/TSP_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/TSP/TSP_{{ version }}.tar.gz

  sha256: 5cf865eb70bd09dbf7869f23b252850c36701bb3fc061cd6fdf093394b76bd0f

build:
  number: 0
  skip: true  # [win32]

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

requirements:
  build:
    - r-base
    - r-foreach
    - posix                # [win]
    - {{native}}toolchain  # [win]
    - gcc                  # [not win]

  run:
    - r-base
    - r-foreach
    - libgcc  # [not win]

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

about:
  home: https://cran.r-project.org/web/packages/TSP/index.html
  license: GPL-3
  summary: Basic infrastructure and some algorithms for the traveling salesperson problem (also
    traveling salesman problem; TSP). The package provides some simple algorithms and
    an interface to the Concorde TSP solver and its implementation of the Chained-Lin-Kernighan
    heuristic. The code for Concorde itself is not included in the package and has to
    be obtained separately.
  license_family: GPL3
  license_file: '{{ environ["PREFIX"] }}\/lib\/R\/share\/licenses\/GPL-3'  # [unix]
  license_file: '{{ environ["PREFIX"] }}\R\share\licenses\GPL-3'  # [win]
extra:
   recipe-maintainers:
    - MathiasHaudgaard
    - FrodePedersen
    - ArneKr
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
