### this file is sourced not run
PKGVER=246.10
PKGBUILD=1
PKGARCH=x86_64

# BLFS 11.3
TARBALL=elogind-$PKGVER.tar.gz
MD5SUM=32ab2201281f14738d9c045f3669c14d 
SRC_URL=https://github.com/elogind/elogind/archive/v246.10/$TARBALL
BUNDLE=

SLACKREQ=libdbus
SLACKDESC="elogind: elogind $PKGVER (Login daemon)
elogind: 
elogind: Elogind track all the users logged in to a system, and whether they 
elogind: are logged in graphically, on the console, or remotely, and makes 
elogind: this information available through DBus interface.
elogind: 
elogind: NOTE This package is unconfigured. It is originally created to satisfy
elogind: link dependencies of third party packages. If you want to use it, you
elogind: will have to configure it yourself.
elogind: 
elogind:
"

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	cd /tmp/elogind* &&

	# BLFS 11.3: enable building without polkit (circular dependency)
	sed -i '/Disable polkit/,+8 d' meson.build &&

	# BLFS 11.3: exit daemon if dbus connection is lost
	sed '/request_name/i\
	r = sd_bus_set_exit_on_disconnect(m->bus, true);\
	if (r < 0)\
		return log_error_errno(r, "Failed to set exit on disconnect: %m");' \
		-i src/login/logind.c &&

	# build
	MESONFLAGS="$MESONFLAGS \
		-Dcgroup-controller=elogind          \
		-Ddbuspolicydir=/etc/dbus-1/system.d \
		-Dman=auto                           \
		-Ddefault-kill-user-processes=false  \
	" &&
	pkg_build_meson &&

	# install systemd compat libs
	ln -sfv  libelogind.pc /usr/lib/pkgconfig/libsystemd.pc &&
	ln -sfvn elogind /usr/include/systemd &&

	pkg_build_slackdesc
}


