Diff kodi-21.3 with a kodi-9999

/usr/portage/media-tv/kodi/kodi-9999.ebuild 2026-05-09 19:17:04.477670084 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
CODENAME="Omega"
6
CODENAME="Piers"
7 7

  
8 8
# libdvd{css,read,nav} are not unbundlable without patching the buildsystem.
9 9

  
......
12 12
LIBDVDCSS_VERSION="1.4.3-Next-Nexus-Alpha2-2"
13 13
LIBDVDREAD_VERSION="6.1.3-Next-Nexus-Alpha2-2"
14 14
LIBDVDNAV_VERSION="6.1.1-Next-Nexus-Alpha2-2"
15
FFMPEG_VERSION="6.0.1"
15
FFMPEG_VERSION="8.1"
16 16

  
17 17
# Java bundles from xbmc/interfaces/swig/CMakeLists.txt
18
GROOVY_VERSION="4.0.26"
19
APACHE_COMMON_LANG_VERSION="3.17.0"
20
APACHE_COMMON_TEXT_VERSION="1.13.0"
18
GROOVY_VERSION="4.0.30"
19
APACHE_COMMON_LANG_VERSION="3.20.0"
20
APACHE_COMMON_TEXT_VERSION="1.15.0"
21 21

  
22
_JAVA_PKG_WANT_BUILD_VM=( {openjdk{,-jre},icedtea}{,-bin}-{8,11,17,21} )
22
_JAVA_PKG_WANT_BUILD_VM=( {openjdk{,-jre},icedtea}{,-bin}-{8,11,17,21,25} )
23 23
JAVA_PKG_WANT_BUILD_VM=${_JAVA_PKG_WANT_BUILD_VM[@]}
24 24
# Required to be set, but not used.
25 25
JAVA_PKG_WANT_SOURCE="21"
......
31 31
# See cmake/scripts/common/ArchSetup.cmake for available options
32 32
CPU_FLAGS="cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_arm_neon"
33 33

  
34
inherit autotools cmake desktop ffmpeg-compat flag-o-matic java-pkg-2 libtool
35
inherit linux-info optfeature pax-utils python-single-r1 toolchain-funcs xdg
34
inherit autotools cmake desktop flag-o-matic java-pkg-2 libtool linux-info optfeature pax-utils python-single-r1 \
35
	toolchain-funcs xdg
36 36

  
37 37
DESCRIPTION="A free and open source media-player and entertainment hub"
38 38
HOMEPAGE="https://kodi.tv/"
......
50 50
			-> libdvdcss-${LIBDVDCSS_VERSION}.tar.gz
51 51
	)
52 52
	!system-ffmpeg? (
53
		https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz
53
		https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz
54 54
	)
55
	system-ffmpeg? ( postproc? (
56
		https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz
57
	) )
55 58
"
56 59
if [[ ${PV} == *9999 ]] ; then
57 60
	EGIT_REPO_URI="https://github.com/xbmc/xbmc.git"
......
67 70
	MY_PV="${MY_PV}-${CODENAME}"
68 71
	MY_P="${PN}-${MY_PV}"
69 72
	SRC_URI+=" https://github.com/xbmc/xbmc/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
70
	KEYWORDS="amd64 ~arm arm64 ~riscv ~x86"
73
	# Dont keyword
74
	if ! [[ ${PV} =~ _alpha ]] && ! [[ ${PV} =~ _beta ]] && ! [[ ${PV} =~ _rc ]]; then
75
		KEYWORDS="~amd64 ~arm64 ~riscv ~x86"
76
	fi
71 77
	S=${WORKDIR}/xbmc-${MY_PV}
