[Buildroot] [git commit branch/next] package/jailhouse: move conditional build/install to macro

Yann E. MORIN yann.morin.1998 at free.fr
Sat Nov 25 21:02:24 UTC 2023


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

The usual way of having conditional build and installation of parts
of a generic-package, is to conditionally define macros that do that
build and installation, and unconditionally expand the macros in the
_BUILD_CMDS and _INSTALL_CMDS.

Do that in jailhouse, which used to use an ad-hoc conditional block
directly in _BUILD_CMDS and _INSTALL_CMDS.

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 package/jailhouse/jailhouse.mk | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/package/jailhouse/jailhouse.mk b/package/jailhouse/jailhouse.mk
index 6356c5a7aa..913be765bd 100644
--- a/package/jailhouse/jailhouse.mk
+++ b/package/jailhouse/jailhouse.mk
@@ -30,11 +30,26 @@ JAILHOUSE_MAKE_OPTS += \
 	PYTHON_PIP_USABLE="no"
 endif
 
+ifeq ($(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS),y)
+define JAILHOUSE_BUILD_HELPER_SCRIPTS
+	cd $(@D) && \
+	$(PKG_PYTHON_SETUPTOOLS_ENV) \
+	$(HOST_DIR)/bin/python setup.py \
+		build
+endef
+define JAILHOUSE_INSTALL_HELPER_SCRIPTS
+	cd $(@D) && \
+	$(PKG_PYTHON_SETUPTOOLS_ENV) \
+	$(HOST_DIR)/bin/python setup.py \
+		install --no-compile \
+		$(PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS)
+endef
+endif
+
 define JAILHOUSE_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) $(JAILHOUSE_MAKE_OPTS) -C $(@D)
 
-	$(if $(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS), \
-		cd $(@D) && $(PKG_PYTHON_SETUPTOOLS_ENV) $(HOST_DIR)/bin/python setup.py build)
+	$(JAILHOUSE_BUILD_HELPER_SCRIPTS)
 endef
 
 define JAILHOUSE_INSTALL_TARGET_CMDS
@@ -47,8 +62,7 @@ define JAILHOUSE_INSTALL_TARGET_CMDS
 	$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/local/libexec/jailhouse/demos
 	$(INSTALL) -D -m 0755 $(@D)/inmates/demos/*/*.bin $(TARGET_DIR)/usr/local/libexec/jailhouse/demos
 
-	$(if $(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS), \
-		cd $(@D) && $(PKG_PYTHON_SETUPTOOLS_ENV) $(HOST_DIR)/bin/python setup.py install --no-compile $(PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS))
+	$(JAILHOUSE_INSTALL_HELPER_SCRIPTS)
 endef
 
 $(eval $(generic-package))



More information about the buildroot mailing list