From ae727a9e22bcaa2984d13f92dcef348e55ad0bf3 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 6 Jul 2022 16:56:56 +0200 Subject: [PATCH] - add $(PKG)_CMAKE_CMDS --- package/pkg-cmake.mk | 28 ++++++++++++++++------------ package/pkg-utils.mk | 11 ++++++++++- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index 31a51991..541cf68d 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -44,16 +44,18 @@ TARGET_CMAKE_OPTS += \ -DCMAKE_READELF="$(TARGET_READELF)" \ -DCMAKE_STRIP="$(TARGET_STRIP)" -define TARGET_CMAKE - @$(call MESSAGE,"Configuring") - $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - $(Q)( \ +define TARGET_CMAKE_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ rm -f CMakeCache.txt; \ $(TARGET_CMAKE_ENV) $($(PKG)_CONF_ENV) \ $($(PKG)_CMAKE) \ - $(TARGET_CMAKE_OPTS) $($(PKG)_CONF_OPTS); \ - ) + $(TARGET_CMAKE_OPTS) $($(PKG)_CONF_OPTS) +endef + +define TARGET_CMAKE + @$(call MESSAGE,"Configuring") + $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) + $(Q)$(call $(PKG)_CMAKE_CMDS) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef @@ -88,16 +90,18 @@ HOST_CMAKE_OPTS += \ -DCMAKE_INSTALL_PREFIX="$(HOST_DIR)" \ -DCMAKE_PREFIX_PATH="$(HOST_DIR)" -define HOST_CMAKE - @$(call MESSAGE,"Configuring") - $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) - $(Q)( \ +define HOST_CMAKE_CMDS $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ rm -f CMakeCache.txt; \ $(HOST_CMAKE_ENV) $($(PKG)_CONF_ENV) \ $($(PKG)_CMAKE) \ - $(HOST_CMAKE_OPTS) $($(PKG)_CONF_OPTS); \ - ) + $(HOST_CMAKE_OPTS) $($(PKG)_CONF_OPTS) +endef + +define HOST_CMAKE + @$(call MESSAGE,"Configuring") + $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) + $(Q)$(call $(PKG)_CMAKE_CMDS) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index c4eb56e0..9c324061 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -43,10 +43,19 @@ ifndef $(PKG)_AUTORECONF_OPTS $(PKG)_AUTORECONF_OPTS = endif -# cmake / configure / meson +# cmake 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