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 # where to build (and put) .ipk packages
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
16 # invoke ipkg-build with some default options
18 ipkg-build
-c
-o
0 -g
0
20 define BuildIPKGVariable
21 $(call shexport
,Package
/$(1)/$(2))
22 $(1)_COMMANDS
+= var2file
"$(call shvar,Package/$(1)/$(2))" $(2);
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 strip_deps
=$(strip $(subst +,,$(filter-out @
%,$(1))))
29 filter_deps
=$(foreach dep
,$(call strip_deps
,$(1)),$(if
$(findstring :,$(dep
)),$(if
$($(call dep_confvar
,$(dep
))),$(call dep_val
,$(dep
))),$(dep
)))
32 define BuildTarget
/ipkg
33 IPKG_
$(1):=$(PACKAGE_DIR
)/$(1)_
$(VERSION
)_
$(PKGARCH
).ipk
34 IDIR_
$(1):=$(PKG_BUILD_DIR
)/ipkg
/$(1)
35 INFO_
$(1):=$(IPKG_STATE_DIR
)/info/$(1).list
37 ifdef Package
/$(1)/install
38 ifneq ($(CONFIG_PACKAGE_
$(1))$(SDK
)$(DEVELOPER
),)
39 compile
: $$(IPKG_
$(1))
41 ifeq ($(CONFIG_PACKAGE_
$(1)),y
)
42 install: $$(INFO_
$(1))
45 compile
: $(1)-disabled
47 @echo
"WARNING: skipping $(1) -- package not selected"
51 IDEPEND_
$(1):=$$(call filter_deps
,$$(DEPENDS
))
53 $(eval
$(call BuildIPKGVariable
,$(1),conffiles
))
54 $(eval
$(call BuildIPKGVariable
,$(1),preinst
))
55 $(eval
$(call BuildIPKGVariable
,$(1),postinst
))
56 $(eval
$(call BuildIPKGVariable
,$(1),prerm
))
57 $(eval
$(call BuildIPKGVariable
,$(1),postrm
))
58 $$(IDIR_
$(1))/CONTROL
/control
: $(PKG_BUILD_DIR
)/.version-
$(1)_
$(VERSION
)_
$(PKGARCH
)
59 @
rm -f
$(PACKAGE_DIR
)/$(1)_
*
60 mkdir
-p
$$(IDIR_
$(1))/CONTROL
61 echo
"Package: $(1)" > $$(IDIR_
$(1))/CONTROL
/control
62 echo
"Version: $(VERSION)" >> $$(IDIR_
$(1))/CONTROL
/control
64 DEPENDS
='$(EXTRA_DEPENDS)'; \
65 for depend in
$$(filter-out @
%,$$(IDEPEND_
$(1))); do \
66 DEPENDS
=$$$${DEPENDS
:+$$$$DEPENDS, }$$$${depend
##+}; \
68 echo
"Depends: $$$$DEPENDS"; \
69 echo
"Provides: $(PROVIDES)"; \
70 echo
"Source: $(SOURCE)"; \
71 echo
"Section: $(SECTION)"; \
72 echo
"Priority: $(PRIORITY)"; \
73 echo
"Maintainer: $(MAINTAINER)"; \
74 echo
"Architecture: $(PKGARCH)"; \
75 echo
-n
"Description: "; getvar
$(call shvar
,Package
/$(1)/description
) | sed
-e
's,^[[:space:]]*, ,g'; \
76 ) >> $$(IDIR_
$(1))/CONTROL
/control
77 chmod
644 $$(IDIR_
$(1))/CONTROL
/control
78 (cd
$$(IDIR_
$(1))/CONTROL
; \
82 $$(IPKG_
$(1)): $(STAGING_DIR
)/etc
/ipkg.conf
$(PKG_BUILD_DIR
)/.built
$$(IDIR_
$(1))/CONTROL
/control
83 $(call Package
/$(1)/install,$$(IDIR_
$(1)))
84 mkdir
-p
$(PACKAGE_DIR
)
85 -find
$$(IDIR_
$(1)) -name
'CVS' -o
-name
'.svn' -o
-name
'.#*' |
$(XARGS
) rm -rf
86 $(RSTRIP
) $$(IDIR_
$(1))
87 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
88 @
[ -f
$$(IPKG_
$(1)) ] || false
90 $$(INFO_
$(1)): $$(IPKG_
$(1))
91 $(IPKG
) install $$(IPKG_
$(1))
94 rm -f
$(PACKAGE_DIR
)/$(1)_
*
98 $(PKG_BUILD_DIR
)/.version-
$(1)_
$(VERSION
)_
$(PKGARCH
): $(STAMP_PREPARED
)
99 -@
rm -f
$(PKG_BUILD_DIR
)/.version-
$(1)_
* 2>/dev
/null
103 $(STAGING_DIR
)/etc
/ipkg.conf
:
104 mkdir
-p
$(STAGING_DIR
)/etc
105 echo
"dest root /" > $(STAGING_DIR
)/etc
/ipkg.conf
106 echo
"option offline_root $(TARGET_DIR)" >> $(STAGING_DIR
)/etc
/ipkg.conf
This page took 0.042513 seconds and 5 git commands to generate.