72 78
fi
73 79

  
......
84 90
# use flag is called libusb so that it doesn't fool people in thinking that
85 91
# it is _required_ for USB support. Otherwise they'll disable udev and
86 92
# that's going to be worse.
87
IUSE="airplay alsa bluetooth bluray caps cec +css dbus doc eventclients gbm gles lcms libusb lirc mariadb mysql nfs +optical pipewire pulseaudio samba soc +system-ffmpeg test udf udev upnp vaapi vdpau wayland webserver X +xslt zeroconf ${CPU_FLAGS}"
93
IUSE="airplay alsa bluetooth bluray caps cec +css dbus doc eventclients gbm gles lcms libusb lirc mariadb mysql nfs +optical pipewire postproc pulseaudio samba soc +system-ffmpeg test udf udev upnp vaapi vdpau wayland webserver X +xslt zeroconf ${CPU_FLAGS}"
88 94
REQUIRED_USE="
89 95
	${PYTHON_REQUIRED_USE}
90 96
	|| ( gbm wayland X )
......
115 121
	dev-db/sqlite:3
116 122
	dev-libs/crossguid
117 123
	>=dev-libs/fribidi-1.0.5
118
	>=dev-libs/libcdio-2.1.0:=[cxx]
119 124
	>=dev-libs/libfmt-6.1.2:=
120 125
	dev-libs/libfstrcmp
121
	dev-libs/libpcre[cxx]
126
	dev-libs/libpcre2:=
122 127
	>=dev-libs/openssl-1.1.1k:0=
123 128
	>=dev-libs/spdlog-1.5.0:=
124 129
	dev-libs/tinyxml[stl]
125 130
	dev-libs/tinyxml2:=
126 131
	media-fonts/roboto
132
	media-gfx/exiv2:=
127 133
	media-libs/libglvnd[X?]
128 134
	>=media-libs/freetype-2.10.1
129 135
	media-libs/harfbuzz:=
130 136
	>=media-libs/libass-0.15.0:=
131 137
	media-libs/mesa[opengl,wayland?,X?]
132 138
	media-libs/taglib:=
133
	sci-libs/kissfft
134 139
	virtual/libiconv
135 140
	virtual/ttf-fonts
136 141
	x11-libs/libdrm
......
184 189
		dev-db/mysql-connector-c:=
185 190
	)
186 191
	nfs? (
187
		>=net-fs/libnfs-2.0.0:=
192
		>=net-fs/libnfs-3.0.0:=
193
	)
194
	optical? (
195
		>=dev-libs/libcdio-2.1.0:=[cxx]
188 196
	)
189 197
	pipewire? (
190 198
		>=media-video/pipewire-0.3.50:=
191 199
	)
192 200
	pulseaudio? (
193
		media-libs/libpulse
201
		>=media-libs/libpulse-11.0.0
194 202
	)
195 203
	samba? (
196 204
		>=net-fs/samba-3.4.6[smbclient(+)]
197 205
	)
198 206
	system-ffmpeg? (
199
		media-video/ffmpeg-compat:6=[encode(+),soc(-)?,postproc(-),vaapi?,vdpau?,X?]
207
		postproc? ( =media-video/ffmpeg-$(ver_cut 1-2 ${FFMPEG_VERSION})*:=[encode(+),soc(-)?,vaapi?,vdpau?,X?] )
208
		!postproc? ( >=media-video/ffmpeg-7:=[encode(+),soc(-)?,vaapi?,vdpau?,X?] )
200 209
	)
201 210
	!system-ffmpeg? (
202 211
		app-arch/bzip2
......
205 214
		net-libs/gnutls:=
206 215
	)
207 216
	udf? (
208
		>=dev-libs/libudfread-1.0.0
217
		>=dev-libs/libudfread-1.0.0:=
209 218
	)
