{% set version = "3.3.2" %}
{% set build = 0 %}

package:
  # must not match any outputs for requirements to be handled correctly
  name: mpich-mpi
  version: {{ version }}

source:
  fn: mpich-{{ version }}.tar.gz
  url: http://www.mpich.org/static/downloads/{{ version }}/mpich-{{ version }}.tar.gz
  sha256: 4bfaf8837a54771d3e4922c84071ef80ffebddbb6971a006038d91ee7ef959b9

build:
  number: {{ build }}
  skip: True  # [win]

outputs:
  {% if mpi_type == 'external' %}
  - name: mpich
    string: "{{ mpi_type }}_{{ build }}"
    track_features:
      - mpich_{{ mpi_type }}
    requirements:
      run:
        - mpi 1.0 mpich
    test:
      commands:
        - echo "It works!"
  {% else %}
  - name: mpich
    script: build-mpi.sh
    build:
      run_exports:
        - {{ pin_subpackage('mpich', max_pin='x.x') }}
      missing_dso_whitelist:                                              # [osx]
        - /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL   # [osx]
    requirements:
      build:
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        - {{ compiler('fortran') }}
        - make  # [unix]
      host: []
      run:
        - mpi 1.0 mpich
    test:
      script: run_test.sh
      files:
        - mpiexec.sh
        - tests/helloworld.sh

  - name: mpich-mpicc
    build:
      script:
        - echo 'ok'  # [not osx]
        # make CONDA_BUILD_SYSROOT a 'used variable'
        # so that conda-build knows to pass it to the test env
        - echo "{{CONDA_BUILD_SYSROOT}}"  # [osx]
    requirements:
      run:
        - {{ pin_subpackage('mpich', exact=True) }}
        # host C compilers work fine (better) on mac
        - {{ compiler('c') }}
    test:
      script: run_test.sh
      files:
        - mpiexec.sh
        - tests/helloworld.c

  - name: mpich-mpicxx
    build:
      script:
        - echo 'ok'  # [not osx]
        # make CONDA_BUILD_SYSROOT a 'used variable'
        # so that conda-build knows to pass it to the test env
        - echo "{{CONDA_BUILD_SYSROOT}}"  # [osx]
    requirements:
      run:
        - {{ pin_subpackage('mpich', exact=True) }}
        # host C compilers work fine (better) on mac
        - {{ compiler('cxx') }}
    test:
      script: run_test.sh
      files:
        - mpiexec.sh
        - tests/helloworld.cxx

  - name: mpich-mpifort
    build:
      script:
        - echo 'ok'  # [not osx]
        # make CONDA_BUILD_SYSROOT a 'used variable'
        # so that conda-build knows to pass it to the test env
        - echo "{{CONDA_BUILD_SYSROOT}}"  # [osx]
    requirements:
      run:
        - {{ pin_subpackage('mpich', exact=True) }}
        - {{ compiler('fortran') }}
    test:
      script: run_test.sh
      files:
        - mpiexec.sh
        - tests/helloworld.f
        - tests/helloworld.f90
  {% endif %}

about:
  home: http://www.mpich.org/
  license: MPICH
  license_file: COPYRIGHT
  license_family: Other
  summary: 'A high performance widely portable implementation of the MPI standard.'
  description: |
    MPICH is a high performance and widely portable implementation of the
    Message Passing Interface (MPI) standard.
  doc_url: http://www.mpich.org/documentation/guides
  dev_url: https://wiki.mpich.org/mpich/index.php/Main_Page

extra:
  recipe-maintainers:
    - astrofrog-conda-forge
    - bekozi
    - dalcinl
    - minrk
    - msarahan
    - ocefpaf
    - beckermr
