# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Anatol Pomozov
# Contributor: JSpaces <jspace@unseen.is>
# Contributor: Triode <triode1@btinternet.com>

pkgname=libsoxr
pkgver=0.1.3
pkgrel=5
pkgdesc='The SoX Resampler library that aims to give fast and high quality results for any constant resampling ratio'
arch=(x86_64 aarch64)
url=https://sourceforge.net/p/soxr/wiki/Home/
license=(
  LGPL-2.1-only
  LicenseRef-soxr
)
depends=(
  glibc
  libgcc
  libgomp
)
makedepends=(
  git
  cmake
  ninja
)
source=(git+https://github.com/chirlu/soxr.git#tag=${pkgver})
b2sums=('bb252500db2c2909fecdd1df7ab3c42c8930bd5c4e41734449edef7eaf16787418a6b4377b26051d3bbe74b79264e2a8193cbb1095bf58c665c706e2b265e6ac')

build() {
  cmake -S soxr -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_SHARED_LIBS=ON \
    -DWITH_AVFFT=ON \
    -DWITH_LSR_BINDINGS=ON \
    -DWITH_OPENMP=ON \
    -DWITH_PFFFT=ON \
    -DCMAKE_POLICY_VERSION_MINIMUM=3.5
    cmake --build build
}

check() {
  ctest --test-dir build
}

package() {
  DESTDIR="${pkgdir}" cmake --install build
  rm -rf "${pkgdir}"/usr/share/doc
  install -Dm 644 soxr/LICENCE -t "${pkgdir}"/usr/share/licenses/libsoxr/
}
