{% set name = "librdkafka" %}
{% set version = "2.1.1" %}
{% set sha256 = "7be1fc37ab10ebdc037d5c5a9b35b48931edafffae054b488faaff99e60e0108" %}

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

source:
  url: https://github.com/confluentinc/{{ name }}/archive/refs/tags/v{{ version }}.tar.gz
  sha256: {{ sha256 }}

build:
  number: 0
  # np cyrus-sasl on s390x
  skip: True  # [linux and s390x]
  run_exports:
    - {{ pin_subpackage("librdkafka", max_pin="x.x") }}

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - ninja  # [win]
    - cmake >=3.2.0  # [win]
    - make  # [unix]
    - pkgconfig

  host:
    - zlib {{ zlib }}
    - openssl 3.0.8
    - cyrus-sasl 2.1.28  # [not win]
    - lz4-c 1.9.4
    - zstd {{ zstd }}
  run:
    - zlib
    - openssl 3.*
    # cyrus-sasl is not used on windows, instead a native implementation is:
    # https://github.com/edenhill/librdkafka/issues/1381#issuecomment-323382697
    - cyrus-sasl  # [not win]
    - lz4-c
    - zstd

test:
  commands:
    - test -f ${PREFIX}/lib/librdkafka${SHLIB_EXT}  # [not win]
    - test -f ${PREFIX}/lib/librdkafka++${SHLIB_EXT}  # [not win]
    - if not exist %LIBRARY_LIB%\\rdkafka.lib exit 1  # [win]
    - if not exist %LIBRARY_LIB%\\rdkafka++.lib exit 1  # [win]

about:
  home: https://github.com/confluentinc/librdkafka
  license: BSD-2-Clause
  license_family: BSD
  license_file: LICENSE
  summary: The Apache Kafka C/C++ client library
  description: |
    librdkafka is a C library implementation of the Apache Kafka protocol,
    containing both Producer and Consumer support. It was designed with message
    delivery reliability and high performance in mind, current figures exceed 1
    million msgs/second for the producer and 3 million msgs/second for the
    consumer.
  doc_url: https://github.com/confluentinc/librdkafka#documentation
  dev_url: https://github.com/confluentinc/librdkafka

extra:
  recipe-maintainers:
    - kwilcox
    - stuarteberg
    - StephenSmith25
