ar71xx: reduce button threshold values
[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 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
21
22 define BuildIPKGVariable
23 $(call shexport,Package/$(1)/$(2))
24 $(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2);
25 endef
26
27 dep_split=$(subst :,$(space),$(1))
28 dep_confvar=CONFIG_$(word 1,$(call dep_split,$(1)))
29 dep_val=$(word 2,$(call dep_split,$(1)))
30 strip_deps=$(strip $(subst +,,$(filter-out @%,$(1))))
31 filter_deps=$(foreach dep,$(call strip_deps,$(1)),$(if $(findstring :,$(dep)),$(if $($(call dep_confvar,$(dep))),$(call dep_val,$(dep))),$(dep)))
32
33 ifeq ($(DUMP),)
34 define BuildTarget/ipkg
35 IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
36 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
37 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
38
39 ifeq ($(if $(VARIANT),$(BUILD_VARIANT)),$(VARIANT))
40 ifdef Package/$(1)/install
41 ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),)
42 compile: $$(IPKG_$(1)) $(STAGING_DIR_ROOT)/stamp/.$(1)_installed
43
44 ifeq ($(CONFIG_PACKAGE_$(1)),y)
45 install: $$(INFO_$(1))
46 endif
47 else
48 compile: $(1)-disabled
49 $(1)-disabled:
50 @echo "WARNING: skipping $(1) -- package not selected"
51 endif
52 endif
53 endif
54
55 IDEPEND_$(1):=$$(call filter_deps,$$(DEPENDS))
56
57 $(eval $(call BuildIPKGVariable,$(1),conffiles))
58 $(eval $(call BuildIPKGVariable,$(1),preinst))
59 $(eval $(call BuildIPKGVariable,$(1),postinst))
60 $(eval $(call BuildIPKGVariable,$(1),prerm))
61 $(eval $(call BuildIPKGVariable,$(1),postrm))
62
63 $(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(STAMP_BUILT)
64 rm -rf $(STAGING_DIR_ROOT)/tmp-$(1)
65 mkdir -p $(STAGING_DIR_ROOT)/stamp $(STAGING_DIR_ROOT)/tmp-$(1)
66 $(call Package/$(1)/install,$(STAGING_DIR_ROOT)/tmp-$(1))
67 $(call Package/$(1)/install_lib,$(STAGING_DIR_ROOT)/tmp-$(1))
68 $(CP) $(STAGING_DIR_ROOT)/tmp-$(1)/. $(STAGING_DIR_ROOT)/
69 rm -rf $(STAGING_DIR_ROOT)/tmp-$(1)
70 touch $$@
71
72 $$(IPKG_$(1)): $(STAGING_DIR)/etc/ipkg.conf $(STAMP_BUILT)
73 @rm -f $(PACKAGE_DIR)/$(1)_*
74 rm -rf $$(IDIR_$(1))
75 mkdir -p $$(IDIR_$(1))/CONTROL
76 echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
77 echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
78 ( \
79 DEPENDS='$(EXTRA_DEPENDS)'; \
80 for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
81 DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
82 done; \
83 echo "Depends: $$$$DEPENDS"; \
84 echo "Provides: $(PROVIDES)"; \
85 echo "Source: $(SOURCE)"; \
86 echo "Section: $(SECTION)"; \
87 echo "Priority: $(PRIORITY)"; \
88 echo "Maintainer: $(MAINTAINER)"; \
89 echo "Architecture: $(PKGARCH)"; \
90 echo "Installed-Size: 1"; \
91 echo -n "Description: "; getvar $(call shvar,Package/$(1)/description) | sed -e 's,^[[:space:]]*, ,g'; \
92 ) >> $$(IDIR_$(1))/CONTROL/control
93 chmod 644 $$(IDIR_$(1))/CONTROL/control
94 (cd $$(IDIR_$(1))/CONTROL; \
95 $($(1)_COMMANDS) \
96 )
97 $(call Package/$(1)/install,$$(IDIR_$(1)))
98 mkdir -p $(PACKAGE_DIR)
99 -find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' | $(XARGS) rm -rf
100 $(RSTRIP) $$(IDIR_$(1))
101 SIZE=`cd $$(IDIR_$(1)); du -bs --exclude=./CONTROL . 2>/dev/null | cut -f1`; \
102 $(SED) "s|^\(Installed-Size:\).*|\1 $$$$SIZE|g" $$(IDIR_$(1))/CONTROL/control
103 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
104 @[ -f $$(IPKG_$(1)) ] || false
105
106 $$(INFO_$(1)): $$(IPKG_$(1))
107 $(IPKG) install $$(IPKG_$(1))
108
109 $(1)-clean:
110 rm -f $(PACKAGE_DIR)/$(1)_*
111
112 clean: $(1)-clean
113
114 endef
115
116 $(STAGING_DIR)/etc/ipkg.conf:
117 mkdir -p $(STAGING_DIR)/etc
118 echo "dest root /" > $(STAGING_DIR)/etc/ipkg.conf
119 echo "option offline_root $(TARGET_DIR)" >> $(STAGING_DIR)/etc/ipkg.conf
120
121 endif
This page took 0.043984 seconds and 5 git commands to generate.