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

pkgname=taglib
pkgver=%version%
pkgrel=%release%
pkgdesc='A Library for reading and editing the meta-data of several popular audio formats'
arch=(x86_64)
url='https://taglib.github.io/'
license=(LGPL-2.1-only
         MPL-1.1)
depends=(gcc-libs
         glibc
         sh
         zlib)
makedepends=(cmake
             utf8cpp)
checkdepends=(cppunit)
source=(https://taglib.github.io/releases/$pkgname-$pkgver.tar.gz
        https://github.com/taglib/taglib/commit/dfef09f1.patch)
sha256sums=('e36ea877a6370810b97d84cf8f72b1e4ed205149ab3ac8232d44c850f38a2859'
            'bef9bf3cb5cb342e339612ca9fb9d9020ddd3307af15db0402507e7dcbcf35a2')

prepare() {
  patch -d $pkgname-$pkgver -Rp1 < dfef09f1.patch # https://github.com/taglib/taglib/issues/1211
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON \
    -DCMAKE_CXX_FLAGS="$CXXFLAGS -DNDEBUG"
  cmake --build build
}

check() {
  cmake --build build --target test
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
