From: Felix Fietkau Date: Sun, 10 Jun 2012 20:27:41 +0000 (+0000) Subject: build: generate a list of provided libraries for each ipkg file (includes provided... X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=031990cf952c2c4703852029b70acaf4d0c123e0;p=openwrt%2Fstaging%2Fdedeckeh.git build: generate a list of provided libraries for each ipkg file (includes provided libraries from packages that the exporting package depends on) SVN-Revision: 32172 --- diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index e0a8118ae6..93c4fdf2f7 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -47,6 +47,24 @@ dep_val=$(word 2,$(call dep_split,$(1))) strip_deps=$(strip $(subst +,,$(filter-out @%,$(1)))) filter_deps=$(foreach dep,$(call strip_deps,$(1)),$(if $(findstring :,$(dep)),$(call dep_if,$(dep)),$(dep))) +define AddDependency + $$(if $(1),$$(if $(2),$$(foreach pkg,$(1),$$(IPKG_$$(pkg))): $$(foreach pkg,$(2),$$(IPKG_$$(pkg))))) +endef + +define FixupReverseDependencies + DEPS := $$(filter %:$(1),$$(IDEPEND)) + DEPS := $$(patsubst %:$(1),%,$$(DEPS)) + DEPS := $$(filter $$(DEPS),$$(IPKGS)) + $(call AddDependency,$$(DEPS),$(1)) +endef + +define FixupDependencies + DEPS := $$(filter $(1):%,$$(IDEPEND)) + DEPS := $$(patsubst $(1):%,%,$$(DEPS)) + DEPS := $$(filter $$(DEPS),$$(IPKGS)) + $(call AddDependency,$(1),$$(DEPS)) +endef + ifeq ($(DUMP),) define BuildTarget/ipkg IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk @@ -57,7 +75,8 @@ ifeq ($(DUMP),) ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT)) ifdef Package/$(1)/install ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),) - compile: $$(IPKG_$(1)) $(STAGING_DIR_ROOT)/stamp/.$(1)_installed + IPKGS += $(1) + compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(STAGING_DIR_ROOT)/stamp/.$(1)_installed ifeq ($(CONFIG_PACKAGE_$(1)),y) install: $$(INFO_$(1)) @@ -70,7 +89,11 @@ ifeq ($(DUMP),) endif endif + DEPENDS:=$(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS)) IDEPEND_$(1):=$$(call filter_deps,$$(DEPENDS)) + IDEPEND += $$(patsubst %,$(1):%,$$(IDEPEND_$(1))) + $(FixupDependencies) + $(FixupReverseDependencies) $(eval $(call BuildIPKGVariable,$(1),conffiles)) $(eval $(call BuildIPKGVariable,$(1),preinst)) @@ -87,11 +110,20 @@ ifeq ($(DUMP),) rm -rf $(STAGING_DIR_ROOT)/tmp-$(1) touch $$@ - $$(IPKG_$(1)): $(STAMP_BUILT) + $(PKG_INFO_DIR)/$(1).provides: $$(IPKG_$(1)) + $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk @rm -rf $(PACKAGE_DIR)/$(1)_* $$(IDIR_$(1)) - mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL + mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR) $(call Package/$(1)/install,$$(IDIR_$(1))) -find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| $(XARGS) rm -rf + @( \ + find $$(IDIR_$(1)) -name lib\*.so\* | awk -F/ '{ print $$$$NF }'; \ + for file in $$(patsubst %,$(PKG_INFO_DIR)/%.provides,$$(IDEPEND_$(1))); do \ + if [ -f "$$$$file" ]; then \ + cat $$$$file; \ + fi; \ + done; \ + ) | sort -u > $(PKG_INFO_DIR)/$(1).provides $(RSTRIP) $$(IDIR_$(1)) ( \ echo "Package: $(1)"; \ diff --git a/include/package.mk b/include/package.mk index e39a6598e0..10de8c41f0 100644 --- a/include/package.mk +++ b/include/package.mk @@ -11,6 +11,7 @@ PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install PKG_MD5SUM ?= unknown PKG_BUILD_PARALLEL ?= +PKG_INFO_DIR := $(STAGING_DIR)/pkginfo ifeq ($(strip $(PKG_BUILD_PARALLEL)),0) PKG_JOBS?=-j1