mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 06:58:39 +01:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user