# Maintainer: Daniel Bermond <dbermond@archlinux.org>

pkgname=libmysofa
pkgver=1.3.3
pkgrel=1
pkgdesc='C library to read HRTFs if they are stored in the AES69-2015 SOFA format'
arch=('x86_64' 'aarch64')
url='https://github.com/hoene/libmysofa/'
license=('BSD-3-Clause')
depends=('zlib')
makedepends=('cmake' 'cunit')
checkdepends=('nodejs')
provides=('libmysofa.so')
source=("https://github.com/hoene/libmysofa/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('a15f7236a2b492f8d8da69f6c71b5bde1ef1bac0ef428b94dfca1cabcb24c84f')

build() {
    cmake \
        -G 'Unix Makefiles' \
        -B "${pkgname}-${pkgver}/build" \
        -S "${pkgname}-${pkgver}" \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -DCODE_COVERAGE:BOOL='OFF' \
        -Wno-dev
    cmake --build "${pkgname}-${pkgver}/build"
}

check() {
    ctest --test-dir "${pkgname}-${pkgver}/build" --output-on-failure --stop-on-failure
}

package() {
    DESTDIR="${pkgdir}" cmake --install "${pkgname}-${pkgver}/build"
    install -D -m644 "${pkgname}-${pkgver}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
