# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-cogl
pkgver=1.22.5
pkgrel=3
pkgdesc="An object oriented GL/GLES Abstraction/Utility Layer for Deepin"
arch=('x86_64')
url="https://github.com/linuxdeepin/deepin-cogl"
license=('GPL2')
depends=('mesa' 'libdrm' 'libxext' 'libxdamage' 'libxcomposite' 'gdk-pixbuf2' 'pango' 'libxrandr')
makedepends=('gobject-introspection' 'gtk-doc')
provides=("cogl=$pkgver")
conflicts=("cogl")
options=(!emptydirs)
source=("https://github.com/linuxdeepin/deepin-cogl/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        0001-Fix-building-with-libglvnd-1.2.0.patch)
sha512sums=('41e4d788dfb255802debb547e10e8b501fd087ee17b2270acaf2c30bcc3fa2cf4b1a55740efd10479b512c6fe1eb1bde8f0227dc8ef67645b86efd344cce3c74'
            '26f1cb91152c8279162eb43d27964815ebf87c14ecaa486a14b53bd85c4c58f90f1b4fad4c9d72a7ac3feb283d95f19be1fb2a371eee2f93a04b1871aae4343d')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../0001-Fix-building-with-libglvnd-1.2.0.patch

  sed -e 's|1.15|1.16 1.15|' -i autogen.sh # Support automake 1.16
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr \
    --enable-gles2 \
    --enable-{kms,wayland}-egl-platform \
    --enable-wayland-egl-server

  # https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make -j1
}

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

# vim:set ts=2 sw=2 et:
