#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=cairo
pkgver=1.17.8
pkgrel=02
pkgdesc="2D graphics library with support for multiple output devices"
url="https://cairographics.org/"
arch=(x86_64)
depends=(lzo zlib libpng fontconfig freetype2 libx11 libxext libxrender libxcb
         glib2 pixman)
makedepends=(valgrind git meson gtk-doc)
#options=(debug)  # uncomment this to have the debug package produced
_commit=c3b672634f0635af1ad0ffa8c15b34fc7c1035cf  # tags/1.17.8^0
source=("git+https://gitlab.freedesktop.org/cairo/cairo.git#commit=$_commit")

pkgver() {
  cd cairo
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd cairo

#  # FS#74354
#  patch -Np1 -i ../0001-Fix-type1-subset-indexing.patch
  # https://bugs.archlinux.org/task/77432
  # https://gitlab.freedesktop.org/cairo/cairo/-/issues/639
  git revert -n 47a21c6e30eef91db503a5a183d5c8cf558aaa56
}

build() {
  local meson_options=(
    -D dwrite=disabled
    -D gtk_doc=true
    -D spectre=disabled
    -D symbol-lookup=disabled
    -D tests=disabled
  )

  arch-meson cairo build "${meson_options[@]}"
  meson compile -C build
}

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

#---- license gpg-key sha256sums ----

license=(LGPL MPL)

sha256sums=(SKIP)

#  471d5ee8d66159f7bf9ebdfd2f553312de2dc71cab63d37abb4c0557ca640b05  cairo-1.17.8-02-x86_64.pkg.tar.lz

