pkgname=flac
pkgver=1.5.0
pkgdesc='Free Lossless Audio Codec'
homepage='https://xiph.org/flac/'
arch=('x86_64')
license=(
  'BSD-3-Clause'     # library
  'GPL-2.0-or-later' # apps
)
depends=(
  'glibc'
  'gcc'
)
makedepends=(
  'cmake'
)
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://github.com/xiph/flac/releases/download/${pkgver}/${sources[0]}")
sha512sums=("34c9193b804e990b0828a5759e4d7ef1d1859174262d3b305d03e65285edb35c7f429e8071d9dd2c6da0c16e842b40b439bf215704636ae15dd5886151f0d17a")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local conf_args=(
    --prefix=/usr
    --docdir=/usr/share/doc/${pkgname}-${pkgver}
    --disable-thorough-tests
    --disable-doxygen-docs
    --disable-examples
    --disable-valgrind-testing
    --disable-version-from-git
    --enable-avx
    --enable-cpplibs
    --disable-debug
    --disable-ogg
    --disable-static
    --enable-programs
  )
  ./configure "${conf_args[@]}"
  make
}

src_check() {
  chown -R leaf .
  su leaf -c "PATH=$PATH make -j1 check"
}

src_install() {
  make DESTDIR="$pkgdir" install
  install -Dm644 COPYING.* -t "$pkgdir/usr/share/licenses/$pkgname/"
}

# vim:ft=sh syn=sh et sw=2:
