2 # Copyright (C) 2006,2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 define BuildIPKGVariable
9 $(call shexport,Package/$(1)/$(2))
10 $(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2);
15 IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
16 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1)
17 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
19 ifdef Package/$(1)/install
20 ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),)
21 compile: $$(IPKG_$(1))
23 ifeq ($(CONFIG_PACKAGE_$(1)),y)
24 install: $$(INFO_$(1))
27 compile: $(1)-disabled
29 @echo "WARNING: skipping $(1) -- package not selected"
33 IDEPEND_$(1):=$$(strip $$(DEPENDS))
35 $(eval $(call BuildIPKGVariable,$(1),conffiles))
36 $(eval $(call BuildIPKGVariable,$(1),preinst))
37 $(eval $(call BuildIPKGVariable,$(1),postinst))
38 $(eval $(call BuildIPKGVariable,$(1),prerm))
39 $(eval $(call BuildIPKGVariable,$(1),postrm))
40 $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH)
41 @rm -f $(PACKAGE_DIR)/$(1)_*
42 mkdir -p $$(IDIR_$(1))/CONTROL
43 echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
44 echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
46 DEPENDS='$(EXTRA_DEPENDS)'; \
47 for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
48 DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
50 echo "Depends: $$$$DEPENDS"; \
51 echo "Source: $(SOURCE)"; \
52 echo "Section: $(SECTION)"; \
53 echo "Priority: $(PRIORITY)"; \
54 echo "Maintainer: $(MAINTAINER)"; \
55 echo "Architecture: $(PKGARCH)"; \
56 echo -n "Description: "; getvar $(call shvar,Package/$(1)/description) | sed -e 's,^[[:space:]]*, ,g'; \
57 ) >> $$(IDIR_$(1))/CONTROL/control
58 chmod 644 $$(IDIR_$(1))/CONTROL/control
59 (cd $$(IDIR_$(1))/CONTROL; \
63 $$(IPKG_$(1)): $(PKG_BUILD_DIR)/.built $$(IDIR_$(1))/CONTROL/control
64 $(call Package/$(1)/install,$$(IDIR_$(1)))
65 mkdir -p $(PACKAGE_DIR)
66 -find $$(IDIR_$(1)) -name CVS | $(XARGS) rm -rf
67 -find $$(IDIR_$(1)) -name .svn | $(XARGS) rm -rf
68 -find $$(IDIR_$(1)) -name '.#*' | $(XARGS) rm -f
69 $(RSTRIP) $$(IDIR_$(1))
70 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
71 @[ -f $$(IPKG_$(1)) ] || false
73 $$(INFO_$(1)): $$(IPKG_$(1))
74 $(IPKG) install $$(IPKG_$(1))
77 rm -f $(PACKAGE_DIR)/$(1)_*
81 $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH): $(STAMP_PREPARED)
82 -@rm -f $(PKG_BUILD_DIR)/.version-$(1)_* 2>/dev/null
85 $$(eval $$(call Build/DefaultTargets,$(1)))