#!/bin/sh
#
# Copyright 2008 Rudson R. Alves
# Available under the terms of the GNU GPL.
#

NAME="consolekit"
VERSION="0.4.1"
REVISION="2"
TARNAME="ConsoleKit"

PKG_SOURCEURL='http://www.freedesktop.org/software/ConsoleKit/dist/$TARNAME-$VERSION.tar.bz2'

PKG_PATCH[0]='08-fix-double-close.patch'
PKG_PATCH[1]='09-directory-handle-leak.patch'
PKG_PATCH[2]='10-file_monitor_remove_watch_crash.patch'
PKG_PATCH[3]='11-fix-multiple-session-detection.patch'
PKG_PATCH[4]='rc.consolekit'

. $DLG_ROOT/config
. $DLG_ROOT/SCRIPTS/dropline-functions.sh

cflags
cxxflags
prepare
analyzesource

#applypatch 0 1
#applypatch 1 1
#applypatch 2 1
#applypatch 3 1

configure --prefix=/usr \
	  --libdir=/usr/lib$LIBSUFFIX \
	  --with-pam-module-dir=/lib$LIBSUFFIX/security \
	  --with-pid-file=/var/run/consolekit.pid \
	  --with-dbus-services=/usr/share/dbus-1/services \
	  --enable-pam-module \
	  --with-dbus-sys=/etc/dbus-1/system.d
make
makeinstall install-strip

createdir "${PKG_STAGEROOT}/etc/rc.d"
findpatch filename ${PKG_PATCH[4]}
spewdo "cp $filename ${PKG_STAGEROOT}/etc/rc.d/"
sysvinitsetup ${PKG_STAGEROOT}/etc/rc.d/rc.consolekit 345 99

tidydocumentation
analyzebinaries
finalizepackage
packagize
cleanup
