You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

  1. #
  2. # Copyright (C) 2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. HOST_PYTHON_INC_DIR:=$(STAGING_DIR_HOST)/include/python$(PYTHON_VERSION)
  8. HOST_PYTHON_PKG_DIR:=/lib/python$(PYTHON_VERSION)/site-packages
  9. HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(STAGING_DIR_HOST)/$(HOST_PYTHON_PKG_DIR)
  10. define HostHostPython
  11. ( export PYTHONPATH="$(HOST_PYTHONPATH)"; \
  12. export PYTHONOPTIMIZE=""; \
  13. export PYTHONDONTWRITEBYTECODE=1; \
  14. export _python_sysroot="$(STAGING_DIR_HOST)"; \
  15. export _python_prefix=""; \
  16. export _python_exec_prefix=""; \
  17. $(1) \
  18. $(HOST_PYTHON_BIN) $(2); \
  19. )
  20. endef
  21. # These configure args are needed in detection of path to Python header files
  22. # using autotools.
  23. HOST_CONFIGURE_ARGS += \
  24. _python_sysroot="$(STAGING_DIR_HOST)" \
  25. _python_prefix="" \
  26. _python_exec_prefix=""
  27. # $(1) => build subdir
  28. # $(2) => additional arguments to setup.py
  29. # $(3) => additional variables
  30. define Build/Compile/HostPyMod
  31. $(call HostHostPython, \
  32. cd $(HOST_BUILD_DIR)/$(strip $(1)); \
  33. CC="$(HOSTCC)" \
  34. CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
  35. CXX="$(HOSTCXX)" \
  36. LD="$(HOSTCC)" \
  37. LDSHARED="$(HOSTCC) -shared" \
  38. CFLAGS="$(HOST_CFLAGS)" \
  39. CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON_INC_DIR)" \
  40. LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON_VERSION)" \
  41. _PYTHON_HOST_PLATFORM=linux2 \
  42. __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON)" \
  43. $(3) \
  44. , \
  45. ./setup.py $(2) \
  46. )
  47. endef