From 3057f8926cde1dc19b545695a55f779bfa92f7d7 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 7 Jul 2022 20:27:03 +0200 Subject: [PATCH] - unify $(PKG)_INSTALL_CMDS --- package/pkg-generic.mk | 8 ++++---- package/pkg-meson.mk | 22 ++++++++++++++++++---- package/pkg-utils.mk | 33 ++++++++++++++++++++++----------- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 1f0cee45..7015d0aa 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -6,7 +6,7 @@ TARGET_MAKE_ENV = -define TARGET_MAKE_CMDS +define TARGET_MAKE_BUILD_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(TARGET_MAKE_ENV) $($(PKG)_MAKE_ENV) \ $($(PKG)_MAKE) $($(PKG)_MAKE_ARGS)\ @@ -30,7 +30,7 @@ endef define TARGET_MAKE_INSTALL @$(call MESSAGE,"Installing") $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep)) - $(Q)$(call $(PKG)_MAKE_INSTALL_CMDS) + $(Q)$(call $(PKG)_INSTALL_CMDS) $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) endef @@ -48,7 +48,7 @@ endef HOST_MAKE_ENV = -define HOST_MAKE_CMDS +define HOST_MAKE_BUILD_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(HOST_MAKE_ENV) $($(PKG)_MAKE_ENV) \ $($(PKG)_MAKE) $($(PKG)_MAKE_ARGS)\ @@ -72,7 +72,7 @@ endef define HOST_MAKE_INSTALL @$(call MESSAGE,"Installing") $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep)) - $(Q)$(call $(PKG)_MAKE_INSTALL_CMDS) + $(Q)$(call $(PKG)_INSTALL_CMDS) $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) endef diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index ee6da485..c39a8515 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -63,7 +63,7 @@ define TARGET_MESON_CONFIGURE $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef -define TARGET_NINJA_CMDS +define TARGET_NINJA_BUILD_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(TARGET_MAKE_ENV) $($(PKG)_NINJA_ENV) \ $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build \ @@ -77,7 +77,7 @@ define TARGET_NINJA_BUILD $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep)) endef -define TARGET_NINJA_INSTALL +define TARGET_NINJA_INSTALL_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(TARGET_MAKE_ENV) $($(PKG)_NINJA_ENV) \ DESTDIR=$(TARGET_DIR) \ @@ -85,6 +85,13 @@ define TARGET_NINJA_INSTALL $($(PKG)_NINJA_OPTS) endef +define TARGET_NINJA_INSTALL + @$(call MESSAGE,"Installing") + $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep)) + $(Q)$(call $(PKG)_INSTALL_CMDS) + $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) +endef + # ----------------------------------------------------------------------------- define meson-package @@ -118,7 +125,7 @@ define HOST_MESON_CONFIGURE $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef -define HOST_NINJA_CMDS +define HOST_NINJA_BUILD_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(HOST_MAKE_ENV) $($(PKG)_NINJA_ENV) \ $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build \ @@ -132,13 +139,20 @@ define HOST_NINJA_BUILD $(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep)) endef -define HOST_NINJA_INSTALL +define HOST_NINJA_INSTALL_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(HOST_MAKE_ENV) $($(PKG)_NINJA_ENV) \ $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build install \ $($(PKG)_NINJA_OPTS) endef +define HOST_NINJA_INSTALL + @$(call MESSAGE,"Installing") + $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep)) + $(Q)$(call $(PKG)_INSTALL_CMDS) + $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) +endef + # ----------------------------------------------------------------------------- define host-meson-package diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index 8fe5933a..d6f46376 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -101,15 +101,15 @@ endif ifndef $(PKG)_BUILD_CMDS ifeq ($(PKG_MODE),$(filter $(PKG_MODE),AUTOTOOLS CMAKE GENERIC)) ifeq ($(PKG_HOST_PACKAGE),YES) - $(PKG)_BUILD_CMDS = $$(HOST_MAKE_CMDS) + $(PKG)_BUILD_CMDS = $$(HOST_MAKE_BUILD_CMDS) else - $(PKG)_BUILD_CMDS = $$(TARGET_MAKE_CMDS) + $(PKG)_BUILD_CMDS = $$(TARGET_MAKE_BUILD_CMDS) endif else ifeq ($(PKG_MODE),$(filter $(PKG_MODE),MESON)) ifeq ($(PKG_HOST_PACKAGE),YES) - $(PKG)_BUILD_CMDS = $$(HOST_NINJA_CMDS) + $(PKG)_BUILD_CMDS = $$(HOST_NINJA_BUILD_CMDS) else - $(PKG)_BUILD_CMDS = $$(TARGET_NINJA_CMDS) + $(PKG)_BUILD_CMDS = $$(TARGET_NINJA_BUILD_CMDS) endif endif endif @@ -118,13 +118,6 @@ endif ifndef $(PKG)_MAKE_INSTALL $(PKG)_MAKE_INSTALL = $$($(PKG)_MAKE) endif -ifndef $(PKG)_MAKE_INSTALL_CMDS - ifeq ($(PKG_HOST_PACKAGE),YES) - $(PKG)_MAKE_INSTALL_CMDS = $$(HOST_MAKE_INSTALL_CMDS) - else - $(PKG)_MAKE_INSTALL_CMDS = $$(TARGET_MAKE_INSTALL_CMDS) - endif -endif ifndef $(PKG)_MAKE_INSTALL_ENV $(PKG)_MAKE_INSTALL_ENV = $$($(PKG)_MAKE_ENV) endif @@ -135,6 +128,24 @@ ifndef $(PKG)_MAKE_INSTALL_OPTS $(PKG)_MAKE_INSTALL_OPTS = $$($(PKG)_MAKE_OPTS) endif +# install commands +# TODO: python, kernel +ifndef $(PKG)_INSTALL_CMDS + ifeq ($(PKG_MODE),$(filter $(PKG_MODE),AUTOTOOLS CMAKE GENERIC)) + ifeq ($(PKG_HOST_PACKAGE),YES) + $(PKG)_INSTALL_CMDS = $$(HOST_MAKE_INSTALL_CMDS) + else + $(PKG)_INSTALL_CMDS = $$(TARGET_MAKE_INSTALL_CMDS) + endif + else ifeq ($(PKG_MODE),$(filter $(PKG_MODE),MESON)) + ifeq ($(PKG_HOST_PACKAGE),YES) + $(PKG)_INSTALL_CMDS = $$(HOST_NINJA_INSTALL_CMDS) + else + $(PKG)_INSTALL_CMDS = $$(TARGET_NINJA_INSTALL_CMDS) + endif + endif +endif + # ninja ifndef $(PKG)_NINJA_ENV $(PKG)_NINJA_ENV =