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

pkgname=soundtouch
pkgver=2.4.0
pkgrel=1
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=d994965fbbcf0f6ceeed0e72516968130c2912f0
source=(
  git+https://codeberg.org/soundtouch/soundtouch.git#tag=${_tag}
  soundtouch-cmake.patch
)
b2sums=('704c87a48b939819b4f59455247ee6935345bc389d3404b36884346d7d6ea9d2f90e77b646530303400e4bc8c154bdb7748b26e95ade817f9dd26bad05046231'
        '9eed09dc451c4e216a322211622e96757671613a4ba8231a699e32a50764eee4072837df697205dea87ef66a4d4d3105418451bec9cbe4f077ab55718ab374dd')

prepare() {
  cd soundtouch
  # 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:
