1 # invoke ipkg with configuration in $(STAGING_DIR)/etc/ipkg.conf
7 CATEGORY:=Extra packages
9 MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org>
10 SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd})
11 VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
17 $$(eval $$(call Package/$(2)))
20 $$(error Package $(2) has no NAME)
23 $$(error Package $(2) has no TITLE)
26 $$(error Package $(2) has no CATEGORY)
29 $$(error Package $(2) has no PRIORITY)
32 $$(error Package $(2) has no VERSION)
38 IPKG_$(1):=$(PACKAGE_DIR)/$(2)_$(VERSION)_$(PKGARCH).ipk
39 IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(2)
40 INFO_$(1):=$(IPKG_STATE_DIR)/info/$(2).list
42 ifneq ($(BR2_PACKAGE_$(1)),)
43 compile-targets: $$(IPKG_$(1))
46 compile-targets: $$(IPKG_$(1))
48 ifeq ($(BR2_PACKAGE_$(1)),y)
49 install-targets: $$(INFO_$(1))
52 IDEPEND_$(1):=$$(strip $$(DEPENDS))
54 $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
55 mkdir -p $$(IDIR_$(1))/CONTROL
56 echo "Package: $(2)" > $$(IDIR_$(1))/CONTROL/control
57 echo "Version: $$(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
58 echo "Depends: $$(IDEPEND_$(1))" >> $$(IDIR_$(1))/CONTROL/control
59 echo "Source: $$(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control
60 echo "Section: $$(SECTION)" >> $$(IDIR_$(1))/CONTROL/control
61 echo "Priority: $$(PRIORITY)" >> $$(IDIR_$(1))/CONTROL/control
62 echo "Maintainer: $$(MAINTAINER)" >> $$(IDIR_$(1))/CONTROL/control
63 echo "Architecture: $$(PKGARCH)" >> $$(IDIR_$(1))/CONTROL/control
64 echo "Description: $$(DESCRIPTION)" >> $$(IDIR_$(1))/CONTROL/control
65 chmod 644 $$(IDIR_$(1))/CONTROL/control
66 for file in conffiles preinst postinst prerm postrm; do \
67 [ -f ./ipkg/$(2).$$$$file ] && cp ./ipkg/$(2).$$$$file $$(IDIR_$(1))/CONTROL/$$$$file || true; \
70 $$(IPKG_$(1)): $$(IDIR_$(1))/CONTROL/control $(PKG_BUILD_DIR)/.built $(PACKAGE_DIR)
72 $$(INFO_$(1)): $$(IPKG_$(1))
73 $(IPKG) install $$(IPKG_$(1))
81 ifneq ($(strip $(PKG_SOURCE)),)
82 $(DL_DIR)/$(PKG_SOURCE):
83 @$(CMD_TRACE) "downloading... "
84 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL) $(MAKE_TRACE)
87 ifneq ($(strip $(PKG_CAT)),)
88 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
89 rm -rf $(PKG_BUILD_DIR)
90 mkdir -p $(PKG_BUILD_DIR)
91 if [ "$(PKG_CAT)" = "unzip" ]; then \
92 unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE) ; \
94 $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) - ; \
96 if [ -d ./patches ]; then \
97 $(PATCH) $(PKG_BUILD_DIR) ./patches ; \
99 touch $(PKG_BUILD_DIR)/.prepared
104 source: $(DL_DIR)/$(PKG_SOURCE)
106 @[ -f $(PKG_BUILD_DIR)/.prepared ] || { \
107 $(CMD_TRACE) "preparing... "; \
108 $(MAKE) $(PKG_BUILD_DIR)/.prepared $(MAKE_TRACE); \
112 @[ -f $(PKG_BUILD_DIR)/.configured ] || { \
113 $(CMD_TRACE) "configuring... "; \
114 $(MAKE) $(PKG_BUILD_DIR)/.configured $(MAKE_TRACE); \
119 @$(CMD_TRACE) "compiling... "
120 @$(MAKE) compile-targets $(MAKE_TRACE)
124 @$(CMD_TRACE) "installing... "
125 @$(MAKE) install-targets $(MAKE_TRACE)
129 $(CMD_TRACE) "rebuilding... "
130 @-$(MAKE) mostlyclean 2>&1 >/dev/null
131 if [ -f $(PKG_BUILD_DIR)/.built ]; then \
132 $(MAKE) clean $(MAKE_TRACE); \
134 $(MAKE) compile $(MAKE_TRACE)
136 $(PKG_BUILD_DIR)/.configured:
137 $(PKG_BUILD_DIR)/.built:
144 @$(CMD_TRACE) "cleaning... "
145 @$(MAKE) clean-targets $(MAKE_TRACE)
146 rm -rf $(PKG_BUILD_DIR)
148 .PHONY: all source prepare compile install clean