{% set name = "mamba" %}
{% set libmamba_version = "1.4.1" %}
{% set libmambapy_version = "1.4.1" %}
{% set mamba_version = "1.4.1" %}
{% set release = "2023.03.28" %}
{% set build_mamba = "false" %}

package:
  name: mamba-split

source:
  url: https://github.com/{{ name }}-org/{{ name }}/archive/refs/tags/{{ release }}.tar.gz
  sha256: 53ee26c7cf3730919cb6b40956a1fb591859ec12a037adc09da1ed390c2fdfb6

build:
  number: 1

outputs:
  - name: libmamba
    version: {{ libmamba_version }}
    script: build_mamba.sh                       # [unix]
    script: build_mamba.bat                      # [win]
    build:
      run_exports:
        - {{ pin_subpackage('libmamba', max_pin='x.x') }}
      ignore_run_exports:
        - spdlog
        - python    # [win]
      missing_dso_whitelist:  # [s390x]
        - $RPATH/ld64.so.1    # [s390x] Known s390x `ld64.so` issue.
    requirements:
      build:
        - {{ compiler('cxx') }}
        - cmake
        - ninja
        - python            # [win]
      host:
        - libsolv 0.7.22
        - libcurl 7.88.1
        - openssl {{ openssl }}
        - libarchive 3.6.2
        - nlohmann_json 3.11.2
        - cpp-expected 1.0.0
        - reproc-cpp 14.2.4
        - reproc 14.2.4
        - spdlog 1.11.0
        - yaml-cpp 0.7.0
        - fmt 9.1.0
        - winreg 4.1.2 # [win]
        - zstd 1.5.4
        - bzip2 1.0
        - cli11 2.1.2
      run:
        - libsolv >=0.7.22,<0.8.0a0
        - reproc-cpp >=14.2.4,<15.0a0
        - reproc >=14.2.4,<15.0a0
    test:
      commands:
        - test -d ${PREFIX}/include/mamba                                   # [unix]
        - test -f ${PREFIX}/include/mamba/version.hpp                       # [unix]
        - test -f ${PREFIX}/lib/cmake/libmamba/libmambaConfig.cmake         # [unix]
        - test -f ${PREFIX}/lib/cmake/libmamba/libmambaConfigVersion.cmake  # [unix]
        - test -e ${PREFIX}/lib/libmamba${SHLIB_EXT}                        # [unix]
        - if not exist %LIBRARY_PREFIX%\include\mamba\version.hpp (exit 1)                       # [win]
        - if not exist %LIBRARY_PREFIX%\lib\cmake\libmamba\libmambaConfig.cmake (exit 1)         # [win]
        - if not exist %LIBRARY_PREFIX%\lib\cmake\libmamba\libmambaConfigVersion.cmake (exit 1)  # [win]
        - if not exist %LIBRARY_PREFIX%\bin\libmamba.dll (exit 1)                                # [win]
        - if not exist %LIBRARY_PREFIX%\lib\libmamba.lib (exit 1)                                # [win]
        {% set libmamba_version_split = libmamba_version.split('.') %}
        - cat $PREFIX/include/mamba/version.hpp | grep "LIBMAMBA_VERSION_MAJOR {{ libmamba_version_split[0] }}"  # [unix]
        - cat $PREFIX/include/mamba/version.hpp | grep "LIBMAMBA_VERSION_MINOR {{ libmamba_version_split[1] }}"  # [unix]
        - cat $PREFIX/include/mamba/version.hpp | grep "LIBMAMBA_VERSION_PATCH {{ libmamba_version_split[2] }}"  # [unix]

  - name: libmambapy
    version: {{ libmambapy_version }}
    script: build_mamba.sh                       # [unix]
    script: build_mamba.bat                      # [win]
    build:
      skip: true  # [py<37]
      string: py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
      run_exports:
        - {{ pin_subpackage('libmambapy', max_pin='x.x') }}
      ignore_run_exports:
        - spdlog
    requirements:
      build:
        - {{ compiler('cxx') }}
        - cmake
        - ninja
      host:
        - python
        - pip
        - setuptools
        - wheel
        - pybind11 2.10.1
        - pybind11-abi 4
        - openssl {{ openssl }}
        - yaml-cpp 0.7.0
        - cpp-expected 1.0.0
        - spdlog 1.11.0
        - fmt 9.1.0
        - nlohmann_json 3.11.2
        - {{ pin_subpackage('libmamba', exact=True) }}
      run:
        - python
        - {{ pin_subpackage('libmamba', exact=True) }}

    test:
      imports:
        - libmambapy
        - libmambapy.bindings
      commands:
        - python -c "import libmambapy._version; assert libmambapy._version.__version__ == '{{ libmambapy_version }}'"

