From 7170bab23e1d8c476360fedcaba0dc18ecfefa67 Mon Sep 17 00:00:00 2001 From: Costin Lupu Date: Wed, 16 Oct 2019 17:22:42 +0300 Subject: [PATCH] Makefile.uk: Add rule for creating root filesystem The Python interpreter needs a filesystem where to keep its libraries. This patch creates a Python virtual environment and installs the Python 3 standard library in /lib/python3.7 directory. For creating the filesystem the following command has to be run: $ make python-rootfs path= Signed-off-by: Costin Lupu Reviewed-by: Felipe Huici --- Makefile.uk | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Makefile.uk b/Makefile.uk index d20fb22..f4c1c87 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -465,3 +465,28 @@ LIBPYTHON3_PREPARED_DEPS = \ $(LIBPYTHON3_BUILD)/.prepared: $(LIBPYTHON3_PREPARED_DEPS) UK_PREPARE += $(LIBPYTHON3_BUILD)/.prepared + +################################################################################ +# Root filesystem +################################################################################ + +# Build root filesystem for Python interpreter +PYTHON_ROOTFS = $(APP_BASE)/$(path) + +# Create virtual environment +$(PYTHON_ROOTFS)/.keep: + python3 -m venv $(PYTHON_ROOTFS) && touch $@ + +# Configure origin +$(PYTHON_ROOTFS)/.configured: $(PYTHON_ROOTFS)/.keep + mkdir -p $(PYTHON_ROOTFS) &>/dev/null + cd $(LIBPYTHON3_SRC) && ./configure --prefix=$(shell realpath $(APP_BASE)/$(path)) && touch $@ + +# Install Python standard library into virtual environment +$(PYTHON_ROOTFS)/.done: $(PYTHON_ROOTFS)/.configured + cd $(LIBPYTHON3_SRC) && make libinstall + cp $(LIBPYTHON3_BASE)/_sysconfigdata.py $(PYTHON_ROOTFS)/lib/python3.7/ + touch $@ + +.PHONY: python-rootfs +python-rootfs: $(PYTHON_ROOTFS)/.done -- 2.39.5