# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=webrtc-audio-processing-1
pkgver=1.3
pkgrel=5
pkgdesc="AudioProcessing library based on Google's implementation of WebRTC (legacy)"
url="https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/"
arch=(x86_64 aarch64)
license=(BSD-3-Clause)
depends=(
  abseil-cpp
  gcc-libs
  glibc
)
makedepends=(
  git
  meson
)
provides=(
  libwebrtc-audio-coding-1.so
  libwebrtc-audio-processing-1.so
)
source=(
  "git+https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing.git?signed#tag=v$pkgver"
  0001-Fix-compilation-with-GCC-15.patch
)
b2sums=('ce5cb5c44474add0beb769b41ca64588dd4b2e164934161360ab71bf5fc520d6aa9cc10b070652a438fc80b00cd7245d7676ed07badb711cba8aa943b2fabbe2'
        '1962d02b733e3e62acebf3c794c85443c8aa667f84dbee2d25e76bc64f41cff3d49427c230e90ea1f2e3761167e7a03444cb7dc07e820c75f517f3c864fdcd3e')
validpgpkeys=(
  52DFA7B8BAC74687C8A88EF48165E3D1987E2132 # Arun Raghavan <arun@asymptotic.io>
)

prepare() {
  cd webrtc-audio-processing

  # Fix compilation with gcc 15
  git apply -3 ../0001-Fix-compilation-with-GCC-15.patch
}

build() {
  local meson_options=(
    # must match abseil
    -D cpp_std=c++17
  )

  arch-meson webrtc-audio-processing build "${meson_options[@]}"
  meson compile -C build
}

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

package() {
  meson install -C build --destdir "$pkgdir"
  install -Dm644 webrtc-audio-processing/COPYING \
    -t "$pkgdir/usr/share/licenses/$pkgname"
}

# vim:set sw=2 sts=-1 et:
