config BR2_PACKAGE_KODI_ARCH_SUPPORTS
	bool
	default y if BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS
	# i386: needs sse (see upstream PR 10351)
	depends on !(BR2_i386 && !BR2_X86_CPU_HAS_SSE)
	depends on BR2_USE_MMU # libcdio, and others

comment "kodi needs python3 w/ .py modules, a uClibc or glibc toolchain w/ C++, threads, wchar, dynamic library, gcc >= 4.9"
	depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
	depends on BR2_TOOLCHAIN_HAS_SYNC_4
	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
		|| !BR2_USE_WCHAR || BR2_STATIC_LIBS \
		|| !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 \
		|| BR2_TOOLCHAIN_USES_MUSL \
		|| !BR2_PACKAGE_PYTHON3 \
		|| BR2_PACKAGE_PYTHON3_PYC_ONLY

config BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
	bool

config BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_GBM
	bool
	default y
	depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
	depends on BR2_PACKAGE_MESA3D_GBM
	depends on BR2_PACKAGE_HAS_UDEV # libinput
	select BR2_PACKAGE_KODI_PLATFORM_SUPPORTS

config BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_WAYLAND
	bool
	default y
	depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
	depends on BR2_PACKAGE_HAS_LIBEGL_WAYLAND # waylandpp
	depends on BR2_HOST_GCC_AT_LEAST_4_9 # waylandpp
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # waylandpp
	depends on BR2_INSTALL_LIBSTDCPP # waylandpp
	depends on BR2_PACKAGE_WAYLAND # waylandpp
	select BR2_PACKAGE_KODI_PLATFORM_SUPPORTS

config BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_X11
	bool
	default y
	depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
	depends on BR2_PACKAGE_XORG7
	select BR2_PACKAGE_KODI_PLATFORM_SUPPORTS

comment "kodi needs an OpenGL EGL backend with OpenGL or GLES support"
	depends on !BR2_PACKAGE_KODI_PLATFORM_SUPPORTS

menuconfig BR2_PACKAGE_KODI
	bool "kodi"
	depends on BR2_INSTALL_LIBSTDCPP
	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libass -> harfbuzz
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # C++14
	depends on BR2_TOOLCHAIN_HAS_THREADS
	depends on !BR2_TOOLCHAIN_USES_MUSL
	depends on BR2_USE_WCHAR
	depends on !BR2_STATIC_LIBS # gnutls, python3 and others
	depends on BR2_PACKAGE_HAS_LIBEGL
	depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
	depends on BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
	depends on BR2_PACKAGE_PYTHON3
	depends on !BR2_PACKAGE_PYTHON3_PYC_ONLY
	select BR2_NEEDS_HOST_JAVA
	select BR2_PACKAGE_FFMPEG
	select BR2_PACKAGE_FFMPEG_GPL
	select BR2_PACKAGE_FFMPEG_POSTPROC
	select BR2_PACKAGE_FFMPEG_SWSCALE
	select BR2_PACKAGE_FLATBUFFERS
	select BR2_PACKAGE_FMT
	select BR2_PACKAGE_FONTCONFIG # needed for libass
	select BR2_PACKAGE_FREETYPE
	select BR2_PACKAGE_FSTRCMP
	select BR2_PACKAGE_LIBASS
	select BR2_PACKAGE_LIBCDIO
	select BR2_PACKAGE_LIBCROSSGUID
	select BR2_PACKAGE_LIBCURL
	select BR2_PACKAGE_LIBDRM
	select BR2_PACKAGE_LIBFRIBIDI
	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
	select BR2_PACKAGE_LIBICONV_EXTRA_ENCODINGS if !BR2_ENABLE_LOCALE
	select BR2_PACKAGE_LIBPLIST
	select BR2_PACKAGE_LZO
	select BR2_PACKAGE_OPENSSL
	select BR2_PACKAGE_PCRE
	select BR2_PACKAGE_PCRE_UCP
	select BR2_PACKAGE_PYTHON3_2TO3
	select BR2_PACKAGE_PYTHON3_PYEXPAT
	select BR2_PACKAGE_PYTHON3_SQLITE
	select BR2_PACKAGE_PYTHON3_SSL
	select BR2_PACKAGE_PYTHON3_UNICODEDATA
	select BR2_PACKAGE_PYTHON3_ZLIB
	select BR2_PACKAGE_RAPIDJSON
	select BR2_PACKAGE_SPDLOG
	select BR2_PACKAGE_SQLITE
	select BR2_PACKAGE_TAGLIB
	select BR2_PACKAGE_TINYXML
	select BR2_PACKAGE_ZLIB
	select BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY if BR2_TOOLCHAIN_USES_GLIBC # runtime UTF conversion support
	select BR2_PACKAGE_LIBINPUT if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_GBM
	select BR2_PACKAGE_LIBXKBCOMMON if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_GBM
	select BR2_PACKAGE_LIBXKBCOMMON if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_WAYLAND
	select BR2_PACKAGE_WAYLANDPP if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_WAYLAND
	select BR2_PACKAGE_XLIB_LIBXRANDR if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_X11
	help
	  Kodi is an award-winning free and open source (GPL) software
	  media player and entertainment hub for digital media.

	  http://kodi.tv

if BR2_PACKAGE_KODI

config BR2_PACKAGE_KODI_ALSA_LIB
	bool "alsa"
	select BR2_PACKAGE_ALSA_LIB
	help
	  Enable alsa support.

config BR2_PACKAGE_KODI_AVAHI
	bool "avahi"
	select BR2_PACKAGE_AVAHI
	select BR2_PACKAGE_AVAHI_DAEMON
	help
	  Enable Avahi support.
	  Select this if you want Kodi to support Bonjour protocol.

config BR2_PACKAGE_KODI_BLUEZ
	bool "bluetooth"
	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_4 # bluez5_utils
	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # bluez5_utils
	select BR2_PACKAGE_BLUEZ5_UTILS
	select BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_AUDIO
	select BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_HID
	help
	    Enable bluetooth support

config BR2_PACKAGE_KODI_DBUS
	bool "dbus"
	select BR2_PACKAGE_DBUS
	help
	  Enable D-Bus support

config BR2_PACKAGE_KODI_EVENTCLIENTS
	bool "eventclients"
	help
	  Enable event clients support

	  https://github.com/xbmc/xbmc/blob/master/tools/EventClients/README.txt

config BR2_PACKAGE_KODI_LIBBLURAY
	bool "blu-ray"
	select BR2_PACKAGE_LIBBLURAY
	help
	  Enable Blu-ray input support.
	  Select this if you want to play back Blu-ray content.

config BR2_PACKAGE_KODI_LIBCEC
	bool "hdmi cec"
	select BR2_PACKAGE_LIBCEC
	help
	  Enable CEC (Consumer Electronics Control) support.
	  Select this if you want Kodi to support HDMI CEC.

config BR2_PACKAGE_KODI_LCMS2
	bool "lcms2"
	select BR2_PACKAGE_LCMS2
	help
	  Enable color management support.

config BR2_PACKAGE_KODI_LIBMICROHTTPD
	bool "web server"
	select BR2_PACKAGE_LIBMICROHTTPD
	help
	  Enable webserver feature

config BR2_PACKAGE_KODI_LIBNFS
	bool "nfs"
	# libnfs -> libtirpc
	depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC || BR2_TOOLCHAIN_HAS_THREADS
	select BR2_PACKAGE_LIBNFS
	help
	  Enable NFS server support.

comment "nfs support needs a toolchain w/ threads support"
	depends on !(BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_HAS_NATIVE_RPC)

config BR2_PACKAGE_KODI_MYSQL
	bool "mysql"
	select BR2_PACKAGE_MYSQL
	help
	  Enable MySQL support

choice
	prompt "render system"
	default BR2_PACKAGE_KODI_RENDER_SYSTEM_GL

config BR2_PACKAGE_KODI_RENDER_SYSTEM_GL
	bool "OpenGL"
	depends on BR2_PACKAGE_HAS_LIBGL
	select BR2_PACKAGE_LIBGLU

config BR2_PACKAGE_KODI_RENDER_SYSTEM_GLES
	bool "GLES"
	depends on BR2_PACKAGE_HAS_LIBGLES

endchoice

config BR2_PACKAGE_KODI_PULSEAUDIO
	bool "pulseaudio"
	depends on BR2_PACKAGE_PULSEAUDIO_HAS_ATOMIC
	# Pulseaudio support in kodi needs glib support in Pulseaudio,
	# see FindPulseAudio.cmake. Kodi meets all dependencies of
	# libglib2, so there is no need to propagate them here.
	select BR2_PACKAGE_LIBGLIB2
	select BR2_PACKAGE_PULSEAUDIO
	help
	  Enable Pulseaudio support.

config BR2_PACKAGE_KODI_LIBSHAIRPLAY
	bool "shairport"
	select BR2_PACKAGE_LIBSHAIRPLAY
	help
	  Enable Shairport support.
	  Select this if you want to stream content from an Apple
	  device.

config BR2_PACKAGE_KODI_LIBSMBCLIENT
	bool "samba"
	depends on BR2_PACKAGE_SAMBA4
	help
	  Enable Samba support

config BR2_PACKAGE_KODI_LIBUSB
	bool "usb"
	# https://github.com/xbmc/xbmc/blob/Jarvis/configure.ac#L1554
	# "if libudev is available, we don't need libusb"
	depends on !BR2_PACKAGE_HAS_UDEV
	select BR2_PACKAGE_LIBUSB
	select BR2_PACKAGE_LIBUSB_COMPAT
	help
	  Enable libusb support.

