summaryrefslogtreecommitdiff
path: root/lang/python/python3-package.mk
diff options
context:
space:
mode:
authorJeffery To <jeffery.to@gmail.com>2020-04-09 22:42:27 +0800
committerJeffery To <jeffery.to@gmail.com>2020-04-19 01:56:07 +0800
commit3642b18441a386e0af2b5912b2d823f7b4dd7939 (patch)
treeeb82b32a02f92d7c788dd78add10933c0099216d /lang/python/python3-package.mk
parent2dfdef66a383a0db10d9746a21a9362f18502fe9 (diff)
python3: Remove HostPython3 in python3-host.mk
HostPython3 only adds a few environment variables before running host Python. It has only two users, Build/Compile/HostPy3RunHost and Build/Compile/HostPy3RunTarget. HostPython3 also accesses $(PYTHON3PATH), even though python3-host.mk does not include python3-package.mk, where the variable is defined. This removes HostPython3 and has its two users run host Python directly. This also combines the environment variables of HostPython3 and the two users into HOST_PYTHON3_VARS and PYTHON3_VARS. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Diffstat (limited to 'lang/python/python3-package.mk')
-rw-r--r--lang/python/python3-package.mk44
1 files changed, 25 insertions, 19 deletions
diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk
index 97589b563..0571bb271 100644
--- a/lang/python/python3-package.mk
+++ b/lang/python/python3-package.mk
@@ -96,26 +96,32 @@ define Py3Package
endif # Package/$(1)/install
endef
-# $(1) => commands to execute before running pythons script
+PYTHON3_VARS = \
+ CC="$(TARGET_CC)" \
+ CCSHARED="$(TARGET_CC) $(FPIC)" \
+ CXX="$(TARGET_CXX)" \
+ LD="$(TARGET_CC)" \
+ LDSHARED="$(TARGET_CC) -shared" \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \
+ LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \
+ _PYTHON_HOST_PLATFORM=linux2 \
+ __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \
+ PYTHONPATH="$(PYTHON3PATH)" \
+ PYTHONDONTWRITEBYTECODE=1 \
+ PYTHONOPTIMIZE="" \
+ _python_sysroot="$(STAGING_DIR)" \
+ _python_prefix="/usr" \
+ _python_exec_prefix="/usr"
+
+# $(1) => directory of python script
# $(2) => python script and its arguments
# $(3) => additional variables
define Build/Compile/HostPy3RunTarget
- $(call HostPython3, \
- $(if $(1),$(1);) \
- CC="$(TARGET_CC)" \
- CCSHARED="$(TARGET_CC) $(FPIC)" \
- CXX="$(TARGET_CXX)" \
- LD="$(TARGET_CC)" \
- LDSHARED="$(TARGET_CC) -shared" \
- CFLAGS="$(TARGET_CFLAGS)" \
- CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \
- LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \
- _PYTHON_HOST_PLATFORM=linux2 \
- __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \
- $(3) \
- , \
- $(2) \
- )
+ cd "$(if $(strip $(1)),$(strip $(1)),.)" && \
+ $(PYTHON3_VARS) \
+ $(3) \
+ $(HOST_PYTHON3_BIN) $(2)
endef
# $(1) => build subdir
@@ -124,8 +130,8 @@ endef
define Build/Compile/Py3Mod
$(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
$(call Build/Compile/HostPy3RunTarget, \
- cd $(PKG_BUILD_DIR)/$(strip $(1)), \
- ./setup.py $(2), \
+ $(PKG_BUILD_DIR)/$(strip $(1)), \
+ setup.py $(2), \
$(3))
endef