dev-qt/qtx11extras: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / x11-misc / slim / slim-1.3.6-r5.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit cmake-utils pam eutils systemd versionator
7
8 DESCRIPTION="Simple Login Manager"
9 HOMEPAGE="https://sourceforge.net/projects/slim.berlios/"
10 SRC_URI="mirror://sourceforge/project/${PN}.berlios/${P}.tar.gz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="amd64 arm ~mips ppc ppc64 sparc x86"
15 IUSE="branding pam consolekit"
16 REQUIRED_USE="consolekit? ( pam )"
17
18 RDEPEND="x11-libs/libXmu
19         x11-libs/libX11
20         x11-libs/libXpm
21         x11-libs/libXft
22         x11-libs/libXrandr
23         media-libs/libpng:0=
24         virtual/jpeg:=
25         x11-apps/sessreg
26         consolekit? ( sys-auth/consolekit
27                 sys-apps/dbus )
28         pam? (  sys-libs/pam
29                 !x11-misc/slimlock )"
30 DEPEND="${RDEPEND}
31         virtual/pkgconfig
32         x11-base/xorg-proto"
33 PDEPEND="branding? ( >=x11-themes/slim-themes-1.2.3a-r3 )"
34
35 PATCHES=(
36         # Our Gentoo-specific config changes
37         "${FILESDIR}"/${P}-config.diff
38         "${FILESDIR}"/${PN}-1.3.5-arm.patch
39         "${FILESDIR}"/${P}-honour-cflags.patch
40         "${FILESDIR}"/${P}-libslim-cmake-fixes.patch
41         "${FILESDIR}"/${PN}-1.3.5-disable-ck-for-systemd.patch
42         "${FILESDIR}"/${P}-strip-systemd-unit-install.patch
43         "${FILESDIR}"/${P}-systemd-session.patch
44         "${FILESDIR}"/${P}-session-chooser.patch
45         "${FILESDIR}"/${P}-fix-slimlock-nopam-v2.patch
46         "${FILESDIR}"/${P}-drop-zlib.patch
47         "${FILESDIR}"/${P}-freetype.patch
48         "${FILESDIR}"/${P}-envcpy-bad-pointer-arithmetic.patch
49 )
50
51 src_prepare() {
52         cmake-utils_src_prepare
53
54         if use elibc_FreeBSD; then
55                 sed -i -e 's/"-DHAVE_SHADOW"/"-DNEEDS_BASENAME"/' CMakeLists.txt \
56                         || die
57         fi
58
59         if use branding; then
60                 sed -i -e 's/  default/  slim-gentoo-simple/' slim.conf || die
61         fi
62 }
63
64 src_configure() {
65         local mycmakeargs=(
66                 $(cmake-utils_use pam USE_PAM)
67                 $(cmake-utils_use consolekit USE_CONSOLEKIT)
68         )
69
70         cmake-utils_src_configure
71 }
72
73 src_install() {
74         cmake-utils_src_install
75
76         if use pam ; then
77                 pamd_mimic system-local-login slim auth account session
78                 pamd_mimic system-local-login slimlock auth
79         fi
80
81         systemd_dounit slim.service
82
83         insinto /usr/share/slim
84         newins "${FILESDIR}/Xsession-r3" Xsession
85
86         insinto /etc/logrotate.d
87         newins "${FILESDIR}/slim.logrotate" slim
88
89         dodoc xinitrc.sample ChangeLog README TODO THEMES
90 }
91
92 pkg_postinst() {
93         # massage ${REPLACING_VERSIONS} to come up with whether or not it's a new install
94         # or if it's older than 1.3.2-r7
95         # Note - there should only ever be zero or one version as this package isn't slotted,
96         # so the logic doesn't worry about what happens if there's two, due to the case where
97         # a previous emerge attempt failed in the middle of qmerge.
98         local rv=none
99         for rv in ${REPLACING_VERSIONS} ; do
100                 if version_is_at_least "1.3.2-r7" "${rv}" ; then
101                         rv=newer
102                         break;
103                 fi
104                 if version_is_at_least "1.0" "${rv}"  ; then
105                         rv=older
106                         break;
107                 fi
108         done
109
110         if [[ ${rv} == none ]]; then
111                 elog
112                 elog "The configuration file is located at /etc/slim.conf."
113                 elog
114                 elog "If you wish ${PN} to start automatically, set DISPLAYMANAGER=\"${PN}\" "
115                 elog "in /etc/conf.d/xdm and run \"rc-update add xdm default\"."
116         fi
117         if [[ ${rv} != newer ]]; then
118                 elog
119                 elog "By default, ${PN} is set up to do proper X session selection, including ~/.xsession"
120                 elog "support, as well as selection between sessions available in"
121                 elog "/etc/X11/Sessions/ at login by pressing [F1]."
122                 elog
123                 elog "The XSESSION environment variable is still supported as a default"
124                 elog "if no session has been specified by the user."
125                 elog
126                 elog "If you want to use .xinitrc in the user's home directory for session"
127                 elog "management instead, see README and xinitrc.sample in"
128                 elog "/usr/share/doc/${PF} and change your login_cmd in /etc/slim.conf"
129                 elog "accordingly."
130                 elog
131                 ewarn "Please note that slim supports consolekit directly.  Please do not use any "
132                 ewarn "old work-arounds (including calls to 'ck-launch-session' in xinitrc scripts)"
133                 ewarn "and enable USE=\"consolekit\" instead."
134                 ewarn
135         fi
136         if ! use pam; then
137                 elog "You have merged ${PN} without USE=\"pam\", this will cause ${PN} to fall back to"
138                 elog "the console when restarting your window manager. If this is not desired, then"
139                 elog "please remerge ${PN} with USE=\"pam\""
140                 elog
141         fi
142 }