config BR2_PACKAGE_KODI_LIBVDPAU
	bool "vdpau"
	depends on BR2_PACKAGE_KODI_PLATFORM_X11 && \
		BR2_PACKAGE_KODI_RENDER_SYSTEM_GL
	select BR2_PACKAGE_LIBVDPAU
	help
	  Enable libvdpau support.

comment "libvdpau support needs platform 'X11/OpenGL'"
	depends on !BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_X11 || \
		!BR2_PACKAGE_KODI_RENDER_SYSTEM_GL

config BR2_PACKAGE_KODI_UPNP
	bool "upnp"
	help
	  Enable UPnP support

config BR2_PACKAGE_KODI_OPTICALDRIVE
	bool "optical drives"
	help
	  Add support for optical drives, to read e.g. DVDs...

menu "Audio decoder addons"
	source "package/kodi-audiodecoder-modplug/Config.in"
	source "package/kodi-audiodecoder-nosefart/Config.in"
	source "package/kodi-audiodecoder-sidplay/Config.in"
	source "package/kodi-audiodecoder-snesapu/Config.in"
	source "package/kodi-audiodecoder-stsound/Config.in"
	source "package/kodi-audiodecoder-timidity/Config.in"
	source "package/kodi-audiodecoder-vgmstream/Config.in"
endmenu

menu "Audio encoder addons"
	source "package/kodi-audioencoder-flac/Config.in"
	source "package/kodi-audioencoder-lame/Config.in"
	source "package/kodi-audioencoder-vorbis/Config.in"
	source "package/kodi-audioencoder-wav/Config.in"
endmenu

menu "Peripheral addons"
	source "package/kodi-peripheral-joystick/Config.in"
	source "package/kodi-peripheral-xarcade/Config.in"
endmenu

menu "Inputstream addons"
	source "package/kodi-inputstream-adaptive/Config.in"
	source "package/kodi-inputstream-ffmpegdirect/Config.in"
	source "package/kodi-inputstream-rtmp/Config.in"
endmenu

menu "PVR addons"
	source "package/kodi-pvr-argustv/Config.in"
	source "package/kodi-pvr-dvblink/Config.in"
	source "package/kodi-pvr-dvbviewer/Config.in"
	source "package/kodi-pvr-filmon/Config.in"
	source "package/kodi-pvr-hdhomerun/Config.in"
	source "package/kodi-pvr-hts/Config.in"
	source "package/kodi-pvr-iptvsimple/Config.in"
	source "package/kodi-pvr-mediaportal-tvserver/Config.in"
	source "package/kodi-pvr-mythtv/Config.in"
	source "package/kodi-pvr-nextpvr/Config.in"
	source "package/kodi-pvr-njoy/Config.in"
	source "package/kodi-pvr-octonet/Config.in"
	source "package/kodi-pvr-pctv/Config.in"
	source "package/kodi-pvr-stalker/Config.in"
	source "package/kodi-pvr-vbox/Config.in"
	source "package/kodi-pvr-vdr-vnsi/Config.in"
	source "package/kodi-pvr-vuplus/Config.in"
	source "package/kodi-pvr-wmc/Config.in"
	source "package/kodi-pvr-zattoo/Config.in"
endmenu

menu "Screensavers"
	source "package/kodi-screensaver-asteroids/Config.in"
	source "package/kodi-screensaver-asterwave/Config.in"
	source "package/kodi-screensaver-biogenesis/Config.in"
	source "package/kodi-screensaver-cpblobs/Config.in"
	source "package/kodi-screensaver-greynetic/Config.in"
	source "package/kodi-screensaver-matrixtrails/Config.in"
	source "package/kodi-screensaver-pingpong/Config.in"
	source "package/kodi-screensaver-pyro/Config.in"
	source "package/kodi-screensaver-rsxs/Config.in"
	source "package/kodi-screensaver-stars/Config.in"
endmenu

menu "Skins"
	source "package/kodi-skin-confluence/Config.in"
endmenu

menu "Virtual file systems"
	source "package/kodi-vfs-libarchive/Config.in"
	source "package/kodi-vfs-rar/Config.in"
	source "package/kodi-vfs-sftp/Config.in"
endmenu

menu "Visualisations"
	source "package/kodi-visualisation-fishbmc/Config.in"
	source "package/kodi-visualisation-goom/Config.in"
	source "package/kodi-visualisation-matrix/Config.in"
	source "package/kodi-visualisation-shadertoy/Config.in"
	source "package/kodi-visualisation-spectrum/Config.in"
	source "package/kodi-visualisation-starburst/Config.in"
	source "package/kodi-visualisation-waveform/Config.in"
endmenu

endif # BR2_PACKAGE_KODI
