Diff xpra-4.4.6-r2 with a xpra-9999

/usr/portage/x11-wm/xpra/xpra-9999.ebuild 2025-07-29 16:22:17.984470439 +0300
1
# Copyright 1999-2024 Gentoo Authors
1
# Copyright 1999-2025 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=8
5 5

  
6
if [[ ${PV} = 9999* ]]; then
6
if [[ ${PV} = *9999* ]]; then
7 7
	EGIT_REPO_URI="https://github.com/Xpra-org/xpra.git"
8
	if [[ ${PV} = 6.9999* ]]; then
9
		EGIT_BRANCH="v6.x"
10
	fi
8 11
	inherit git-r3
9 12
else
10 13
	inherit pypi
11
	KEYWORDS="amd64 x86"
14
	KEYWORDS="~amd64 ~x86"
12 15
fi
13 16

  
14
PYTHON_COMPAT=( python3_{10..11} )
17
PYTHON_COMPAT=( python3_{11..13} )
15 18
DISTUTILS_USE_PEP517=setuptools
16 19
DISTUTILS_SINGLE_IMPL=yes
17 20
DISTUTILS_EXT=1
18 21

  
19
inherit xdg distutils-r1 prefix tmpfiles udev
22
inherit cuda xdg distutils-r1 prefix tmpfiles udev
20 23

  
21 24
DESCRIPTION="X Persistent Remote Apps (xpra) and Partitioning WM (parti) based on wimpiggy"
22 25
HOMEPAGE="https://xpra.org/"
23 26
LICENSE="GPL-2 BSD"
24 27
SLOT="0"
25
IUSE="brotli +client +clipboard crypt csc cups dbus doc ffmpeg jpeg html ibus +lz4 lzo minimal oauth opengl pinentry pulseaudio +server sound systemd test +trayicon udev vpx webcam webp xdg xinerama"
26
IUSE+=" +python_single_target_python3_11"
28
IUSE="+X avif brotli +client +clipboard crypt csc cuda cups dbus debug doc examples gstreamer +gtk3 html ibus jpeg +lz4 mdns minimal oauth opengl openh264 pinentry pulseaudio qrcode +server sound systemd test +trayicon udev vpx webcam webp x264 xdg xinerama "
29
IUSE+=" video_cards_nvidia"
30
RESTRICT="!test? ( test )"
27 31

  
28 32
REQUIRED_USE="${PYTHON_REQUIRED_USE}
29
	|| ( client server )
33
	|| ( client gtk3 server )
30 34
	cups? ( dbus )
31 35
	oauth? ( server )
32 36
	opengl? ( client )
33
	test? ( client clipboard crypt dbus html server sound xdg xinerama )
37
	clipboard? ( gtk3 )
38
	gtk3? ( client )
39
	test? ( client clipboard crypt dbus gstreamer html server sound xdg xinerama )
