Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jan 2019 07:52:47 +0000 (UTC)
From:      Tobias Kortkamp <tobik@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r490630 - in head/multimedia/kodi-devel: . files
Message-ID:  <201901180752.x0I7ql0p008247@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tobik
Date: Fri Jan 18 07:52:47 2019
New Revision: 490630
URL: https://svnweb.freebsd.org/changeset/ports/490630

Log:
  multimedia/kodi-devel: Enable GBM and WAYLAND by default
  
  - Lift the previous restriction of only being able to build for a
    single platform.
  - The 'kodi' script will run the appropriate platform binary
    based on environment variables (DISPLAY, WAYLAND_DISPLAY), so
    this unlocks the ability to run Kodi in more environments, i.e.,
    under Xorg, the console, or in Wayland compositors.
  - Export XKB_DEFAULT_RULES=evdev in the 'kodi' script to avoid
    surprises where keyboard input does not work correctly.
  - Add explicit xkeyboard-config run dependency.  It is already
    implicit for X11 via xorg-server and required for correctly working
    input with WAYLAND and GBM.
  - GBM: Workaround a compatibility problem between Kodi and our
    libepoll-shim and unbreak input
  - Remove slave port scaffolding
  - Remove a no longer needed patch

Added:
  head/multimedia/kodi-devel/files/patch-tools_Linux_kodi.sh.in   (contents, props changed)
  head/multimedia/kodi-devel/files/patch-xbmc_platform_linux_input_LibInputHandler.cpp   (contents, props changed)
Deleted:
  head/multimedia/kodi-devel/files/patch-xbmc_platform_linux_storage_LinuxStorageProvider.cpp
Modified:
  head/multimedia/kodi-devel/Makefile

Modified: head/multimedia/kodi-devel/Makefile
==============================================================================
--- head/multimedia/kodi-devel/Makefile	Fri Jan 18 05:30:08 2019	(r490629)
+++ head/multimedia/kodi-devel/Makefile	Fri Jan 18 07:52:47 2019	(r490630)
@@ -3,8 +3,9 @@
 PORTNAME=	kodi
 DISTVERSION=	18.0rc5.2
 DISTVERSIONSUFFIX=	-Leia
+PORTREVISION=	1
 CATEGORIES=	multimedia
-PKGNAMESUFFIX?=	-devel
+PKGNAMESUFFIX=	-devel
 
 MAINTAINER=	tobik@FreeBSD.org
 COMMENT=	Award winning media center application
@@ -45,6 +46,7 @@ LIB_DEPENDS=	libass.so:multimedia/libass \
 		libtinyxml.so:textproc/tinyxml \
 		libudev.so:devel/libudev-devd \
 		libuuid.so:misc/e2fsprogs-libuuid
+RUN_DEPENDS=	xkeyboard-config>=2.24:x11/xkeyboard-config
 
 # Building libcpluff.a requires autoreconf and gmake.  Using ninja
 # leads to dependency problems where libcpluff.a is not yet finished
@@ -76,12 +78,13 @@ KODIARCH_i386=	x86
 KODIARCH_amd64=	x86_64
 
 PLIST_SUB=	ARCH=${KODIARCH_${ARCH}:U${ARCH}} OPSYS=${OPSYS:tl}
+PORTDATA=	*
 
 OPTIONS_DEFINE=	AVAHI CEC DBUS LIBBLURAY MYSQL NFS SMB SSE UPNP VAAPI VDPAU WEBSERVER
-OPTIONS_DEFAULT=	LIBBLURAY UPNP VAAPI VDPAU WEBSERVER X11
+OPTIONS_DEFAULT=	GBM LIBBLURAY UPNP VAAPI VDPAU WEBSERVER WAYLAND X11
 OPTIONS_DEFAULT_amd64=	SSE
-OPTIONS_SINGLE=	PLATFORM
-OPTIONS_SINGLE_PLATFORM=	GBM RPI WAYLAND X11
+OPTIONS_MULTI=	PLATFORM
+OPTIONS_MULTI_PLATFORM=	GBM RPI WAYLAND X11
 OPTIONS_EXCLUDE_amd64=	RPI
 OPTIONS_EXCLUDE_armv6=	SSE
 OPTIONS_EXCLUDE_armv7=	SSE
@@ -105,7 +108,7 @@ CEC_CMAKE_BOOL=		ENABLE_CEC
 DBUS_LIB_DEPENDS=	libdbus-1.so:devel/dbus
 DBUS_CMAKE_BOOL=	ENABLE_DBUS
 
-GBM_CMAKE_ON=		-DCORE_PLATFORM_NAME:STRING="gbm" \
+KODI_GBM_ARGS=		-DCORE_PLATFORM_NAME:STRING="gbm" \
 			-DGBM_RENDER_SYSTEM:STRING="gl"
 GBM_CFLAGS=		-I${LOCALBASE}/include/libepoll-shim
 GBM_LDFLAGS=		-L${LOCALBASE}/lib -lepoll-shim -lpthread -lrt
@@ -113,6 +116,7 @@ GBM_BUILD_DEPENDS=	evdev-proto>0:devel/evdev-proto
 GBM_LIB_DEPENDS=	libepoll-shim.so:devel/libepoll-shim \
 			libinput.so:x11/libinput \
 			libxkbcommon.so:x11/libxkbcommon
+GBM_VARS=		KODI_PLATFORMS+=GBM
 
 LIBBLURAY_LIB_DEPENDS=	libbluray.so:multimedia/libbluray
 LIBBLURAY_CMAKE_BOOL=	ENABLE_BLURAY
@@ -129,12 +133,13 @@ PULSEAUDIO_CMAKE_BOOL=	ENABLE_PULSEAUDIO
 # For RPI, disable VAAPI in multimedia/ffmpeg too, so that mesa-libs
 # is *not* installed via libva in the build environment.  Both
 # mesa-libs and raspberrypi-userland conflict with each other.
-RPI_CMAKE_ON=		-DCORE_PLATFORM_NAME:STRING="rbpi"
+KODI_RBPI_ARGS=		-DCORE_PLATFORM_NAME:STRING="rbpi"
 RPI_LIB_DEPENDS=	libbrcmEGL.so:misc/raspberrypi-userland
 RPI_LIB_DEPENDS_OFF=	libdrm.so:graphics/libdrm
-RPI_PREVENTS=		VAAPI VDPAU
+RPI_PREVENTS=		GBM VAAPI VDPAU WAYLAND X11
 RPI_USES_OFF=		gl
 RPI_USE_OFF=		GL=egl,gl,glu
+RPI_VARS=		KODI_PLATFORMS+=RBPI
 
 SMB_USES=		samba:lib
 SMB_CMAKE_BOOL=		ENABLE_SMBCLIENT
@@ -163,7 +168,7 @@ VAAPI_LIB_DEPENDS=	libva.so:multimedia/libva
 VDPAU_CMAKE_BOOL=	ENABLE_VDPAU
 VDPAU_LIB_DEPENDS=	libvdpau.so:multimedia/libvdpau
 
-WAYLAND_CMAKE_ON=	-DCORE_PLATFORM_NAME:STRING="wayland" \
+KODI_WAYLAND_ARGS=	-DCORE_PLATFORM_NAME:STRING="wayland" \
 			-DWAYLAND_RENDER_SYSTEM:STRING="gl"
 WAYLAND_BUILD_DEPENDS=	evdev-proto>0:devel/evdev-proto \
 			wayland-protocols>=0:graphics/wayland-protocols
@@ -171,19 +176,18 @@ WAYLAND_LIB_DEPENDS=	libinput.so:x11/libinput \
 			libwayland-client++.so:graphics/waylandpp \
 			libwayland-client.so:graphics/wayland \
 			libxkbcommon.so:x11/libxkbcommon
+WAYLAND_VARS=		KODI_PLATFORMS+=WAYLAND
 
 WEBSERVER_LIB_DEPENDS=	libmicrohttpd.so:www/libmicrohttpd
 WEBSERVER_CMAKE_BOOL=	ENABLE_MICROHTTPD
 
-X11_CMAKE_ON=		-DCORE_PLATFORM_NAME:STRING="x11"
+KODI_X11_ARGS=		-DCORE_PLATFORM_NAME:STRING="x11"
+KODI_X11_BINS=		kodi-x11 kodi-xrandr
 X11_USE=		XORG=x11,xext,xrandr
+X11_VARS=		KODI_PLATFORMS+=X11
 
 .include <bsd.port.options.mk>
 
-.if ${SLAVE_PORT} == no
-PORTDATA=	*
-.endif
-
 post-patch:
 # Do not try to download dvdnav/dvdread during the build, instead
 # we'll manually point the build to the system's libdvd{nav,read}.so
@@ -194,9 +198,42 @@ post-patch:
 # upstream devs do not sync them
 	@${CP} ${WRKSRC}/system/settings/linux.xml \
 		${WRKSRC}/system/settings/freebsd.xml
+# Make sure Kodi can find keyboard layouts from xkeyboard-config
+	@${REINPLACE_CMD} 's,/usr/share/X11/xkb/rules/,${LOCALBASE}/share/X11/xkb/rules/,g' \
+		${WRKSRC}/xbmc/platform/linux/input/LibInputSettings.cpp
 
-.if ${SLAVE_PORT} == no
-post-install:
+do-configure:
+.for platform in ${KODI_PLATFORMS:O}
+	@${ECHO_MSG} "===> Performing out-of-source build for ${platform}"
+	${MKDIR} ${CONFIGURE_WRKSRC}/${platform}
+	@cd ${CONFIGURE_WRKSRC}/${platform} && ${SETENV} ${CONFIGURE_ENV} \
+		${CMAKE_BIN} ${CMAKE_ARGS} ${KODI_${platform}_ARGS} \
+		${CMAKE_SOURCE_PATH}
+.endfor
+
+do-build:
+# build in reverse to avoid touching some source files in later
+# builds and triggering rebuilds/relinks in the first platform
+# install phase.
+.for platform in ${KODI_PLATFORMS:O:[-1..1]}
+	@${ECHO_MSG} "===>  Building for ${platform}"
+	@${DO_MAKE_BUILD} -C ${BUILD_WRKSRC}/${platform} ${ALL_TARGET}
+.endfor
+
+do-install:
+# Do a full install for the first platform including shared data files...
+.for platform in ${KODI_PLATFORMS:O:[1]}
+	@${ECHO_MSG} "===>  Installing for ${platform}"
+	@cd ${INSTALL_WRKSRC}/${platform} && ${SETENV} ${MAKE_ENV} ${FAKEROOT} \
+		${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET}
+.endfor
+# ... followed by only the other platform binaries
+.for platform in ${KODI_PLATFORMS:O:[2..-1]}
+	@${ECHO_MSG} "===>  Installing for ${platform}"
+	cd ${INSTALL_WRKSRC}/${platform} && \
+		${INSTALL_PROGRAM} ${KODI_${platform}_BINS:Ukodi-${platform:tl}} \
+		${STAGEDIR}${PREFIX}/lib/kodi
+.endfor
 	${INSTALL_MAN} ${WRKSRC}/docs/manpages/kodi.bin.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
 	@cd ${STAGEDIR}${MAN1PREFIX}/man/man1 && ${LN} -sf kodi.bin.1.gz kodi.1.gz
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/TexturePacker
@@ -205,6 +242,5 @@ post-install:
 	@${RM} -r ${STAGEDIR}${DOCSDIR}
 # No firewalld on FreeBSD...
 	@${RM} -r ${STAGEDIR}${PREFIX}/lib/firewalld
-.endif
 
 .include <bsd.port.mk>

Added: head/multimedia/kodi-devel/files/patch-tools_Linux_kodi.sh.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/kodi-devel/files/patch-tools_Linux_kodi.sh.in	Fri Jan 18 07:52:47 2019	(r490630)
@@ -0,0 +1,18 @@
+Export XKB_DEFAULT_RULES=evdev when using Wayland or GBM to avoid
+surprises and make sure all keys work.  Default rules are set to
+'xorg' in x11/libxkbcommon which is problematic.
+
+--- tools/Linux/kodi.sh.in.orig	2019-01-17 22:53:57 UTC
++++ tools/Linux/kodi.sh.in
+@@ -83,6 +83,11 @@ if [ ! -x ${KODI_BINARY} ]; then
+     exit 2
+ fi
+ 
++if [ "${KODI_BINARY##*-}" == "gbm" ] || [ "${KODI_BINARY##*-}" == "wayland" ]; then
++    : ${XKB_DEFAULT_RULES:=evdev}
++    export XKB_DEFAULT_RULES
++fi
++
+ APPORT_CORE="/var/crash/$(echo -n ${KODI_BINARY}|tr / _).$(id -u).crash"
+ 
+ migrate_home()

Added: head/multimedia/kodi-devel/files/patch-xbmc_platform_linux_input_LibInputHandler.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/kodi-devel/files/patch-xbmc_platform_linux_input_LibInputHandler.cpp	Fri Jan 18 07:52:47 2019	(r490630)
@@ -0,0 +1,14 @@
+epoll_create1() from libepoll-shim always fails with 0 and only
+supports EPOLL_CLOEXEC, so let's use that...
+
+--- xbmc/platform/linux/input/LibInputHandler.cpp.orig	2019-01-17 23:22:57 UTC
++++ xbmc/platform/linux/input/LibInputHandler.cpp
+@@ -115,7 +115,7 @@ void CLibInputHandler::Start()
+ 
+ void CLibInputHandler::Process()
+ {
+-  int epollFd = epoll_create1(0);
++  int epollFd = epoll_create1(EPOLL_CLOEXEC);
+   if (epollFd < 0)
+   {
+     CLog::Log(LOGERROR, "CLibInputHandler::%s - failed to create epoll file descriptor: %s", __FUNCTION__, strerror(-errno));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901180752.x0I7ql0p008247>