multimedia/kodi-devel: Add GBM flavor and prepare for Wayland support
AbandonedPublic

Authored by tobik on Sun, Dec 31, 12:55 PM.

Details

Reviewers
mat
bdrewery
Group Reviewers
Contributor Reviewers (ports)
Summary

This adds a 'gbm' flavor to kodi-devel with which we can run Kodi
directly from the console without Xorg or a Wayland compositor.

The gbm flavor requires graphics/drm-next-kmod and evdev support, so
there is no much point in building it for FreeBSD 11.1.

This also adds preliminary Wayland support to kodi-devel. It requires
a new port graphics/waylandpp (C++ bindings for Wayland) [1] that can
only be built when graphics/mesa-libs has been built with WAYLAND
support, which is still off by default, so I have not added it to
FLAVORS yet.

I hope I can get approval to commit it to the tree. Though kodi-devel
won't built on 12.0-CURRENT until the fix for RapidJSON (D13599) is
committed.

[1] https://github.com/t6/freebsd-ports-sndio/blob/sndio-rebase/graphics/waylandpp

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 14174
Build 14343: arc lint + arc unit
tobik created this revision.Sun, Dec 31, 12:55 PM
tobik updated this revision to Diff 37344.Mon, Jan 1, 9:13 AM

Fix conflicts

The kodi wrapper script already tries to infer in what kind of
environment it runs and calls lib/kodi/kodi-{x11,gbm,wayland} as
appropriate. The data files and supporting libraries do not change
between the different flavors.

Make gbm the default flavor. It installs all necessary data files
and doesn't add any additional dependencies when compared to the x11
or wayland flavors. Users can then install additional platform
binaries with the kodi-devel-{x11,wayland} packages.

mat added a comment.Tue, Jan 2, 2:29 PM

I admit I only use kodi on my π3 running openelec so I don't really know much about it, but, hum, what good is it without x11? I mean, you need to display videos, does it come with its own display thingie ?

mat added a comment.Tue, Jan 2, 2:32 PM

Also, can the multiple flavors be installed at once?

tobik added a comment.Tue, Jan 2, 3:42 PM
In D13712#287419, @mat wrote:

I admit I only use kodi on my π3 running openelec so I don't really know much about it, but, hum, what good is it without x11? I mean, you need to display videos, does it come with its own display thingie ?

Yes, it uses the DRM drivers (via libgbm, libdrm, and libEGL) directly to display itself.

It also requires evdev support in the kernel if you want to control it with your keyboard/mouse (but using a smartphone or tablet remote control should work too).

In D13712#287420, @mat wrote:

Also, can the multiple flavors be installed at once?

Yes, they can all be installed at the same time. kodi-devel@gbm (which installs all necessary data files) has to be installed for the x11 and wayland flavors to even work.

Adding a RUN_DEPENDS on kodi-devel@gbm to the x11 and wayland flavors is something that Poudriere doesn't seem to like (the ports framework
itself appears to not mind):

[00:00:02] Gathering ports metadata
[00:00:03] Warning: (multimedia/kodi-devel): Error: gather_port_vars_port: Already had multimedia/kodi-devel (rdep=metadata gbm listed)
[00:00:03] Error: Fatal errors encountered gathering ports metadata

Do you think this is a bug in Poudriere? Or am I misusing flavors?

mat added a comment.Tue, Jan 2, 4:39 PM
In D13712#287420, @mat wrote:

Also, can the multiple flavors be installed at once?

Yes, they can all be installed at the same time. kodi-devel@gbm (which installs all necessary data files) has to be installed for the x11 and wayland flavors to even work.

Adding a RUN_DEPENDS on kodi-devel@gbm to the x11 and wayland flavors is something that Poudriere doesn't seem to like (the ports framework
itself appears to not mind):

[00:00:02] Gathering ports metadata
[00:00:03] Warning: (multimedia/kodi-devel): Error: gather_port_vars_port: Already had multimedia/kodi-devel (rdep=metadata gbm listed)
[00:00:03] Error: Fatal errors encountered gathering ports metadata

Do you think this is a bug in Poudriere? Or am I misusing flavors?

Mmmm, as all the Python ports have flavors all over their dependencies, and it works just fine with poudriere, I guess it should work just fine here.

What exactly did you put in the Makefile ?

tobik added a comment.Tue, Jan 2, 4:47 PM
In D13712#287444, @mat wrote:
In D13712#287420, @mat wrote:

Also, can the multiple flavors be installed at once?

Yes, they can all be installed at the same time. kodi-devel@gbm (which installs all necessary data files) has to be installed for the x11 and wayland flavors to even work.

Adding a RUN_DEPENDS on kodi-devel@gbm to the x11 and wayland flavors is something that Poudriere doesn't seem to like (the ports framework
itself appears to not mind):

[00:00:02] Gathering ports metadata
[00:00:03] Warning: (multimedia/kodi-devel): Error: gather_port_vars_port: Already had multimedia/kodi-devel (rdep=metadata gbm listed)
[00:00:03] Error: Fatal errors encountered gathering ports metadata

Do you think this is a bug in Poudriere? Or am I misusing flavors?

Mmmm, as all the Python ports have flavors all over their dependencies, and it works just fine with poudriere, I guess it should work just fine here.

What exactly did you put in the Makefile ?

I basically just added

wayland_RUN_DEPENDS=        kodi-devel>=0:multimedia/kodi-devel@gbm
x11_RUN_DEPENDS=        kodi-devel>=0:multimedia/kodi-devel@gbm

Let me try removing @gbm...

mat added a comment.Tue, Jan 2, 9:27 PM

What exactly did you put in the Makefile ?

I basically just added

wayland_RUN_DEPENDS=        kodi-devel>=0:multimedia/kodi-devel@gbm
x11_RUN_DEPENDS=        kodi-devel>=0:multimedia/kodi-devel@gbm

Let me try removing @gbm...

No, the @gbm is right. It should work.
I'm exhausted today, but I'll have a look tomorrow if it's ok with you.

In D13712#287420, @mat wrote:

Also, can the multiple flavors be installed at once?

Yes, they can all be installed at the same time. kodi-devel@gbm (which installs all necessary data files) has to be installed for the x11 and wayland flavors to even work.

Adding a RUN_DEPENDS on kodi-devel@gbm to the x11 and wayland flavors is something that Poudriere doesn't seem to like (the ports framework
itself appears to not mind):

[00:00:02] Gathering ports metadata
[00:00:03] Warning: (multimedia/kodi-devel): Error: gather_port_vars_port: Already had multimedia/kodi-devel (rdep=metadata gbm listed)
[00:00:03] Error: Fatal errors encountered gathering ports metadata

Do you think this is a bug in Poudriere? Or am I misusing flavors?

Where exactly are you adding the RUN_DEPENDS at? Which Makefile?

bdrewery requested changes to this revision.Tue, Jan 2, 9:47 PM

Block pending potential Poudriere bug.

This revision now requires changes to proceed.Tue, Jan 2, 9:47 PM
tobik updated this revision to Diff 37443.Wed, Jan 3, 5:32 AM
  • Add the broken *_RUN_DEPENDS
tobik added a comment.Wed, Jan 3, 5:37 AM
In D13712#287532, @mat wrote:

What exactly did you put in the Makefile ?

I basically just added

wayland_RUN_DEPENDS=        kodi-devel>=0:multimedia/kodi-devel@gbm
x11_RUN_DEPENDS=        kodi-devel>=0:multimedia/kodi-devel@gbm

Let me try removing @gbm...

No, the @gbm is right. It should work.
I'm exhausted today, but I'll have a look tomorrow if it's ok with you.

Of course.

In D13712#287420, @mat wrote:

Also, can the multiple flavors be installed at once?

Yes, they can all be installed at the same time. kodi-devel@gbm (which installs all necessary data files) has to be installed for the x11 and wayland flavors to even work.

Adding a RUN_DEPENDS on kodi-devel@gbm to the x11 and wayland flavors is something that Poudriere doesn't seem to like (the ports framework
itself appears to not mind):

[00:00:02] Gathering ports metadata
[00:00:03] Warning: (multimedia/kodi-devel): Error: gather_port_vars_port: Already had multimedia/kodi-devel (rdep=metadata gbm listed)
[00:00:03] Error: Fatal errors encountered gathering ports metadata

Do you think this is a bug in Poudriere? Or am I misusing flavors?

Where exactly are you adding the RUN_DEPENDS at? Which Makefile?

multimedia/kodi-devel/Makefile

I've updated the differential to include them now.

mat added inline comments.Wed, Jan 3, 7:34 AM
multimedia/kodi-devel/Makefile
109

At that point, FLAVOR can be undefined, so using :U is right, but gbm is the default flavor, so it is also the value that is to be used when FLAVOR is undefined. So either change this to:

​.if ${FLAVOR:Ugbm} == gbm || ${FLAVOR:U} == wayland

Or just after the FLAVORS line, add a:

FLAVOR?=  ${FLAVORS:[1]}
200

same here, :Ugbm

tobik updated this revision to Diff 37450.Wed, Jan 3, 8:27 AM
tobik marked 2 inline comments as done.
  • Add FLAVOR?=${FLAVORS:[1]}
mat added a comment.Wed, Jan 3, 11:53 AM

Side question, you can't ask kodi to build for x11/wayland/gbm at the same time?

tobik added a comment.Wed, Jan 3, 12:54 PM
In D13712#287675, @mat wrote:

Side question, you can't ask kodi to build for x11/wayland/gbm at the same time?

No, IIUC it's a singleton design and the build system just wires in the platform sources depending on whatever CORE_PLATFORM_NAME is set to.

mat added a comment.Wed, Jan 3, 1:06 PM
In D13712#287675, @mat wrote:

Side question, you can't ask kodi to build for x11/wayland/gbm at the same time?

No, IIUC it's a singleton design and the build system just wires in the platform sources depending on whatever CORE_PLATFORM_NAME is set to.

Ok, just checking that this was flavors and not sub-packages :-)

bdrewery added inline comments.Wed, Jan 3, 5:53 PM
multimedia/kodi-devel/Makefile
58

Ok yeah this is a problem. A port cannot depend on itself. It seems like you're trying to do a sub-package thing here by making kodi-devel a meta package of the 2 possible flavors?

Adding a RUN_DEPENDS on kodi-devel@gbm to the x11 and wayland flavors is something that Poudriere doesn't seem to like (the ports framework
itself appears to not mind):

[00:00:02] Gathering ports metadata
[00:00:03] Warning: (multimedia/kodi-devel): Error: gather_port_vars_port: Already had multimedia/kodi-devel (rdep=metadata gbm listed)
[00:00:03] Error: Fatal errors encountered gathering ports metadata

Do you think this is a bug in Poudriere? Or am I misusing flavors?

The bug in Poudriere, IMHO, is that the error is obscure and needs to explicitly deny a port depending on itself: https://github.com/freebsd/poudriere/issues/574

Adding a RUN_DEPENDS on kodi-devel@gbm to the x11 and wayland flavors is something that Poudriere doesn't seem to like (the ports framework
itself appears to not mind):

[00:00:02] Gathering ports metadata
[00:00:03] Warning: (multimedia/kodi-devel): Error: gather_port_vars_port: Already had multimedia/kodi-devel (rdep=metadata gbm listed)
[00:00:03] Error: Fatal errors encountered gathering ports metadata

Do you think this is a bug in Poudriere? Or am I misusing flavors?

The bug in Poudriere, IMHO, is that the error is obscure and needs to explicitly deny a port depending on itself: https://github.com/freebsd/poudriere/issues/574

Oddly with Poudriere 3.2.3 I actually get the proper error: [00:00:19] [Dry Run] Warning: (multimedia/kodi-devel@x11): Error: multimedia/kodi-devel incorrectly depends on itself. Please contact maintainer of the port to fix this.

tobik added a comment.Wed, Jan 3, 6:50 PM

Adding a RUN_DEPENDS on kodi-devel@gbm to the x11 and wayland flavors is something that Poudriere doesn't seem to like (the ports framework
itself appears to not mind):

[00:00:02] Gathering ports metadata
[00:00:03] Warning: (multimedia/kodi-devel): Error: gather_port_vars_port: Already had multimedia/kodi-devel (rdep=metadata gbm listed)
[00:00:03] Error: Fatal errors encountered gathering ports metadata

Do you think this is a bug in Poudriere? Or am I misusing flavors?

The bug in Poudriere, IMHO, is that the error is obscure and needs to explicitly deny a port depending on itself: https://github.com/freebsd/poudriere/issues/574

