{% set name = "mamba" %}
{% set version = "2.3.2" %}

package:
  name: mamba-split
  version: {{ version }}

source:
  url: https://github.com/{{ name }}-org/{{ name }}/archive/refs/tags/{{ version }}.tar.gz
  sha256: c969d189b0263218467b9e3b8922fcad8f7023bd8b5a981edc37e0da27cf953f
  patches:
    - patches/0001-revert-use-range-in-solution.patch # [linux]

build:
  number: 3

outputs:
  - name: libmamba
    version: {{ 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
    requirements:
      build:
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        - {{ stdlib('c') }}
        - cmake
        - ninja-base
        - pkg-config
      host:
        - libsolv 0.7.30
        - libcurl {{ libcurl }}
        - openssl {{ openssl }}
        - libarchive {{ libarchive }}
        - nlohmann_json 3.11.2
        - cpp-expected 1.1.0
        - reproc-cpp {{ reproc_cpp }}
        - reproc {{ reproc }}
        - spdlog {{ spdlog }}
        - yaml-cpp {{ yaml_cpp }}
        - fmt {{ fmt }}
        - winreg 4.1.2 # [win]
        - zstd {{ zstd }}
        - bzip2 {{ bzip2 }}
        - cli11 2.1.2
        - simdjson {{ simdjson }}
      run:
        - {{ pin_compatible('libsolv', max_pin='x.x') }}
        - {{ pin_compatible('nlohmann_json', max_pin='x.x.x') }}
        - {{ pin_compatible('cpp-expected', max_pin='x.x.x') }}
        # through run_exports
        - libcurl
        - openssl
        - libarchive
        - reproc-cpp
        - reproc
        - fmt
        - zstd
        - bzip2
        - simdjson
    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 = 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: {{ 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') }}
        - {{ stdlib('c') }}
        - cmake
        - ninja-base
      host:
        - python
        - pip
        - scikit-build
        - pybind11 <3.0
        - pybind11-abi
        - spdlog {{ spdlog }}
        - fmt {{ fmt}}
        - {{ pin_subpackage('libmamba', exact=True) }}
      run:
        - python
        - {{ pin_subpackage('libmamba', exact=True) }}

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

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
