# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=consolekit2
pkgver=1.2.6
pkgrel=0
pkgdesc="Framework for defining and tracking users, login sessions, and seats"
provides="consolekit=$pkgver"
replaces="consolekit"
arch="all"
url="https://consolekit2.github.io/ConsoleKit2"
license="GPL-2.0-or-later"
depends="
	eudev
	polkit
	"
makedepends="
	autoconf
	automake
	eudev-dev
	gettext-dev
	glib-dev
	libdrm-dev
	libnih-dev
	libtool
	libxslt-dev
	polkit-dev
	xorg-server-dev
	zlib-dev
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/ConsoleKit2/ConsoleKit2/archive/refs/tags/$pkgver.tar.gz
	0001-busybox-reboot-and-poweroff-support.patch
	pam-foreground-compat.ck
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
builddir="$srcdir/ConsoleKit2-$pkgver"
options="!check" #no testsuite provided

build() {
	NOCONFIGURE=1 ./autogen.sh
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--disable-static
	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -m 755 "$srcdir"/pam-foreground-compat.ck \
		"$pkgdir"/usr/lib/ConsoleKit/run-session.d/

	mkdir -p "$pkgdir"/usr/share/dbus-1/system.d/
	mv "$pkgdir"/etc/dbus-1/system.d/* "$pkgdir"/usr/share/dbus-1/system.d/
}
sha512sums="
2bb529d93e13bb9a5d3577e3299d1f108b8f4c38434e09aafffd55d843bc569d5490632dd9c0c6e746721b1cc049d40b4d8f05663b4c418647cf91dc7c0a817a  consolekit2-1.2.6.tar.gz
b8554649de3fdf112c87d2f8b05def58bd7c0540a79bfbe5aa4a95d002b8115be3a2b92958441f56b9f97149edb33e0b7ab81567158fe67158803c086a269e49  0001-busybox-reboot-and-poweroff-support.patch
3b114fbbe74cfba0bfd4dad0eb1b85d08b4979a998980c1cbcd7f44b8a16b0ceca224680d4f4a1644cd24698f8817e5e8bdfcdc4ead87a122d0e323142f47910  pam-foreground-compat.ck
"
