Do not use dynamic ticks on rb532 (#4110)
[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 # where to build (and put) .ipk packages
9 IPKG:= \
10 IPKG_TMP=$(TMP_DIR)/ipkg \
11 IPKG_INSTROOT=$(TARGET_DIR) \
12 IPKG_CONF_DIR=$(STAGING_DIR)/etc \
13 IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
14 $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
15
16 # invoke ipkg-build with some default options
17 IPKG_BUILD:= \
18 ipkg-build -c -o 0 -g 0
19
20 define BuildIPKGVariable
21 $(call shexport,Package/$(1)/$(2))
22 $(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2);
23 endef
24
25 dep_split=$(subst :,$(space),$(1))
26 dep_confvar=CONFIG_$(word 1,$(call dep_split,$(1)))
27 dep_val=$(word 2,$(call dep_split,$(1)))
28 filter_deps=$(foreach dep,$(1),$(if $(findstring :,$(dep)),$(if $($(call dep_confvar,$(dep))),$(call dep_val,$(dep))),$(dep)))
29
30 ifeq ($(DUMP),)
31 define BuildTarget/ipkg
32 IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
33 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1)
34 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
35
36 ifdef Package/$(1)/install
37 ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),)
38 compile: $$(IPKG_$(1))
39
40 ifeq ($(CONFIG_PACKAGE_$(1)),y)
41 install: $$(INFO_$(1))
42 endif
43 else
44 compile: $(1)-disabled
45 $(1)-disabled:
46 @echo "WARNING: skipping $(1) -- package not selected"
47 endif
48 endif
49
50 IDEPEND_$(1):=$$(call filter_deps,$$(strip $$(DEPENDS)))
51
52 $(eval $(call BuildIPKGVariable,$(1),conffiles))
53 $(eval $(call BuildIPKGVariable,$(1),preinst))
54 $(eval $(call BuildIPKGVariable,$(1),postinst))
55 $(eval $(call BuildIPKGVariable,$(1),prerm))
56 $(eval $(call BuildIPKGVariable,$(1),postrm))
57 $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH)
58 @rm -f $(PACKAGE_DIR)/$(1)_*
59 mkdir -p $$(IDIR_$(1))/CONTROL
60 echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
61 echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
62 ( \
63 DEPENDS='$(EXTRA_DEPENDS)'; \
64 for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
65 DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
66 done; \
67 echo "Depends: $$$$DEPENDS"; \
68 echo "Provides: $(PROVIDES)"; \
69 echo "Source: $(SOURCE)"; \
70 echo "Section: $(SECTION)"; \
71 echo "Priority: $(PRIORITY)"; \
72 echo "Maintainer: $(MAINTAINER)"; \
73 echo "Architecture: $(PKGARCH)"; \
74 echo -n "Description: "; getvar $(call shvar,Package/$(1)/description) | sed -e 's,^[[:space:]]*, ,g'; \
75 ) >> $$(IDIR_$(1))/CONTROL/control
76 chmod 644 $$(IDIR_$(1))/CONTROL/control
77 (cd $$(IDIR_$(1))/CONTROL; \
78 $($(1)_COMMANDS) \
79 )
80
81 $$(IPKG_$(1)): $(STAGING_DIR)/etc/ipkg.conf $(PKG_BUILD_DIR)/.built $$(IDIR_$(1))/CONTROL/control
82 $(call Package/$(1)/install,$$(IDIR_$(1)))
83 mkdir -p $(PACKAGE_DIR)
84 -find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' | $(XARGS) rm -rf
85 $(RSTRIP) $$(IDIR_$(1))
86 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
87 @[ -f $$(IPKG_$(1)) ] || false
88
89 $$(INFO_$(1)): $$(IPKG_$(1))
90 $(IPKG) install $$(IPKG_$(1))
91
92 $(1)-clean:
93 rm -f $(PACKAGE_DIR)/$(1)_*
94
95 clean: $(1)-clean
96
97 $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH): $(STAMP_PREPARED)
98 -@rm -f $(PKG_BUILD_DIR)/.version-$(1)_* 2>/dev/null
99 @touch $$@
100 endef
101
102 $(STAGING_DIR)/etc/ipkg.conf:
103 mkdir -p $(STAGING_DIR)/etc
104 echo "dest root /" > $(STAGING_DIR)/etc/ipkg.conf
105 echo "option offline_root $(TARGET_DIR)" >> $(STAGING_DIR)/etc/ipkg.conf
106
107 endif
This page took 0.048922 seconds and 5 git commands to generate.