diff options
| author | Alexandru Ardelean <ardeleanalex@gmail.com> | 2018-01-10 09:29:41 +0200 |
|---|---|---|
| committer | Alexandru Ardelean <ardeleanalex@gmail.com> | 2018-01-10 23:01:51 +0200 |
| commit | ccdc6bc530444283a510ceb6a50878493fe356f2 (patch) | |
| tree | 4bbde4652f654ab7b47611c450d717f67e3c1d43 /lang/python/python3/files/python3-package.mk | |
| parent | 55c0b5ae19afa8d160c6ccf10869c22fd3bd0c03 (diff) | |
python,python3: export mk files outside of python package dirs
Since `lang/python` is it's own folder of Python packages
(for both Python 2 & 3), and these build rules are needed
in a lot of packages [especially Python packages],
putting them here makes sense architecturally,
to be shared.
This also helps get rid of the `include_mk` construct
which relies on OpenWrt core to provide, and seems
like a broken design idea that has persisted for a while.
Reason is: it requires that Python 2/3 be built to provide
these mk files for other Python packages,
which seems like a bad idea.
Long-term, there could be an issue where some other feeds
would require these mk files [e.g. telephony] for
some Python packages.
We'll see how we handle this a bit later.
For now we limit this to this feed.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Diffstat (limited to 'lang/python/python3/files/python3-package.mk')
| -rw-r--r-- | lang/python/python3/files/python3-package.mk | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/lang/python/python3/files/python3-package.mk b/lang/python/python3/files/python3-package.mk deleted file mode 100644 index 93b14fac2..000000000 --- a/lang/python/python3/files/python3-package.mk +++ /dev/null @@ -1,144 +0,0 @@ -# -# Copyright (C) 2007-2016 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -$(call include_mk, python3-version.mk) - -PYTHON3_DIR:=$(STAGING_DIR)/usr -PYTHON3_BIN_DIR:=$(PYTHON3_DIR)/bin -PYTHON3_INC_DIR:=$(PYTHON3_DIR)/include/python$(PYTHON3_VERSION) -PYTHON3_LIB_DIR:=$(PYTHON3_DIR)/lib/python$(PYTHON3_VERSION) - -PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages - -PYTHON3:=python$(PYTHON3_VERSION) - -PYTHON3PATH:=$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) - -# These configure args are needed in detection of path to Python header files -# using autotools. -CONFIGURE_ARGS += \ - _python_sysroot="$(STAGING_DIR)" \ - _python_prefix="/usr" \ - _python_exec_prefix="/usr" - -PKG_USE_MIPS16:=0 -# This is required in addition to PKG_USE_MIPS16:=0 because otherwise MIPS16 -# flags are inherited from the Python base package (via sysconfig module) -ifdef CONFIG_USE_MIPS16 - TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16 -endif - -define Py3Package - - define Package/$(1)-src - $(call Package/$(1)) - TITLE+= (sources) - DEPENDS:=$$$$(foreach dep,$$$$(filter +python3-%,$$$$(DEPENDS)),$$$$(dep)-src) - endef - - define Package/$(1)-src/description - $(call Package/$(1)/description). - (Contains the Python3 sources for this package). - endef - - # Add default PyPackage filespec none defined - ifndef Py3Package/$(1)/filespec - define Py3Package/$(1)/filespec - +|$(PYTHON3_PKG_DIR) - 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 - - ifndef Package/$(1)/install - $(call shexport,Py3Package/$(1)/filespec) - - define Package/$(1)/install - $(call Py3Package/$(1)/install,$$(1)) - find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f - if [ -e files/python3-package-install.sh ] ; then \ - $(SHELL) files/python3-package-install.sh \ - "$(PKG_INSTALL_DIR)" "$$(1)" \ - "$(HOST_PYTHON3_BIN)" "$$(2)" \ - "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" ; \ - elif [ -e $(STAGING_DIR)/mk/python3-package-install.sh ] ; then \ - $(SHELL) $(STAGING_DIR)/mk/python3-package-install.sh \ - "$(PKG_INSTALL_DIR)" "$$(1)" \ - "$(HOST_PYTHON3_BIN)" "$$(2)" \ - "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" ; \ - else \ - echo "No 'python3-package-install.sh' script found" ; \ - exit 1 ; \ - fi - endef - - define Package/$(1)-src/install - $$(call Package/$(1)/install,$$(1),sources) - endef - endif # Package/$(1)/install -endef - -$(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/HostPy3RunTarget - $(call HostPython3, \ - $(if $(1),$(1);) \ - CC="$(TARGET_CC)" \ - CCSHARED="$(TARGET_CC) $(FPIC)" \ - CXX="$(TARGET_CXX)" \ - LD="$(TARGET_CC)" \ - LDSHARED="$(TARGET_CC) -shared" \ - CFLAGS="$(TARGET_CFLAGS)" \ - CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \ - LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \ - _PYTHON_HOST_PLATFORM=linux2 \ - __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \ - $(3) \ - , \ - $(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 "*\.exe" | xargs rm -f -endef - -define Py3Build/Compile/Default - $(foreach pkg,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS), - $(call host_python3_pip_install_host,$(pkg)) - ) - $(call Build/Compile/Py3Mod,, \ - install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \ - --single-version-externally-managed \ - ) -endef - -Py3Build/Compile=$(Py3Build/Compile/Default) - -ifeq ($(BUILD_VARIANT),python3) -define Build/Compile - $(call Py3Build/Compile) -endef -endif # python3 |
