# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Chocobo1 <chocobo1@archlinux.net>

pkgname=libdeflate
pkgver=1.21
pkgrel=1.1
pkgdesc='Heavily optimized library for DEFLATE/zlib/gzip compression and decompression'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url=https://github.com/ebiggers/libdeflate
license=(MIT)
depends=(glibc)
makedepends=(
  cmake
  git
  ninja
)
provides=(libdeflate.so)
_tag=9be1c54e6086cd1f9e1e7dece96eb6d1355c93f7
source=(git+https://github.com/ebiggers/libdeflate.git#tag=${_tag})
b2sums=('c9a880d2f8111177494d5c54651f5b872cb34c8a838563cac7d09f4dbc1afa680fe9c24c350b27027b524721b41a06df8bf1ce53b2ed8119f99269d39ba3e57c')

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:
