{% set name = "glpk" %}
{% set version = "5.0" %}
{% set build = 0 %}
{% set sha256 = "4a1013eebb50f728fc601bdd833b0b2870333c3b3e5a816eeba921d95bec6f15" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: http://ftp.gnu.org/gnu/{{ name }}/{{ name }}-{{ version }}.tar.gz
  sha256: {{ sha256 }}
  patches:
    # glp_netgen_prob was removed in 5.0, but it wasn't removed from .def file
    - glp_netgen_prob.diff

build:
  number: {{ build }}
  run_exports:
    - {{ pin_subpackage("glpk") }}

requirements:
  build:
    - libtool  # [unix]
    - make
    - {{ compiler('c') }}
  host:
    - gmp         # [not win]
  run:
    - gmp         # [not win]

test:
  requires:
    - {{ compiler('c') }}
    - setuptools
    - cython
  files:
    - test.c
    - setup.py
    - spam.pyx
    - plan.mps
    - test_ctypes.py

  commands:
    # test glpsol executable
    - glpsol --mps plan.mps

    # test python extension using cython
    - cython spam.pyx
    - python setup.py develop test

    # test shared library using python ctypes module
    - python test_ctypes.py

    - test -f ${PREFIX}/lib/libglpk.a        # [linux]
    - test -f ${PREFIX}/lib/libglpk.so       # [linux]
    # static library not available on os x
    - test -f ${PREFIX}/lib/libglpk.dylib    # [osx]

about:
  home: https://www.gnu.org/software/glpk/
  license: GPL-3.0-or-later
  license_file:
    - COPYING
    # this is where the copyright statements are
    - README
  summary: GNU Linear Programming Kit
  description: |
    The GLPK (GNU Linear Programming Kit) package is intended for solving
    large-scale linear programming (LP), mixed integer programming (MIP), and
    other related problems. It is a set of routines written in ANSI C and
    organized in the form of a callable library.

extra:
  recipe-maintainers:
    - jakirkham
    - snorfalorpagus
    - isuruf
