distributable:
  url: https://downloads.xiph.org/releases/flac/flac-{{version}}.tar.xz
  strip-components: 1

versions:
  github: xiph/flac/releases/tags

dependencies:
  xiph.org/ogg: ^1.3.5

build:
  dependencies:
    freedesktop.org/pkg-config: ^0.29
    gnu.org/libtool: ^2.4
    gnu.org/automake: ^1.16
    gnu.org/autoconf: ^2.71
  script: |
    ./configure $ARGS
    make --jobs {{ hw.concurrency }} install
  env:
    ARGS:
      - --disable-debug
      - --disable-dependency-tracking
      - --prefix="{{prefix}}"
      - --enable-static

provides:
  - bin/flac

test:
  script: |
    test "$(flac --version)" = "flac {{version}}"
    flac $ARG1
    flac $ARG2
  env:
    ARG1:
      - --decode
      - --force-raw
      - --endian=little
      - --sign=signed
      - --output-name=out.raw
      - test.flac
    ARG2:
      - --endian=little
      - --sign=signed
      - --channels=1
      - --bps=8
      - --sample-rate=8000
      - --output-name=out.flac
      - out.raw
