# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Chocobo1 <chocobo1@archlinux.net>

pkgname=libdeflate
pkgver=1.24
pkgrel=1
pkgdesc='Heavily optimized library for DEFLATE/zlib/gzip compression and decompression'
arch=(x86_64 aarch64)
url=https://github.com/ebiggers/libdeflate
license=(MIT)
depends=(glibc)
makedepends=(
  cmake
  git
  ninja
)
provides=(libdeflate.so)
_tag=96836d7d9d10e3e0d53e6edb54eb908514e336c4
source=(git+https://github.com/ebiggers/libdeflate.git#tag=${_tag})
b2sums=('a8717cc7ab3d09695357f74da1df8f0a11c303b79a6764e20a683f36f67d0a2fca2cde77721d1c38a75aa7c64901c09d45009be591cef2829fbc310dee26ac76')

pkgver() {
  cd libdeflate
  git describe --tags | sed 's/^v//'
}

build() {
  cmake -S libdeflate -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIBDEFLATE_BUILD_STATIC_LIB=OFF \
    -DLIBDEFLATE_BUILD_TESTS=ON
  cmake --build build
}

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

package() {
  DESTDIR="${pkgdir}" cmake --install build
  install -Dm 644 libdeflate/COPYING -t "${pkgdir}"/usr/share/licenses/libdeflate/
}

# vim ts=2 sw=2 et:
