From 623825103e17a975f36854b362f17f8d26557828 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 23 Feb 2014 17:32:04 +0000 Subject: [PATCH] build: allow packages to declare ABI versions to detect necessary package rebuilds If a package directly depends on another package that recently changed its ABI version, it will be cleaned up and rebuilt (assuming quilt is not used). This helps with packages that have no stable ABI, e.g. libubox, ubus, etc. Signed-off-by: Felix Fietkau SVN-Revision: 39720 --- include/package-defaults.mk | 1 + include/package-ipkg.mk | 7 +++++++ include/package.mk | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/include/package-defaults.mk b/include/package-defaults.mk index 0505a43c4f..62ccbb93ef 100644 --- a/include/package-defaults.mk +++ b/include/package-defaults.mk @@ -32,6 +32,7 @@ define Package/Default else VERSION:=$(PKG_RELEASE) endif + ABI_VERSION:= ifneq ($(PKG_FLAGS),) PKGFLAGS:=$(PKG_FLAGS) else diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 043431c349..cb2a4087fe 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -83,6 +83,9 @@ ifeq ($(DUMP),) ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),) IPKGS += $(1) compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(STAGING_DIR_ROOT)/stamp/.$(1)_installed + ifneq ($(ABI_VERSION),) + compile: $(PKG_INFO_DIR)/$(1).version + endif ifeq ($(CONFIG_PACKAGE_$(1)),y) .PHONY: $(PKG_INSTALL_STAMP).$(1) @@ -124,6 +127,10 @@ ifeq ($(DUMP),) rm -rf $(STAGING_DIR_ROOT)/tmp-$(1) touch $$@ + $(PKG_INFO_DIR)/$(1).version: $$(IPKG_$(1)) + echo '$(ABI_VERSION)' | cmp -s - $$@ || \ + echo '$(ABI_VERSION)' > $$@ + $(PKG_INFO_DIR)/$(1).provides: $$(IPKG_$(1)) $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk @rm -rf $(PACKAGE_DIR)/$(1)_* $$(IDIR_$(1)) diff --git a/include/package.mk b/include/package.mk index 79066fe1e2..d14c525506 100644 --- a/include/package.mk +++ b/include/package.mk @@ -39,6 +39,15 @@ include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/unpack.mk include $(INCLUDE_DIR)/depends.mk +find_library_dependencies = $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \ + $(filter-out $(BUILD_PACKAGES),$(foreach dep, \ + $(filter-out @%, $(patsubst +%,%,$(1))), \ + $(if $(findstring :,$(dep)), \ + $(word 2,$(subst :,$(space),$(dep))), \ + $(dep) \ + ) \ + )))) + STAMP_NO_AUTOREBUILD=$(wildcard $(PKG_BUILD_DIR)/.no_autorebuild) PREV_STAMP_PREPARED:=$(if $(STAMP_NO_AUTOREBUILD),$(wildcard $(PKG_BUILD_DIR)/.prepared*)) ifneq ($(PREV_STAMP_PREPARED),) @@ -227,6 +236,9 @@ define Package/$(1)/description endef endif + BUILD_PACKAGES += $(1) + $(STAMP_PREPARED): $$(if $(QUILT)$(DUMP),,$(call find_library_dependencies,$(DEPENDS))) + $(foreach FIELD, TITLE CATEGORY SECTION VERSION, ifeq ($($(FIELD)),) $$(error Package/$(1) is missing the $(FIELD) field) -- 2.30.2