pkgname=appstream
_name="AppStream"
pkgver=1.0.6
pkgdesc="Cross-distro effort for providing metadata for software in the Linux ecosystem"
homepage="https://www.freedesktop.org/wiki/Distributions/AppStream/"
license=("LGPL-2.1+" "GPL-2+")
depends=(
  zstd
  glib:2
  libxml2:2
  libxmlb
  libyaml
  snowball-stemmer
  curl
  gobject-introspection
  systemd
)
bdepends=(
  libxslt
  itstool
)
_patches=("${pkgname}-1.0.0-disable-Werror-flags.patch")
_patch_sums=("e5df79dda5f433c67dd0b02c681e04cde22e6648a4d438a50314575e37353686fbcbc4fd56ee209095f71498d0e553b4d061e328fcc740b19ab7ae9281b85423")
sources=("${_name}-${pkgver}.tar.xz"
  "${_patches[@]}"
)
urls=("https://www.freedesktop.org/software/appstream/releases/${sources[0]}"
  "${_patches[@]}"
)
sha512sums=("a7a34ce2b37f7a3d9f22a69ff4a546d4fb33edaec4a303bd7541ede990d8a2c2a67d17f61c9cf09d75af277e308d21baaf42d6b968eca1a11d1df983a27e02a5"
  "${_patch_sums[@]}"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=2
  for _patch in ${_patches[@]}; do
    patch -p1 -i ${filedir}/${_patch}
  done
}

src_build() {
  local meson_args=(
    --prefix=/usr
    --buildtype=release
    --wrap-mode=nodownload
    -D python.bytecompile=1
    -D apidocs=false
    -D docs=false
    -D compose=false
    -D maintainer=false
    -D static-analysis=false
    -D stemming=true
    -D vapi=false
    -D apt-support=false
    -D compose=false
    -D install-docs=false
    -D gir=true
    -D qt=false
    -D systemd=true
  )
  meson setup build "${meson_args[@]}"
  meson compile -C build
}

src_install() {
  meson install -C build --destdir "$pkgdir"
}

# vim:ft=sh syn=sh et sw=2:
