[Buildroot] [git commit branch/next] package/pkg-python.mk: split the commands in a target and host section

Yann E. MORIN yann.morin.1998 at free.fr
Sat Nov 25 15:41:41 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=aae25fb55e13198cfabbcbd7e561767d337c0407
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/next

Only define the _CMDS variables that are relevant for the target resp.
host variant. Duplicate the _BUILD_CMDS. This will allow us to
differentiate part of the _BUILD_CMDS definition in a follow-up patch.

Signed-off-by: Arnout Vandecappelle <arnout at mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 package/pkg-python.mk | 47 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/package/pkg-python.mk b/package/pkg-python.mk
index eacf75c165..c1640d71bb 100644
--- a/package/pkg-python.mk
+++ b/package/pkg-python.mk
@@ -324,6 +324,7 @@ $(2)_DOWNLOAD_POST_PROCESS = cargo
 $(2)_DOWNLOAD_DEPENDENCIES = host-rustc
 endif # SETUP_TYPE
 
+ifeq ($(4),target)
 #
 # Build step. Only define it if not already defined by the package .mk
 # file.
@@ -338,20 +339,6 @@ define $(2)_BUILD_CMDS
 endef
 endif
 
-#
-# Host installation step. Only define it if not already defined by the
-# package .mk file.
-#
-ifndef $(2)_INSTALL_CMDS
-define $(2)_INSTALL_CMDS
-	(cd $$($$(PKG)_BUILDDIR)/; \
-		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
-		$$(HOST_DIR)/bin/python3 \
-		$$($$(PKG)_BASE_INSTALL_CMD) \
-		$$($$(PKG)_INSTALL_OPTS))
-endef
-endif
-
 #
 # Target installation step. Only define it if not already defined by
 # the package .mk file.
@@ -380,6 +367,38 @@ define $(2)_INSTALL_STAGING_CMDS
 endef
 endif
 
+else # host
+
+#
+# Host build step. Only define it if not already defined by the package .mk
+# file.
+#
+ifndef $(2)_BUILD_CMDS
+define $(2)_BUILD_CMDS
+	(cd $$($$(PKG)_BUILDDIR)/; \
+		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
+		$$(HOST_DIR)/bin/python3 \
+		$$($$(PKG)_BASE_BUILD_CMD) \
+		$$($$(PKG)_BUILD_OPTS))
+endef
+endif
+
+#
+# Host installation step. Only define it if not already defined by the
+# package .mk file.
+#
+ifndef $(2)_INSTALL_CMDS
+define $(2)_INSTALL_CMDS
+	(cd $$($$(PKG)_BUILDDIR)/; \
+		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
+		$$(HOST_DIR)/bin/python3 \
+		$$($$(PKG)_BASE_INSTALL_CMD) \
+		$$($$(PKG)_INSTALL_OPTS))
+endef
+endif
+
+endif # host / target
+
 # Call the generic package infrastructure to generate the necessary
 # make targets
 $(call inner-generic-package,$(1),$(2),$(3),$(4))



More information about the buildroot mailing list