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

pkgname=libdeflate
pkgver=1.23
pkgrel=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=78051988f96dc8d8916310d8b24021f01bd9e102
source=(git+https://github.com/ebiggers/libdeflate.git#tag=${_tag})
b2sums=('bcecce5629623146aabd8252ed4f724a38904caabd1b6e3d7cf84ce18dcb7f5570bbfce767f3ff58a7446615cc7897703859146294fde3df16fc739c922401d3')

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:
