aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-09-04 15:14:59 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-09-04 15:21:16 +0200
commite6b102e4019d9f369442c0d4b812aafb4fc650c4 (patch)
treec45af59dcc7059ee979ec1a03cac9ff5a0a80b8a
parentbbd257e34e8ee259eaf5bac794b76574625d9119 (diff)
downloadexternal_mesa3d-e6b102e4019d9f369442c0d4b812aafb4fc650c4.tar.gz
external_mesa3d-e6b102e4019d9f369442c0d4b812aafb4fc650c4.tar.bz2
external_mesa3d-e6b102e4019d9f369442c0d4b812aafb4fc650c4.zip
Use the host python through Android's path_interposerreplicant-10
Mesa requires python2-mako and probably python3-mako as well. To add them I tried several approaches: - I tried to package them in Android, but I hit several issues that made the process very time consuming: Adding the mako/ directory from mako in the ANDROID_PYTHONPATH didn't work. However installing it in the ANDROID_PYTHONPATH with python setup.py install --root ${DESTDIR} (DESTDIR being a temporary directory) and moving the resulting mako directory from ${DESTDIR}/usr/lib/python*/site-packages/ to ANDROID_PYTHONPATH worked. However I didn't want to ship yet another binary so I needed to install mako somewhere on out/. To do that the following was needed: - Mako needed to be installed in a directory. By looking at build/make I found several places where it could be installed. - Setuptools needed to be bootstrapped: I wasn't able to do that with shell commands in a target in an Android.mk: setutools's bootstrap.py creates the binaries in the source directory, which Android doesn't permit. I didn't try to look how Guix did the setuptool bootstrap yet. - It would also need to be tested to see if there isn't any side effects as adding a python2 library in a PYTHONPATH that is also used by python3 may have side effects. - Using the host's PYTHONPATH is also not a good idea as the python versions might differ. This also broke build later on as adding the host python2 libraries broke Android's python3 in mesa. - The various Android python2 and python3 binaries could have been replaced by a wrapper, but as the Android build system is huge, I wasn't confident in doing this right, as many things probably need to be taken care of (shell environment, etc) to make the build system see no difference and not introduce side effects that are very complicated to debug. - Requiring users to symlink the python to $(which python) works but also has side effects: (1) It's gone at every repo --force-sync which makes the build time consuming as re-making the symlink will often be forgotten about. - Making an arbitrary symlink to /usr/bin/python{2,3} and checking that in git would also have side effects as it doesn't respect the PATH. People not having their system python in /usr/bin could end up with strange side effects and/or something that doesn't work. Using /usr/bin/python in this Android.mk like Android x86 does leads to the same set of issues. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--Android.mk13
1 files changed, 11 insertions, 2 deletions
diff --git a/Android.mk b/Android.mk
index 125f87c2e21..0ec8bb158f7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -42,8 +42,17 @@ MESA_DRI_MODULE_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/$(M
MESA_DRI_LDFLAGS := -Wl,--build-id=sha1
MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
-MESA_PYTHON2 := $(shell which python2)
-MESA_PYTHON3 := $(shell which python3)
+
+# This uses the host python through Android's path_interposer. Android's
+# path_interposer enable to run only selected host binaries. To do that the
+# previous PATH is saved in a file and then during the build it's not available
+# anymore. The path_interposer is then able to use that saved PATH to run a
+# given binary if the TEMPORARY_DISABLE_PATH_RESTRICTIONS environment variable
+# is set to true or if the binary to run is whitelisted by in a file like
+# build/soong/ui/build/paths/config.go. See the path_interposer source in
+# build/soong/cmd/path_interposer for more details).
+MESA_PYTHON2 := out/.path/python2
+MESA_PYTHON3 := out/.path/python3
# Lists to convert driver names to boolean variables
# in form of <driver name>.<boolean make variable>