diff options
| author | Alexandru Ardelean <ardeleanalex@gmail.com> | 2017-01-04 11:27:36 +0200 |
|---|---|---|
| committer | Alexandru Ardelean <ardeleanalex@gmail.com> | 2017-01-04 17:18:50 +0200 |
| commit | 3af20278869ad43ead7361616887685231a2fb97 (patch) | |
| tree | 464fa25f9b903d9fc1e742dedf1fbb8ba907100f /lang/python3/files/python3-package.mk | |
| parent | ae5d8d674b43e1590c5a064a24bc84ae78ba1408 (diff) | |
python3: sync makefiles with python package
Technically, this just updates build details.
No functionality change to package itself.
So, no need to increase PKG_RELEASE on this change.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Diffstat (limited to 'lang/python3/files/python3-package.mk')
| -rw-r--r-- | lang/python3/files/python3-package.mk | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/lang/python3/files/python3-package.mk b/lang/python3/files/python3-package.mk index 56dbedc9c..f13e737ae 100644 --- a/lang/python3/files/python3-package.mk +++ b/lang/python3/files/python3-package.mk @@ -5,12 +5,6 @@ # See /LICENSE for more information. # -# Compatibility fallback for older OpenWrt and LEDE versions -ifeq ($(STAGING_DIR_HOSTPKG),) - $(warning STAGING_DIR_HOSTPKG is unset - falling back to $$(STAGING_DIR)/host) - STAGING_DIR_HOSTPKG := $(STAGING_DIR)/host -endif - $(call include_mk, python3-version.mk) PYTHON3_DIR:=$(STAGING_DIR)/usr @@ -22,22 +16,7 @@ PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages PYTHON3:=python$(PYTHON3_VERSION) -HOST_PYTHON3_DIR:=$(STAGING_DIR_HOSTPKG) -HOST_PYTHON3_LIB_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION) -HOST_PYTHON3_BIN:=$(HOST_PYTHON3_DIR)/bin/python3 - PYTHON3PATH:=$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) -define HostPython3 - ( export PYTHONPATH="$(PYTHON3PATH)"; \ - export PYTHONOPTIMIZE=""; \ - export PYTHONDONTWRITEBYTECODE=1; \ - export _python_sysroot="$(STAGING_DIR)"; \ - export _python_prefix="/usr"; \ - export _python_exec_prefix="/usr"; \ - $(1) \ - $(HOST_PYTHON3_BIN) $(2); \ - ) -endef # These configure args are needed in detection of path to Python header files # using autotools. @@ -62,6 +41,15 @@ define Py3Package endef endif + ifndef Py3Package/$(1)/install + define Py3Package/$(1)/install + if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \ + $(INSTALL_DIR) $$(1)/usr/bin \ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ + fi + endef + endif + $(call shexport,Py3Package/$(1)/filespec) define Package/$(1)/install @@ -100,15 +88,17 @@ define Py3Package endef endef -# $(1) => build subdir -# $(2) => additional arguments to setup.py +$(call include_mk, python3-host.mk) + +# $(1) => commands to execute before running pythons script +# $(2) => python script and its arguments # $(3) => additional variables -define Build/Compile/Py3Mod - $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) +define Build/Compile/HostPy3RunTarget $(call HostPython3, \ - cd $(PKG_BUILD_DIR)/$(strip $(1)); \ + $(if $(1),$(1);) \ CC="$(TARGET_CC)" \ CCSHARED="$(TARGET_CC) $(FPIC)" \ + CXX="$(TARGET_CXX)" \ LD="$(TARGET_CC)" \ LDSHARED="$(TARGET_CC) -shared" \ CFLAGS="$(TARGET_CFLAGS)" \ @@ -118,8 +108,31 @@ define Build/Compile/Py3Mod __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \ $(3) \ , \ - ./setup.py $(2) \ + $(2) \ ) +endef + +# $(1) => build subdir +# $(2) => additional arguments to setup.py +# $(3) => additional variables +define Build/Compile/Py3Mod + $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) + $(call Build/Compile/HostPy3RunTarget, \ + cd $(PKG_BUILD_DIR)/$(strip $(1)), \ + ./setup.py $(2), \ + $(3)) find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" -o -name "*\.exe" | xargs rm -f endef +define Py3Build/Compile/Default + $(call Build/Compile/Py3Mod,, \ + install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \ + --single-version-externally-managed \ + ) +endef + +ifeq ($(BUILD_VARIANT),python3) +define Build/Compile + $(call Py3Build/Compile/Default) +endef +endif # python3 |
