# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=appstream-generator
pkgver=0.7.7
pkgrel=4
pkgdesc="A fast AppStream metadata generator"
arch=(x86_64)
url="https://github.com/ximion/appstream-generator"
license=(GPL3)
depends=(appstream libarchive librsvg lmdb optipng d-stdx-allocator glibd d-containers)
makedepends=(ldc meson ninja mustache-d curl gir-to-d gobject-introspection docbook-xsl)
source=($pkgname-$pkgver.tar.gz::"https://github.com/ximion/appstream-generator/archive/v$pkgver.tar.gz"
        Fix-build-with-latest-AppStream.patch::"https://github.com/ximion/appstream-generator/commit/aef1bea05fb0560e2aa4e4bdd1100ec006168503.patch")
sha256sums=('bf3b2996897f12f817ce8189e64b7dc9e79acc3e749f7f5b292e024cde511dd1'
            '0ca4ee0a398f306923c999846e9495e5f2340a36321138b06b62ba2feb976c39')

prepare() {
  mkdir -p build

  # Needed to fix compilation with the latest AppStream (https://github.com/ximion/appstream-generator/commit/aef1bea05fb0560e2aa4e4bdd1100ec006168503)
  cd $pkgname-$pkgver
  patch -p1 < ../Fix-build-with-latest-AppStream.patch
}

build() {
  cd build
  meson ../$pkgname-$pkgver -Ddownload-js=false --prefix=/usr
  ninja
}

package() {
  cd build
  DESTDIR="$pkgdir" ninja install
}
