# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Daniel Bermond <dbermond@archlinux.org>
# Contributor: Thomas Schneider <maxmusterm@gmail.com>

pkgname=svt-av1
pkgver=2.2.1
pkgrel=1.1
pkgdesc='Scalable Video Technology AV1 encoder and decoder'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url=https://gitlab.com/AOMediaCodec/SVT-AV1
license=(
  BSD
  'custom: Alliance for Open Media Patent License 1.0'
)
depends=(glibc)
makedepends=(
  cmake
  git
  ninja
)
makdepends_x86_64=(
  nasm
)
_tag=55a01def732bb9e7016d23cc512384f7a88d6e86
source=(git+https://gitlab.com/AOMediaCodec/SVT-AV1.git#tag=${_tag})
b2sums=('5db0b7ec87a64d36c36a9b61a414562679ff25d987d39bc6f10d2fb4a3bd78b5e01accd0b141062a21ed15daab1a0735cf2a8423e03bc221827aeaebb618d9aa')

prepare() {
  sed '/CMAKE_BUILD_TYPE Release/d' -i SVT-AV1/CMakeLists.txt
}

pkgver() {
  cd SVT-AV1
  git describe --tags | sed 's/^v//'
}

build() {
  cmake -S SVT-AV1 -B build -G Ninja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON \
    -DNATIVE=OFF
  ninja -C build
}

package() {
  DESTDIR="${pkgdir}" ninja -C build install
  install -Dm 644 SVT-AV1/{LICENSE,PATENTS}.md -t "${pkgdir}"/usr/share/licenses/svt-av1/
}

# vim: ts=2 sw=2 et:
