pkgname="xz"
pkgver="5.8.1"
pkgdesc='Library and command line tools for XZ and LZMA compressed files'
homepage="https://tukaani.org/xz"
license=('GPL' 'LGPL' 'custom')
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://github.com//tukaani-project/xz/releases/download/v${pkgver}/${sources[0]}")
md5sums=("cf5e1feb023d22c6bdaa30e84ef3abe3")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  ./configure --prefix=/usr  \
            --disable-static \
            --docdir=/usr/share/doc/${pkgname}-${pkgver} &&
  make
}

src_check() {
  make check
}

src_install() {
  make DESTDIR="${pkgdir}" install
  install -d -m0755 "${pkgdir}/usr/share/licenses/xz/"
  ln -sf ../../doc/xz/COPYING "${pkgdir}/usr/share/licenses/xz/"
}