Oddly with Poudriere 3.2.3 I actually get the proper error: [00:00:19] [Dry Run] Warning: (multimedia/kodi-devel@x11): Error: multimedia/kodi-devel incorrectly depends on itself. Please contact maintainer of the port to fix this.

The error message I quoted came from poudriere testport.

multimedia/kodi-devel/Makefile
58

Can you explain why? Surely a package can depend on another package regardless of how it is built or what origin it has.

Let's assume I split multimedia/kodi-devel up into three ports: (1) multimedia/kodi-devel-gbm, (2) multimedia/kodi-devel-wayland, (3) multimedia/kodi-devel-x11. Then I would have no problems whatsoever to let (2) depend on (1), and (3) depend on (1).

Maybe I should do that instead.

bdrewery added inline comments.Wed, Jan 3, 7:51 PM
multimedia/kodi-devel/Makefile
58

Your reasoning makes sense but it's just not the pattern we use in Ports right now.
Let's step back though...

Kodi depends on itself?
How so?
Is it some sub-component of Kodi that needs to be built before the larger piece?
Or is it just some module, like a core module, that can be different for the main package to use?

tobik added inline comments.Thu, Jan 4, 6:11 AM
multimedia/kodi-devel/Makefile
58

Let me quote two earlier comments I wrote here:

Fix conflicts

The kodi wrapper script already tries to infer in what kind of
environment it runs and calls lib/kodi/kodi-{x11,gbm,wayland} as
appropriate. The data files and supporting libraries do not change
between the different flavors.

Make gbm the default flavor. It installs all necessary data files
and doesn't add any additional dependencies when compared to the x11
or wayland flavors. Users can then install additional platform
binaries with the kodi-devel-{x11,wayland} packages.

To prevent having to add CONFLICTS_INSTALL to all flavors (like I did in the initial revision of this differential), both x11 and wayland do not install the data files, but gbm does. So I want to add a RUN_DEPENDS to get them when someone only installs kodi-devel-x11. Having conflicts between them makes Kodi annoying to test and is really unnecessary.

In D13712#287675, @mat wrote:

Side question, you can't ask kodi to build for x11/wayland/gbm at the same time?

No, IIUC it's a singleton design and the build system just wires in the platform sources depending on whatever CORE_PLATFORM_NAME is set to.

To get lib/kodi/kodi-{x11,wayland,gbm} I have to rebuild Kodi three times (hence the use of flavors), but I'd like to be able to install them simultaneously.

So I'm really stuck between five choices:

Do I

  1. live with the conflicts?
  1. not care about this at all? (Users can figure this out, right?)
  1. add a pkg-message (the horror) to tell users to install gbm as well?
  1. add a RUN_DEPENDS on gbm to wayland and x11?
  1. add unique suffixes to lib/kodi, bin/kodi, include/kodi, share/kodi? (Which basically means supporting addons just became a lot harder than necessary)

IMHO the only sensible choice here is 4 or 3.

tobik updated this revision to Diff 37552.Fri, Jan 5, 8:41 AM
  • Enable build on armv6/armv7
  • Rename gbm flavor to native
  • Rename patch-wayland to the more accurate patch-evdev
  • Add armv* only RPI option in the native flavor to enable support for the Raspberry Pi. When enabled Kodi will be built with the rbpi platform instead of gbm.
mat added a comment.Fri, Jan 5, 9:06 AM

The RPI option does not seem to have a description, also, it seems it is not enable when arch=arm*, but maybe it is normal.

tobik updated this revision to Diff 37553.Fri, Jan 5, 9:17 AM
In D13712#288405, @mat wrote:

The RPI option does not seem to have a description, also, it seems it is not enable when arch=arm*, but maybe it is normal.

Right, thanks. Added one.

Yes, it's off by default because of bad default options in ffmpeg (VAAPI=on adds libva which depends on mesa-libs which conflicts with raspberrpi-userland).

tobik updated this revision to Diff 37558.Fri, Jan 5, 1:26 PM
  • Fix build with all other flavors again
  • Slave VAAPI to wayland. It's always required.
tobik updated this revision to Diff 37608.Sun, Jan 7, 2:06 PM
tobik abandoned this revision.Tue, Jan 9, 1:17 PM

I've added platform options to the port in rP458517 and I'm abandoning this for now. With the options in place I can easily flavorize it myself via Makefile.local for the time being.

Thank you for taking the time to review this.