sys-auth/elogind: Drop 236.1
[gentoo.git] / sys-auth / elogind / elogind-238.1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit linux-info meson pam udev xdg-utils
7
8 DESCRIPTION="The systemd project's logind, extracted to a standalone package"
9 HOMEPAGE="https://github.com/elogind/elogind"
10 SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
11
12 LICENSE="CC0-1.0 LGPL-2.1+ public-domain"
13 SLOT="0"
14 KEYWORDS="~amd64 ~arm ~x86"
15 IUSE="+acl debug doc +pam +policykit selinux"
16
17 COMMON_DEPEND="
18         sys-apps/util-linux
19         sys-libs/libcap
20         virtual/libudev:=
21         acl? ( sys-apps/acl )
22         pam? ( virtual/pam )
23         selinux? ( sys-libs/libselinux )
24 "
25 DEPEND="${COMMON_DEPEND}
26         app-text/docbook-xml-dtd:4.2
27         app-text/docbook-xml-dtd:4.5
28         app-text/docbook-xsl-stylesheets
29         dev-util/gperf
30         dev-util/intltool
31         sys-devel/libtool
32         virtual/pkgconfig
33 "
34 RDEPEND="${COMMON_DEPEND}
35         !sys-apps/systemd
36 "
37 PDEPEND="
38         sys-apps/dbus
39         policykit? ( sys-auth/polkit )
40 "
41
42 DOCS=( src/libelogind/sd-bus/GVARIANT-SERIALIZATION )
43
44 PATCHES=( "${FILESDIR}/${P}-docs.patch" )
45
46 pkg_setup() {
47         local CONFIG_CHECK="~CGROUPS ~EPOLL ~INOTIFY_USER ~SIGNALFD ~TIMERFD"
48
49         if use kernel_linux; then
50                 linux-info_pkg_setup
51         fi
52 }
53
54 src_prepare() {
55         default
56         xdg_environment_reset
57 }
58
59 src_configure() {
60         local rccgroupmode="$(grep rc_cgroup_mode /etc/rc.conf | cut -d '"' -f 2)"
61         local cgroupmode="legacy"
62
63         if [[ "xhybrid" = "x${rccgroupmode}" ]] ; then
64                 cgroupmode="hybrid"
65         elif [[ "xunified" = "x${rccgroupmode}" ]] ; then
66                 cgroupmode="unified"
67         fi
68
69         local emesonargs=(
70                 -Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
71                 -Dhtmldir="${EPREFIX}/usr/share/doc/${PF}/html"
72                 -Dpamlibdir=$(getpam_mod_dir)
73                 -Dudevrulesdir="$(get_udevdir)"/rules.d
74                 --libdir="${EPREFIX}"/usr/$(get_libdir)
75                 -Drootlibdir="${EPREFIX}"/$(get_libdir)
76                 -Drootlibexecdir="${EPREFIX}"/$(get_libdir)/elogind
77                 -Drootprefix="${EPREFIX}/"
78                 -Dbashcompletiondir="${EPREFIX}/usr/share/bash-completion/completions"
79                 -Dman=auto
80                 -Dsmack=true
81                 -Dcgroup-controller=openrc
82                 -Ddefault-hierarchy=${cgroupmode}
83                 -Ddefault-kill-user-processes=false
84                 -Dacl=$(usex acl true false)
85                 -Ddebug=$(usex debug elogind false)
86                 --buildtype $(usex debug debug release)
87                 -Dhtml=$(usex doc auto false)
88                 -Dpam=$(usex pam true false)
89                 -Dselinux=$(usex selinux true false)
90         )
91
92         meson_src_configure
93 }
94
95 src_install() {
96         DOCS+=( src/libelogind/sd-bus/GVARIANT-SERIALIZATION )
97
98         meson_src_install
99
100         newinitd "${FILESDIR}"/${PN}.init ${PN}
101
102         sed -e "s/@libdir@/$(get_libdir)/" "${FILESDIR}"/${PN}.conf.in > ${PN}.conf || die
103         newconfd ${PN}.conf ${PN}
104 }
105
106 pkg_postinst() {
107         if [[ "$(rc-config list boot | grep elogind)" != "" ]]; then
108                 elog "elogind is currently started from boot runlevel."
109         elif [[ "$(rc-config list default | grep elogind)" != "" ]]; then
110                 ewarn "elogind is currently started from default runlevel."
111                 ewarn "Please remove elogind from the default runlevel and"
112                 ewarn "add it to the boot runlevel by:"
113                 ewarn "# rc-update del elogind default"
114                 ewarn "# rc-update add elogind boot"
115         else
116                 ewarn "elogind is currently not started from any runlevel."
117                 ewarn "You may add it to the boot runlevel by:"
118                 ewarn "# rc-update add elogind boot"
119         fi
120 }