diff options
| author | Jeffery To <jeffery.to@gmail.com> | 2015-11-19 00:34:14 +0800 |
|---|---|---|
| committer | Jeffery To <jeffery.to@gmail.com> | 2015-11-24 22:43:56 +0800 |
| commit | b12d7b6db12b0830f021df5058b347f030feac70 (patch) | |
| tree | f7115096b96792e7d713c744c0112421a53e8b3b /lang/python/files/python-host.mk | |
| parent | 0421b321310e252919e83a43d653317ec88acbb0 (diff) | |
python: add capability to install python packages for the host
Some python packages (e.g. cffi) compile one or more shared libraries
as part of their setup process. When these packages are setup
dependencies of other packages (e.g. cryptography), these packages (and
their shared libraries) will need to be loaded on the host system.
This adds a makefile, similar to python-package.mk, to simplify
installing python packages on the host.
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Diffstat (limited to 'lang/python/files/python-host.mk')
| -rw-r--r-- | lang/python/files/python-host.mk | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lang/python/files/python-host.mk b/lang/python/files/python-host.mk new file mode 100644 index 000000000..ed0ef4159 --- /dev/null +++ b/lang/python/files/python-host.mk @@ -0,0 +1,53 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +HOST_PYTHON_INC_DIR:=$(STAGING_DIR_HOST)/include/python$(PYTHON_VERSION) + +HOST_PYTHON_PKG_DIR:=/lib/python$(PYTHON_VERSION)/site-packages + +HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(STAGING_DIR_HOST)/$(HOST_PYTHON_PKG_DIR) +define HostHostPython + ( export PYTHONPATH="$(HOST_PYTHONPATH)"; \ + export PYTHONOPTIMIZE=""; \ + export PYTHONDONTWRITEBYTECODE=1; \ + export _python_sysroot="$(STAGING_DIR_HOST)"; \ + export _python_prefix=""; \ + export _python_exec_prefix=""; \ + $(1) \ + $(HOST_PYTHON_BIN) $(2); \ + ) +endef + +# These configure args are needed in detection of path to Python header files +# using autotools. +HOST_CONFIGURE_ARGS += \ + _python_sysroot="$(STAGING_DIR_HOST)" \ + _python_prefix="" \ + _python_exec_prefix="" + +# $(1) => build subdir +# $(2) => additional arguments to setup.py +# $(3) => additional variables +define Build/Compile/HostPyMod + $(call HostHostPython, \ + cd $(HOST_BUILD_DIR)/$(strip $(1)); \ + 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)" \ + _PYTHON_HOST_PLATFORM=linux2 \ + __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON)" \ + $(3) \ + , \ + ./setup.py $(2) \ + ) +endef + |
