pkgname=opus
pkgver=1.5.2
pkgdesc="Totally open, royalty-free, highly versatile audio codec"
homepage="https://www.opus-codec.org/"
arch=(x86_64)
license=(BSD-3-Clause)
depends=(glibc)
makedepends=(meson)
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("https://downloads.xiph.org/releases/${pkgname}/${sources[0]}")
sha512sums=("78d963cd56d5504611f111e2b3606e236189a3585d65fae1ecdbec9bf4545632b1956f11824328279a2d1ea2ecf441ebc11e455fb598d20a458df15185e95da4")

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

src_build() {
  local meson_args=(
    --prefix=/usr
    --buildtype=release
    --wrap-mode=nodownload
    -D python.bytecompile=1
    -D default_library=shared
    -D custom-modes=false
    -D assertions=false
    -D tests=enabled
    -D hardening=false
    -D deep-plc=disabled
    -D dred=disabled
    -D osce=disabled
    -D docs=disabled
    -D docdir=/usr/share/doc/${pkgname}-${pkgver}
    -D intrinsics=enabled #cpu_flags_x86_sse
  )
  meson setup build "${meson_args[@]}"
  meson compile -C build
}

src_check() {
  meson test -C build --print-errorlogs
}

src_install() {
  meson install -C build --destdir "$pkgdir"
  install -Dm644 opus.m4 -t "$pkgdir/usr/share/aclocal"
  install -Dm644 COPYING -t "$pkgdir/usr/share/licenses/$pkgname"
}

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