summaryrefslogtreecommitdiff
blob: cd277b37a06b20043adf03d11317302fae756e48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake pam readme.gentoo-r1 systemd

if [[ ${PV} == "9999" ]] ; then
	ESVN_REPO_URI="https://svn.code.sf.net/p/slim-fork/code/trunk"
	inherit subversion
else
	SRC_URI="https://downloads.sourceforge.net/project/${PN}-fork/${P}.tar.gz"
	KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 ~riscv sparc x86"
fi

DESCRIPTION="Simple Login Manager resurrected"
HOMEPAGE="https://slim-fork.sourceforge.io/"

LICENSE="GPL-2"
SLOT="0"
IUSE="branding pam"

RDEPEND="media-libs/libjpeg-turbo:=
	media-libs/libpng:0=
	virtual/libcrypt:=
	x11-apps/sessreg
	x11-libs/libX11
	x11-libs/libXft
	x11-libs/libXmu
	x11-libs/libXpm
	x11-libs/libXrandr
	pam? (
		sys-libs/pam
		x11-libs/libXext
	)"
DEPEND="${RDEPEND}
	x11-base/xorg-proto"
BDEPEND="virtual/pkgconfig"
PDEPEND="branding? ( >=x11-themes/slim-themes-1.2.3a-r3 )"

PATCHES=(
	# Our Gentoo-specific config changes
	"${FILESDIR}"/${PN}-1.4.0-config.diff
)

DISABLE_AUTOFORMATTING=1
DOC_CONTENTS="
The configuration file is located at /etc/slim.conf.

If you wish ${PN} to start automatically, set DISPLAYMANAGER=\"${PN}\"
in /etc/conf.d/display-manager and run

	# rc-update add display-manager default.

See also https://wiki.gentoo.org/wiki/SLiM
"

src_prepare() {
	cmake_src_prepare

	if use branding; then
		sed -i -e '/current_theme/s/default/slim-gentoo-simple/' slim.conf || die
	fi
}

src_configure() {
	local mycmakeargs=(
		-DUSE_PAM=$(usex pam)
		-DUSE_CONSOLEKIT=OFF
		-DBUILD_SLIMLOCK=$(usex pam)
	)

	cmake_src_configure
}

src_install() {
	cmake_src_install

	if use pam ; then
		pamd_mimic system-local-login slim auth account session
		pamd_mimic system-local-login slimlock auth
	fi

	systemd_dounit slim.service

	insinto /usr/share/slim
	newins "${FILESDIR}/Xsession-r3" Xsession

	insinto /etc/logrotate.d
	newins "${FILESDIR}/slim.logrotate" slim

	dodoc xinitrc.sample ChangeLog README TODO THEMES
	readme.gentoo_create_doc
}

pkg_postinst() {
	readme.gentoo_print_elog

	if ! use pam; then
		elog "You have merged ${PN} without USE=\"pam\", this will cause ${PN} to fall back to"
		elog "the console when restarting your window manager. If this is not desired, then"
		elog "please remerge ${PN} with USE=\"pam\""
		elog
	fi
}