{% set version = "1.21" %}

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

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

source:
  url: https://github.com/samtools/htslib/releases/download/{{ version }}/htslib-{{ version }}.tar.bz2
  sha256: 84b510e735f4963641f26fd88c8abdee81ff4cb62168310ae716636aac0f1823
  patches:
    - arm_hwcap.patch

requirements:
  build:
    - make
    - {{ compiler('c') }}
  host:
    - libcurl
    - bzip2
    - xz
    - zlib
    - libdeflate
    - 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
  license_family: MIT
  license_file: LICENSE
  summary: C library for high-throughput sequencing data formats.
  doc_url: http://www.htslib.org/

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