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
This commit is contained in:
Felix Fietkau 2012-06-10 20:27:41 +00:00
parent edee850e18
commit 031990cf95
2 changed files with 36 additions and 3 deletions

View File

@ -47,6 +47,24 @@ dep_val=$(word 2,$(call dep_split,$(1)))
strip_deps=$(strip $(subst +,,$(filter-out @%,$(1)))) strip_deps=$(strip $(subst +,,$(filter-out @%,$(1))))
filter_deps=$(foreach dep,$(call strip_deps,$(1)),$(if $(findstring :,$(dep)),$(call dep_if,$(dep)),$(dep))) 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),) ifeq ($(DUMP),)
define BuildTarget/ipkg define BuildTarget/ipkg
IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
@ -57,7 +75,8 @@ ifeq ($(DUMP),)
ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT)) ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT))
ifdef Package/$(1)/install ifdef Package/$(1)/install
ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),) 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) ifeq ($(CONFIG_PACKAGE_$(1)),y)
install: $$(INFO_$(1)) install: $$(INFO_$(1))
@ -70,7 +89,11 @@ ifeq ($(DUMP),)
endif endif
endif endif
DEPENDS:=$(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
IDEPEND_$(1):=$$(call filter_deps,$$(DEPENDS)) IDEPEND_$(1):=$$(call filter_deps,$$(DEPENDS))
IDEPEND += $$(patsubst %,$(1):%,$$(IDEPEND_$(1)))
$(FixupDependencies)
$(FixupReverseDependencies)
$(eval $(call BuildIPKGVariable,$(1),conffiles)) $(eval $(call BuildIPKGVariable,$(1),conffiles))
$(eval $(call BuildIPKGVariable,$(1),preinst)) $(eval $(call BuildIPKGVariable,$(1),preinst))
@ -87,11 +110,20 @@ ifeq ($(DUMP),)
rm -rf $(STAGING_DIR_ROOT)/tmp-$(1) rm -rf $(STAGING_DIR_ROOT)/tmp-$(1)
touch $$@ 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)) @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))) $(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 '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)) $(RSTRIP) $$(IDIR_$(1))
( \ ( \
echo "Package: $(1)"; \ echo "Package: $(1)"; \

View File

@ -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_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
PKG_MD5SUM ?= unknown PKG_MD5SUM ?= unknown
PKG_BUILD_PARALLEL ?= PKG_BUILD_PARALLEL ?=
PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
ifeq ($(strip $(PKG_BUILD_PARALLEL)),0) ifeq ($(strip $(PKG_BUILD_PARALLEL)),0)
PKG_JOBS?=-j1 PKG_JOBS?=-j1