{% set name = "OpenMS" %}
{% set version = "2.8.0" %}
package:
  name: {{ name|lower  }}-meta
  version: {{ version  }}

source:
  url: https://abibuilder.informatik.uni-tuebingen.de/archive/openms/OpenMSInstaller/release/{{ version }}/OpenMS-{{ version }}-src.tar.gz
  sha256: c39e3ccdce5c335d2659cfa9d0bb63555a01ec422757afd90706d3869bf611ac
  # patch should be removed in 2.9 https://github.com/OpenMS/OpenMS/pull/6122
  patches:
    - sirius-2.8.0.patch

build:
  number: 2

# Try this when building with GUI
#extra:
#  container:
#    extended-base: True

requirements:
    build:
      - {{ compiler('cxx') }}
      - cmake
      - make
      - autoconf
      - automake
    host:
      - llvm-openmp # [osx]
      - zlib
      - libtool
      - xerces-c
      - boost-cpp
      - eigen >=3.3.2
      - glpk
      - hdf5 >=1.10
      - bzip2
      - qt
      - libsvm
      - coinmp
      - sqlite

test:
  commands:
    - conda inspect linkages -p $PREFIX $PKG_NAME  # [not win]
    - conda inspect objects -p $PREFIX $PKG_NAME  # [osx]

outputs:
  - name: libopenms
    version: {{ version }}
    script: package_libopenms.sh
    requirements:
        # no actual build is done. CMake is used to install different parts of the existing build
        # But since the other packages depend on its run_exports
        # We want to make sure that the versions of the dependencies used are the same as above
        build:
          - cmake
        host:
          - llvm-openmp # [osx]
          - zlib
          - libtool
          - xerces-c
          - boost-cpp
          - eigen >=3.3.2
          - glpk
          - hdf5 >=1.10
          - bzip2
          - qt
          - libsvm
          - coinmp
          - sqlite
    build:
      run_exports:
          - {{ pin_compatible('llvm-openmp', max_pin='x.x') }} # [osx]
          - {{ pin_compatible('zlib', max_pin='x.x') }}
          - {{ pin_compatible('xerces-c', max_pin='x.x') }}
          - {{ pin_compatible('boost-cpp', max_pin='x.x') }}
          - {{ pin_compatible('eigen', max_pin='x.x') }}
          - {{ pin_compatible('glpk', max_pin='x.x') }}
          - {{ pin_compatible('hdf5', max_pin='x.x') }}
          - {{ pin_compatible('bzip2', max_pin='x.x') }}
          - {{ pin_compatible('qt', max_pin='x.x') }}
          - {{ pin_compatible('libsvm', max_pin='x.x') }}
          - {{ pin_compatible('coinmp', max_pin='x.x') }}
          - {{ pin_compatible('sqlite', max_pin='x.x') }}
          - libopenms {{ version }}

  - name: openms
    version: {{ version }}
    script: package_openms-tools.sh
    requirements:
      # no actual build is done. CMake is used to install different parts of the existing build
      build:
        - cmake
      host:
        - {{ pin_subpackage('libopenms', exact=True) }}
      # conda apparently does not support run_exports in subpackages yet, otherwise having libopenms in host would be enough.
      # see https://github.com/conda/conda-build/issues/3478
      # so specify everything again, such that EXACTLY the same versions are used!
      # I could not get the "resolved_packages" jinja function to gather dependencies from other subpackages.
        - llvm-openmp # [osx]
        - zlib
        - libtool
        - xerces-c
        - boost-cpp
        - eigen >=3.3.2
        - glpk
        - hdf5 >=1.10
        - bzip2
        - qt
        - libsvm
        - coinmp
        - sqlite
      run:
        - {{ pin_subpackage('libopenms', exact=True) }}
        - {{ pin_compatible('llvm-openmp', max_pin='x.x') }} # [osx]
        - {{ pin_compatible('zlib', max_pin='x.x') }}
        - {{ pin_compatible('xerces-c', max_pin='x.x') }}
        - {{ pin_compatible('boost-cpp', max_pin='x.x') }}
        - {{ pin_compatible('eigen', max_pin='x.x') }}
        - {{ pin_compatible('glpk', max_pin='x.x') }}
        - {{ pin_compatible('hdf5', max_pin='x.x') }}
        - {{ pin_compatible('bzip2', max_pin='x.x') }}
        - {{ pin_compatible('qt', max_pin='x.x') }}
        - {{ pin_compatible('libsvm', max_pin='x.x') }}
        - {{ pin_compatible('coinmp', max_pin='x.x') }}
        - {{ pin_compatible('sqlite', max_pin='x.x') }}
    test:
      commands:
        - OPENMS_DATA_PATH=${PREFIX}/share/OpenMS/ ${PREFIX}/bin/OpenMSInfo
        - OPENMS_DATA_PATH=${PREFIX}/share/OpenMS/ ${PREFIX}/bin/FileMerger --help

  - name: openms-thirdparty
    version: {{ version }}
    build:
     # Dependencies bumbershoot, fido, percolator are not available for osx.
     skip: True  # [osx]
    requirements:
     run:
       - {{ pin_subpackage('openms', exact=True) }}
       - bumbershoot ==3_0_21142_0e4f4a4
       - comet-ms ==2019015
       - crux-toolkit ==3.2
       - fido ==1.0
       - luciphor2 ==2020_04_03
       - msgf_plus ==2021.03.22
       - pepnovo ==20101117
       - percolator ==3.5
       - sirius-csifingerid =4.9
       - thermorawfileparser ==1.3.4
       - xtandem ==15.12.15.2
       - gnuplot
       - r-gplots
    test:
     # Test copied from openms output to make sure a test environment for this output is created.
     commands:
       - OPENMS_DATA_PATH=${PREFIX}/share/OpenMS/ ${PREFIX}/bin/OpenMSInfo
       - sirius --help

about:
  home: https://github.com/OpenMS/OpenMS
  license: BSD
  license_file: LICENSE
  summary: OpenMS is an open-source software C++ library for LC-MS data management and analyses

extra:
  skip-lints:
    - build_number_needs_reset  # our linter has some issues with multi-package recipes as it seems
  identifiers:
    - biotools:openms
    - usegalaxy-eu:openms_fileconverter
    - doi:10.1038/nmeth.3959
