Use the `KIVY_RPI_VERSION` env variable to force the build of `egl_rpi` in non Raspi CI builds (#7804)

* Use the `USE_RPI` env variable to force the platform to `rpi`

* Update doc/sources/installation/installation-rpi.rst

Co-authored-by: Matt Einhorn <matt@einhorn.dev>

* Introduce new env variable `FORCE_RPI_VERSION` for forcing `egl_rpi`
instead of reusing `USE_RPI`, which has a different connotation.

* Update docs for `FORCE_RPI_VERSION` variable

* Update setup.py

Co-authored-by: Matt Einhorn <matt@einhorn.dev>

* Rename variable to `KIVY_RPI_VERSION`

Co-authored-by: Matt Einhorn <matt@einhorn.dev>

Co-authored-by: Matt Einhorn <matt@einhorn.dev>
This commit is contained in:
Alexander Lais 2022-02-17 08:17:23 +01:00 committed by GitHub
parent 4d83ec5baa
commit 27dff1fadb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -77,6 +77,23 @@ then install SDL2 from apt::
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
Cross-Compilation for Raspberry Pi 1-3 headless installation on Raspbian Buster
*******************************************************************************
The Raspberry OS project uses `pi-gen` project to create bootable images for Raspberry PI.
Kivy determines automatically the sub-packages to build based on the environment it is compiled within. By default, the `egl_rpi` renderer that uses the (now deprecated but still useful) DISPMANX API is only compiled when running on a Raspberry Pi.
In order to build Kivy in such `pi-gen` environment, the auto-detection of the Raspberry Pi hardware version needs to be disabled.
When cross-compiling using e.g. `pi-gen`, the build system can be forced into compiling for Raspberry Pi with `egl_rpi` support by setting the environment variabel `KIVY_RPI_VERSION` to any number < 4, e.g. `3`.
The install command then looks something like this::
apt install build-essential libraspberrypi-dev raspberrypi-kernel-headers
KIVY_RPI_VERSION=3 python -m pip install "kivy[base]" kivy_examples --no-binary kivy
Please note that the `egl_rpi` window handler is not supported on Raspberry Pi 4 and higher.
The existing version check will refuse to compile the `egl_rpi` provider when detecting or forcing the Raspberry Pi version to 4 or higher.
Raspberry Pi 4 headless installation on Raspbian Buster
*******************************************************

View File

@ -112,9 +112,13 @@ if kivy_ios_root is not None:
platform = 'ios'
# proprietary broadcom video core drivers
if exists('/opt/vc/include/bcm_host.h'):
used_pi_version = pi_version
# Force detected Raspberry Pi version for cross-builds, if needed
if 'KIVY_RPI_VERSION' in environ:
used_pi_version = int(environ['KIVY_RPI_VERSION'])
# The proprietary broadcom video core drivers are not available on the
# Raspberry Pi 4
if (pi_version or 4) < 4:
if (used_pi_version or 4) < 4:
platform = 'rpi'
# use mesa video core drivers
if environ.get('VIDEOCOREMESA', None) == '1':