From c1394a6a7fb87d334e6ab279aea923a625a7e2cb Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 28 Apr 2020 17:20:50 +0800 Subject: [PATCH] python: Fix host build tool names recorded in target files Python will record the values of CC, CXX, AR, and RANLIB (and other configure options) used during compilation. pip will use these programs when asked to compile extension modules on the target device. * If ccache is used during build, CC and CXX will be ccache_cc and ccache_cxx, respectively, which are not available on-device (#11912). * If an external toolchain is used during build, the values of these variables will contain the external toolchain prefix, which may not be available on target. * If the normal toolchain is used during build, AR and RANLIB will contain the toolchain prefix, but the names of ar and ranlib on-device do not contain the prefix; they are named "ar" and "ranlib". This changes the values of these variables in Python's files to match the names available on-device, and without any toolchain prefix. Signed-off-by: Jeffery To --- lang/python/python/Makefile | 4 +++- lang/python/python/files/python-package-dev.mk | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lang/python/python/Makefile b/lang/python/python/Makefile index 3cb4628ce..d6fe87400 100644 --- a/lang/python/python/Makefile +++ b/lang/python/python/Makefile @@ -12,7 +12,7 @@ include ../python-version.mk PKG_NAME:=python PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION) @@ -289,6 +289,8 @@ define PyPackage/python-base/install $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python $(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/ + $(SED) 's|$(TARGET_AR)|ar|g;s|$(TARGET_RANLIB)|ranlib|g;s|$(TARGET_CC)|gcc|g;s|$(TARGET_CXX)|g++|g' \ + $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py endef PyPackage/python-light/install:=: diff --git a/lang/python/python/files/python-package-dev.mk b/lang/python/python/files/python-package-dev.mk index 7c9e21980..0cd780547 100644 --- a/lang/python/python/files/python-package-dev.mk +++ b/lang/python/python/files/python-package-dev.mk @@ -15,6 +15,8 @@ define PyPackage/python-dev/install $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/bin/python*config $(1)/usr/bin $(CP) $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config/libpython$(PYTHON_VERSION).a $(1)/usr/lib + $(SED) 's|$(TARGET_AR)|ar|g;s|$(TARGET_RANLIB)|ranlib|g;s|$(TARGET_CC)|gcc|g;s|$(TARGET_CXX)|g++|g' \ + $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config/Makefile endef $(eval $(call PyBasePackage,python-dev, \