{% set version = "1.10" %}

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

source:
  url: https://github.com/samtools/htslib/releases/download/{{ version }}/htslib-{{ version }}.tar.bz2
  sha256: 7ae44dd9faeb4c4293e9bb4815164ac28c6c6fae81fed4791df2fa878f57a972

build:
  number: 2
  run_exports:
    - {{ pin_subpackage('htslib', max_pin="x") }}

requirements:
  build:
    - {{ compiler('c') }}
    - make
    - autoconf
    - automake
    - libtool
    - pkg-config
    - gnuconfig
  host:
    - libcurl
    - bzip2
    - xz
    - zlib
    - libdeflate
    - openssl  # [not osx]
    - gcsfs    # [linux]
    - aws-sdk-cpp  # [linux]
  run:
    - openssl  # [not osx]

test:
  files:
    - test1.bed
  commands:  # We want to make sure that libdeflate is actually linked via HTSLib
    - "otool -L $PREFIX/bin/bgzip | grep deflate"  # [osx]
    - "ldd $PREFIX/bin/bgzip | grep deflate"  # [not osx]
    # Work around mulled-build's failure to copy the test file
    - "test -e test1.bed || printf 'chr1\\t100\\t200\\n' > test1.bed"
    - bgzip test1.bed
    - tabix test1.bed.gz
    - htsfile test1.bed.gz

about:
  home: https://github.com/samtools/htslib
  license: MIT
  summary: C library for high-throughput sequencing data formats.

extra:
  identifiers:
    - biotools:HTSlib
  additional-platforms:
    - linux-aarch64
    - osx-arm64
