# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=librsvg
pkgver=2.46.0
pkgrel=1
epoch=2
pkgdesc="SVG rendering library"
url="https://wiki.gnome.org/Projects/LibRsvg"
arch=(x86_64)
license=(LGPL)
depends=(gdk-pixbuf2 pango libcroco)
makedepends=(gobject-introspection vala gtk-doc git rust)
_commit=b4aa8d277d30f4042797dc8b64c073b10f8bac4b  # tags/2.46.0^0
source=("git+https://gitlab.gnome.org/GNOME/librsvg.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname

  # Fix build with gtk-doc 1.30
  sed -i '/tree_index/d' doc/rsvg-docs.xml

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --disable-static --enable-vala --enable-gtk-doc
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' libtool
  make
}

check() {
  cd $pkgname
  # Reftests are probably broken
  # e.g. 91-nonzero-translation-ref.png's background is only 95% transparent,
  # while 91-nonzero-translation-out.png is 100% transparent
  make check || :
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}

# vim: ts=2 sw=2 et:
