python3: Reorder recipes in python3-package.mk
authorJeffery To <jeffery.to@gmail.com>
Fri, 10 Apr 2020 14:22:58 +0000 (22:22 +0800)
committerJeffery To <jeffery.to@gmail.com>
Sat, 18 Apr 2020 17:56:23 +0000 (01:56 +0800)
Group Python3/* recipes together, group Py3Package and Py3Build
together.

This also adds headings and whitespace to separate major sections.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/python3-package.mk

index b3326eaa89858f83dba73bf3e0d5e5f324617c96..81e7cd77786d536e4cef7af8e2ee4df330f12f27 100644 (file)
@@ -6,6 +6,7 @@
 #
 
 # Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
+
 python3_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
 include $(python3_mk_path)python3-host.mk
 
@@ -34,10 +35,52 @@ ifdef CONFIG_USE_MIPS16
   TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
 endif
 
+PYTHON3_VARS = \
+       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)" \
+       PYTHONPATH="$(PYTHON3PATH)" \
+       PYTHONDONTWRITEBYTECODE=1 \
+       PYTHONOPTIMIZE="" \
+       _python_sysroot="$(STAGING_DIR)" \
+       _python_prefix="/usr" \
+       _python_exec_prefix="/usr"
+
+# $(1) => directory of python script
+# $(2) => python script and its arguments
+# $(3) => additional variables
+define Python3/Run
+       cd "$(if $(strip $(1)),$(strip $(1)),.)" && \
+       $(PYTHON3_VARS) \
+       $(3) \
+       $(HOST_PYTHON3_BIN) $(2)
+endef
+
+# $(1) => build subdir
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Python3/ModSetup
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
+       $(call Python3/Run, \
+               $(PKG_BUILD_DIR)/$(strip $(1)), \
+               setup.py $(2), \
+               $(3))
+endef
+
 define Python3/FixShebang
 $(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python3," -i --follow-symlinks $(1)
 endef
 
+
+# Py3Package
+
 define Py3Package
 
   define Package/$(1)-src
@@ -96,44 +139,8 @@ define Py3Package
   endif # Package/$(1)/install
 endef
 
-PYTHON3_VARS = \
-       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)" \
-       PYTHONPATH="$(PYTHON3PATH)" \
-       PYTHONDONTWRITEBYTECODE=1 \
-       PYTHONOPTIMIZE="" \
-       _python_sysroot="$(STAGING_DIR)" \
-       _python_prefix="/usr" \
-       _python_exec_prefix="/usr"
 
-# $(1) => directory of python script
-# $(2) => python script and its arguments
-# $(3) => additional variables
-define Python3/Run
-       cd "$(if $(strip $(1)),$(strip $(1)),.)" && \
-       $(PYTHON3_VARS) \
-       $(3) \
-       $(HOST_PYTHON3_BIN) $(2)
-endef
-
-# $(1) => build subdir
-# $(2) => additional arguments to setup.py
-# $(3) => additional variables
-define Python3/ModSetup
-       $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
-       $(call Python3/Run, \
-               $(PKG_BUILD_DIR)/$(strip $(1)), \
-               setup.py $(2), \
-               $(3))
-endef
+# Py3Build
 
 PYTHON3_PKG_SETUP_DIR ?=
 PYTHON3_PKG_SETUP_GLOBAL_ARGS ?=