package/jailhouse: move conditional build/install to macro

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@free.fr>
This commit is contained in:
Yann E. MORIN 2023-11-25 21:23:13 +01:00
parent 906a9fb989
commit fde20964c7

View File

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