{% if build_mamba == "true" %}
  # we don't intend to support mamba on Anaconda's defaults, therefore
  # we disable it, but still trying to share recipe in most parts with
  # conda-forge.
  - name: mamba
    version: {{ mamba_version }}
    script: build_mamba.sh                       # [unix]
    script: build_mamba.bat                      # [win]
    build:
      skip: true  # [py<37]
      string: py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}
      entry_points:
        - mamba = mamba.mamba:main
    requirements:
      host:
        - python
        - pip
        - setuptools
        - wheel
        - openssl {{ openssl }}
        - {{ pin_subpackage('libmambapy', exact=True) }}
      run:
        - python
        - conda >=4.14.0,<23.4
        - {{ pin_subpackage('libmambapy', exact=True) }}

    test:
      imports:
        - mamba
      requires:
        - pip
      commands:
        - mamba --help
        - if exist %PREFIX%\condabin\mamba.bat (exit 0) else (exit 1)  # [win]
        - test -f ${PREFIX}/etc/profile.d/mamba.sh  # [linux]
        # these tests work when run on win, but for some reason not during conda build
        - mamba create -n test_py2 python=2.7 --dry-run  # [linux and (x86_64 or ppc64le)]
        - mamba install xtensor xsimd -c conda-forge --dry-run  # [linux and x86_64]
        # for some reason tqdm doesn't have a proper colorama dependency so pip check fails
        # but that's completely unrelated to mamba
        - python -c "import mamba._version; assert mamba._version.__version__ == '{{ mamba_version }}'"
        - test -f ${PREFIX}/condabin/mamba  # [unix]
{% endif %}

about:
  home: https://github.com/mamba-org/mamba
  license: BSD-3-Clause
  license_file: LICENSE
  license_family: BSD
  summary: A fast drop-in alternative to conda, using libsolv for dependency resolution
  description: |
    # Mamba, the Fast Cross-Platform Package Manager

    [![Build Status](https://github.com/mamba-org/mamba/workflows/CI/badge.svg)](https://github.com/mamba-org/mamba/actions)
    [![Join the Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mamba-org/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
    [![docs](https://readthedocs.org/projects/mamba/badge/?version=latest&style=flat)](https://mamba.readthedocs.io/en/latest)

    `mamba` is a reimplementation of the conda package manager in C++.

    - parallel downloading of repository data and package files using multi-threading
    - libsolv for much faster dependency solving, a state of the art library used in the RPM package manager of Red Hat, Fedora and OpenSUSE
    - core parts of `mamba` are implemented in C++ for maximum efficiency

    At the same time, `mamba` utilizes the same command line parser, package installation and deinstallation code and transaction verification routines as `conda` to stay as compatible as possible.

    Mamba is part of a bigger ecosystem to make scientific packaging more sustainable. You can read our [announcement blog post](https://medium.com/@QuantStack/open-software-packaging-for-science-61cecee7fc23).
    The ecosystem also consists of `quetz`, an open source `conda` package server and `boa`, a fast `conda` package builder.

    ### Installation

    Please refer to the [`mamba` and `micromamba` installation guide](https://mamba.readthedocs.io/en/latest/installation.html) in the documentation.

    ### Additional features in Mamba and Micromamba

    `mamba` and `micromamba` come with features on top of stock `conda`.

    ### `repoquery`

    To efficiently query repositories and query package dependencies you can use `mamba repoquery` or `micromamba repoquery`.
    See the [repoquery documentation](https://mamba.readthedocs.io/en/latest/user_guide/mamba.html#repoquery) for details.

    ### Installing lock files

    `micromamba` can be used to install lock files generated by [conda-lock](https://conda-incubator.github.io/conda-lock/) without having to install `conda-lock`. Simply invoke e.g. `micromamba create -n my-env -f conda-lock.yml` with an environment lockfile named `*-lock.yml` or `*-lock.yaml`.

  dev_url: https://github.com/mamba-org/mamba
  doc_url: https://mamba.readthedocs.io/

extra:
  recipe-maintainers:
    - adriendelsalle
    - SylvainCorlay
    - JohanMabille
    - wolfv
    - ericmjl
