summaryrefslogtreecommitdiff
path: root/phosh-base/phosh-shell/phosh-shell-0.52.0.ebuild
blob: ee631d02aefc78506cdaf2f438f9b446b46ecec5 (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# Copyright 2021-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{13..14} )

inherit gnome2-utils meson pam python-any-r1 systemd toolchain-funcs vala verify-sig virtualx xdg

MY_PN="${PN%-shell}"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="Pure Wayland shell for mobile devices"
HOMEPAGE="https://gitlab.gnome.org/World/Phosh/phosh/"
SRC_URI="https://sources.phosh.mobi/releases/${MY_PN}/${MY_P}.tar.xz
	verify-sig? ( https://sources.phosh.mobi/releases/${MY_PN}/${MY_P}.tar.xz.asc )"
S="${WORKDIR}/${MY_P}"

LICENSE="CC0-1.0 CC-BY-SA-4.0 GPL-2+ GPL-3+ LGPL-2+ LGPL-2.1+ MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="gtk-doc introspection +lockscreen-plugins man +plugins systemd test test-full vala"
REQUIRED_USE="
	gtk-doc? ( introspection )
	lockscreen-plugins? ( plugins )
	test? ( plugins lockscreen-plugins test-full )
	vala? ( introspection )
"

COMMON_DEPEND="
	>=app-crypt/gcr-3.7.5:0=[introspection?]
	app-crypt/libsecret
	>=dev-libs/appstream-1.0.0:=
	>=dev-libs/feedbackd-0.7.0
	dev-libs/fribidi
	>=dev-libs/glib-2.80:2
	dev-libs/gmobile
	dev-libs/libgudev:=
	dev-libs/libical:=
	>=dev-libs/wayland-1.14
	>=gnome-base/gnome-desktop-3.26:3=[introspection?]
	>=gnome-base/gsettings-desktop-schemas-47
	>=gnome-extra/evolution-data-server-3.33.1:=
	>=gui-libs/libhandy-1.1.90:1[introspection?]
	media-libs/libpulse[glib]
	media-sound/callaudiod
	>=net-libs/libsoup-3.6:3.0
	>=net-misc/modemmanager-1.24.0:=
	>=net-misc/networkmanager-1.14[introspection?]
	>=net-wireless/gnome-bluetooth-46.0:3=[introspection?]
	sys-apps/dbus
	>=sys-auth/polkit-0.122
	sys-libs/pam
	>=sys-power/upower-1.90:=
	x11-libs/cairo
	x11-libs/gdk-pixbuf:2
	x11-libs/pango
	>=x11-libs/gtk+-3.22:3[introspection?,wayland]
	systemd? ( >=sys-apps/systemd-241:= )
	!systemd? ( >=sys-auth/elogind-241 )
	plugins? (
		dev-libs/qr-code-generator:=
		>=gui-libs/gtk-4.12:4
		>=gui-libs/libadwaita-1.5:1
		lockscreen-plugins? (
			app-text/evince:=
		)
	)
"
RUNTIME_DEPEND="
	gnome-base/gnome-shell
	virtual/freedesktop-icon-theme
	x11-themes/gnome-themes-standard
"

DEPEND="
	${COMMON_DEPEND:?}
	>=dev-libs/wayland-protocols-1.12
	test-full? ( ${RUNTIME_DEPEND:?} )
	vala? (
		$(vala_depend)
		>=net-misc/networkmanager-1.14[vala]
	)
"
RDEPEND="
	${COMMON_DEPEND:?}
	${RUNTIME_DEPEND:?}
	systemd? ( sys-libs/libcap )
"
BDEPEND="
	dev-libs/glib:2
	dev-libs/libxml2
	dev-util/gdbus-codegen
	dev-util/glib-utils
	dev-util/wayland-scanner
	sys-devel/gettext
	virtual/pkgconfig
	gtk-doc? ( dev-util/gi-docgen )
	introspection? ( dev-libs/gobject-introspection )
	man? ( dev-python/docutils )
	test-full? (
		dev-util/umockdev
		gui-apps/wlr-randr
		>=gui-wm/phoc-0.45.0
		net-misc/networkmanager[tools]
		$(python_gen_any_dep '
			dev-python/dbus-python[${PYTHON_USEDEP}]
			dev-python/pygobject[${PYTHON_USEDEP}]
			dev-python/pytest[${PYTHON_USEDEP}]
			dev-python/python-dbusmock[${PYTHON_USEDEP}]
		')
	)
	verify-sig? ( >=sec-keys/openpgp-keys-phosh-2025 )
"

EPYTEST_PLUGINS=()

VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/phosh.asc"

python_check_deps() {
	python_has_version -b "dev-python/dbus-python[${PYTHON_USEDEP}]" &&
	python_has_version -b "dev-python/pygobject[${PYTHON_USEDEP}]" &&
	python_has_version -b "dev-python/pytest[${PYTHON_USEDEP}]" &&
	python_has_version -b "dev-python/python-dbusmock[${PYTHON_USEDEP}]"
}

pkg_setup() {
	use test-full && python-any-r1_pkg_setup
}

src_prepare() {
	use vala && vala_setup
	default

	sed "/^set -e/d; /^exec /d" -i tests/integration/run-pytest.in || die

	# fixes "Unable to open wayland socket: File name too long"
	sed "/self.tmpdir =/ { s:topbuilddir:'${T}': }" \
		-i tests/integration/__init__.py || die
}

src_configure() {
	local emesonargs=(
		-Dcompositor="${EPREFIX}"/usr/bin/phoc
		-Dtools=true
		-Dsearchd=true
		$(meson_use gtk-doc gtk_doc)
		$(meson_use introspection)
		$(meson_use introspection bindings-lib)
		$(meson_use lockscreen-plugins)
		$(meson_use plugins quick-setting-plugins)
		$(meson_use man)
		$(meson_use test tests)
		$(meson_feature test-full phoc_tests)
		$(meson_use vala vapi)
	)
	meson_src_configure
}

src_test() {
	my_src_test() {
		local -x LC_ALL="C.UTF-8"
		local -x WLR_RENDERER="pixman"
		local -x PHOSH_TEST_PHOC_INI="${T}/phoc.ini"

		# XXX: app-grid-button tests segfaults
		# https://gitlab.gnome.org/World/Phosh/phosh/-/issues/1240
		# https://github.com/ximion/appstream/issues/720
		#meson_src_test --suite unit || return 1

		if use test-full; then
			meson_src_test --suite integration --timeout-multiplier 2 || return 1
		fi

		source "${BUILD_DIR}"/tests/integration/run-pytest || return 1
		ewarn "Some tests might fail if umockdev is broken on your system"
		ewarn "See https://bugs.gentoo.org/868204"
		LD_PRELOAD="libumockdev-preload.so.0:${LD_PRELOAD}" epytest tests/integration || return 1
	}

	# Xwayland breaks "phosh:integration / shell", pollutes /tmp
	cat data/phoc.ini - > "${T}"/phoc.ini <<- EOF || die
		[core]
		xwayland=false
	EOF

	virtx my_src_test
}

src_install() {
	meson_src_install
	find "${ED}/usr/$(get_libdir)" -name '*.a' -delete || die

	pamd_mimic system-local-login phosh auth account session
	systemd_douserunit data/phosh.service

	if use gtk-doc; then
		mkdir -p "${ED}"/usr/share/gtk-doc/html/ || die
		mv "${ED}"/usr/share/doc/${MY_PN}-${SLOT} "${ED}"/usr/share/gtk-doc/html/ || die
	fi
}

phosh_giomodule_cache_update() {
	local plugins_dir
	plugins_dir=$("$(tc-getPKG_CONFIG)" --variable=lockscreen_plugins_dir phosh-plugins) || return 1

	ebegin "Updating GIO modules cache"
	gio-querymodules "${plugins_dir}"
	eend $?
}

pkg_postinst() {
	xdg_pkg_postinst
	gnome2_schemas_update
	phosh_giomodule_cache_update
}

pkg_postrm() {
	xdg_pkg_postrm
	gnome2_schemas_update
	phosh_giomodule_cache_update
}