{% set version = "1.10.2" %}

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: e3b543de2f71723830a1e0472cf5489ec27d0fbeb46b1103e14a11b7177d1939

requirements:
  build:
    - {{ compiler('c') }}
  host:
    - libcurl
    - bzip2
    - xz
    - zlib
    - libdeflate
    - openssl  # [not osx]
  run:
    - 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
  summary: C library for high-throughput sequencing data formats.

extra:
  identifiers:
    - biotools:HTSlib
