From 4d6dd4376943038c28e239143bcfb05f60f9dce3 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 7 Jul 2022 18:46:35 +0200 Subject: [PATCH] - unify $(PKG)_CONFIGURE_CMDS --- package/pkg-cmake.mk | 4 ++-- package/pkg-meson.mk | 33 +++++++++++++++++++-------------- package/pkg-utils.mk | 37 +++++++++++++++++++++++-------------- 3 files changed, 44 insertions(+), 30 deletions(-) diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index ea643638..49ea319a 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -55,7 +55,7 @@ endef define TARGET_CMAKE @$(call MESSAGE,"Configuring") $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - $(Q)$(call $(PKG)_CMAKE_CMDS) + $(Q)$(call $(PKG)_CONFIGURE_CMDS) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef @@ -102,7 +102,7 @@ endef define HOST_CMAKE @$(call MESSAGE,"Configuring") $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - $(Q)$(call $(PKG)_CMAKE_CMDS) + $(Q)$(call $(PKG)_CONFIGURE_CMDS) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 174b46d2..ed37195b 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -42,11 +42,7 @@ endef # ----------------------------------------------------------------------------- -define TARGET_MESON_CONFIGURE - @$(call MESSAGE,"Configuring") - $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - $(call MESON_CROSS_CONFIG_HOOK,$(PKG_BUILD_DIR)/build) - $(Q)( \ +define TARGET_MESON_CMDS unset CC CXX CPP LD AR NM STRIP; \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $($(PKG)_CONF_ENV) \ @@ -56,8 +52,14 @@ define TARGET_MESON_CONFIGURE -Db_pie=false \ -Dstrip=false \ $($(PKG)_CONF_OPTS) \ - $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/build; \ - ) + $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/build +endef + +define TARGET_MESON_CONFIGURE + @$(call MESSAGE,"Configuring") + $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) + $(Q)$(call MESON_CROSS_CONFIG_HOOK,$(PKG_BUILD_DIR)/build) + $(Q)$(call $(PKG)_CONFIGURE_CMDS) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef @@ -71,7 +73,8 @@ endef define TARGET_NINJA_INSTALL $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(TARGET_MAKE_ENV) $($(PKG)_NINJA_ENV) \ - $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build install DESTDIR=$(TARGET_DIR) \ + DESTDIR=$(TARGET_DIR) \ + $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build install \ $($(PKG)_NINJA_OPTS) endef @@ -88,10 +91,7 @@ endef # ----------------------------------------------------------------------------- -define HOST_MESON_CONFIGURE - @$(call MESSAGE,"Configuring") - $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - $(Q)( \ +define HOST_MESON_CMDS unset CC CXX CPP LD AR NM STRIP; \ PKG_CONFIG=/usr/bin/pkg-config \ PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig \ @@ -101,8 +101,13 @@ define HOST_MESON_CONFIGURE --prefix=$(HOST_DIR) \ --buildtype=release \ $($(PKG)_CONF_OPTS) \ - $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/build; \ - ) + $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/build +endef + +define HOST_MESON_CONFIGURE + @$(call MESSAGE,"Configuring") + $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) + $(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 29441502..adcda2ab 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -47,25 +47,11 @@ endif ifndef $(PKG)_CMAKE $(PKG)_CMAKE = cmake endif -ifndef $(PKG)_CMAKE_CMDS - ifeq ($(PKG_HOST_PACKAGE),YES) - $(PKG)_CMAKE_CMDS = $$(HOST_CMAKE_CMDS) - else - $(PKG)_CMAKE_CMDS = $$(TARGET_CMAKE_CMDS) - endif -endif # configure 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 @@ -73,6 +59,29 @@ ifndef $(PKG)_CONF_OPTS $(PKG)_CONF_OPTS = endif +# configure commands +ifndef $(PKG)_CONFIGURE_CMDS + ifeq ($(PKG_MODE),CMAKE) + ifeq ($(PKG_HOST_PACKAGE),YES) + $(PKG)_CONFIGURE_CMDS = $$(HOST_CMAKE_CMDS) + else + $(PKG)_CONFIGURE_CMDS = $$(TARGET_CMAKE_CMDS) + endif + else ifeq ($(PKG_MODE),MESON) + ifeq ($(PKG_HOST_PACKAGE),YES) + $(PKG)_CONFIGURE_CMDS = $$(HOST_MESON_CMDS) + else + $(PKG)_CONFIGURE_CMDS = $$(TARGET_MESON_CMDS) + endif + else + ifeq ($(PKG_HOST_PACKAGE),YES) + $(PKG)_CONFIGURE_CMDS = $$(HOST_CONFIGURE_CMDS) + else + $(PKG)_CONFIGURE_CMDS = $$(TARGET_CONFIGURE_CMDS) + endif + endif +endif + # make ifndef $(PKG)_MAKE $(PKG)_MAKE = $$(MAKE)