From 453ef9b48fd957fe14b7148dc09f34545063976f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 5 Jul 2022 20:55:05 +0200 Subject: [PATCH] - add $(PKG)_CONFIGURE_CMDS --- package/pkg-autotools.mk | 32 ++++++++++++++++++-------------- package/pkg-utils.mk | 10 ++++++++++ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk index 65a2489c..873ffd92 100644 --- a/package/pkg-autotools.mk +++ b/package/pkg-autotools.mk @@ -63,18 +63,20 @@ TARGET_CONFIGURE_OPTS = \ --mandir=$(REMOVE_mandir) \ --infodir=$(REMOVE_infodir) -define TARGET_CONFIGURE - @$(call MESSAGE,"Configuring") - $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - $(call AUTORECONF_HOOK) - $(Q)( \ +define TARGET_CONFIGURE_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ test -f ./$($(PKG)_CONFIGURE_CMD) || ./autogen.sh && \ CONFIG_SITE=/dev/null \ $(TARGET_CONFIGURE_ENV) $($(PKG)_CONF_ENV) \ ./$($(PKG)_CONFIGURE_CMD) \ - $(TARGET_CONFIGURE_OPTS) $($(PKG)_CONF_OPTS); \ - ) + $(TARGET_CONFIGURE_OPTS) $($(PKG)_CONF_OPTS) +endef + +define TARGET_CONFIGURE + @$(call MESSAGE,"Configuring") + $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) + $(call AUTORECONF_HOOK) + $(Q)$(call $(PKG)_CONFIGURE_CMDS) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef @@ -117,18 +119,20 @@ HOST_CONFIGURE_OPTS = \ --prefix=$(HOST_DIR) \ --sysconfdir=$(HOST_DIR)/etc -define HOST_CONFIGURE - @$(call MESSAGE,"Configuring") - $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - $(call AUTORECONF_HOOK) - $(Q)( \ +define HOST_CONFIGURE_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ test -f ./$($(PKG)_CONFIGURE_CMD) || ./autogen.sh && \ CONFIG_SITE=/dev/null \ $(HOST_CONFIGURE_ENV) $($(PKG)_CONF_ENV) \ ./$($(PKG)_CONFIGURE_CMD) \ - $(HOST_CONFIGURE_OPTS) $($(PKG)_CONF_OPTS); \ - ) + $(HOST_CONFIGURE_OPTS) $($(PKG)_CONF_OPTS) +endef + +define HOST_CONFIGURE + @$(call MESSAGE,"Configuring") + $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) + $(call AUTORECONF_HOOK) + $(Q)$(call $(PKG)_CONFIGURE_CMDS) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index 6c4c0e4e..5363a039 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -13,6 +13,9 @@ PKG_BUILD_DIR = $(BUILD_DIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR) PKG_FILES_DIR = $(PACKAGE_DIR)/$(subst host-,,$(pkgname))/files PKG_PATCHES_DIR = $(PACKAGE_DIR)/$(subst host-,,$(pkgname))/patches +PKG_HOST_PACKAGE = $(if $(filter $(firstword $(subst -, ,$(pkg))),host),YES,NO) +PKG_TARGET_PACKAGE = $(if $(filter $(PKG_HOST_PACKAGE),NO),YES,NO) + # ----------------------------------------------------------------------------- # check for necessary $(PKG) variables @@ -47,6 +50,13 @@ endif ifndef $(PKG)_CONFIGURE_CMD $(PKG)_CONFIGURE_CMD = configure endif +ifndef $(PKG)_CONFIGURE_CMDS + ifeq ($(PKG_HOST_PACKAGE),YES) + $(PKG)_CONFIGURE_CMDS = $$(HOST_CONFIGURE_CMDS) + else + $(PKG)_CONFIGURE_CMDS = $$(TARGET_CONFIGURE_CMDS) + endif +endif ifndef $(PKG)_CONF_ENV $(PKG)_CONF_ENV = endif