210 219
	udev? (
211 220
		virtual/libudev:=
......
245 254
DEPEND="
246 255
	${COMMON_DEPEND}
247 256
	${COMMON_TARGET_DEPEND}
248
	>=dev-libs/rapidjson-1.0.2
257
	>=dev-cpp/nlohmann_json-3.2.0
249 258
	test? (
250 259
		>=dev-cpp/gtest-1.10.0
251 260
	)
......
263 272
	dev-build/cmake
264 273
	dev-lang/swig
265 274
	virtual/pkgconfig
266
	<=virtual/jre-21-r9999:*
275
	<=virtual/jre-25-r9999:*
267 276
	doc? (
268 277
		app-text/doxygen
269 278
	)
......
271 280

  
272 281
PATCHES=(
273 282
	"${FILESDIR}"/kodi-21-optional-ffmpeg-libx11.patch
274
	"${FILESDIR}"/kodi-21.1-silence-libdvdread-git.patch
283
	"${FILESDIR}"/kodi-22-silence-libdvdread-git.patch
275 284
)
276 285

  
277 286
# bug #544020
......
283 292

  
284 293
pkg_setup() {
285 294
	check_extra_config
286
	java-pkg-2_pkg_setup
295
	ROOT= java-pkg-2_pkg_setup
287 296
	python-single-r1_pkg_setup
288 297
}
289 298

  
......
297 306
	unpack apache-groovy-binary-${GROOVY_VERSION}.zip
298 307
	unpack commons-lang3-${APACHE_COMMON_LANG_VERSION}-bin.tar.gz
299 308
	unpack commons-text-${APACHE_COMMON_TEXT_VERSION}-bin.tar.gz
309

  
310
	if use system-ffmpeg && use postproc; then
311
		unpack ffmpeg-${FFMPEG_VERSION}.tar.xz
312
	fi
300 313
}
301 314

  
302 315
src_prepare() {
......
307 320
		-e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
308 321
		xbmc/platform/linux/*.cpp || die
309 322

  
310
	# Add all possible names for kissfft libraries
311
	for datatype in {float,int16,int32,simd}; do
312
		sed -i \
313
			-e "s/\(find_library(KISSFFT_LIBRARY NAMES .*\)/\1 kissfft-${datatype} kissfft-${datatype}-openmp/" \
314
			cmake/modules/FindKissFFT.cmake || die
315
	done
316

  
317 323
	if tc-is-cross-compiler; then
318 324
		# These tools are automatically built with CMake during a native build
319 325
		# but need to be built in advance using Autotools for a cross build.
......
330 336
		done
331 337
		elibtoolize
332 338
	fi
339

  
340
	if use system-ffmpeg && use postproc; then
341
		pushd "${WORKDIR}/ffmpeg-${FFMPEG_VERSION}" >/dev/null || die
342
		eapply "${S}"/tools/depends/target/ffmpeg/001-ffmpeg-all-libpostproc-plugin.patch
343
		eapply "${FILESDIR}"/ffmpeg-no-static-rpath.patch
344
		popd >/dev/null || die
345
	fi
333 346
}
334 347

  
335 348
src_configure() {
349
	# used below and by vendored libdvdread
350
	tc-export PKG_CONFIG
351

  
336 352
	local core_platform=(
337 353
		$(usev gbm)
338 354
		$(usev wayland)
......
362 378
		-DENABLE_GOLD=OFF
363 379
		-DENABLE_LLD=OFF
364 380
		-DENABLE_MOLD=OFF
365
		-DUSE_LTO=OFF
381

  
382
		# This isn't normally necessary with CMake, but Kodi includes its own
383
		# FindPkgConfig module that doesn't respect PKG_CONFIG. :(
384
		-DPKG_CONFIG_EXECUTABLE=$(type -P "${PKG_CONFIG}")
366 385

  
367 386
		# Features
368 387
		-DENABLE_AIRTUNES=$(usex airplay)
......
398 417
		-DENABLE_VDPAU=$(usex vdpau)
399 418
		-DENABLE_XSLT=$(usex xslt)
400 419

  
401
		-DWITH_FFMPEG=$(usex system-ffmpeg)
420
		-DWITH_FFMPEG=OFF
421
		-DDISABLE_FFMPEG_SOURCE_PLUGINS=$(usex !postproc)
402 422

  
403 423
		#To bundle or not
424
		-DENABLE_INTERNAL_ASS=OFF
404 425
		-DENABLE_INTERNAL_CROSSGUID=OFF
405
		-DENABLE_INTERNAL_DAV1D=OFF
426
		-DENABLE_INTERNAL_CURL=OFF
427
		-DENABLE_INTERNAL_EXIV2=OFF
406 428
		-DENABLE_INTERNAL_FFMPEG="$(usex !system-ffmpeg)"
407 429
		-DENABLE_INTERNAL_FLATBUFFERS=OFF
408 430
		-DENABLE_INTERNAL_FMT=OFF
409 431
		-DENABLE_INTERNAL_FSTRCMP=OFF
410 432
		-DENABLE_INTERNAL_GTEST=OFF
411
		-DENABLE_INTERNAL_KISSFFT=OFF
412
		-DENABLE_INTERNAL_PCRE=OFF
413
		-DENABLE_INTERNAL_RapidJSON=OFF
433
		-DENABLE_INTERNAL_LZO2=OFF
434
		-DENABLE_INTERNAL_NLOHMANNJSON=OFF
435
		-DENABLE_INTERNAL_PCRE2=OFF
414 436
		-DENABLE_INTERNAL_SPDLOG=OFF
415 437
		-DENABLE_INTERNAL_TAGLIB=OFF
416
		-DENABLE_INTERNAL_UDFREAD=OFF
417 438

  
418 439
		-DTARBALL_DIR="${DISTDIR}"
419 440
		-Dlibdvdnav_URL="${DISTDIR}/libdvdnav-${LIBDVDNAV_VERSION}.tar.gz"
......
424 445
	)
425 446

  
426 447
	# Separated to avoid "Manually-specified variables were not used by the project:"
448
	use bluray && mycmakeargs+=( -DENABLE_INTERNAL_BLURAY=OFF )
427 449
	use cec && mycmakeargs+=( -DENABLE_INTERNAL_CEC=OFF )
428 450
	use css && mycmakeargs+=( -Dlibdvdcss_URL="${DISTDIR}/libdvdcss-${LIBDVDCSS_VERSION}.tar.gz" )
429
	use nfs && mycmakeargs+=( -DENABLE_INTERNAL_NFS=OFF )
451
	use mariadb && mycmakeargs+=( -DENABLE_INTERNAL_MARIADBCLIENT=OFF )
430 452
	use !system-ffmpeg && mycmakeargs+=(
431
		-DFFMPEG_URL="${DISTDIR}/ffmpeg-${FFMPEG_VERSION}.tar.gz"
453
		# Additional find_package on top of core_optional_deps for whatever reason
454
		$(cmake_use_find_package vaapi VAAPI)
455
		$(cmake_use_find_package vdpau VDPAU)
456
		-DENABLE_INTERNAL_DAV1D=OFF
457
		-DFFMPEG_URL="${DISTDIR}/ffmpeg-${FFMPEG_VERSION}.tar.xz"
432 458
	)
459
	use nfs && mycmakeargs+=( -DENABLE_INTERNAL_NFS=OFF )
433 460
	use !udev && mycmakeargs+=( -DENABLE_LIBUSB=$(usex libusb) )
461
	use udf && mycmakeargs+=( -DENABLE_INTERNAL_UDFREAD=OFF )
462
	use webserver && mycmakeargs+=( -DENABLE_INTERNAL_LIBMICROHTTPD=OFF )
434 463
	use X && use !gles && mycmakeargs+=( -DENABLE_GLX=ON )
464
	use xslt && mycmakeargs+=( -DENABLE_INTERNAL_XSLT=OFF )
435 465

  
436 466
	for flag in ${CPU_FLAGS[@]} ; do
437 467
		local name=${flag#cpu_flags_*_}
438 468
		mycmakeargs+=( -DENABLE_${name^^}=$(usex ${flag}) )
439 469
	done
440 470

  
441
	if use system-ffmpeg; then
442
		# TODO: drop compat and allow using >=media-video/ffmpeg-7
443
		ffmpeg_compat_setup 6
444
		ffmpeg_compat_add_flags
445
		mycmakeargs+=( -DFFMPEG_INCLUDE_DIRS="${SYSROOT}$(ffmpeg_compat_get_prefix 6)" )
446
	fi
447

  
448 471
	if ! is-flag -DNDEBUG && ! is-flag -D_DEBUG ; then
449 472
		# Kodi requires one of the 'NDEBUG' or '_DEBUG' defines
450 473
		append-cflags -DNDEBUG
451 474
		append-cxxflags -DNDEBUG
452 475
	fi
453 476

  
454
	# Violates ODR (bug #860984) and USE_LTO does spooky stuff
455
	# https://github.com/xbmc/xbmc/commit/cb72a22d54a91845b1092c295f84eeb48328921e
456
	filter-lto
477
	if tc-is-lto ; then
478
		mycmakeargs+=( -DUSE_LTO=ON )
479
	else
480
		mycmakeargs+=( -DUSE_LTO=OFF )
481
	fi
457 482

  
458 483
	# bug #926076
459 484
	append-flags -fPIC
460 485

  
461
	# used by vendored libdvdread
462
	tc-export PKG_CONFIG
486
	if use system-ffmpeg && use postproc; then
487
		pushd "${WORKDIR}/ffmpeg-${FFMPEG_VERSION}" >/dev/null || die
488
		local ffconf=(
489
			--disable-all
490
			--enable-postproc
491
			--enable-gpl
492
		)
493
		if tc-is-cross-compiler; then
494
			ffconf+=(
495
				--enable-cross-compile
496
				--arch="$(tc-arch-kernel)"
497
				--cross-prefix="${CHOST}-"
498
				--host-cc="$(tc-getBUILD_CC)"
499
				--target-os=linux
500
			)
501
		elif use arm; then
502
			ffconf+=( --arch=arm )
503
		fi
504
		./configure "${ffconf[@]}" || die
505
		touch libpostproc/libpostproc.a || die # Actually build later.
506
		emake libpostproc/libpostproc.pc V=1
507
		export PKG_CONFIG_PATH="${PWD}/doc/examples/pc-uninstalled"
508
		# Work around CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY in eclass. It's a
509
		# weird thing to do, but probably safer than setting that to BOTH.
510
		[[ ${SYSROOT:-/} != / ]] && mycmakeargs+=( -DCMAKE_FIND_ROOT_PATH="${PWD}" )
511
		popd >/dev/null || die
512
	fi
463 513

  
464 514
	if tc-is-cross-compiler; then
465 515
		for t in "${NATIVE_TOOLS[@]}" ; do
......
475 525
}
476 526

  
477 527
src_compile() {
528
	if use system-ffmpeg && use postproc; then
529
		pushd "${WORKDIR}/ffmpeg-${FFMPEG_VERSION}" >/dev/null || die
530
		emake libpostproc/libpostproc.a V=1
531
		rm -r libav* libsw* || die
532
		popd >/dev/null || die
533
	fi
534

  
478 535
	if tc-is-cross-compiler; then
479 536
		for t in "${NATIVE_TOOLS[@]}" ; do
480 537
			emake -C "${S}/tools/depends/native/$t/src"
......
491 548
		# Known failing, unreliable test
492 549
		# bug #743938
493 550
		TestCPUInfo.GetCPUFrequency
494
		# Test failure stemming from sci-libs/kissfft
495
		# The difference between output[2i] and (i==freq1?1.0:0.0) is inf, which exceeds 1e-7, where output[2i]
496
		# evaluates to inf,(i==freq1?1.0:0.0) evaluates to 0, and 1e-7 evaluates to 9.9999999999999995e-08.
497
		TestRFFT.SimpleSignal
498 551
		# Tries to ping localhost, naturally breaking network-sandbox
499 552
		TestNetwork.PingHost
500 553
	)
501 554

  
555
	# Tests assumes bluray support is enabled
556
	if use !bluray; then
557
		CMAKE_SKIP_TESTS+=(
558
			TestStacks.TestMovieFilesStackFolderFilesDiscPart
559
			TestURIUtils.GetBasePath
560
		)
561
	fi
562

  
502 563
	if use arm || use x86; then
503 564
		# bug #779184
504 565
		# https://github.com/xbmc/xbmc/issues/18594
Thank you!