build: generate a list of provided libraries for each ipkg file (includes provided...
authorFelix Fietkau <nbd@openwrt.org>
Sun, 10 Jun 2012 20:27:41 +0000 (20:27 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 10 Jun 2012 20:27:41 +0000 (20:27 +0000)
SVN-Revision: 32172

include/package-ipkg.mk
include/package.mk

index e0a8118ae60996578a3d3a52adac006ef1b8576d..93c4fdf2f7c52609aa705f37fdfbabee2abc7a08 100644 (file)
@@ -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)"; \
index e39a6598e00640f7e0016663eeac3f7ca7259395..10de8c41f0433c850cc9eed2860e5bb10664769b 100644 (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_MD5SUM ?= unknown
 PKG_BUILD_PARALLEL ?=
+PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
 
 ifeq ($(strip $(PKG_BUILD_PARALLEL)),0)
 PKG_JOBS?=-j1