From b86d88fc48a1f4fb74df3d710696f9e5858db01a Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 4 Jul 2022 18:23:16 +0200 Subject: [PATCH] - add PKG_CHECK_VARIABLES define --- make/buildsystem-helpers.mk | 1 + package/pkg-autotools.mk | 10 +++---- package/pkg-cmake.mk | 4 +-- package/pkg-generic.mk | 16 +++++----- package/pkg-kernel-module.mk | 2 +- package/pkg-utils.mk | 58 ++++++++++++++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 16 deletions(-) diff --git a/make/buildsystem-helpers.mk b/make/buildsystem-helpers.mk index 5307193d..fe2b9482 100644 --- a/make/buildsystem-helpers.mk +++ b/make/buildsystem-helpers.mk @@ -165,6 +165,7 @@ endef # prepare for build define PREPARE + $(eval $(pkg-check-variables)) $(call STARTUP) $(call DEPENDENCIES) $(call DOWNLOAD,$($(PKG)_SOURCE)) diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk index 35d050f8..65a2489c 100644 --- a/package/pkg-autotools.mk +++ b/package/pkg-autotools.mk @@ -10,7 +10,7 @@ define AUTORECONF_HOOK $(call MESSAGE,"Autoreconfiguring"); \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $($(PKG)_AUTORECONF_ENV) \ - autoreconf -fi \ + $($(PKG)_AUTORECONF_CMD) \ $($(PKG)_AUTORECONF_OPTS); \ fi; \ ) @@ -69,10 +69,10 @@ define TARGET_CONFIGURE $(call AUTORECONF_HOOK) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - test -f ./configure || ./autogen.sh && \ + test -f ./$($(PKG)_CONFIGURE_CMD) || ./autogen.sh && \ CONFIG_SITE=/dev/null \ $(TARGET_CONFIGURE_ENV) $($(PKG)_CONF_ENV) \ - ./configure \ + ./$($(PKG)_CONFIGURE_CMD) \ $(TARGET_CONFIGURE_OPTS) $($(PKG)_CONF_OPTS); \ ) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) @@ -123,10 +123,10 @@ define HOST_CONFIGURE $(call AUTORECONF_HOOK) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - test -f ./configure || ./autogen.sh && \ + test -f ./$($(PKG)_CONFIGURE_CMD) || ./autogen.sh && \ CONFIG_SITE=/dev/null \ $(HOST_CONFIGURE_ENV) $($(PKG)_CONF_ENV) \ - ./configure \ + ./$($(PKG)_CONFIGURE_CMD) \ $(HOST_CONFIGURE_OPTS) $($(PKG)_CONF_OPTS); \ ) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index 4ffecb0d..31a51991 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -51,7 +51,7 @@ define TARGET_CMAKE $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ rm -f CMakeCache.txt; \ $(TARGET_CMAKE_ENV) $($(PKG)_CONF_ENV) \ - cmake \ + $($(PKG)_CMAKE) \ $(TARGET_CMAKE_OPTS) $($(PKG)_CONF_OPTS); \ ) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) @@ -95,7 +95,7 @@ define HOST_CMAKE $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ rm -f CMakeCache.txt; \ $(HOST_CMAKE_ENV) $($(PKG)_CONF_ENV) \ - cmake \ + $($(PKG)_CMAKE) \ $(HOST_CMAKE_OPTS) $($(PKG)_CONF_OPTS); \ ) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index cc45f804..55c61569 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -12,7 +12,7 @@ define TARGET_MAKE $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(TARGET_MAKE_ENV) $($(PKG)_MAKE_ENV) \ - $(MAKE) \ + $($(PKG)_MAKE) \ $($(PKG)_MAKE_OPTS); \ ) $(foreach hook,$($(PKG)_POST_COMPILE_HOOKS),$(call $(hook))$(sep)) @@ -23,9 +23,9 @@ define TARGET_MAKE_INSTALL $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep)) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $(TARGET_MAKE_ENV) $($(PKG)_MAKE_ENV) \ - $(MAKE) install DESTDIR=$(TARGET_DIR) \ - $($(PKG)_MAKE_OPTS); \ + $(TARGET_MAKE_ENV) $($(PKG)_MAKE_INSTALL_ENV) \ + $($(PKG)_MAKE) install DESTDIR=$(TARGET_DIR) \ + $($(PKG)_MAKE_INSTALL_OPTS); \ ) $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) endef @@ -49,7 +49,7 @@ define HOST_MAKE $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(HOST_MAKE_ENV) $($(PKG)_MAKE_ENV) \ - $(MAKE) \ + $($(PKG)_MAKE) \ $($(PKG)_MAKE_OPTS); \ ) $(foreach hook,$($(PKG)_POST_COMPILE_HOOKS),$(call $(hook))$(sep)) @@ -60,9 +60,9 @@ define HOST_MAKE_INSTALL $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep)) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $(HOST_MAKE_ENV) $($(PKG)_MAKE_ENV) \ - $(MAKE) install \ - $($(PKG)_MAKE_OPTS); \ + $(HOST_MAKE_ENV) $($(PKG)_MAKE_INSTALL_ENV) \ + $($(PKG)_MAKE) install \ + $($(PKG)_MAKE_INSTALL_OPTS); \ ) $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) endef diff --git a/package/pkg-kernel-module.mk b/package/pkg-kernel-module.mk index 178207e0..9446d52c 100644 --- a/package/pkg-kernel-module.mk +++ b/package/pkg-kernel-module.mk @@ -21,7 +21,7 @@ define KERNEL_MODULE_BUILD @$(call MESSAGE,"Building kernel module") $(CHDIR)/$($(PKG)_DIR); \ $(TARGET_MAKE_ENV) $($(PKG)_MAKE_ENV) \ - $(MAKE) \ + $($(PKG)_MAKE) \ $($(PKG)_MAKE_OPTS) $(KERNEL_MAKE_VARS) endef diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index 249c7505..e9ec361b 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -15,6 +15,64 @@ PKG_PATCHES_DIR = $(PACKAGE_DIR)/$(subst host-,,$(pkgname))/patches # ----------------------------------------------------------------------------- +# check for necessary $(PKG) variables +define PKG_CHECK_VARIABLES +# autoreconf +ifndef $(PKG)_AUTORECONF + $(PKG)_AUTORECONF = NO +endif +ifndef $(PKG)_AUTORECONF_CMD + $(PKG)_AUTORECONF_CMD = autoreconf -fi +endif +ifndef $(PKG)_AUTORECONF_ENV + $(PKG)_AUTORECONF_ENV = +endif +ifndef $(PKG)_AUTORECONF_OPTS + $(PKG)_AUTORECONF_OPTS = +endif +# cmake / configure / meson +ifndef $(PKG)_CMAKE + $(PKG)_CMAKE = cmake +endif +ifndef $(PKG)_CONFIGURE_CMD + $(PKG)_CONFIGURE_CMD = configure +endif +ifndef $(PKG)_CONF_ENV + $(PKG)_CONF_ENV = +endif +ifndef $(PKG)_CONF_OPTS + $(PKG)_CONF_OPTS = +endif +# make +ifndef $(PKG)_MAKE + $(PKG)_MAKE = $(MAKE) +endif +ifndef $(PKG)_MAKE_ENV + $(PKG)_MAKE_ENV = +endif +ifndef $(PKG)_MAKE_OPTS + $(PKG)_MAKE_OPTS = +endif +# make install +ifndef $(PKG)_MAKE_INSTALL_ENV + $(PKG)_MAKE_INSTALL_ENV = $($(PKG)_MAKE_ENV) +endif +ifndef $(PKG)_MAKE_INSTALL_OPTS + $(PKG)_MAKE_INSTALL_OPTS = $($(PKG)_MAKE_OPTS) +endif +# ninja +ifndef $(PKG)_NINJA_ENV + $(PKG)_NINJA_ENV = +endif +ifndef $(PKG)_NINJA_OPTS + $(PKG)_NINJA_OPTS = +endif +endef + +pkg-check-variables = $(call PKG_CHECK_VARIABLES) + +# ----------------------------------------------------------------------------- + # PKG "control-flag" variables PKG_NO_EXTRACT = pkg-no-extract PKG_NO_PATCHES = pkg-no-patches