python,python3: add host-flags/settings to host pip install rules
The host pip install should have the host's CFLAGS, LDFLAGS, etc available. And not the target's flags. Otherwise, weird things can happen when installing packages (host-side) that need to build C code. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
parent
e3b2ef74e9
commit
4d94943818
2 changed files with 30 additions and 18 deletions
|
@ -37,21 +37,26 @@ define HostPython
|
||||||
$(HOST_PYTHON_BIN) $(2);
|
$(HOST_PYTHON_BIN) $(2);
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define host_python_settings
|
||||||
|
ARCH="$(HOST_ARCH)" \
|
||||||
|
CC="$(HOSTCC)" \
|
||||||
|
CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
|
||||||
|
CXX="$(HOSTCXX)" \
|
||||||
|
LD="$(HOSTCC)" \
|
||||||
|
LDSHARED="$(HOSTCC) -shared" \
|
||||||
|
CFLAGS="$(HOST_CFLAGS)" \
|
||||||
|
CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON_INC_DIR)" \
|
||||||
|
LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
|
||||||
|
_PYTHON_HOST_PLATFORM=linux2
|
||||||
|
endef
|
||||||
|
|
||||||
# $(1) => commands to execute before running pythons script
|
# $(1) => commands to execute before running pythons script
|
||||||
# $(2) => python script and its arguments
|
# $(2) => python script and its arguments
|
||||||
# $(3) => additional variables
|
# $(3) => additional variables
|
||||||
define Build/Compile/HostPyRunHost
|
define Build/Compile/HostPyRunHost
|
||||||
$(call HostPython, \
|
$(call HostPython, \
|
||||||
$(if $(1),$(1);) \
|
$(if $(1),$(1);) \
|
||||||
CC="$(HOSTCC)" \
|
$(call host_python_settings) \
|
||||||
CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
|
|
||||||
CXX="$(HOSTCXX)" \
|
|
||||||
LD="$(HOSTCC)" \
|
|
||||||
LDSHARED="$(HOSTCC) -shared" \
|
|
||||||
CFLAGS="$(HOST_CFLAGS)" \
|
|
||||||
CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON_INC_DIR)" \
|
|
||||||
LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
|
|
||||||
_PYTHON_HOST_PLATFORM=linux2 \
|
|
||||||
$(3) \
|
$(3) \
|
||||||
, \
|
, \
|
||||||
$(2) \
|
$(2) \
|
||||||
|
@ -63,6 +68,7 @@ endef
|
||||||
# Note: I shamelessly copied this from Yousong's logic (from python-packages);
|
# Note: I shamelessly copied this from Yousong's logic (from python-packages);
|
||||||
HOST_PYTHON_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON_VERSION)
|
HOST_PYTHON_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON_VERSION)
|
||||||
define host_python_pip_install
|
define host_python_pip_install
|
||||||
|
$(call host_python_settings) \
|
||||||
$(HOST_PYTHON_PIP) install \
|
$(HOST_PYTHON_PIP) install \
|
||||||
--root=$(1) \
|
--root=$(1) \
|
||||||
--prefix=$(2) \
|
--prefix=$(2) \
|
||||||
|
|
|
@ -37,21 +37,26 @@ define HostPython3
|
||||||
$(HOST_PYTHON3_BIN) $(2);
|
$(HOST_PYTHON3_BIN) $(2);
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define host_python3_settings
|
||||||
|
ARCH="$(HOST_ARCH)" \
|
||||||
|
CC="$(HOSTCC)" \
|
||||||
|
CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
|
||||||
|
CXX="$(HOSTCXX)" \
|
||||||
|
LD="$(HOSTCC)" \
|
||||||
|
LDSHARED="$(HOSTCC) -shared" \
|
||||||
|
CFLAGS="$(HOST_CFLAGS)" \
|
||||||
|
CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
|
||||||
|
LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
|
||||||
|
_PYTHON_HOST_PLATFORM=linux2
|
||||||
|
endef
|
||||||
|
|
||||||
# $(1) => commands to execute before running pythons script
|
# $(1) => commands to execute before running pythons script
|
||||||
# $(2) => python script and its arguments
|
# $(2) => python script and its arguments
|
||||||
# $(3) => additional variables
|
# $(3) => additional variables
|
||||||
define Build/Compile/HostPy3RunHost
|
define Build/Compile/HostPy3RunHost
|
||||||
$(call HostPython3, \
|
$(call HostPython3, \
|
||||||
$(if $(1),$(1);) \
|
$(if $(1),$(1);) \
|
||||||
CC="$(HOSTCC)" \
|
$(call host_python3_settings) \
|
||||||
CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
|
|
||||||
CXX="$(HOSTCXX)" \
|
|
||||||
LD="$(HOSTCC)" \
|
|
||||||
LDSHARED="$(HOSTCC) -shared" \
|
|
||||||
CFLAGS="$(HOST_CFLAGS)" \
|
|
||||||
CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
|
|
||||||
LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
|
|
||||||
_PYTHON_HOST_PLATFORM=linux2 \
|
|
||||||
$(3) \
|
$(3) \
|
||||||
, \
|
, \
|
||||||
$(2) \
|
$(2) \
|
||||||
|
@ -63,6 +68,7 @@ endef
|
||||||
# Note: I shamelessly copied this from Yousong's logic (from python-packages);
|
# Note: I shamelessly copied this from Yousong's logic (from python-packages);
|
||||||
HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION)
|
HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION)
|
||||||
define host_python3_pip_install
|
define host_python3_pip_install
|
||||||
|
$(call host_python3_settings) \
|
||||||
$(HOST_PYTHON3_PIP) install \
|
$(HOST_PYTHON3_PIP) install \
|
||||||
--root=$(1) \
|
--root=$(1) \
|
||||||
--prefix=$(2) \
|
--prefix=$(2) \
|
||||||
|
|
Loading…
Reference in a new issue