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 define BuildIPKGVariable
9 $(call shexport
,Package
/$(1)/$(2))
10 $(1)_COMMANDS
+= var2file
"$(call shvar,Package/$(1)/$(2))" $(2);
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
19 ifdef Package
/$(1)/install
20 ifeq ($(CONFIG_PACKAGE_
$(1)),y
)
21 install: $$(INFO_
$(1))
24 ifneq ($(CONFIG_PACKAGE_
$(1))$(DEVELOPER
)$(SDK
),)
25 compile
: $$(IPKG_
$(1))
27 compile
: $(1)-disabled
29 @echo
"WARNING: skipping $(1) -- package not selected"
33 ifeq ($(FORCEREBUILD
),y
)
37 IDEPEND_
$(1):=$$(strip $$(DEPENDS
))
40 $(eval
$(call BuildIPKGVariable
,$(1),conffiles
))
41 $(eval
$(call BuildIPKGVariable
,$(1),preinst
))
42 $(eval
$(call BuildIPKGVariable
,$(1),postinst
))
43 $(eval
$(call BuildIPKGVariable
,$(1),prerm
))
44 $(eval
$(call BuildIPKGVariable
,$(1),postrm
))
45 $$(IDIR_
$(1))/CONTROL
/control
: $(PKG_BUILD_DIR
)/.version-
$(1)_
$(VERSION
)_
$(PKGARCH
)
46 @
rm -f
$(PACKAGE_DIR
)/$(1)_
*
47 mkdir
-p
$$(IDIR_
$(1))/CONTROL
48 echo
"Package: $(1)" > $$(IDIR_
$(1))/CONTROL
/control
49 echo
"Version: $(VERSION)" >> $$(IDIR_
$(1))/CONTROL
/control
51 DEPENDS
='$(EXTRA_DEPENDS)'; \
52 for depend in
$$(filter-out @
%,$$(IDEPEND_
$(1))); do \
53 DEPENDS
=$$$${DEPENDS
:+$$$$DEPENDS, }$$$${depend
##+}; \
55 echo
"Depends: $$$$DEPENDS" >> $$(IDIR_
$(1))/CONTROL
/control
; \
58 echo
"Source: $(SOURCE)"; \
59 echo
"Section: $(SECTION)"; \
60 echo
"Priority: $(PRIORITY)"; \
61 echo
"Maintainer: $(MAINTAINER)"; \
62 echo
"Architecture: $(PKGARCH)"; \
63 echo
-n
"Description: "; getvar
$(call shvar
,Package
/$(1)/description
) | sed
-e
's,^[[:space:]]*, ,g'; \
64 ) >> $$(IDIR_
$(1))/CONTROL
/control
65 chmod
644 $$(IDIR_
$(1))/CONTROL
/control
66 (cd
$$(IDIR_
$(1))/CONTROL
; \
70 $$(IPKG_
$(1)): $(PKG_BUILD_DIR
)/.built
$$(IDIR_
$(1))/CONTROL
/control
71 $(call Package
/$(1)/install,$$(IDIR_
$(1)))
72 mkdir
-p
$(PACKAGE_DIR
)
73 -find
$$(IDIR_
$(1)) -name CVS | xargs
rm -rf
74 -find
$$(IDIR_
$(1)) -name .svn | xargs
rm -rf
75 -find
$$(IDIR_
$(1)) -name
'.#*' | xargs
rm -f
76 $(RSTRIP
) $$(IDIR_
$(1))
77 $(IPKG_BUILD
) $$(IDIR_
$(1)) $(PACKAGE_DIR
)
78 @
[ -f
$$(IPKG_
$(1)) ] || false
80 $$(INFO_
$(1)): $$(IPKG_
$(1))
81 $(IPKG
) install $$(IPKG_
$(1))
84 rm -f
$(PACKAGE_DIR
)/$(1)_
*
88 $(PKG_BUILD_DIR
)/.version-
$(1)_
$(VERSION
)_
$(PKGARCH
): $(PKG_BUILD_DIR
)/.prepared
89 -@
rm -f
$(PKG_BUILD_DIR
)/.version-
$(1)_
* 2>/dev
/null
92 $$(eval
$$(call Build
/DefaultTargets
,$(1)))
94 ifdef Package
/$(1)/install
95 ifneq ($$(CONFIG_PACKAGE_
$(1))$(DEVELOPER
)$(SDK
),)
96 ifneq ($(MAKECMDGOALS
),prereq
)
98 ifneq ($$(shell $(SCRIPT_DIR
)/timestamp.pl
-p
-x ipkg
-x ipkg-install
'$$(IPKG_$(1))' '$(PKG_BUILD_DIR)'),$$(IPKG_
$(1)))
99 $(PKG_BUILD_DIR
)/.built
: package-rebuild
100 $$(info Rebuilding
$(subst $(TOPDIR
)/,,$$(IPKG_
$(1))))