# $Id: PKGBUILD 87085 2010-08-10 18:29:16Z jgc $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: onestep_ua <onestep@ukr.net>

pkgname=consolekit
pkgver=0.4.1
pkgrel=4
pkgdesc="A framework for defining and tracking users, login sessions, and seats"
arch=('i686' 'x86_64')
url="http://www.freedesktop.org/wiki/Software/ConsoleKit"
license=('GPL')
depends=('polkit>=0.95' 'zlib' 'libx11>=1.2.2')
makedepends=('pkgconfig' 'xmlto' 'docbook-xsl')
options=(!libtool)
source=(http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-${pkgver}.tar.bz2
        pam-foreground-compat.ck
        nodaemon.patch
        reorder-initialization.patch
        add_since_option.patch
        consolekit.logrotate)
md5sums=('48eda4483cc97841d5f88e8e003eb6d7'
         'a8a4de71d9b0549b8143e5f6c2a36fc7'
         'a5bfd56bc89411ff5bb18276a68cb212'
         '99fa8cb1bf232050cc0c076378e216c5'
         'bd5e72397fe2d42a933a897d28d58155'
         '6fefa451d9fe2fc6d6269629d3529793')

build() {
  cd "${srcdir}/ConsoleKit-${pkgver}"
  patch -Np1 -i "${srcdir}/nodaemon.patch"
  patch -Np1 -i "${srcdir}/reorder-initialization.patch"
  patch -Np1 -i "${srcdir}/add_since_option.patch"
  ./configure --prefix=/usr \
      --sysconfdir=/etc \
      --localstatedir=/var \
      --libexecdir=/usr/lib/ConsoleKit \
      --enable-pam-module \
      --enable-docbook-docs
  make
  make DESTDIR="${pkgdir}" install
  install -m755 "${srcdir}/pam-foreground-compat.ck" "${pkgdir}/usr/lib/ConsoleKit/run-session.d/"

  # install the logrotate config
  install -D -m644 ${srcdir}/consolekit.logrotate ${pkgdir}/etc/logrotate.d/consolekit
}