34 40
"
35 41

  
36 42
TEST_DEPEND="
37 43
	$(python_gen_cond_dep '
38 44
		dev-python/netifaces[${PYTHON_USEDEP}]
39 45
		dev-python/pillow[jpeg?,webp?,${PYTHON_USEDEP}]
40
		dev-python/rencode[${PYTHON_USEDEP}]
41 46
		dbus? ( dev-python/dbus-python[${PYTHON_USEDEP}] )
42 47
		xdg? ( dev-python/pyxdg[${PYTHON_USEDEP}] )
43 48
	')
......
45 50
	server? (
46 51
		x11-base/xorg-server[-minimal,xvfb]
47 52
		x11-drivers/xf86-input-void
53
		x11-drivers/xf86-video-dummy
48 54
	)
55
	webcam? ( media-video/v4l2loopback )
49 56
	xinerama? ( x11-libs/libfakeXinerama )
50 57
"
51 58
DEPEND="
52 59
	${PYTHON_DEPS}
53 60
	$(python_gen_cond_dep '
54
		dev-python/pygobject:3[${PYTHON_USEDEP},cairo]
61
		dev-python/pygobject:3[${PYTHON_USEDEP}]
55 62
		opengl? ( dev-python/pyopengl[${PYTHON_USEDEP}] )
56 63
		sound? ( dev-python/gst-python:1.0[${PYTHON_USEDEP}] )
64
		gtk3? (
65
			dev-python/pygobject:3[cairo]
66
		)
57 67
	')
58
	x11-libs/gtk+:3[introspection]
59
	x11-libs/libX11
60
	x11-libs/libXcomposite
61
	x11-libs/libXdamage
62
	x11-libs/libXfixes
63
	x11-libs/libXrandr
64
	x11-libs/libXres
65
	x11-libs/libXtst
66
	x11-libs/libxkbfile
68
	dev-libs/xxhash
69
	avif? ( media-libs/libavif )
67 70
	brotli? ( app-arch/brotli )
68
	csc? ( >=media-video/ffmpeg-1.2.2:0= )
69
	ffmpeg? ( >=media-video/ffmpeg-3.2.2:0=[x264] )
71
	client? (
72
			x11-libs/gtk+:3[X?,introspection]
73
		)
70 74
	jpeg? ( media-libs/libjpeg-turbo )
75
	mdns? ( dev-libs/mdns )
76
	!minimal? ( sys-libs/pam )
77
	openh264? ( media-libs/openh264:= )
71 78
	pulseaudio? (
72
		media-libs/libpulse
73 79
		media-plugins/gst-plugins-pulse:1.0
80
		media-plugins/gst-plugins-opus
74 81
	)
82
	qrcode? ( media-gfx/qrencode )
75 83
	sound? (
76 84
		media-libs/gstreamer:1.0
77 85
		media-libs/gst-plugins-base:1.0
78 86
	)
79
	vpx? ( media-libs/libvpx media-video/ffmpeg )
87
	vpx? ( media-libs/libvpx )
80 88
	webp? ( media-libs/libwebp )
89
	X? (
90
		x11-apps/xrandr
91
		x11-libs/libXcomposite
92
		x11-libs/libXdamage
93
		x11-libs/libXfixes
94
		x11-libs/libXrandr
95
		x11-libs/libXres
96
		x11-libs/libXtst
97
		x11-libs/libxkbfile
98
	)
99
	x264? ( media-libs/x264 )
81 100
"
101
# nvenc? ( amd64? ( media-libs/nv-codec-headers ) )
82 102
RDEPEND="
83 103
	${DEPEND}
84 104
	${TEST_DEPEND}
......
86 106
		crypt? ( dev-python/cryptography[${PYTHON_USEDEP}] )
87 107
		cups? ( dev-python/pycups[${PYTHON_USEDEP}] )
88 108
		lz4? ( dev-python/lz4[${PYTHON_USEDEP}] )
89
		lzo? ( >=dev-python/python-lzo-0.7.0[${PYTHON_USEDEP}] )
90 109
		oauth? ( dev-python/oauthlib[${PYTHON_USEDEP}] )
91 110
		opengl? ( dev-python/pyopengl-accelerate[${PYTHON_USEDEP}] )
92 111
		webcam? (
......
105 124
	udev? ( virtual/udev )
106 125
"
107 126
DEPEND+="
108
	test? ( ${TEST_DEPEND} )
127
	test? (
128
		${TEST_DEPEND}
129
		$(python_gen_cond_dep '
130
			dev-python/paramiko[${PYTHON_USEDEP}]
131
		')
132
	)
109 133
"
110 134
BDEPEND="
111 135
	$(python_gen_cond_dep '
112
		>=dev-python/cython-0.16[${PYTHON_USEDEP}]
136
		dev-python/cython[${PYTHON_USEDEP}]
137
		dev-python/pip[${PYTHON_USEDEP}]
113 138
	')
114 139
	virtual/pkgconfig
115 140
	doc? ( virtual/pandoc )
116 141
"
117 142

  
118
# Broken by PEP517 migration, and some tests failed for a while before that for
119
# unknown reasons.
120
RESTRICT="test"
121

  
122 143
PATCHES=(
123
	"${FILESDIR}"/${PN}-4.4-xdummy.patch
144
	"${FILESDIR}/${PN}-9999-pep517.patch"
124 145
)
125 146

  
126
python_prepare_all() {
127
	if use minimal; then
128
		sed -r -e '/pam_ENABLED/s/DEFAULT/False/' \
129
			-e 's/^(xdg_open)_ENABLED = .*/\1_ENABLED = False/' \
130
			-i setup.py || die
131
		PATCHES+=( "${FILESDIR}"/${PN}-4.4.6_minimal-features.patch )
132
	fi
147
src_prepare() {
148
	default
133 149

  
150
	sed \
151
		-e 's#UNITTESTS_DIR=`dirname $(readlink -f $0)`#: "${UNITTESTS_DIR:=`dirname $(readlink -f $0)`}"#' \
152
		-e 's#INSTALL_ROOT="$SRC_DIR/dist/python${PYTHON_VERSION}"#: "${INSTALL_ROOT:=$SRC_DIR/dist/python${PYTHON_VERSION}}"#' \
153
		-e '/setup.py install/d' \
154
		-i "${S}/tests/unittests/run" || die
155
}
156

  
157
python_prepare_all() {
134 158
	distutils-r1_python_prepare_all
135 159

  
136 160
	hprefixify xpra/scripts/config.py
137 161

  
138 162
	sed -r -e "/\bdoc_dir =/s:/${PN}/\":/${PF}/html\":" \
139 163
		-i setup.py || die
164

  
165
	if use minimal; then
166
		sed -r -e '/pam_ENABLED/s/DEFAULT/False/' \
167
			-e 's/^(xdg_open)_ENABLED = .*/\1_ENABLED = False/' \
168
			-i setup.py || die
169
	fi
140 170
}
141 171

  
142 172
python_configure_all() {
......
144 174
		-i setup.py || die
145 175

  
146 176
	DISTUTILS_ARGS=(
147
		--without-PIC
148
		--without-Xdummy
149
		$(use_with client)
150
		$(use_with clipboard)
151
		$(use_with csc csc_swscale)
177
		--with-PIC
178
		"$(use_with avif)"
179
		"$(use_with brotli)"
180
		"$(use_with sound audio)"
181
		"$(use_with client)"
182
		"$(use_with clipboard)"
183
		"$(use_with csc csc_cython)"
152 184
		--without-csc_libyuv
153
		--without-cuda_rebuild
154
		--without-cuda_kernels
155
		$(use_with cups printing)
156
		--without-debug
157
		$(use_with dbus)
158
		$(use_with doc docs)
159
		$(use_with ffmpeg dec_avcodec2)
160
		$(use_with ffmpeg enc_ffmpeg)
161
		$(use_with ffmpeg enc_x264)
162
		--without-enc_x265
163
		--with-gtk3
164
		$(use_with jpeg jpeg_encoder)
165
		$(use_with jpeg jpeg_decoder)
166
		--without-mdns
167
		--without-sd_listen
168
		--without-service
169
		$(use_with opengl)
170
		$(use_with server shadow)
171
		$(use_with server)
172
		$(use_with sound)
173
		--without-strict
174
		$(use_with vpx)
175
		--with-warn
176
		$(use_with webcam)
177
		$(use_with webp)
178
		--with-x11
185
		# "$(use_with csc csc_libyuv)" # https://chromium.googlesource.com/libyuv/libyuv
186
		"$(use_with cuda cuda_rebuild)"
187
		"$(use_with cuda cuda_kernels)"
188
		"$(use_with dbus)"
189
		"$(use_with debug)"
190
		"$(use_with doc docs)"
191
		--without-evdi
192
		# "$(use_with evdi)" x11-drivers/evdi::guru
193
		"$(use_with examples example)"
194
		"$(use_with gstreamer)"
195
		"$(use_with gstreamer gstreamer_audio)"
196
		"$(use_with gstreamer gstreamer_video)"
197
		"$(use_with gtk3)"
198
		"$(use_with html http)"
199
		"$(use_with mdns)"
200
		"$(use_with video_cards_nvidia nvidia)"
201
		--without-nvdec
202
		--without-nvenc
203
		--without-nvfbc
204
		# "$(use_with nvenc nvdec)" # NVIDIA Video Codec SDK
205
		# "$(use_with nvenc nvenc)" # NVIDIA Video Codec SDK
206
		# "$(use_with nvenc nvfbc)" # NVIDIA Capture SDK
207
		"$(use_with opengl)"
208
		"$(use_with openh264)"
209
		"$(use_with cups printing)"
210
		--without-pandoc_lua
211
		"$(use_with qrcode qrencode)"
212
		--without-quic
213
		# "$(use_with quic)" # https://github.com/aiortc/aioquic
214
		"$(use_with systemd sd_listen)"
215
		"$(use_with server)"
216
		"$(use_with systemd service)"
217
		"$(use_with server shadow)"
218
		"$(use_with vpx)"
219
		"$(use_with webcam)"
220
		"$(use_with webp)"
221
		"$(use_with X x11)"
222
		"$(use_with X Xdummy)"
223

  
224
		"$(use_with test tests)"
225
		--with-strict
226
		# --with-verbose
227
		# --with-warn
228
		# --with-cythonize_more
229

  
230
		--pkg-config-path="${S}/fs/lib/pkgconfig"
179 231
	)
180 232

  
181
	export XPRA_SOCKET_DIRS="${EPREFIX}/run/xpra"
233
	if use server; then
234
		DISTUTILS_ARGS+=(
235
			"$(use_with jpeg jpeg_encoder)"
236
			"$(use_with vpx vpx_encoder)"
237
			"$(use_with openh264 openh264_encoder)"
238
			"$(use_with cuda nvjpeg_encoder)"
239
			"$(use_with avif avif_encoder)"
240
			"$(use_with webp webp_encoder)"
241
			--without-spng_encoder
242
			# "$(use_with spng spng_encoder)" # https://github.com/randy408/libspng
243
		)
244
	else
245
		DISTUTILS_ARGS+=(
246
			--without-jpeg_encoder
247
			--without-vpx_encoder
248
			--without-openh264_encoder
249
			--without-nvjpeg_encoder
250
			--without-avif_encoder
251
			--without-webp_encoder
252
			--without-spng_encoder
253
		)
254
	fi
255

  
256
	if use client || use gtk3; then
257
		DISTUTILS_ARGS+=(
258
			"$(use_with vpx vpx_decoder)"
259
			"$(use_with openh264 openh264_decoder)"
260
			"$(use_with cuda nvjpeg_decoder)"
261
			"$(use_with jpeg jpeg_decoder)"
262
			"$(use_with avif avif_decoder)"
263
			"$(use_with webp webp_decoder)"
264
			--without-spng_decoder
265
			# "$(use_with spng spng_decoder)" # https://github.com/randy408/libspng
266
		)
267
	else
268
		DISTUTILS_ARGS+=(
269
			--without-jpeg_decoder
270
			--without-vpx_decoder
271
			--without-openh264_decoder
272
			--without-nvjpeg_decoder
273
			--without-avif_decoder
274
			--without-webp_decoder
275
			--without-spng_decoder
276
		)
277
	fi
278

  
279
	DISTUTILS_ARGS+=(
280
		# Arguments from user
281
		"${MYDISTUTILS_ARGS[@]}"
282
	)
283

  
284
	export XPRA_SOCKET_DIRS="${EPREFIX}/var/run/xpra"
285
}
286

  
287
python_compile() {
288
	if use cuda; then
289
		export NVCC_PREPEND_FLAGS="-ccbin $(cuda_gccdir)/g++"
290
	fi
291

  
292
	PYTHONPATH="${S}" distutils-r1_python_compile
182 293
}
183 294

  
184 295
python_test() {
185
	export XAUTHORITY=${HOME}/.Xauthority
186
	touch "${XAUTHORITY}" || die
296
	einfo "${BUILD_DIR}/install/$(python_get_sitedir)"
297

  
298
	use cuda && cuda_add_sandbox -w
299
	addwrite /dev/dri/renderD128
300

  
301
	addpredict /dev/dri/card0
302
	addpredict /dev/fuse
303
	addpredict /dev/tty0
304
	addpredict /dev/vga_arbiter
305
	addpredict /proc/mtrr
306
	addpredict /var/run/utmp
307

  
308
	addpredict "$(python_get_sitedir)"
309

  
310
	if [[ -d "/sys/devices/virtual/video4linux" ]]; then
311
		local devices
312
		readarray -t devices <<<"$(find /sys/devices/virtual/video4linux -mindepth 1 -maxdepth 1 -type d -name 'video*' )"
313
		for device in "${devices[@]}"; do
314
			addwrite "/dev/$(basename "${device}" || die )"
315
		done
316
	fi
187 317

  
188
	distutils_install_for_testing
189 318
	xdg_environment_reset
190 319

  
191
	env -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE \
192
	PYTHONPATH="${S}/tests/unittests:${BUILD_DIR}/test/lib" \
193
	XPRA_SYSTEMD_RUN=$(usex systemd) XPRA_TEST_COVERAGE=0 \
194
		"${PYTHON}" "${S}"/tests/unittests/unit/run.py || die
320
	export XAUTHORITY=${T}/.Xauthority
321
	touch "${XAUTHORITY}" || die
322

  
323
	local -x XPRA_TEST_COVERAGE=0 INSTALL_ROOT="${BUILD_DIR}/install" UNITTESTS_DIR="${S}/tests/unittests"
324

  
325
	tests/unittests/run \
326
		--skip-fail unit.client.mixins.audioclient_test \
327
		--skip-fail unit.client.x11_client_test \
328
		--skip-fail unit.net.net_util_test \
329
		--skip-fail unit.notifications.common_test \
330
		--skip-fail unit.server.mixins.shadow_option_test \
331
		--skip-fail unit.server.mixins.start_option_test \
332
		--skip-fail unit.server.mixins.startdesktop_option_test \
333
		--skip-fail unit.server.server_auth_test \
334
		--skip-fail unit.server.shadow_server_test \
335
		--skip-fail unit.x11.x11_server_test \
336
		--skip-slow unit.client.mixins.webcam_test \
337
		--skip-slow unit.server.server_sockets_test \
338
		--skip-slow unit.server.source.source_mixins_test \
339
	|| die -n
195 340
}
196 341

  
197
python_install_all() {
198
	distutils-r1_python_prepare_all
342
python_install() {
343
	# remove test file
344
	rm -vrf "${BUILD_DIR}/install/usr/share/xpra/www"
345

  
346
	distutils-r1_python_install
347
}
199 348

  
200
	# Switching to PEP517 gives /usr/etc. Previously, setup.py hardcodes
201
	# if root_prefix.endswith("/usr"):
202
	#     root_prefix = root_prefix[:-4]
203
	# But now setuptools uses data/* to represent out-of-sitedir files.
204
	# The upstream hack no longer works. We are on our own.
349
python_install_all() {
350
	distutils-r1_python_install_all
205 351

  
206 352
	mv -v "${ED}"/usr/etc "${ED}"/ || die
207 353

  
354
	sed -e "s#/.*data/etc#/etc#g" \
355
		-i "${ED}/etc/xpra/conf.d/"* || die
356

  
208 357
	# Move udev dir to the right place if necessary.
209 358
	if use udev; then
210
		local dir=$(get_udevdir)
359
		local dir
360
		dir=$(get_udevdir)
211 361
		if [[ ! ${ED}/usr/lib/udev -ef ${ED}${dir} ]]; then
212 362
			dodir "${dir%/*}"
213 363
			mv -vnT "${ED}"/usr/lib/udev "${ED}${dir}" || die
Thank you!