{% set version = "4.1.0" %}

package:
  name: magics
  version: {{ version }}

source:
  url: https://confluence.ecmwf.int/download/attachments/121845745/Magics-{{ version }}-Source.tar.gz
  sha256: 970ad7292595c24aa57a4fe649e767be65251610eb139be7178ce6f5ddafe47e
  patches:
    - 0001-Find-proj_6_0.lib-if-proj.lib-isn-t-found.patch

build:
  number: 0
  skip: True  # [(win and vc<14)]
  detect_binary_files_with_prefix: true
  features:
    - vc14  # [win]

requirements:
  build:
    - cmake
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    # the CDTs below are needed when building with Metview enabled
    - {{ cdt('mesa-libgl-devel') }}  # [linux]
    - {{ cdt('mesa-dri-drivers') }}  # [linux]
    - {{ cdt('libselinux') }}  # [linux]
    - {{ cdt('libxdamage') }}  # [linux]
    - {{ cdt('libxfixes') }}  # [linux]
    - {{ cdt('libxxf86vm') }}  # [linux]
    - {{ cdt('libxcb') }}  # [linux]
    - m2-bash  # [win]
    - m2-findutils  # [win]
    - m2-coreutils  # [win]
    - m2-grep  # [win]
    - m2-sed  # [win]
    - m2-gawk  # [win]
    - m2-diffutils  # [win]
    - m2-unzip  # [win]
  host:
    - python
    - pip
    - wheel
    - pkg-config  # [not win]
    - boost
    - expat
    - glib  # [not win]
    - pango  # [not win]
    - cairo  # [not win]
    - proj4
    - eccodes
    - libnetcdf
    - pthreads-win32  # [win]
    - libiconv  # [win]
    - jinja2
    - qt  # [not win]
    - zlib
    - magics-python
  run:
    - python
    - numpy
    - expat
    - pango  # [not win]
    - cairo  # [not win]
    - proj4
    - eccodes
    - simplejson
    - libnetcdf
    - pthreads-win32  # [win]
    - libiconv  # [win]
    - qt  # [not win]
    - zlib
    - magics-python

test:
  requires:
    # the CDTs below are needed when building with Metview enabled
    - {{ cdt('mesa-libgl-devel') }}  # [linux]
    - {{ cdt('mesa-dri-drivers') }}  # [linux]
    - {{ cdt('libselinux') }}  # [linux]
    - {{ cdt('libxdamage') }}  # [linux]
    - {{ cdt('libxfixes') }}  # [linux]
    - {{ cdt('libxxf86vm') }}  # [linux]
    - {{ cdt('libxcb') }}  # [linux]
  commands:
    - conda inspect linkages -p $PREFIX magics  # [not win]
    - conda inspect objects -p $PREFIX magics  # [osx]
    - printf "%s\n" "${MAGPLUS_HOME:?MAGPLUS_HOME is not set"  # [not win]
    - set | grep "MAGPLUS_HOME"  # [win]
  imports:
    - Magics  # [not linux]
    - Magics.macro  # [not linux]
    - Magics.metgram  # [not linux]
    - Magics.toolbox  # [not linux]

about:
  home: https://software.ecmwf.int/wiki/display/MAGP/
  license: Apache 2.0
  license_family: Apache
  summary: ECMWF's Meteorological plotting software

extra:
  recipe-maintainers:
    - kynan
    - carletes
    - StephanSiemen
    - dtip
