# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>

pkgname=soundtouch
pkgver=2.3.0
pkgrel=2
pkgdesc='An audio processing library'
arch=(x86_64)
url=https://www.surina.net/soundtouch/
license=(LGPL2.1)
depends=(gcc-libs)
makedepends=(
  cmake
  git
  ninja
)
_tag=c65afe49f697fcea87d9a134870c8d115d7700cc
source=(
  git+https://gitlab.com/soundtouch/soundtouch.git#tag=${_tag}
  soundtouch-cmake.patch
)
b2sums=(
  SKIP
  995f751615848acd46da4420d3f243f5b4887879b5a654f546a52629443cdec8249bbcb53cf800600d65ecfe0cf114249b63e0c53e8f75478e7f8bc060ae1e40
)

prepare() {
  cd soundtouch
  # set soname, install autotools files
  patch -Np1 -i ../soundtouch-cmake.patch
  # cmake doesn't generate files for autotools
  autoreconf -fiv
  ./configure --prefix=/usr --enable-shared
}

pkgver() {
  cd soundtouch
  git describe --tags
}

build() {
  cmake -S soundtouch -B build -G Ninja \
    -DCMAKE_BUILD_TYPE='' \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON
  cmake --build build
}

package() {
  DESTDIR="${pkgdir}" cmake --install build
}

# vim: ts=2 sw=2 et:
