#!/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"
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=libgksu
pkgver=2.0.12
pkgrel=09
pkgdesc="gksu authorization library"
arch=(x86_64)
url="http://www.nongnu.org/gksu/index.html"
depends=('gconf' 'gtk2' 'libgnome-keyring' 'libgtop' 'startup-notification')
makedepends=('intltool' 'gtk-doc')
options=('!emptydirs')
source=(http://people.debian.org/~kov/gksu/${pkgname}-${pkgver}.tar.gz
        libgksu-2.0.0-fbsd.patch
        libgksu-2.0.12-automake-1.11.2.patch
        libgksu-2.0.12-fix-make-3.82.patch
        libgksu-2.0.12-notests.patch
        libgksu-2.0.12-revert-forkpty.patch
        libgksu-2.0.7-libs.patch
        libgksu-2.0.7-polinguas.patch
        libgksu-2.0.12-security-format.patch)

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -Np1 -i "${srcdir}/libgksu-2.0.0-fbsd.patch"
  patch -Np1 -i "${srcdir}/libgksu-2.0.7-libs.patch"
  patch -Np1 -i "${srcdir}/libgksu-2.0.7-polinguas.patch"
  patch -Np1 -i "${srcdir}/libgksu-2.0.12-revert-forkpty.patch"
  patch -Np0 -i "${srcdir}/libgksu-2.0.12-fix-make-3.82.patch"
  patch -Np1 -i "${srcdir}/libgksu-2.0.12-notests.patch"
  patch -Np1 -i "${srcdir}/libgksu-2.0.12-automake-1.11.2.patch"
  patch -Np2 -i "${srcdir}/libgksu-2.0.12-security-format.patch"

  touch NEWS README

  intltoolize --force --copy --automake
  autoreconf -fi
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure --prefix=/usr --sysconfdir=/etc \
      --localstatedir=/var --disable-static --disable-schemas-install --disable-gtk-doc
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR="${pkgdir}" install
  rm -f ${pkgdir}/usr/lib/*.a
  install -m755 -d "${pkgdir}/usr/share/gconf/schemas"
  gconf-merge-schema "${pkgdir}/usr/share/gconf/schemas/${pkgname}.schemas" --domain libgksu ${pkgdir}/etc/gconf/schemas/*.schemas
  rm -f ${pkgdir}/etc/gconf/schemas/*.schemas
}

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

license=(GPL)

sha256sums=(22f9cfc3627dcb6774b9aff66c6ea6554f3b34b82bbfa2467b821e67874c3faf # libgksu-2.0.12.tar.gz
	bf0343df8e316ac227da7c40a889dd5128da081a640c187dfb743b4f213c3792 # libgksu-2.0.0-fbsd.patch
	8d6573025758e5f5c569963fab2d99f406ea50fb055bf06693868ba976c5dd66 # libgksu-2.0.12-automake-1.11.2.patch
	4634482b8b9187fd6eaa8560fc88a3f0f93f3a7a143b5b42cdc9ffa2ac112d11 # libgksu-2.0.12-fix-make-3.82.patch
	6cac450d0e3d8950c25fec078cc41478138fd14afe3492e96f7b889178725707 # libgksu-2.0.12-notests.patch
	e75597115bdc7c30ee223d73f5c071d7cceffd04fbf2798d1aa17920fae865dd # libgksu-2.0.12-revert-forkpty.patch
	62d1d576bd8e4b07494a788d6760463ee2090e341dae5113d5f763a3549f6b6a # libgksu-2.0.7-libs.patch
	f360bbd003492e7bc7818f97988ff3af81a14c4278b1f788b0b919f743d7ee8f # libgksu-2.0.7-polinguas.patch
	49b4f3224f958caad35f3a414bd3d3e25a0f2919d07c83c1313aedc47cbafec9) # libgksu-2.0.12-security-format.patch
