diff mbox series

[03/10] package/pkg-python.mk: split the commands in a target and host section

Message ID 20230930221727.1458825-4-arnout@mind.be
State Accepted
Headers show
Series package/pkg-python.mk: refactor setup-type variables | expand

Commit Message

Arnout Vandecappelle Sept. 30, 2023, 10:16 p.m. UTC
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@mind.be>
---
 package/pkg-python.mk | 47 ++++++++++++++++++++++++++++++-------------
 1 file changed, 33 insertions(+), 14 deletions(-)

Comments

Yann E. MORIN Nov. 25, 2023, 3:42 p.m. UTC | #1
Arnout, All,

On 2023-10-01 00:16 +0200, Arnout Vandecappelle via buildroot spake thusly:
> 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@mind.be>

Applied to next, thanks.

Regards,
Yann E. MORIN.

> ---
>  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))
> -- 
> 2.41.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

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))