# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

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

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}"
}
