{% set version = "1.3" %}
{% set p = "m2-" if win else "" %}

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

source:
  url: https://archive.mozilla.org/pub/opus/opus-{{ version }}.1.tar.gz
  sha256: 65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d
build:
  number: 1
  skip: True  # [win]
  run_exports:
    # seems to be maintaining compatibility across minor versions
    # https://abi-laboratory.pro/tracker/timeline/opus/
    - {{ pin_subpackage('libopus', max_pin='x') }}

requirements:
  build:
    - {{ compiler('c') }}
    - posix                     # [win]
    - git
    - {{ p }}make
    - {{ p }}autoconf
    - {{ p }}libtool
    - {{ p }}automake           # [not win]
    - {{ p }}automake-wrapper   # [win]
    - m2w64-toolchain           # [win]
  run:
    - m2w64-gcc-libs            # [win]

test:
  commands:
    - test -f ${PREFIX}/lib/libopus.a              # [not win]
    - test -f ${PREFIX}/lib/libopus.so             # [linux]
    - test -f ${PREFIX}/lib/libopus.dylib          # [osx]
    - conda inspect linkages -p $PREFIX libopus   # [not win]
    - conda inspect objects -p $PREFIX libopus    # [osx]

about:
  home: http://opus-codec.org/
  license: 3-clause BSD
  license_family: BSD
  summary: Opus Interactive Audio Codec
  description: |
    Opus is a totally open, royalty-free, highly versatile
    audio codec. Opus is unmatched for interactive speech
    and music transmission over the Internet, but is also
    intended for storage and streaming applications. It is
    standardized by the Internet Engineering Task Force
    (IETF) as RFC 6716 which incorporated technology from
    Skype's SILK codec and Xiph.Org's CELT codec.
  doc_url: http://opus-codec.org/docs/
  dev_url: http://opus-codec.org/development/
