Here is the recipe I’ve made recently to integrate Kivy 2.0.0 in Yocto (dunfell).
It’s probably far from perfect, but I guess it can help other Yocto+Kivy users
like me. Note that I had to patch the setup.py
of Kivy to work around a bug.
This bug has been fixed now, so
this patch won’t be useful for future versions.
SUMMARY = "Recipe to embedded the Python PiP Package Kivy"
HOMEPAGE = "https://kivy.org/"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=f0c851d60495c7e27225a819e179208a"
PYPI_PACKAGE = "Kivy"
USE_WAYLAND = "1"
export USE_WAYLAND
inherit dos2unix pypi setuptools3
SRC_URI += " \
file://0001-setup.py-Fix-get_modulename_from_file.patch \
"
SRC_URI[md5sum] = "410d3968c7f45171285bcac76bbad265"
SRC_URI[sha256sum] = "d25e44eb44e43762b2fd0c5874e51954e0f1181fd9800d8a6756be6d084812d8"
DEPENDS += " \
gstreamer1.0 \
gstreamer1.0-python \
libsdl2 \
libsdl2-image \
libsdl2-mixer \
libsdl2-ttf \
pango \
python3-cython-native \
"
RDEPENDS_${PN} = " \
gstreamer1.0 \
gstreamer1.0-python \
libsdl2 \
libsdl2-image \
libsdl2-mixer \
libsdl2-ttf \
pango \
python3-docutils \
python3-fcntl \
python3-image \
python3-kivy-garden \
python3-pillow \
python3-pygments \
"
do_install_append() {
# drop the examples
# XXX(Jflesch): by default they shouldn't have been built by
# Kivy's setup.py. Therefore they shouldn't have been installed
# either. Yet somehow here they are.
rm -rf ${D}/usr/share
}
Kivy-garden is also required by Kivy, so I also had to make a recipe for it. You can download the complete recipes and patches for Kivy and Kivy-garden here: yocto_recipe_kivy.tar.gz.
If like me you are working on an Olinuxino A20 (Micro or Lime2):
- Do not try to use Linux 3.4 + Xorg + sunxi-mali. Use Wayland and the lima driver from the mainline kernel (and Weston and Xwayland if you have to).
- You must modify the Kivy configuration:
kivy.config.Config.set('graphics', 'multisamples', 0)
. Otherwise you will just get a black screen/window.
I’ve made it work with the following settings in local.conf
:
# Mainline kernel drivers + disable sunxi-mali
MACHINEOVERRIDES .= ":use-mailine-graphics"
ROOT_HOME = "/root"
DISTRO_FEATURES = " \
egl \
ext4 \
gles \
gles2 \
opengl \
opengles \
opengles2 \
systemd \
wayland \
x11 \
"
(I’m pretty sure half of those flags don’t actually exist, but meh).