# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=speexdsp
pkgver=1.2.1
pkgrel=2.1
pkgdesc="DSP library derived from Speex"
url="https://www.speex.org/"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=(BSD)
depends=(gcc-libs)
makedepends=(git)
provides=(libspeexdsp.so)
_commit=1b28a0f61bc31162979e1f26f3981fc3637095c8  # tags/SpeexDSP-1.2.1^0
source=("git+https://gitlab.xiph.org/xiph/speexdsp.git#commit=$_commit")
b2sums=('f44bb6a7df8606aecfe2333e3191486d77b1ea9c1ef2c0d4763133d8f0c05252429f11562df8b3a5f6e9610f150a9b0d677b92764e45d244458a6bed733b66e8')

pkgver() {
  cd speexdsp
  git describe --tags | sed 's/^SpeexDSP-//;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd speexdsp
  ./autogen.sh
}

build() {
  cd speexdsp
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --disable-static
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd speexdsp
  make -k check
}

package() {
  cd speexdsp
  make DESTDIR="$pkgdir" install
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 COPYING
}
