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