simplify handling of zcat - always use gzip -dc. zcat and gzcat are either broken...
[openwrt.git] / include / package-ipkg.mk
1 #
2 # Copyright (C) 2006,2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 define BuildIPKGVariable
9 $(call shexport,Package/$(1)/$(2))
10 $(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2);
11 endef
12
13 ifeq ($(DUMP),)
14 define BuildIPKG
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
18
19 ifdef Package/$(1)/install
20 ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),)
21 compile: $$(IPKG_$(1))
22
23 ifeq ($(CONFIG_PACKAGE_$(1)),y)
24 install: $$(INFO_$(1))
25 endif
26 else
27 compile: $(1)-disabled
28 $(1)-disabled:
29 @echo "WARNING: skipping $(1) -- package not selected"
30 endif
31 endif
32
33 IDEPEND_$(1):=$$(strip $$(DEPENDS))
34
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
45 ( \
46 DEPENDS='$(EXTRA_DEPENDS)'; \
47 for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
48 DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
49 done; \
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; \
60 $($(1)_COMMANDS) \
61 )
62
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
72
73 $$(INFO_$(1)): $$(IPKG_$(1))
74 $(IPKG) install $$(IPKG_$(1))
75
76 $(1)-clean:
77 rm -f $(PACKAGE_DIR)/$(1)_*
78
79 clean: $(1)-clean
80
81 $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH): $(PKG_BUILD_DIR)/.prepared
82 -@rm -f $(PKG_BUILD_DIR)/.version-$(1)_* 2>/dev/null
83 @touch $$@
84
85 $$(eval $$(call Build/DefaultTargets,$(1)))
86
87 endef
88 endif
This page took 0.056359 seconds and 5 git commands to generate.