also strip the .notes section of the kernel
[openwrt/openwrt.git] / include / package-ipkg.mk
index c5d4916c2cd59f0ed2a3a0e8761a72d7d28abee2..8b4c042a076775f0df48d1426a4afe9e167d62f8 100644 (file)
@@ -17,6 +17,8 @@ IPKG:= \
 IPKG_BUILD:= \
   ipkg-build -c -o 0 -g 0
 
+IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
+
 define BuildIPKGVariable
   $(call shexport,Package/$(1)/$(2))
   $(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2);
@@ -72,6 +74,7 @@ ifeq ($(DUMP),)
                echo "Priority: $(PRIORITY)"; \
                echo "Maintainer: $(MAINTAINER)"; \
                echo "Architecture: $(PKGARCH)"; \
+               echo "Installed-Size: 1"; \
                echo -n "Description: "; getvar $(call shvar,Package/$(1)/description) | sed -e 's,^[[:space:]]*, ,g'; \
        ) >> $$(IDIR_$(1))/CONTROL/control
        chmod 644 $$(IDIR_$(1))/CONTROL/control
@@ -84,6 +87,8 @@ ifeq ($(DUMP),)
        mkdir -p $(PACKAGE_DIR)
        -find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' | $(XARGS) rm -rf
        $(RSTRIP) $$(IDIR_$(1))
+       SIZE=`cd $$(IDIR_$(1)); du -bs --exclude=./CONTROL . 2>/dev/null | cut -f1`; \
+       $(SED) "s|^\(Installed-Size:\).*|\1 $$$$SIZE|g" $$(IDIR_$(1))/CONTROL/control
        $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
        @[ -f $$(IPKG_$(1)) ] || false