makedepends=(cmake)

description="The SoX Resampler library that aims to give fast and high quality results for any constant resampling ratio"
url="https://sourceforge.net/p/soxr/wiki/Home/"

packager="Great-OS Team"
maintainer="Great-OS Team"

name="libsoxr"
version="0.1.3"
release=1

source=(https://downloads.sourceforge.net/project/soxr/soxr-$version-Source.tar.xz)

prepare() {
  mv soxr-$version-Source $name-$version
}

build() {
  mkdir build

  cmake -S $name-$version -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
  cmake --build build
}

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