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 <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To 2020-04-28 17:20:50 +08:00
parent 3d2dc69200
commit c1394a6a7f
2 changed files with 5 additions and 1 deletions

View file

@ -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:=:

View file

@ -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, \