Package wpa-passphrase (#1275)
[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 ifeq ($(DUMP),)
26 define BuildIPKG
27 IPKG_$(1):=$(PACKAGE_DIR)/$(1)_$(VERSION)_$(PKGARCH).ipk
28 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1)
29 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
30
31 ifdef Package/$(1)/install
32 ifneq ($(CONFIG_PACKAGE_$(1))$(SDK)$(DEVELOPER),)
33 compile: $$(IPKG_$(1))
34
35 ifeq ($(CONFIG_PACKAGE_$(1)),y)
36 install: $$(INFO_$(1))
37 endif
38 else
39 compile: $(1)-disabled
40 $(1)-disabled:
41 @echo "WARNING: skipping $(1) -- package not selected"
42 endif
43 endif
44
45 IDEPEND_$(1):=$$(strip $$(DEPENDS))
46
47 $(eval $(call BuildIPKGVariable,$(1),conffiles))
48 $(eval $(call BuildIPKGVariable,$(1),preinst))
49 $(eval $(call BuildIPKGVariable,$(1),postinst))
50 $(eval $(call BuildIPKGVariable,$(1),prerm))
51 $(eval $(call BuildIPKGVariable,$(1),postrm))
52 $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH)
53 @rm -f $(PACKAGE_DIR)/$(1)_*
54 mkdir -p $$(IDIR_$(1))/CONTROL
55 echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
56 echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
57 ( \
58 DEPENDS='$(EXTRA_DEPENDS)'; \
59 for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
60 DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
61 done; \
62 echo "Depends: $$$$DEPENDS"; \
63 echo "Source: $(SOURCE)"; \
64 echo "Section: $(SECTION)"; \
65 echo "Priority: $(PRIORITY)"; \
66 echo "Maintainer: $(MAINTAINER)"; \
67 echo "Architecture: $(PKGARCH)"; \
68 echo -n "Description: "; getvar $(call shvar,Package/$(1)/description) | sed -e 's,^[[:space:]]*, ,g'; \
69 ) >> $$(IDIR_$(1))/CONTROL/control
70 chmod 644 $$(IDIR_$(1))/CONTROL/control
71 (cd $$(IDIR_$(1))/CONTROL; \
72 $($(1)_COMMANDS) \
73 )
74
75 $$(IPKG_$(1)): $(STAGING_DIR)/etc/ipkg.conf $(PKG_BUILD_DIR)/.built $$(IDIR_$(1))/CONTROL/control
76 $(call Package/$(1)/install,$$(IDIR_$(1)))
77 mkdir -p $(PACKAGE_DIR)
78 -find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' | $(XARGS) rm -rf
79 $(RSTRIP) $$(IDIR_$(1))
80 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
81 @[ -f $$(IPKG_$(1)) ] || false
82
83 $$(INFO_$(1)): $$(IPKG_$(1))
84 $(IPKG) install $$(IPKG_$(1))
85
86 $(1)-clean:
87 rm -f $(PACKAGE_DIR)/$(1)_*
88
89 clean: $(1)-clean
90
91 $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH): $(STAMP_PREPARED)
92 -@rm -f $(PKG_BUILD_DIR)/.version-$(1)_* 2>/dev/null
93 @touch $$@
94
95 $$(eval $$(call Build/DefaultTargets,$(1)))
96
97 endef
98
99 $(STAGING_DIR)/etc/ipkg.conf:
100 mkdir -p $(STAGING_DIR)/etc
101 echo "dest root /" > $(STAGING_DIR)/etc/ipkg.conf
102 echo "option offline_root $(TARGET_DIR)" >> $(STAGING_DIR)/etc/ipkg.conf
103
104 endif
This page took 0.051639 seconds and 5 git commands to generate.